Hi All,
I am trying to create custom bootloader app. I reserved 256KB space both bootloader app and parameters from the beginnig of the flash. I need to store boot parameters on the same block with the bootloader code. I tried to use C40 ip but, I am always getting HardFault error. As I learned from "AN13388-S32K3 Memories Guide" I can not write or erase same block while reading(code executing).
I tried some technics like ramcode and ITCM but, I could not be successful.
I do not want to use Data flash. Because HSE firmware uses all of it.
What is the proper way to do that? Is there any example?
已解决! 转到解答。
Hi @mesutkilicmak,
The below API functions have to be placed into SRAM (".ramcode" section), as show below.
Then, the core must not access the block from interrupts. The interrupts must be either masked (PRIMASK = 1), or the vector table as well as the ISR() functions and the data the ISR() access must not be in the block.
C40_Ip.h.
Before the declaration:
#if ( 1 == C40_RAM_CODE_ENABLE
/* ram code start */
#define FLS_STOP_SEC_CODE
#include "Fls_MemMap.h"
#define FLS_START_SEC_RAMCODE
#include "Fls_MemMap.h"
#endif
After the declaration.
#if ( 1 == C40_RAM_CODE_ENABLE )
/* ram code end */
#define FLS_STOP_SEC_RAMCODE
#include "Fls_MemMap.h"
#define FLS_START_SEC_CODE
#include "Fls_MemMap.h"
#endif
if #define C40_RAM_CODE_ENABLE 1, the above four flash API functions are placed in the ".ramcode" section.
Regards,
Daniel
Thank you for your answer. Your solution is worked for me.
In addition to your solution I also need to edit this function prototype too.
This function static in C40_Ip.c
I tried on C40 example. It worked fine but, does not worked my app.
I removed the tick from "Fls Timeout Supervision Enabled" in C40_Ip. Because of the "OsIf_GetElapsed" function used.
I also need to move my functions that uses write and and erase to ramcode.
Regards,
Mesut
Hi @mesutkilicmak,
The below API functions have to be placed into SRAM (".ramcode" section), as show below.
Then, the core must not access the block from interrupts. The interrupts must be either masked (PRIMASK = 1), or the vector table as well as the ISR() functions and the data the ISR() access must not be in the block.
C40_Ip.h.
Before the declaration:
#if ( 1 == C40_RAM_CODE_ENABLE
/* ram code start */
#define FLS_STOP_SEC_CODE
#include "Fls_MemMap.h"
#define FLS_START_SEC_RAMCODE
#include "Fls_MemMap.h"
#endif
After the declaration.
#if ( 1 == C40_RAM_CODE_ENABLE )
/* ram code end */
#define FLS_STOP_SEC_RAMCODE
#include "Fls_MemMap.h"
#define FLS_START_SEC_CODE
#include "Fls_MemMap.h"
#endif
if #define C40_RAM_CODE_ENABLE 1, the above four flash API functions are placed in the ".ramcode" section.
Regards,
Daniel