I'm using design studio for S32K .
I had a piece of code to partition the part (S32K146) , LAUNCHING THE COMMAND FROM RAM.
DID NOT ENABLE THE SECURITY, even when I comment the code out the problem persist.
I can load and run any other project without an issue . even my partition code was loading and running fine until the last morning.
here is the code to partition:
#if 0
uint8_t configure_part_CSEc(void)
{
uint8_t flash_error_status=0;
while((FTFC->FSTAT & FTFC_FSTAT_CCIF_MASK) != FTFC_FSTAT_CCIF_MASK); /* Wait until any ongoing flash operation is completed */
FTFC->FSTAT = (FTFC_FSTAT_FPVIOL_MASK | FTFC_FSTAT_ACCERR_MASK); /* Write 1 to clear error flags */
FTFC->FCCOB[3] = 0x80; /* FCCOB0 = 0x80, program partition command */
FTFC->FCCOB[2] = 0x03; /* FCCOB1 = 2b11, 20 keys */
FTFC->FCCOB[1] = 0x00; /* FCCOB2 = 0x00, SFE = 0, VERIFY_ONLY attribute functionality disable */
FTFC->FCCOB[0] = 0x00; /* FCCOB3 = 0x00, FlexRAM will be loaded with valid EEPROM data during reset sequence */
FTFC->FCCOB[7] = 0x02; /* FCCOB4 = 0x02, 4k EEPROM Data Set Size */
FTFC->FCCOB[6] = 0x04; /* FCCOB5 = 0x04, no data flash, 64k(all) EEPROM backup */
//FTFC->FSTAT = FTFC_FSTAT_CCIF_MASK; /* Start command execution by writing 1 to clear CCIF bit */
//while((FTFC->FSTAT & FTFC_FSTAT_CCIF_MASK) != FTFC_FSTAT_CCIF_MASK); /* Wait until ongoing flash operation is completed */
flash_error_status = FTFC->FSTAT; /* Read the flash status register for any Execution Error */
return flash_error_status;
}
//copied to RAM
void launch_flsh_com(void)
{
#if 1
#pragma asm
ldr r1, =0x40020000 ; <run_ocs_volt_once..C.3A.5CFramework_ZERV_v00.2E02.5CApplications.5CZERV_Framework.5CAppl.5Cobj.5CINF_CDD.>)
movs r0, #128 ; 0x80
strb r0, [r1, #0]
L1:
ldrb r0, [r1, #0]
lsls r0, r0, #24
bpl L1
; bx lr
#pragma endasm
#endif
#if 0
uint8_t configure_part_CSEc(void)
{
uint8_t flash_error_status=0;
while((FTFC->FSTAT & FTFC_FSTAT_CCIF_MASK) != FTFC_FSTAT_CCIF_MASK); /* Wait until any ongoing flash operation is completed */
FTFC->FSTAT = (FTFC_FSTAT_FPVIOL_MASK | FTFC_FSTAT_ACCERR_MASK); /* Write 1 to clear error flags */
FTFC->FCCOB[3] = 0x80; /* FCCOB0 = 0x80, program partition command */
FTFC->FCCOB[2] = 0x03; /* FCCOB1 = 2b11, 20 keys */
FTFC->FCCOB[1] = 0x00; /* FCCOB2 = 0x00, SFE = 0, VERIFY_ONLY attribute functionality disable */
FTFC->FCCOB[0] = 0x00; /* FCCOB3 = 0x00, FlexRAM will be loaded with valid EEPROM data during reset sequence */
FTFC->FCCOB[7] = 0x02; /* FCCOB4 = 0x02, 4k EEPROM Data Set Size */
FTFC->FCCOB[6] = 0x04; /* FCCOB5 = 0x04, no data flash, 64k(all) EEPROM backup */
//FTFC->FSTAT = FTFC_FSTAT_CCIF_MASK; /* Start command execution by writing 1 to clear CCIF bit */
//while((FTFC->FSTAT & FTFC_FSTAT_CCIF_MASK) != FTFC_FSTAT_CCIF_MASK); /* Wait until ongoing flash operation is completed */
flash_error_status = FTFC->FSTAT; /* Read the flash status register for any Execution Error */
return flash_error_status;
}
void launch_flsh_com(void)
{
#if 1
#pragma asm
ldr r1,=0x40020000
movs r0, #128 ; 0x80
strb r0, [r1, #0]
L1:
ldrb r0, [r1, #0]
lsls r0, r0, #24
bpl L1
; bx lr
#pragma endasm
#endif
// FTFC->FSTAT = FTFC_FSTAT_CCIF_MASK; /* Start command execution by writing 1 to clear CCIF bit */
// while((FTFC->FSTAT & FTFC_FSTAT_CCIF_MASK) != FTFC_FSTAT_CCIF_MASK); /* Wait until ongoing flash operation is completed */
}
Thanks,