Hello.
Initially I was trying to place the standard library in a separate flash section on the 21.06.0 LTS version of the toolchain.
And it worked.
However after downgrading to the 20.2.5 toolchain the placement statement is ignored with the following error:
"/home/eugensoldatenko/work/lv/F280041.cmd", line 110: warning #10068-D: no matching section --library=libc.a<*>(.text)
As a result the standard library symbols are allocated automatically in non-predictable places.
The linker command file:
// Code Area Checksums
#ifdef APP_CRC
_appl_cs_val = APP_CRC;
#else
/* _appl_cs_val = 0x6FFF; */
_appl_cs_val = 0x487d;
#endif
#ifdef BOOT_CRC
_boot_cs_val = BOOT_CRC;
#else
/* _boot_cs_val = 0x0FFF; */
_boot_cs_val = 0x3026;
#endif
/* -l f28004x_headers_nonbios.cmd */
MEMORY
{
PAGE 0 :
RAMLS0 : origin = 0x008000, length = 0x000800
/* Flash sectors: you can use FLASH for program memory when the RAM is filled up*/
/* BANK 0 */
FLASH_BOOT_JMP : origin = 0x080000, length = 0x000010 /* code entry location */
FLASH_BOOT_SEC0 : origin = 0x080010, length = 0x001FB0 /* on-chip Flash */
FLASH_BOOT_UPDATE_FLAG : origin = 0x081FC0, length = 0x00003D /* Firmware update flag, aligned on 64-bit boundary */
FLASH_BOOT_CS : origin = 0x081FFD, length = 0x000001 /* on-chip Flash */
/* Flash sectors from 2 to 15 */
FLASH_STDLIB : origin = 0x082000, length = 0x001FFD
BEGIN : origin = 0x083FFE, length = 0x000002 /* on-chip Flash */
FLASH_APP_JMP : origin = 0x084000, length = 0x000004 /* code entry location */
FLASH_APP_SEC0 : origin = 0x084004, length = 0x001551 /* on-chip Flash */
FLASH_5555 : origin = 0x085555, length = 0x000020 /* on-chip Flash UL PC test */
FLASH_APP_SEC1 : origin = 0x085575, length = 0x005535 /* on-chip Flash */
FLASH_AAAA : origin = 0x08AAAA, length = 0x000020 /* on-chip Flash UL PC test */
FLASH_APP_SEC2 : origin = 0x08AACA, length = 0x00550C /* on-chip Flash */
FLASH_APP_GITHASH : origin = 0x08FFD6, length = 0x000029 /* on-chip Flash */
FLASH_APP_CS : origin = 0x08FFFF, length = 0x000001 /* on-chip Flash */
RESET : origin = 0x3FFFC0, length = 0x000040
PAGE 1 :
/* RAM sectors */
BOOT_RSVD : origin = 0x000000, length = 0x000080 /* Part of M0, BOOT rom will use this for stack */
RAMM0 : origin = 0x000080, length = 0x000380 /* on-chip RAM block M0 */
RAMM1 : origin = 0x000400, length = 0x0003E8 /* on-chip RAM block M1 */
RAMM1ul : origin = 0x0007E8, length = 0x000010 // ul ram test RAM block M1
// RAMM1_RSVD : origin = 0x0007F8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
RAMLS1_6 : origin = 0x008800, length = 0x003000
RAMGS0 : origin = 0x00C000, length = 0x002000
RAMGS1 : origin = 0x00E000, length = 0x002000
RAMGS2 : origin = 0x010000, length = 0x002000
RAMGS3 : origin = 0x012000, length = 0x001FF8
// RAMGS3_RSVD : origin = 0x013FF8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
PAGE 2: // Boot Ram for code and variables (overlays above area)
BOOT_RAM : origin = 0x008000, length = 0x004000 // ram for boot code and variables (L0-L7)
// RAMGS3_RSVD : origin = 0x013FF8, length = 0x000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
PAGE 3: // Boot Initialization, just constants
M01START : origin = 0x000080, length = 0x000780
M01END : origin = 0x000800, length = 0x01
L07START : origin = 0x008800, length = 0x001800
L07END : origin = 0x00A000, length = 0x01
BOOTSTART : origin = 0x080000, length = 0x002000
BOOTEND : origin = 0x082000, length = 0x01
PAGE 4: // Boot Initialization Continued, just constants
APPLSTART : origin = 0x084000, length = 0x00B000
APPLEND : origin = 0x090000, length = 0x01
}
/*You can arrange the .text, .cinit, .const, .pinit, .switch and .econst to FLASH when RAM is filled up.*/
SECTIONS
{
appentry : > FLASH_APP_JMP PAGE = 0 // must be beginnning of FLASHapp!
boot_cs : > FLASH_BOOT_CS, PAGE = 0
codestart : > BEGIN, PAGE = 0
githash : > FLASH_APP_GITHASH PAGE = 0
appl_cs : > FLASH_APP_CS PAGE = 0
.cinit : > FLASH_APP_SEC0, PAGE = 0
.pinit : > FLASH_APP_SEC0, PAGE = 0
.text : >> FLASH_APP_SEC0 | FLASH_APP_SEC1 | FLASH_APP_SEC2 , PAGE = 0
.text_AAAA : > FLASH_AAAA PAGE = 0
.text_5555 : > FLASH_5555 PAGE = 0
.switch : > FLASH_APP_SEC0, PAGE = 0
.reset : > RESET, PAGE = 0, TYPE = DSECT /* not used, */
.binit : > FLASH_STDLIB, PAGE = 0
// boot code running in ram
bootentry : > FLASH_BOOT_JMP PAGE = 0 // boot code jump table
btext : > FLASH_BOOT_SEC0 PAGE = 0 // boot code start
bootconst : load = FLASH_BOOT_SEC0 PAGE = 0, // comm constants in FLASH then loaded into ram
run = BOOT_RAM PAGE = 2, // ram load area
load_start(_BootconstLoadStart), // start of constants (FLASH address)
load_end( _BootconstLoadEnd), // end of constants (FLASH address)
run_start( _BootconstRunStart) // run start (RAM address)
bootfuncs : load = FLASH_BOOT_SEC0 PAGE = 0,
run = BOOT_RAM PAGE = 2,
load_start(_BootfuncsLoadStart),
load_end( _BootfuncsLoadEnd),
run_start( _BootfuncsRunStart)
stdlib
{
--library=libc.a<*>(.text)
} > FLASH_STDLIB, PAGE = 0
GROUP(BSS_HEAP_GROUP) : > RAMLS1_6
{
.ebss :{}
.esysmem :{}
}
rtext : > FLASH_APP_SEC2 PAGE = 0 // <TODO> Is this legacy or current? Doesn't seem to do anything
ramfuncs : load = FLASH_APP_SEC2 PAGE = 0,
run = RAMGS0 PAGE = 1,
load_start(_RamfuncsLoadStart),
load_end( _RamfuncsLoadEnd),
run_start( _RamfuncsRunStart)
.TI.ramfunc : LOAD = FLASH_APP_SEC0, PAGE = 0, ALIGN(4)
RUN = RAMGS0, PAGE = 1,
LOAD_START(_TIRamfuncsLoadStart),
LOAD_SIZE(_TIRamfuncsLoadSize),
LOAD_END(_TIRamfuncsLoadEnd),
RUN_START(_TIRamfuncsRunStart),
RUN_SIZE(_TIRamfuncsRunSize),
RUN_END(_TIRamfuncsRunEnd),
table(BINIT)
ulbss : > RAMM1ul PAGE = 1 // ul ram test data storage
.stack : > RAMM0, PAGE = 1
.cio : > RAMLS0, PAGE = 0
.econst : >> FLASH_APP_SEC0 | FLASH_APP_SEC1 | FLASH_APP_SEC2, PAGE = 0, ALIGN(4)
bebss : > BOOT_RAM PAGE = 2
ramgs0 : > RAMGS0, PAGE = 1
ramgs1 : > RAMGS1, PAGE = 1
// boot dummy sections
// used by boot up code to clear ram and do checksums
.dummy0 : > M01START PAGE = 3 {_ramm01_start = .;}
.dummy0e : > M01END PAGE = 3 {_ramm01_end = .;}
.dummy1 : > L07START PAGE = 3 {_raml07_start = .;}
.dummy1e : > L07END PAGE = 3 {_raml07_end = .;}
.dummy2 : > APPLSTART PAGE = 4 {_appl_start = .;}
.dummy2e : > APPLEND PAGE = 4 {_appl_end = .;}
.dummy3 : > BOOTSTART PAGE = 3 {_boot_start = .;}
.dummy3e : > BOOTEND PAGE = 3 {_boot_end = .;}
.dummy4 : > BEGIN PAGE = 0 {_code_start = .;}
}
/*
//===========================================================================
// End of file.
//===========================================================================
*/