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
While working on the clock lab, I ran into bus errors when trying to access the intc via a struct pointer. Some minimal code (won't help anyone do the lab) to show this issue is here. On my board the output looks like this:
$ sudo apps/interrupt_test/interrupt_test
-------------------------------------------------------
Welcome to the interrupt test.
When you press or release a button, or move a switch, the program will print a message.
The buttons may bounce, so you may sometimes see multiple messages on a button press.
-------------------------------------------------------
Bus error
$ dmesg | tail -n3
[ 4269.957460] Unhandled fault: external abort on non-linefetch (0x1818) at 0x36f8c000
[ 4269.963730] pgd = 5ed84000
[ 4269.965115] [36f8c000] *pgd=1588c831, *pte=41800743, *ppte=41800c33
If I point the struct pointer at some stack memory, the strb works, so I guess it is not a fundamental memory alignment issue, but specific to the intc peripheral.
Anyway, it would be nice to fix if possible. Can the IP be generated to allow access via strb? Can we add a compiler flag that will avoid this? Is there something I'm doing wrong?
My workaround was to first assign the value I wanted to put in a register to a local uint32_t variable, then assign that into the struct.
The text was updated successfully, but these errors were encountered:
While working on the clock lab, I ran into bus errors when trying to access the intc via a struct pointer. Some minimal code (won't help anyone do the lab) to show this issue is here. On my board the output looks like this:
gdb identifies the problematic instruction:
On the other hand, the ptr_write function doesn't use strb:
If I point the struct pointer at some stack memory, the strb works, so I guess it is not a fundamental memory alignment issue, but specific to the intc peripheral.
Anyway, it would be nice to fix if possible. Can the IP be generated to allow access via strb? Can we add a compiler flag that will avoid this? Is there something I'm doing wrong?
My workaround was to first assign the value I wanted to put in a register to a local uint32_t variable, then assign that into the struct.
The text was updated successfully, but these errors were encountered: