Hello, I setup the last 3 segments in flash for persistent log memory on our project. I have both the debug/release configuration setup with SMALL code and data models, since our code doesn't need the FLASH2 region. When I run the code, and the reset the program ('soft reset'), the flash LOG memory that was initialized by my application shows it was written correctly. But, if I restart the debugger, and the program is reloaded, the flash LOG memory looks like its all erased to 0xFF. I was hoping when the program is loaded it only flashes the .text and .const memory segments, but maybe its doing a mass erase of the entire flash. Or something else is going on. I did reduce the length of FLASH so it only goes to 0xF97F. I'm not use the info flash region because the log data is larger than the info segments.
FLASH2 : origin = 0x10000,length = 0x43F8 /* Boundaries changed to fix CPU47 */
FLASH : origin = 0x4400, length = 0xB580
FLASH_LOG1 (RW) : origin = 0xF980, length = 0x0200 /* 3 512 byte segments for log data */
FLASH_LOG2 (RW) : origin = 0xFB80, length = 0x0200
FLASH_LOG3 (RW) : origin = 0xFD80, length = 0x0200
#ifndef __LARGE_DATA_MODEL__
.const : {} > FLASH /* Constant data */
.first_day : {} > FLASH_LOG1 type=NOINIT /* log data for test results */
.first_year : {} > FLASH_LOG2 type=NOINIT
.last_year : {} > FLASH_LOG3 type=NOINIT
#else
.const : {} >> FLASH | FLASH2 /* Constant data */
#endif
Here's an example of code where I setup the 'variables' in flash. I seem to get the same result whether I use const or not.
#pragma SET_DATA_SECTION(".first_day")
static const uint16_t first_day_log_revision;
static const test_log_struct first_day_log_flash;
#pragma SET_DATA_SECTION()
Here's the map file, showing that everything is allocated correctly.
FLASH 00004400 0000b580 00006192 000053ee RWIX
FLASH_LOG1 0000f980 00000200 000000f3 0000010d RW
FLASH_LOG2 0000fb80 00000200 000000f3 0000010d RW
FLASH_LOG3 0000fd80 00000200 000000f3 0000010d RW
.first_day
* 0 0000f980 000000f3 UNINITIALIZED
0000f980 000000f3 TestLog.obj (.first_day)
.first_year
* 0 0000fb80 000000f3 UNINITIALIZED
0000fb80 000000f3 TestLog.obj (.first_year)
.last_year
* 0 0000fd80 000000f3 UNINITIALIZED
0000fd80 000000f3 TestLog.obj (.last_year)
Code Composer Studio, Version: 10.3.0.00007

