Other Parts Discussed in Thread: SYSBIOS
Hi,
I import uartecho project into CCS and add some codes to test how to save data into flash area.
So I changed .cmd file as follows:--stack_size=8192 /* C stack is also used for ISR stack */
HEAPSIZE = 0x20000; /* Size of heap buffer used by HeapMem */
MEMORY
{
FLASH (RX) : origin = 0x00000000, length = 0x000FF000
MYDATA (RW) : origin = 0x000FF000, length = 0x00001000
SRAM (RWX) : origin = 0x20000000, length = 0x00040000
}
/* Section allocation in memory */
SECTIONS
{
.text : > FLASH
.const : > FLASH
.rodata : > FLASH
.cinit : > FLASH
.init_array : > FLASH
myvars : {} > MYDATA
.TI.ramfunc : {} load=FLASH, run=SRAM, table(BINIT)
.data : > SRAM
.bss : > SRAM
.sysmem : > SRAM
/* Heap buffer used by HeapMem */
.priheap : {
__primary_heap_start__ = .;
. += HEAPSIZE;
__primary_heap_end__ = .;
} > SRAM align 8
.stack : > SRAM (HIGH)
}
Please note MYDATA and myvars.
I put following code snippet into uartecho.c:/* pragmas to define the variables in flash */
#pragma DATA_SECTION(var1, "myvars");
#pragma RETAIN(var1)
uint32_t var1 = 125;
#pragma DATA_SECTION(var2, "myvars");
#pragma RETAIN(var2)
uint32_t var2 = 300;
I compiled the project and started debugging. Then I got following debugging session screen shot immediately.
Program run got into exit status and then hanged.
For testing purpose, I modified the attribute of variable var1 and var2 by adding const.
const uint32_t var1 = 125;
const uint32_t var2 = 300;
Then uartecho program runs well.
That means I can not change/modifiy the contents of specific location in flash.
How can I change contents of var1 and var2 defined in flash dynamically ?
Any tips/advises are appreciated in advance.
HaeSeung