Other Parts Discussed in Thread: RM48L952, , HALCOGEN
Hi,
I am trying to adapt one of the Hercules Bootloader examples to use the GCC toolchain. In the TI linker script, the flash API is placed in its own section in Flash to later be loaded into RAM. I've added the same sections to my GCC linker script, however when I execute the program, it triggers a prefetch abort when it gets to the Flash routines. When I check the executable with objdump, it turns out that it's not placing all of the flash API into the explicit section I created for it; some of the symbols get placed in the .text section.
Any guidance on this?
Here is my linker script and objdump output:
/*----------------------------------------------------------------------------*/
/* sys_link.ld */
/* */
/* (c) Texas Instruments 2009-2013, All rights reserved. */
/* */
/*----------------------------------------------------------------------------*/
/* Entry Point */
ENTRY(_c_int00)
/* Highest address of the stack */
_estack = 0x8040000; /* end of 256K RAM */
/* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size = 0x400; /* required amount of heap */
/* Specify the memory areas */
MEMORY
{
VECTORS(rx) : ORIGIN = 0x00000000, LENGTH = 0x00000020
FLASH_API (rx) : ORIGIN = 0x00000020, LENGTH = 0x000014E0
FLASH (rx) : ORIGIN = 0x00001500, LENGTH = 0x002FEB00
CPU_STACK (rw) : ORIGIN = 0x08000000, LENGTH = 0x00002000 /* Stack is configured in sys_core.asm */
RAM (xrw) : ORIGIN = 0x08002000, LENGTH = 0x0002D000
MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K
}
/* Define output sections */
SECTIONS
{
/* The ISR vector goes first into RAM */
.intvecs :
{
. = ALIGN(4);
KEEP(*(.intvecs)) /* ISR vector */
. = ALIGN(4);
} >VECTORS
/* used by the startup to initialize flashAPI */
_siflashAPI = LOADADDR(.flashAPI);
.flashAPI :
{
. = ALIGN(4);
_sflashAPI = .; /* create a global symbol at data start */
*Fapi_UserDefinedFunctions.c.o (.text .text*)
*bl_flash.c.o (.text .text*)
*F021_API_CortexR4_BE_V3D16.lib (.text .text*)
. = ALIGN(4);
_eflashAPI = .; /* define a global symbol at data end */
} >RAM AT> FLASH_API
/* The program code and other data goes into RAM */
. = ALIGN(4);
.text :
{
. = ALIGN(4);
/* original placement */
*(.text) /* .text sections (code) */
*(.text*) /* .text sections (code) */
*(.glue_7) /* glue arm to thumb code */
*(.glue_7t) /* glue thumb to arm code */
*(.eh_frame)
KEEP (*(.init))
KEEP (*(.fini))
. = ALIGN(4);
_etext = .; /* define a global symbols at end of code */
} >FLASH
/* Constant data goes into RAM */
.rodata :
{
. = ALIGN(4);
*(.rodata) /* .rodata sections (constants, strings, etc.) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
. = ALIGN(4);
} >FLASH
.ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >RAM
.ARM : {
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
} >FLASH
.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
} >FLASH
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
} >FLASH
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
} >FLASH
/* used by the startup to initialize data */
_sidata = LOADADDR(.data);
/* Initialized data sections goes into RAM, load LMA copy after code */
.data :
{
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
*(.data) /* .data sections */
*(.data*) /* .data* sections */
. = ALIGN(4);
_edata = .; /* define a global symbol at data end */
} >RAM AT> FLASH
/* Uninitialized data section */
. = ALIGN(4);
.bss :
{
/* This is used by the startup in order to initialize the .bss secion */
_sbss = .; /* define a global symbol at bss start */
__bss_start__ = _sbss;
*(.bss)
*(.bss*)
*(COMMON)
. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end */
__bss_end__ = _ebss;
} >RAM
PROVIDE ( end = _ebss );
PROVIDE ( _end = _ebss );
PROVIDE ( __end__ = _ebss );
/* MEMORY_bank1 section, code must be located here explicitly */
/* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */
.memory_b1_text :
{
*(.mb1text) /* .mb1text sections (code) */
*(.mb1text*) /* .mb1text* sections (code) */
*(.mb1rodata) /* read-only data (constants) */
*(.mb1rodata*)
} >MEMORY_B1
/* Remove information from the standard libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
.ARM.attributes 0 : { *(.ARM.attributes) }
}
objdump output.elf -t | grep Fapi
00000000 l df *ABS* 00000000 Fapi_UserDefinedFunctions.c
00015839 l F .text 00000000 .hidden _Fapi_divideUnsignedLong
080024c8 l F .flashAPI 00000008 __Fapi_setActiveFlashBank_from_arm
080024d0 l F .flashAPI 00000008 __Fapi_initializeFlashBanks_from_arm
080024d8 l F .flashAPI 00000008 __Fapi_doMarginReadByByte_from_arm
080024e0 l F .flashAPI 00000008 __Fapi_issueAsyncCommandWithAddress_from_arm
080024e8 l F .flashAPI 00000008 __Fapi_enableMainBankSectors_from_arm
080024f0 l F .flashAPI 00000008 __Fapi_issueProgrammingCommand_from_arm
00016099 l F .text 0000000c __Fapi_serviceWatchdogTimer_from_thumb
000160a4 l F .text 00000008 __Fapi_BlockProgram_veneer
000160ac l F .text 00000008 __Fapi_UpdateStatusProgram_veneer
000160b4 l F .text 00000008 __Fapi_BlockErase_veneer
00016049 g F .text 00000000 .hidden Fapi_isAddressEEPROM
08002028 g F .flashAPI 00000024 Fapi_setupBankSectorEnable
00015e05 g F .text 00000000 .hidden Fapi_doMarginReadByByte
08002138 g F .flashAPI 00000084 Fapi_Init
00015ee5 g F .text 00000000 .hidden _Fapi_readDword
00015e51 g F .text 00000000 .hidden Fapi_calculateEcc
00015f11 g F .text 00000000 .hidden _Fapi_exitMarginMode
00015b11 g F .text 00000000 .hidden Fapi_setActiveFlashBank
00015ff9 g F .text 00000000 .hidden Fapi_isAddressEcc
00015f3d g F .text 00000000 .hidden _Fapi_enterMarginMode
00015ead g F .text 00000000 .hidden _Fapi_readLword
00015c8d g F .text 00000000 .hidden Fapi_issueProgrammingCommand
08002284 g F .flashAPI 00000058 Fapi_UpdateStatusProgram
00015e65 g F .text 00000000 .hidden Fapi_calculateFletcherChecksum
00015e9d g F .text 00000000 .hidden Fapi_getNumberOfBankSectors
0800246c g F .flashAPI 00000058 Fapi_BlockRead
00015fa5 g F .text 00000000 .hidden Fapi_flushPipeline
00015e45 g F .text 00000000 .hidden _Fapi_checkWdService
08002330 g F .flashAPI 0000013c Fapi_BlockErase
00015ab5 g F .text 00000000 .hidden _Fapi_issueFsmCommand
00015fc7 g F .text 00000000 .hidden Fapi_waitDelay
000157c9 g F .text 00000000 .hidden Fapi_enableMainBankSectors
00015855 g F .text 00000000 .hidden Fapi_initializeFlashBanks
00015799 g F .text 00000000 .hidden Fapi_issueAsyncCommandWithAddress
080021bc g F .flashAPI 000000c8 Fapi_BlockProgram
08002000 g F .flashAPI 00000008 .hidden Fapi_serviceWatchdogTimer
08002008 g F .flashAPI 00000020 Fapi_setupEepromSectorEnable