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.

HALCOGEN: HALCoGen 04.07.01 HL_sys_link.ld GCC linker script places read-only section .ARM.extab section in RAM, not FLASH

Part Number: HALCOGEN
Other Parts Discussed in Thread: TMS570LC4357,

While investigating use of the GCC ARM compiler for a C++ project using a TMS570LC4357 with HALCoGen 04.07.01 noticed that on attempting to get the CCS debugger to verify a program was getting a verification error:

CortexR5: File Loader: Verification failed: Values at address 0x08001500 do not match Please verify target memory and memory map.

Where the linker map file showed the address with the verification error was the start of the .ARM.extab section:

.ARM.extab      0x08001500     0x62ec
 *(.ARM.extab* .gnu.linkonce.armextab.*)

The HL_sys_link.ld GCC linker script created by HALCoGen contains the following entries for sections related to C++ exception handling:

   .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >RAM
    .ARM : {
    __exidx_start = .;
      *(.ARM.exidx*)
      __exidx_end = .;
    } >FLASH

The Exception Handling ABI for the Arm® Architecture shows that the .ARM.extab and .ARM.exidx sections both contain read-only data:

The issue is that the HALCoGen HL_sys_link.ld GCC linker script is incorrectly placing the .ARM.extab section in RAM rather than FLASH.

After correcting the linker script to place .ARM.extab in FLASH rather than RAM then the program verification was successful.

A search of HALCoGen 04.07.01 found the following "template" linker script files which all appear to the same error:

Search ".ARM.extab*" (8 hits in 8 files of 1695 searched)
  C:\ti\Hercules\HALCoGen\v04.07.01\drivers\TMS570LC4357ZWT\SYSTEM570v000\sys_link.ld (1 hit)
	Line 63:    .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >RAM
  C:\ti\Hercules\HALCoGen\v04.07.01\drivers\TMS570LC4357ZWT\SYSTEM570v000\sys_link_freeRTOS.ld (1 hit)
	Line 73:    .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >RAM
  C:\ti\Hercules\HALCoGen\v04.07.01\drivers\TMS570LS0432PZ\SYSTEM570v000\sys_link.ld (1 hit)
	Line 62:    .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >RAM
  C:\ti\Hercules\HALCoGen\v04.07.01\drivers\TMS570LS0432PZ\SYSTEM570v000\sys_link_freeRTOS.ld (1 hit)
	Line 72:    .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >RAM
  C:\ti\Hercules\HALCoGen\v04.07.01\drivers\TMS570LS1227ZWT\SYSTEM570v000\sys_link.ld (1 hit)
	Line 63:    .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >RAM
  C:\ti\Hercules\HALCoGen\v04.07.01\drivers\TMS570LS1227ZWT\SYSTEM570v000\sys_link_freeRTOS.ld (1 hit)
	Line 73:    .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >RAM
  C:\ti\Hercules\HALCoGen\v04.07.01\drivers\TMS570LS3137ZWT\SYSTEM570v000\sys_link.ld (1 hit)
	Line 63:    .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >RAM
  C:\ti\Hercules\HALCoGen\v04.07.01\drivers\TMS570LS3137ZWT\SYSTEM570v000\sys_link_freeRTOS.ld (1 hit)
	Line 73:    .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >RAM

  • Thanks Chester. Did you see the same issue before when you were developing the GCC ARM 7.2.1 patch?

  • Did you see the same issue before when you were developing the GCC ARM 7.2.1 patch?

    At the time when I developed the GCC ARM 7.2.1 patch I didn't see the issue, since the original patch was only tested with C code.

    With the patched ARM 9.3.1p1 compiler, after adding a test of C++ exceptions:

    • With the .ARM.extab sections placed in RAM then an ABORT occurs when the code attempts to raise an exception.
    • With the .ARM.extab sections placed in FLASH then the code can successful raise and catch an exception.

    Have just verified the same behavior occurs with the patched ARM 7.2.1p1 compiler.

  • No, I didn't

    I need to submit a bug ticket for this SW bug in linker script. Thanks Chester so much!