Question
Mixed Thumb and ARM modes in .init section hard fault
Posted on May 23, 2016 at 01:07
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-mode