Bill Greiman
Well-known member
I have written a ring buffer class for buffering data during SD busy time. It works well if I use it for buffering full sectors. I have declared the buffer array like this. Size is a multiple of 512 bytes so everything is 32-bit aligned and sizes are a multiple of 32-bits.
I also use it with Print as a base class and I have implemented write required by print with memcpy. It's really handy in a logger to print into the ring buffer. Even though memcpy is called in the class with type uint8_t arguments, the compiler optimizes it so a hard fault occurs when copying across the RAM_L/RAMU boundary in cases where the destination is not 32-bit aligned.
Is there an attribute that would cause the entire array to be in RAM_U?
Anyone have a custom memcpy for Teensy 3.6 that is efficient?
Code:
uint8_t __attribute__ ((aligned (4))) m_buf[Size];
I also use it with Print as a base class and I have implemented write required by print with memcpy. It's really handy in a logger to print into the ring buffer. Even though memcpy is called in the class with type uint8_t arguments, the compiler optimizes it so a hard fault occurs when copying across the RAM_L/RAMU boundary in cases where the destination is not 32-bit aligned.
Is there an attribute that would cause the entire array to be in RAM_U?
Anyone have a custom memcpy for Teensy 3.6 that is efficient?