Hi all,
My MCU is 9S08PA60, use PE to generate a Flash component,
below is IFsh.c
typedef struct {
uint8_t code[12]; /* Structure required to copy code to ram memory */
/* Size of this structure needs to be at least (but best) the size of the FnCmdInRam_ */
} FnCmdInRamStruct;
typedef void (* near pFnCmdInRam)(void);
/* Global variables */
static void FnCmdInRam_(void)
{
NVM_FSTAT = 0x80U; /* Clear flag command buffer empty */
while (NVM_FSTAT_CCIF == 0U) {} /* Wait to command complete */
return;
}
#pragma MESSAGE DISABLE C1805 /* Disable warning C1805 "Non-standard conversion used" */
/*lint -save -e740 -e931 Disable MISRA rule (1.2) checking. */
static void CallFnCmdInRam()
{
FnCmdInRamStruct FnCmdInRam = *(FnCmdInRamStruct *)(FnCmdInRam_); /* Create a copy of Wait in RAM routine on stack */
((pFnCmdInRam)&FnCmdInRam)(); /* Call code in RAM */
return;
}
size of the code array is 12, but size of function FnCmdInRam_ is 14, crash in all flash operation.
10.4 with this issue, updated to 10.6 + update 1.0.0 and it remains.
need help.
thanks
bill
Hi Bill,
I've created a project with the wizard including Processor Expert.
I've added the intFlash bean and enabled the SetByteflash and Getbyteflash function.
In the main.c file I've added the code:
/* Erase whole sector - necessary only if Write mode property is set to "Write" */
Err = IFsh1_EraseSector(0xE000);
/* Write number 28 to address 0xE000 */
Err = IFsh1_SetByteFlash(0xE000, 28);
/* Read contents of internal FLASH array on address
0xE000 and write it to variable Data */
Err = IFsh1_GetByteFlash(0xE000, &Data);
This is working fine on my board.
I see in the flash memory the value 1C at 0xE000.
I've disassembled the IFsh1.c file and got:
DISASSEMBLY OF: '.text' FROM 1036 TO 1905 SIZE 869 (0X365)
Opening source file 'F:/Temp_bis/Community/331964/MCU_10.6/test_pt60\Generated_Code\IFsh1.c'
121: static void FnCmdInRam_(void)
FnCmdInRam_:
00000000 A680 LDA #0x80
00000002 C70000 STA NVM_FSTAT
124: while (NVM_FSTAT_CCIF == 0U) {} /* Wait to command complete */
00000005 C60000 LDA NVM_FSTAT
00000008 2AFB BPL *-3 ;abs = 0x0005
126: }
0000000A 81 RTS
the size of the function is 0xA =10.
Have a great day,
Pascal Irrle
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Bill,
I don't have a PA60 but a TWR-S08PT60.
I will perform some tests on my side and will keep you informed.
Have a great day,
Pascal Irrle
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------