AnsweredAssumed Answered

problem with startup on stm32f407

Question asked by avihay eini on Jun 13, 2017
Latest reply on Jun 14, 2017 by AvaTar

very weird problem ive got here.
im working on a big project which was passed over to me , so im quite new in this field and still studying the project as well. the programs runs, with no problems. i added a function that playes .wav files which are stored as a buffer on flash memory.
when i debug with optimizition level 0, the program crashed to Hard_fault_hendler on startup, it doesnt reach my main func,if i comment out the new function (somewhere in the code) it runs well. but on opt-1,-2,-3 it runs and plays the file well (with the new funtion).

ive checked for memory issues , got enoght to go around!

dont know if that matters but my code runs on CCM memory as RAM memory is saved for buffers allocations.

so, what could the level of optimiztion change in the startup funcionality?
what vlaues can i check?
ive been compering .map file for two days trying to figure out what changed.

im reading the SP register and i can see the line which led me to Hard_fault_hendler
and its found on the "system_stm32f4xx.c" file from the last line of "void System_init(void) function.

please try to direct me on this one!
thanks!

Outcomes