2013-10-21 07:10 AM
Hello,
I am using a : STM32F303RC (256k FLASK, 32k RAM, 8K CCRAM) gcc g++ tool chain with Eclipse. At compilation time, my firmware memory are as following:arm-none-eabi-size --format=berkeley -t Muster.elf text data bss dec hex filename 261528 1640 30076 293244 4797c Muster.elfThe flashing is working but when the program starts, i got immediatly a HardFault_Handler() interrupt.It seems that there are 616 bytes remaining in the flash but this size is not enough to start.Is someone has an explanation for this behavior ? #flash-size-hardfault-error2013-10-21 07:15 AM
You only have 616 bytes if you don't have any variables that get initialized. If you are copying stuff to RAM, it has to live somewhere.
Have you stepped through the initialization code to observe where it Hard Faults?2013-10-21 08:45 AM
It happens in the startup_stm32f30x.s file at function LoopCopyDataInit.
After a while it crashes.CopyDataInit: ldr r3, =_sidata ldr r3, [r3, r1] str r3, [r0, r1] adds r1, r1, #4LoopCopyDataInit: ldr r0, =_sdata ldr r3, =_edata adds r2, r0, r1 cmp r2, r3 bcc CopyDataInit ldr r2, =_sbss b LoopFillZerobss2013-10-21 08:53 AM
Your linker output suggests you're some 1024 bytes OVER your budget, not 616 bytes BELOW it.
Compiled with Keil it might fit, GNU/GCC tends to bulk things up, even with optimization.