You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
Have a question about using GCC's data alignment attributes. Background is I'm working on updating a Zephyr driver where the a HW feature requires a 64 byte data transfer buffer to be 64 byte aligned. The buffer is a static uint8_t array in the driver not on the stack. After adding attribute((aligned(64))) to the array, when I run the code I get a Kernel fault. HW transfer data into the buffer, fires a done interrupt. The driver ISR does not touch the buffer, clears HW status and make a callback. The callback function is very simple, does not touch the buffer, and only sets a flag and stores HW status. Upon return from ISR, the kernel faults deep inside ready_thread's SYS_DLIST_FOR_EACH_CONTAINER.
I have verified the HW is programmed properly, an aligned address is used and HW transferred data correctly. The MAP files shows the linker has located the 64 byte aligned buffer just below .bss.z_idle_threads at the beginning of __kernel_ram_start.
The issue goes away if I double the size of the buffer and manually compute an aligned address in the driver at run time.
Question: Does Zephyr depend upon .bss.z_idle_threads and .bss.z_main_thread to start at __kernel_ram_start meaning you can't allow non-kernel data to be placed there?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Have a question about using GCC's data alignment attributes. Background is I'm working on updating a Zephyr driver where the a HW feature requires a 64 byte data transfer buffer to be 64 byte aligned. The buffer is a static uint8_t array in the driver not on the stack. After adding attribute((aligned(64))) to the array, when I run the code I get a Kernel fault. HW transfer data into the buffer, fires a done interrupt. The driver ISR does not touch the buffer, clears HW status and make a callback. The callback function is very simple, does not touch the buffer, and only sets a flag and stores HW status. Upon return from ISR, the kernel faults deep inside ready_thread's SYS_DLIST_FOR_EACH_CONTAINER.
I have verified the HW is programmed properly, an aligned address is used and HW transferred data correctly. The MAP files shows the linker has located the 64 byte aligned buffer just below .bss.z_idle_threads at the beginning of __kernel_ram_start.
The issue goes away if I double the size of the buffer and manually compute an aligned address in the driver at run time.
Question: Does Zephyr depend upon .bss.z_idle_threads and .bss.z_main_thread to start at __kernel_ram_start meaning you can't allow non-kernel data to be placed there?
Beta Was this translation helpful? Give feedback.
All reactions