Hello @Harry_Zhang!
So you came to the same conclusion I had reached previously.
I placed the clear, set and reset functions of the fsl_reset driver in SRAM to isolate this part and let it work in SRAM, but the microcontroller still crashed.
Here are the functions I placed in SRAM and the define to enable these functions.
#include <cr_section_macros.h>
//fsl_reset.c
__RAMFUNC(RAM) void RESET_SetPeripheralReset(reset_ip_name_t peripheral);
__RAMFUNC(RAM) void RESET_ClearPeripheralReset(reset_ip_name_t peripheral);
__RAMFUNC(RAM) void RESET_PeripheralReset(reset_ip_name_t peripheral);
//fsl_spifi.c
__RAMFUNC(RAM) uint32_t SPIFI_GetInstance(SPIFI_Type *base);
__RAMFUNC(RAM) void SPIFI_GetDefaultConfig(spifi_config_t *config);
__RAMFUNC(RAM) void SPIFI_Init(SPIFI_Type *base, const spifi_config_t *config);
__RAMFUNC(RAM) void SPIFI_Deinit(SPIFI_Type *base);
__RAMFUNC(RAM) void SPIFI_SetCommand(SPIFI_Type *base, spifi_command_t *cmd);
__RAMFUNC(RAM) void SPIFI_SetMemoryCommand(SPIFI_Type *base, spifi_command_t *cmd);
__RAMFUNC(RAM) void SPIFI_WriteDataHalfword(SPIFI_Type *base, uint16_t data);
__RAMFUNC(RAM) uint16_t SPIFI_ReadDataHalfword(SPIFI_Type *base);
//fsl_spifi.h
__RAMFUNC(RAM) static inline void SPIFI_SetCommandAddress(SPIFI_Type *base, uint32_t addr);
__RAMFUNC(RAM) static inline void SPIFI_SetIntermediateData(SPIFI_Type *base, uint32_t val);
__RAMFUNC(RAM) static inline void SPIFI_SetCacheLimit(SPIFI_Type *base, uint32_t val);
__RAMFUNC(RAM) static inline void SPIFI_ResetCommand(SPIFI_Type *base);
__RAMFUNC(RAM) static inline void SPIFI_EnableInterrupt(SPIFI_Type *base, uint32_t mask);
__RAMFUNC(RAM) static inline void SPIFI_DisableInterrupt(SPIFI_Type *base, uint32_t mask);
__RAMFUNC(RAM) static inline uint32_t SPIFI_GetStatusFlag(SPIFI_Type *base);
__RAMFUNC(RAM) static inline void SPIFI_EnableDMA(SPIFI_Type *base, bool enable);
__RAMFUNC(RAM) static inline uint32_t SPIFI_GetDataRegisterAddress(SPIFI_Type *base);
__RAMFUNC(RAM) static inline void SPIFI_WriteData(SPIFI_Type *base, uint32_t data);
__RAMFUNC(RAM) static inline void SPIFI_WriteDataByte(SPIFI_Type *base, uint8_t data);
__RAMFUNC(RAM) static inline uint32_t SPIFI_ReadData(SPIFI_Type *base);
__RAMFUNC(RAM) static inline uint8_t SPIFI_ReadDataByte(SPIFI_Type *base);
And here is the forum link I followed to allocate the functions in SRAM.
https://community.nxp.com/t5/LPCXpresso-IDE-FAQs/Relocating-code-from-FLASH-to-RAM/m-p/473993
I also did a test allocating the entire SPIFI driver in SRAM, just like I did for the reset driver, but it didn't change the result.
When you mentioned modifying the linker script, I didn't quite understand. Would it be possible to explain better how to make this modification to the linker script?
Thanks for now.