Again sorry hard to know what to do here...
As mentioned @Paul is probably the best one to answer some of these and your thread has had comments in it by several of the members...
And there are several of us up here who try to help out when we can. But some of these like issue are often hard to know what is right..
There are two bugs
discussed in my support thread.
One is a memcpy bug from 2014 or earlier, that Frank B mentioned had been fixed, then un-fixed in the intervening years. Basically memcpy is trying to be clever by doing unaligned 32 bit reads and writes, but that causes corruption when copying across the 0x20000000 boundary. The thing is, unaligned access usually works on teensy 3.2, except when crossing the 0x20000000 boundary. This bug was mentioned in passing by another user, so I posted a test case that verifies the bug. I did not write a fix.
The other bug is a race condition in teensy3 usb_dev.c because the usb buffer descriptors are not declared volatile, and need to be. This bug has probably existed since the teensy3 usb code was written. There was
a note about it and a partial workaround posted in 2018, but I'm pretty sure this bug has been corrupting teensy3 usb since teensy3 was released. I posted a simple fix. (n.b. it's not a compiler bug).
Basically I just want these fixes to get into the library and "stick" so I don't have to keep my own set of patches.
Again if you have clear issues with fixes that don't cause major side effects than the best way to get things to stick is to try to create a Pull Request with the actual fix and pointers to thread(s) that describe the issues you are solving and what tests you have run to show that it works...
I have not commented on either of these issues as unclear to me, what the right answers are:
That is memcpy issue: I believe has the: cores\teensy3\memcpy-arm7m.S file? all relating to if the memcpy support unaligned copy or not?
https://github.com/PaulStoffregen/cores/blob/master/teensy3/memcpy-armv7m.S#L37
In particular if the options: #define __ARM_FEATURE_UNALIGNED 1
Should be set or not set? The particular question is what breaks if I don't enable unaligned memcpy?
From looking at the Code changes on this file, it is unclear if there is a clear right answer as this has changed several times.
The current stuff is setup to allow the build to choose it or not?
Code:
/*
* Let __ARM_FEATURE_UNALIGNED be set by the architecture and the compiler flags:
* -munaligned-access
* -mno-unaligned-access
* instead of always setting it here.
*
#define __ARM_FEATURE_UNALIGNED 1
*/
The USB issue...
Maybe volatile is valid fix? Actually never used that on a structure, but instead always used on members in structures.
I guess the question would be, is this a sledgehammer fix? (sort of like the current one) and/or is there specific places that used this structure or pointer to structure that needed to be volatile?
Also I had not tried it out as
https://forum.pjrc.com/threads/67081-Haunted-USB-Serial-on-Teensy-3-2?p=278849&viewfull=1#post278849
your next post which you deleted, had comment for the delete: whoops, my bug, not lib
So thought your problem had been resolved.
Again probably something for Paul to take a look at.