S32K144 P_FLASH Erase fail and HardFault

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32K144 P_FLASH Erase fail and HardFault

1,116 Views
eafly
Contributor I

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.

Labels (1)
0 Kudos
1 Reply

849 Views
eafly
Contributor I

hi, guys, issue have been fixed, it happened 'cause i have set the wrong callback: CallBack  = NULL

in sdk source file, the null callback NULL_CALLBACK is defined as "#define NULL_CALLBACK      ((flash_callback_t)0xFFFFFFFFU)" .

0 Kudos