Hi everyone,
I set Fls_Erase function at RAM(address: 0x1fff8188), and I use Fls_Init_Node_Data at Flash(address: 0x674) call this function.
- However, once I call Fls_Erase from Fls_Init_Node_Data , the system crash and a WDOG fault exception executes.
- I try to move Fls_Init_Node_Data to RAM too, my system work normally. So, I think that Fls_Init_Node_Data call Fls_Erase at a far distance address. I also check assembly code: Fls_Erase is called by BL command(range +- 32MB).
- So, I would like to know how to call a RAM function from Flash. To do this, do we use a compiler option or another solution?
I hope I give your answer soon, thank you.
已解决! 转到解答。
I'm not sure how did you place the functions to .code section.
But it must be in .code_ram section.
Becasue the startup code (startup.c) copies the functions from ROM (flash) to SRAM after every reset, so that it can be called in the application from SRAM.
Regards,
Daniel
Hi @danielmartynek,
Yes, Fls_Erase() function is a blocking function that waits until the flash operation is complete in SRAM
I located Fls_Erase to ".code_ram" section instead of ".code" section, everything worked normally. Setting the function to ".code" section is the cause that led to my fault.
Map file in case function to ".code_ram" section:
Map file in case function to ".code" section(fault exception occurs)
My linker knowledge is small. So could you explain for me a little bit about ".code" and ".code_ram" sections in the linker script?
I attached my linker script to the topic that you could review.
Thank you,
I'm not sure how did you place the functions to .code section.
But it must be in .code_ram section.
Becasue the startup code (startup.c) copies the functions from ROM (flash) to SRAM after every reset, so that it can be called in the application from SRAM.
Regards,
Daniel
Hello @AndersonStarling,
Can you please specify what driver do you use?
Is the Fls_Erase() function in SRAM a blocking function that waits until the flash operation is complete?
If so, it does not matter where the function that calls Fls_Erase() is located.
Regards,
Daniel