2016-05-22 04:07 PM
I have a 5 liner 'c' code to copy a module into ccmram which I put into the .init section which works fine. However, immediately after this function, libc_array_init() is called which results in a hard fault. I think this is due to my code being in thumb mode and the libc code is in arm mode and it isn't switching modes correctly. I want to avoid changes to the startup_smtxxx.s assembler module (reduced maintenance) and my stm32f303 gcc doesn't seem to support the __attribute__((target(''arm''))) which might force my code into arm mode.
I've hacked it for now into the .fini section which works but I'd like to find a proper solution. #.init #thumb-mode #arm-mode2016-05-22 05:17 PM
The Cortex-Mx parts don't support 32-bit ARM code, at all.
2016-05-22 05:44 PM
Any ideas on what might be causing the Hard Fault if it is not erroneous arm code in libc?
The STM32f303 I'm using has ccmram on the I & D buses which is where I'm copying my flash programming code to but at this point I'm only copying the code, not executing it.When I do come to execute it I get a similar hard fault but that appears to be my copy code is picking up a bad pointer (the default ST supplied LD script uses _siccmram as the start of code to be copied to ccmram). Documentation is sparse to say the least in this area :(2016-05-22 06:01 PM
The Hard Fault mechanism should point you to exactly where the code is faulting, the processor registers and stacked state should be available for analysis.
When jumping to code, the address must be ODD