Hi, Lukas. In my sofeware , I use this memory segment :
.__writeback_rom LOAD (0x0000C000) :{}>write_back_ram
#ifdef START_SECTION_WriteBackRom //NVM ROM?
#pragma push
#pragma section all_types ".__writeback_rom" ".__writeback_rom"
#undef START_SECTION_WriteBackRom
#endif
#ifdef STOP_SECTION_WriteBackRom
#pragma pop
#undef STOP_SECTION_WriteBackRom
#endif
#define START_SECTION_WriteBackRom
#include "pragma.h"
volatile UINT8 WriteBakData_Copy_Successful_Flag_NVM = 0;
#define STOP_SECTION_WriteBackRom
#include "pragma.h"
By this method , the variable "WriteBakData_Copy_Successful_Flag_NVM " was defined in RAM. And the flash was allocated a memory for this variable also , and the initial data also exists in the mot file . This is the background for the problems . If this section erase failed , the program will not run at all . So I guess if there are some flash opreate exsit in the start code for the device ? So the flash read in start code will lead the program run away , so that the program can't excute the main function.