AnsweredAssumed Answered

S32K144 P_FLASH Erase fail and HardFault

Question asked by zaijzhgh huang on Jul 6, 2019
Latest reply on Jul 8, 2019 by zaijzhgh huang

hi all, I'am working on S32K144(100*PIN), now I can't erased the flash. the flash partition like this:
bootloader: 0x00000 ~ 0xFFFF (0 ~ 64 KB)
application: 0x10000 ~ 0x3A710 (64 ~ 288 KB)
when erase function:FLASH_DRV_EraseSector called, mcu halt on HardFault_Handler

here is the code:

status_t erase_status;
flash_user_config_t pUserConf;
flash_ssd_config_t pSSDConfig;

pUserConf.PFlashBase = 0x0000;
pUserConf.PFlashSize = 512 * 1024;
pUserConf.CallBack = NULL;

 

FLASH_DRV_Init(&pUserConf, &pSSDConfig);
INT_SYS_DisableIRQGlobal();
/*
PFLASH_APP_START_ADDR == (64 * 1024), PFLASH_SECTOR_SIZE == (4 * 1024)
*/
erase_status = FLASH_DRV_EraseSector(&pSSDConfig, PFLASH_APP_START_ADDR, PFLASH_SECTOR_SIZE); 
INT_SYS_EnableIRQGlobal();

 

and FLASH_DRV_CommandSequence function has been linked to ram section:

FLASH_DRV_CommandSequence 0x2000031d Thumb Code 60 flash_driver.o(RAMCODE)

 

sct file:

LR_m_text m_text_start m_text_size { ; load region size_region
ER_m_text m_text_start m_text_size { ; load address = execution address
* (InRoot$$Sections)
.ANY (+RO)
}
RW_m_data m_data_start m_data_size { ; RW data
.ANY (+RW +ZI)
}
RW_m_data_2 m_data_2_start m_data_2_size-Stack_Size-Heap_Size { ; RW data
.ANY (+RW +ZI)
*.o(RAMCODE)
}
ARM_LIB_HEAP ((ImageLimit(RW_m_data_2) == m_data_2_start) ? ImageLimit(RW_m_data) : +0) EMPTY Heap_Size { ; Heap region growing up
}
ARM_LIB_STACK m_data_2_start+m_data_2_size EMPTY -Stack_Size { ; Stack region growing down
}
}

Can you advise me what to do next?
Regards.

Attachments

Outcomes