This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to put a memory section in RAM before the .bss section?

Other Parts Discussed in Thread: TM4C129XNCZAD

Hi 

I'm using CCSv6 , tirtos_tivac_2_01_00_03, arm compiler 5.1.9, and the target is TM4C129XNCZAD.

I want to put some arrays in a fixed memory location at the begiining of the RAM . So I edited the the .cmd file as follows

MEMORY
{
FLASH (RX) : origin = 0x00000000, length = 0x00100000
SRAM (RWX) : origin = 0x20000000, length = 0x00040000
ESRAM_PART1(RWX) : origin = 0x60000000, length = 0x00100000 /* 1MB will be reserved for the FW update */
ESRAM_PART2(RWX) : origin = 0x60100000, length = 0x00700000
}

SECTIONS
{
.intvecs: > 0x00000000
.text : > FLASH
.const : > FLASH
.cinit : > FLASH
.pinit : > FLASH
.init_array : > FLASH

.vtable : > 0x20000000
.no_init_ram_sect : {} type=NOINIT > SRAM
.data : > SRAM
.bss : > SRAM
.sysmem : > SRAM
.stack : > SRAM
.xram2 : {} type=NOINIT > ESRAM_PART2
.xram1 : {} type=NOINIT > ESRAM_PART1
}

but the resulted .map file showed that the no_init_ram_sect  section comes after the .bss and the .stack.


run origin load origin length init length attrs members
---------- ----------- ---------- ----------- ----- -------
00000000 00000000 0004ce08 0004ce08 r-x
00000000 00000000 0000003c 0000003c r-- .resetVecs
0000003c 0000003c 000332d8 000332d8 r-x .text
00033314 00033314 00018dd0 00018dd0 r-- .const
0004c0e8 0004c0e8 00000d20 00000d20 r-- .cinit
20000000 20000000 00000360 00000000 rw-
20000000 20000000 00000360 00000000 rw- .vecs
20000400 20000400 0002b1f8 00000000 rw-
20000400 20000400 00025f61 00000000 rw- .bss
20026364 20026364 00002000 00000000 rw- .stack
20028364 20028364 00001dec 00000000 rw- .no_init_ram_sect
2002a150 2002a150 000014a8 00000000 rw- .data
60100000 60100000 00032000 00000000 rw-
60100000 60100000 00032000 00000000 rw- .xram2

I need the no_init_ram_sect to be at the start of RAM at fixed address.

Thanks.

  • Mostafa Al Marakshi said:
    I need the no_init_ram_sect to be at the start of RAM at fixed address

    If you need it at a fixed address, you can hard-code the addess as has been done for .vtable.

    If you just want to control the order in which sections are allocated in SRAM so that no_init_ram_sect is placed first, use the GROUP directive as mentioned in this FAQ.