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.

CCS/AM3358: ICEv2 link issue

Part Number: AM3358
Other Parts Discussed in Thread: SYSBIOS

Tool/software: Code Composer Studio

Hello

I'm having an issue when compiling an application for the tirtos that uses execute in place or XIP.


I generated this linker file by using the RTSC tool in Code Composer (8.3.1.00004) - (see also the attached)
I've attached both files that the RTSC tool produced The icev2AM335x.zip and the icev2XIPAM335x.zip


When using the icev2AM335x selection as shown,


The application works fine and runs.


If I change the board to the icev2XIPAM335x the application fails to link.

The error I get when linking this application to use the GPMC and the NOR Flash address in the GPMC space is the following.

"C:/Tools/ti/ccsv8/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-gcc.exe" -mtune=cortex-a8 -marm -fno-exceptions -Dam3358 -Dicev2AM335x -DSOC_AM335x -Og -g -gdwarf-3 -gstrict-dwarf -Wall -mfloat-abi=hard -Wl,-Map,"rtos_template_app_am335x_a8.map" -nostartfiles -static -Wl,--gc-sections -L"C:/Tools/ti/pdk_am335x_1_0_16/packages/ti/board/lib/gcaAM335x/a8/debug/" -L"C:/Tools/ti/pdk_am335x_1_0_16/packages/ti/csl/lib/am335x/a8/debug/" -L"C:/Tools/ti/bios_6_76_02_02/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/hard" -Wl,--defsym,STACKSIZE=0x1C000 -Wl,--defsym,HEAPSIZE=0x400 --specs=nano.specs -o"rtos_template_app_am335x_a8.out" "./app.o" "./main.o" -Wl,-T"configPkg/linker.cmd" -Wl,--start-group -l:ti.board.aa8fg -l:ti.csl.aa8fg -lgcc -lm -lrdimon -lc -Wl,--end-group
makefile:148: recipe for target 'rtos_template_app_am335x_a8.out' failed
c:/tools/ti/ccsv8/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/hard\libgcc.a(_udivmoddi4.o):(.ARM.exidx+0x0): relocation truncated to fit: R_ARM_PREL31 against `.text'
collect2.exe: error: ld returned 1 exit status
gmake[1]: *** [rtos_template_app_am335x_a8.out] Error 1
gmake: *** [all] Error 2
makefile:144: recipe for target 'all' failed

I'm not sure why it is producing this error, because the it should be linked using the base starting address of 0x0801_0010 and any addresses that are relative in the code should be with that as a base.

The demo application I'm trying to compile for XIP is the one found in the {install_path}/processor_sdk_rtos_am335x_6_01_00_08/demos/rtos_template_app which was copied to my workspace.
The linker file for the board is {Wspace}/rtos_template_app_am335x_a8/Debug/configPkg/linker.cmd


Depending on the selection of the board, I'll get one of the these two linker files.
If icev2AM335x is selected the attached linker file (linker.cmd) would be used to link the code for the DDR.
If icev2XIPAM335x is seleced the attached linker file (linker-XIP.cmd - renamed for clarity) would be used to link the code for the NOR.
These look correct for each type of application being built.

What is not happening correctly to get the XIP application to link?

Respectfully,
Alan Hasty.

Since I was unable to attach these files, I've put them on drop box so that you can download them.


www.dropbox.com/.../linker.cmd
www.dropbox.com/.../linker-XIP.cmd
www.dropbox.com/.../icev2XIPAM335x.zip
www.dropbox.com/.../icev2AM335x.zip

  • Hi,

    Unfortunately I can't download your files from dropbox since it's against TI's file sharing policy.

    I surmise you've created the two custom platforms icev2AM335x and icev2XIPAM335x. Although the contents of the files you've shared would be useful in diagnosing the build problem, it would probably be more useful for you to share your custom platform folder / files.

    Why do you need a separate platform definition for the XIP case, and what is the difference between icev2AM335x  & icev2XIPAM335x? Is it the memory map and where certain code/data is linked?

    Regards,
    Frank

  • Hello Frank,

    The first time I tried this it would not accept these attachments. Here are the respective zip files for the two configs.

    The reason that I wanted two config files is to be able to compile to put the application into the ram vs putting the application into the NOR Flash.

    icev2AM335x.zip

    icev2XIPAM335x.zip

  • I'm unable to post those linker files by uploading them.

    So here is the linker file for the execute from ram instance.

    /*
     * This file was generated by linkcmd_bm_v7a.xdt from the gnu.target.arm  package.
     */

    ENTRY(_c_int00)

    __TI_STACK_SIZE = 0x1000;
    __STACK_SIZE = __TI_STACK_SIZE;

    __HEAP_SIZE = 0x0;

    INPUT(
        "C:\wrk\BAE-BL\rtos_template_app_am335x_a8\Debug\configPkg\package\cfg\main_pa8fg.oa8fg"
        "C:\Tools\ti\pdk_am335x_1_0_16\packages\ti\drv\spi\lib\am335x\a8\release\ti.drv.spi.aa8fg"
        "C:\Tools\ti\pdk_am335x_1_0_16\packages\ti\drv\uart\lib\am335x\a8\release\ti.drv.uart.aa8fg"
        "C:\Tools\ti\pdk_am335x_1_0_16\packages\ti\drv\i2c\lib\am335x\a8\release\ti.drv.i2c.aa8fg"
        "C:\Tools\ti\pdk_am335x_1_0_16\packages\ti\osal\lib\tirtos\a8\release\ti.osal.aa8fg"
        "C:\wrk\BAE-BL\rtos_template_app_am335x_a8\src\sysbios\sysbios.aa8fg"
        "C:\Tools\ti\pdk_am335x_1_0_16\packages\ti\csl\lib\am335x\a8\release\ti.csl.aa8fg"
        "C:\Tools\ti\bios_6_76_02_02\packages\gnu\targets\arm\rtsv7A\lib\gnu.targets.arm.rtsv7A.aa8fg"
        "C:\Tools\ti\bios_6_76_02_02\packages\gnu\targets\arm\rtsv7A\lib\boot.aa8fg"
        "C:\Tools\ti\bios_6_76_02_02\packages\gnu\targets\arm\rtsv7A\lib\syscalls.aa8fg"
    )

    MEMORY
    {
        SRAM_LO (RWX) : org = 0x402f0000, len = 0x400
        SRAM_HI (RWX) : org = 0x402f0400, len = 0xfc00
        OCMC_SRAM (RWX) : org = 0x40300000, len = 0x10000
        DDR (RWX) : org = 0x80000000, len = 0x10000000
    }

    /*
     * In order to put the .bass, .text, .data, .heap or .stack into a
     * different memory section, change the corresponding REGION_ALIAS.
     */
    REGION_ALIAS("REGION_BSS", DDR);
    REGION_ALIAS("REGION_TEXT", DDR);
    REGION_ALIAS("REGION_DATA", DDR);
    REGION_ALIAS("REGION_STACK", DDR);
    REGION_ALIAS("REGION_HEAP", DDR);
    REGION_ALIAS("REGION_ARM_EXTAB", DDR);
    REGION_ALIAS("REGION_ARM_EXIDX", DDR);

    /*
     * symbolic aliases for static instance objects
     */
    xdc_runtime_Startup__EXECFXN__C = 1;
    xdc_runtime_Startup__RESETFXN__C = 1;
    xdc_rov_runtime_Mon__checksum = 1;
    xdc_rov_runtime_Mon__write = 1;

    /*
     * Linker command file contributions from all loaded packages:
     */

    /* Content from ti.sysbios.family.arm (ti/sysbios/family/arm/linkcmd.xdt): */

    /* Content from ti.sysbios.family.arm.a8.intcps (ti/sysbios/family/arm/a8/intcps/linkcmd.xdt): */
    ti_sysbios_family_arm_a8_intcps_Hwi_intc = 0x48200000;


    SECTIONS {

            .vecs : {*(.vecs)}  AT> DDR
        ti.sysbios.family.arm.a8.mmuTableSection (NOLOAD) : {*(ti.sysbios.family.arm.a8.mmuTableSection)}  AT> DDR
        xdc.meta (COPY) : {KEEP(*(xdc.meta))}  AT> DDR


        .c_int00 : {
            KEEP (*(.c_int00))
        } > REGION_TEXT

        .text : {
            CREATE_OBJECT_SYMBOLS
            KEEP (*(.resetVecs))
            KEEP (*(.text))
            *(.text.*)
            *(.gnu.linkonce.t*)
            *(.gnu.warning)
            *(.glue*)
            . = ALIGN(0x4);
            KEEP (*(.ctors))
            *(.gnu.linkonce.r.*)
            . = ALIGN(0x4);
            __init_array_start = .;
            KEEP(*(SORT(.init_array.*)))
            KEEP(*(.init_array))
            __init_array_end = .;
            *(.init)
            *(.fini*)
        } > REGION_TEXT

        .rodata : {
            *(.rodata)
            *(.rodata.*)
        } > REGION_TEXT

        .ARM.extab : {
            *(.ARM.extab*)
            *(.gnu.linkonce.armextab.*)
        } > REGION_ARM_EXTAB

        .ARM.exidx : {
            __exidx_start = .;
            *(.ARM.exidx*)
            *(.gnu.linkonce.armexidx.*)
            __exidx_end = .;
        } > REGION_ARM_EXIDX

        etext   = .;
        _etext  = .;
        __etext = .;

        .data : ALIGN(4) {
            __data_load__ = LOADADDR (.data);
            __data_start__ = .;
            *(.got.plt)
            *(.got)
            *(.shdata)
            KEEP (*(.data))
            KEEP (*(.data*))
            *(.gnu.linkonce.d.*)
            . = ALIGN (4);
            __data_end__ = .;
        } > REGION_DATA AT> REGION_TEXT

        /*
         * Place .heap section before .bss and .stack as the _sbrk
         * implementation in librdimon.a compares the (heap_end + incr)
         * to the current SP value to check if the heap has overlapped
         * with the stack.
         *
         * If .heap is placed between .bss and .stack in a SYS/BIOS app,
         * when the task stack (allocated in .bss) is the current stack,
         * the heap check in _sbrk will fail and trigger an error even
         * though the heap might not have actually overlapped with the
         * system stack.
         */
        .heap : ALIGN(0x100) {
            __heap_start__ = .;
            end = __heap_start__;
            _end = end;
            __end = end;
            . += __HEAP_SIZE;
            __heap_end__ = .;
            __HeapLimit = __heap_end__;
        } > REGION_HEAP

        .bss : {
            __bss_start__ = .;
            *(.shbss)
            KEEP (*(.bss))
            *(.bss.*)
            *(.gnu.linkonce.b.*)
            *(COMMON)
            . = ALIGN (4);
            __bss_end__ = .;
        } > REGION_BSS

        .stack : ALIGN(0x0008) {
            __TI_STACK_BASE = .;
            __stack = .;
            . += __TI_STACK_SIZE;
        } > REGION_STACK

        .stab           0 : { *(.stab) }
        .stabstr        0 : { *(.stabstr) }
        .stab.excl      0 : { *(.stab.excl) }
        .stab.exclstr   0 : { *(.stab.exclstr) }
        .stab.index     0 : { *(.stab.index) }
        .stab.indexstr  0 : { *(.stab.indexstr) }
        .comment        0 : { *(.comment) }

        .debug          0 : { *(.debug) }
        .line           0 : { *(.line)  }
        .debug_srcinfo  0 : { *(.debug_srcinfo) }
        .debug_sfnames  0 : { *(.debug_sfnames) }
        .debug_aranges  0 : { *(.debug_aranges) }
        .debug_pubnames 0 : { *(.debug_pubnames) }
        .debug_info     0 : { *(.debug_info) }
        .debug_abbrev   0 : { *(.debug_abbrev) }
        .debug_line     0 : { *(.debug_line) }
        .debug_frame    0 : { *(.debug_frame) }
        .debug_str      0 : { *(.debug_str) }
        .debug_loc      0 : { *(.debug_loc) }
        .debug_macinfo  0 : { *(.debug_macinfo) }
        .debug_weaknames    0 : { *(.debug_weaknames) }
        .debug_funcnames    0 : { *(.debug_funcnames) }
        .debug_typenames    0 : { *(.debug_typenames) }
        .debug_varnames     0 : { *(.debug_varnames) }
        .debug_pubtypes     0 : { *(.debug_pubtypes) }
        .debug_ranges       0 : { *(.debug_ranges) }

    }

    /* function aliases */
    xdc_runtime_System_asprintf_va__E = xdc_runtime_System_asprintf_va__F;
    xdc_runtime_System_snprintf_va__E = xdc_runtime_System_snprintf_va__F;
    xdc_runtime_System_printf_va__E = xdc_runtime_System_printf_va__F;
    xdc_runtime_System_aprintf_va__E = xdc_runtime_System_aprintf_va__F;
    xdc_runtime_System_sprintf_va__E = xdc_runtime_System_sprintf_va__F;

  • And here is the linker file for the execute in place, which is the file that fails to link complaining about the error

    (.ARM.exidx+0x0): relocation truncated to fit: R_ARM_PREL31 against `.text'

    /*
     * This file was generated by linkcmd_bm_v7a.xdt from the gnu.target.arm  package.
     */

    ENTRY(_c_int00)

    __TI_STACK_SIZE = 0x1000;
    __STACK_SIZE = __TI_STACK_SIZE;

    __HEAP_SIZE = 0x0;

    INPUT(
        "C:\wrk\BAE-BL\rtos_template_app_am335x_a8\Debug\configPkg\package\cfg\main_pa8fg.oa8fg"
        "C:\Tools\ti\pdk_am335x_1_0_16\packages\ti\drv\spi\lib\am335x\a8\release\ti.drv.spi.aa8fg"
        "C:\Tools\ti\pdk_am335x_1_0_16\packages\ti\drv\uart\lib\am335x\a8\release\ti.drv.uart.aa8fg"
        "C:\Tools\ti\pdk_am335x_1_0_16\packages\ti\drv\i2c\lib\am335x\a8\release\ti.drv.i2c.aa8fg"
        "C:\Tools\ti\pdk_am335x_1_0_16\packages\ti\osal\lib\tirtos\a8\release\ti.osal.aa8fg"
        "C:\wrk\BAE-BL\rtos_template_app_am335x_a8\src\sysbios\sysbios.aa8fg"
        "C:\Tools\ti\pdk_am335x_1_0_16\packages\ti\csl\lib\am335x\a8\release\ti.csl.aa8fg"
        "C:\Tools\ti\bios_6_76_02_02\packages\gnu\targets\arm\rtsv7A\lib\gnu.targets.arm.rtsv7A.aa8fg"
        "C:\Tools\ti\bios_6_76_02_02\packages\gnu\targets\arm\rtsv7A\lib\boot.aa8fg"
        "C:\Tools\ti\bios_6_76_02_02\packages\gnu\targets\arm\rtsv7A\lib\syscalls.aa8fg"
    )

    MEMORY
    {
        SRAM_LO (RWX) : org = 0x402f0000, len = 0x400
        SRAM_HI (RWX) : org = 0x402f0400, len = 0xfc00
        OCMC_SRAM (RWX) : org = 0x40300000, len = 0x10000
        DDR (RWX) : org = 0x80000000, len = 0x10000000
        NOR_FLASH (RX) : org = 0x8010010, len = 0x1ffff0
    }

    /*
     * In order to put the .bass, .text, .data, .heap or .stack into a
     * different memory section, change the corresponding REGION_ALIAS.
     */
    REGION_ALIAS("REGION_BSS", DDR);
    REGION_ALIAS("REGION_TEXT", NOR_FLASH);
    REGION_ALIAS("REGION_DATA", DDR);
    REGION_ALIAS("REGION_STACK", DDR);
    REGION_ALIAS("REGION_HEAP", DDR);
    REGION_ALIAS("REGION_ARM_EXTAB", DDR);
    REGION_ALIAS("REGION_ARM_EXIDX", DDR);

    /*
     * symbolic aliases for static instance objects
     */
    xdc_runtime_Startup__EXECFXN__C = 1;
    xdc_runtime_Startup__RESETFXN__C = 1;
    xdc_rov_runtime_Mon__checksum = 1;
    xdc_rov_runtime_Mon__write = 1;

    /*
     * Linker command file contributions from all loaded packages:
     */

    /* Content from ti.sysbios.family.arm (ti/sysbios/family/arm/linkcmd.xdt): */

    /* Content from ti.sysbios.family.arm.a8.intcps (ti/sysbios/family/arm/a8/intcps/linkcmd.xdt): */
    ti_sysbios_family_arm_a8_intcps_Hwi_intc = 0x48200000;


    SECTIONS {

            .vecs : {*(.vecs)}  AT> NOR_FLASH
        ti.sysbios.family.arm.a8.mmuTableSection (NOLOAD) : {*(ti.sysbios.family.arm.a8.mmuTableSection)}  AT> DDR
        xdc.meta (COPY) : {KEEP(*(xdc.meta))}  AT> NOR_FLASH


        .c_int00 : {
            KEEP (*(.c_int00))
        } > REGION_TEXT

        .text : {
            CREATE_OBJECT_SYMBOLS
            KEEP (*(.resetVecs))
            KEEP (*(.text))
            *(.text.*)
            *(.gnu.linkonce.t*)
            *(.gnu.warning)
            *(.glue*)
            . = ALIGN(0x4);
            KEEP (*(.ctors))
            *(.gnu.linkonce.r.*)
            . = ALIGN(0x4);
            __init_array_start = .;
            KEEP(*(SORT(.init_array.*)))
            KEEP(*(.init_array))
            __init_array_end = .;
            *(.init)
            *(.fini*)
        } > REGION_TEXT

        .rodata : {
            *(.rodata)
            *(.rodata.*)
        } > REGION_TEXT

        .ARM.extab : {
            *(.ARM.extab*)
            *(.gnu.linkonce.armextab.*)
        } > REGION_ARM_EXTAB

        .ARM.exidx : {
            __exidx_start = .;
            *(.ARM.exidx*)
            *(.gnu.linkonce.armexidx.*)
            __exidx_end = .;
        } > REGION_ARM_EXIDX

        etext   = .;
        _etext  = .;
        __etext = .;

        .data : ALIGN(4) {
            __data_load__ = LOADADDR (.data);
            __data_start__ = .;
            *(.got.plt)
            *(.got)
            *(.shdata)
            KEEP (*(.data))
            KEEP (*(.data*))
            *(.gnu.linkonce.d.*)
            . = ALIGN (4);
            __data_end__ = .;
        } > REGION_DATA AT> REGION_TEXT

        /*
         * Place .heap section before .bss and .stack as the _sbrk
         * implementation in librdimon.a compares the (heap_end + incr)
         * to the current SP value to check if the heap has overlapped
         * with the stack.
         *
         * If .heap is placed between .bss and .stack in a SYS/BIOS app,
         * when the task stack (allocated in .bss) is the current stack,
         * the heap check in _sbrk will fail and trigger an error even
         * though the heap might not have actually overlapped with the
         * system stack.
         */
        .heap : ALIGN(0x100) {
            __heap_start__ = .;
            end = __heap_start__;
            _end = end;
            __end = end;
            . += __HEAP_SIZE;
            __heap_end__ = .;
            __HeapLimit = __heap_end__;
        } > REGION_HEAP

        .bss : {
            __bss_start__ = .;
            *(.shbss)
            KEEP (*(.bss))
            *(.bss.*)
            *(.gnu.linkonce.b.*)
            *(COMMON)
            . = ALIGN (4);
            __bss_end__ = .;
        } > REGION_BSS

        .stack : ALIGN(0x0008) {
            __TI_STACK_BASE = .;
            __stack = .;
            . += __TI_STACK_SIZE;
        } > REGION_STACK

        .stab           0 : { *(.stab) }
        .stabstr        0 : { *(.stabstr) }
        .stab.excl      0 : { *(.stab.excl) }
        .stab.exclstr   0 : { *(.stab.exclstr) }
        .stab.index     0 : { *(.stab.index) }
        .stab.indexstr  0 : { *(.stab.indexstr) }
        .comment        0 : { *(.comment) }

        .debug          0 : { *(.debug) }
        .line           0 : { *(.line)  }
        .debug_srcinfo  0 : { *(.debug_srcinfo) }
        .debug_sfnames  0 : { *(.debug_sfnames) }
        .debug_aranges  0 : { *(.debug_aranges) }
        .debug_pubnames 0 : { *(.debug_pubnames) }
        .debug_info     0 : { *(.debug_info) }
        .debug_abbrev   0 : { *(.debug_abbrev) }
        .debug_line     0 : { *(.debug_line) }
        .debug_frame    0 : { *(.debug_frame) }
        .debug_str      0 : { *(.debug_str) }
        .debug_loc      0 : { *(.debug_loc) }
        .debug_macinfo  0 : { *(.debug_macinfo) }
        .debug_weaknames    0 : { *(.debug_weaknames) }
        .debug_funcnames    0 : { *(.debug_funcnames) }
        .debug_typenames    0 : { *(.debug_typenames) }
        .debug_varnames     0 : { *(.debug_varnames) }
        .debug_pubtypes     0 : { *(.debug_pubtypes) }
        .debug_ranges       0 : { *(.debug_ranges) }

    }

    /* function aliases */
    xdc_runtime_System_asprintf_va__E = xdc_runtime_System_asprintf_va__F;
    xdc_runtime_System_snprintf_va__E = xdc_runtime_System_snprintf_va__F;
    xdc_runtime_System_printf_va__E = xdc_runtime_System_printf_va__F;
    xdc_runtime_System_aprintf_va__E = xdc_runtime_System_aprintf_va__F;
    xdc_runtime_System_sprintf_va__E = xdc_runtime_System_sprintf_va__F;

  • Hi Alan,

    I was able to reproduce the problem with the platform definitions you shared. I need to investigate further to see if I can determine the source of the problem.

    Regards,
    Frank

  • Alan,

    I see a similar issue described here: https://stackoverflow.com/questions/41879952/how-to-avoid-relocation-truncated-to-fit-from-arm-exidx

    It seems the compiler is generating the .ARM.exidx section, and there is some reference to this section in the code you're linking to NOR. Apparently the address offset between DDR and NOR is too large to be encoded in the ARM instruction set, so the failure occurs.

    Regards,
    Frank

  • Alan,

    I added a user-level linker command file to the CCS project which links .ARM.extab and .ARM.exidx to REGION_TEXT (alias for NOR_FLASH memory region). The code links for the icev2XIPAM335x platform with this change.

    This is the linker command file: https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/app.cmd

    I added the linker command file to the CCS project under:

    Build->GNU Linker
    Libraries
    Linker command files (-T, --script)

    Regards,
    Frank

  • Hello Frank,

    Thank you for the response. However, I'm still not quite there. I did manage to finally get it to link (with warnings) - so I'll include what I've done so perhaps you can direct me further.

    I downloaded the file and stuck it in with the other sources. This is how I have the linker configured in the build settings.

    I did a "clean" and then a build. This is the failure I'm now getting.  

    Invoking: GNU Linker
    "C:/Tools/ti/ccsv8/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/arm-none-eabi-gcc.exe" -mtune=cortex-a8 -marm -fno-exceptions -Dam3358 -DgcaAM335x -DSOC_AM335x -Og -g -gdwarf-3 -gstrict-dwarf -Wall -mfloat-abi=hard -Wl,-Map,"rtos_template_app_am335x_a8.map" -nostartfiles -static -Wl,--gc-sections -L"C:/Tools/ti/pdk_am335x_1_0_16/packages/ti/board/lib/gcaAM335x/a8/debug/" -L"C:/Tools/ti/pdk_am335x_1_0_16/packages/ti/csl/lib/am335x/a8/debug/" -L"C:/Tools/ti/bios_6_76_02_02/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/hard" -Wl,--defsym,STACKSIZE=0x1C000 -Wl,--defsym,HEAPSIZE=0x400 --specs=nano.specs -o"rtos_template_app_am335x_a8.out" "./app.o" "./main.o" -Wl,-T"../app.cmd" -Wl,-T"configPkg/linker.cmd" -Wl,--start-group -Wl,-T"C:/wrk/BAE-BL/rtos_template_app_am335x_a8/app.cmd" -l:ti.board.aa8fg -l:ti.csl.aa8fg -lgcc -lm -lrdimon -lc -Wl,--end-group
    makefile:150: recipe for target 'rtos_template_app_am335x_a8.out' failed
    c:/tools/ti/ccsv8/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe:../app.cmd:7: warning: memory region `REGION_TEXT' not declared
    c:/tools/ti/ccsv8/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe:configPkg/linker.cmd:39: error: redefinition of memory region alias `REGION_TEXT'
    collect2.exe: error: ld returned 1 exit status
    gmake[1]: *** [rtos_template_app_am335x_a8.out] Error 1
    gmake: *** [all] Error 2
    makefile:146: recipe for target 'all' failed

    I see that the file is included and it link command has the correct path to the file.

    From the file Debug/linker.cmd file

    REGION_ALIAS("REGION_BSS", DDR);
    REGION_ALIAS("REGION_TEXT", NORFLASH);
    REGION_ALIAS("REGION_DATA", DDR);
    REGION_ALIAS("REGION_STACK", DDR);
    REGION_ALIAS("REGION_HEAP", DDR);
    REGION_ALIAS("REGION_ARM_EXTAB", DDR);
    REGION_ALIAS("REGION_ARM_EXIDX", DDR);

    So I'm puzzled by the error message as we  are not redefining the REGION_TEXT section, just adding to it.

    Do I use this script instead of the one generated (linker.cmd) or in addition to the one generated? It looks like it would be in addition to , based on it's contents.

    I tried just using NORFLASH in app.cmd for the region, with success. - ie. it linked, with the the following warning message.

    c:/tools/ti/ccsv8/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe:../app.cmd:10: warning: memory region `NORFLASH' not declared
    c:/tools/ti/ccsv8/tools/compiler/gcc-arm-none-eabi-7-2017-q4-major-win32/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe:configPkg/linker.cmd:31: warning: redeclaration of memory region `NORFLASH'
    Finished building target: "rtos_template_app_am335x_a8.out"

    I examined the map and it did put main where I directed the generation.

    From .map file

     .text          0x08010540       0xa8 ./main.o

    Not sure why I'm unable to use your script unchanged? Any ideas?

    Thanks! Any further info that would help get rid of the warnings would be most helpful.

    Later,

    Alan.

    ......

    This is how the app.cmd  looks now.

    SECTIONS {
        .ARM.extab : {
            *(.ARM.extab*)
            *(.gnu.linkonce.armextab.*)
        } > NORFLASH

        .ARM.exidx : {
            __exidx_start = .;
            *(.ARM.exidx*)
            *(.gnu.linkonce.armexidx.*)
            __exidx_end = .;
        } > NORFLASH
    }

  • Hi Alan,

    I don't see any warnings or errors when I build. If app.cmd is included in your project directory, did you exclude it from the build?

    Regards,
    Frank

    Regards,
    Frank