- Platform: Windows 7
- Hardware: CC2538EM with SmartRF06
- IDE: CCS v6.0.1
- Compiler: GNU v4.7.4 (Linaro)
Dear support,
During a debug session with CCSv6 on my project, my initialized global variables doesn't get initialized at startup because the flashing tool of CCSv6 seems to not load those data in flash. I'm using as usual the following code to populate those variables at startup:
pul_src = &_etext;
for(pul_dst = &_data; pul_dst < &_edata;) {
*pul_dst++ = *pul_src++;
}
The memory content at _etext is filled with 0 and thus my global variables get initialized with 0.
Here is the linker script I'm currently using:
MEMORY
{
FLASH (RX) : ORIGIN = 0x00200000, LENGTH = (0x00080000 - 44)
FLASH_CCA (RX) : ORIGIN = (0x00200000 + (0x00080000 - 44)), LENGTH = 44
NRSRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00004000
SRAM (RWX) : ORIGIN = 0x20004000, LENGTH = 0x00004000
}
/* heap section */
_eheapdata = ORIGIN(SRAM) + LENGTH(SRAM);
/* We put the usb related init and non-init data in the non-retention SRAM.
The Load Memory Address (LMA) is stored in a variable and used by the program
to initiliaze the usb data once needed. */
SECTIONS
{
.text :
{
_text = .;
KEEP(*(.vectors))
*(.text*)
*(.rodata*)
_etext = .;
} > FLASH= 0
.socdata (NOLOAD) :
{
*(.udma_channel_control_table)
} > SRAM
.data :
{
_data_lma = LOADADDR(.data);
_data = .;
*(EXCLUDE_FILE(*usb*.o) .data*)
_edata = .;
} > SRAM AT > FLASH
.ARM.exidx :
{
*(.ARM.exidx*)
} > FLASH
.bss :
{
_bss = .;
*(EXCLUDE_FILE(*usb*.o) .bss*)
*(EXCLUDE_FILE(*usb*.o) COMMON)
. = ALIGN(4);
_ebss = .;
_heapdata = ABSOLUTE(.);
} > SRAM
.nrdata :
{
_nrdata_lma = LOADADDR(.nrdata);
_nrdata = .;
*(.nrdata*)
*usb*.o(.data)
_enrdata = .;
} > NRSRAM AT > FLASH
.nrbss (NOLOAD) :
{
_nrbss = .;
*(.nrbss*)
*usb*.o(.bss COMMON)
_enrbss = .;
} > NRSRAM
.flashcca :
{
KEEP(*(.flashcca))
} > FLASH_CCA
}
By looking at the symbol table generated by arm-none-eabi-nm.exe I noticed that the initialized data are effectively present after the .text section (0x0021e098-0x0021db9a = 1278):
0021db9a A _data_lma 0021db9a T _etext 0021e098 A _nrdata_lma 0027ffd4 0000002c R __cca
CCSv6 appear to be unconcerned about what is coming after the .text section during a debug session and won't load this part in flash.
Note that everything works fine and I'm able to run my program when I'm flashing the device with the Flash Programmer 2 software. After that, if a run a debug session by loading only the symbols, the content after the .text section are not zero and my global variables get initialized properly.
Thanks a lot for your help if there is a solution to this problem.

