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.

TDA4VM: [TDA4VM]: Linking Issue while compiling customized code & folder structure

Part Number: TDA4VM
Other Parts Discussed in Thread: SYSBIOS

Hello,

We are working on the TDA4VM platform. We are working on the MCU Island core MCU1_0. We are creating a build procedure. The application is on TI RTOS. Compiler is "aarch64-none-elf-gcc". We are getting below mentioned linking error. Could you please suggest the libraries that we have to include in the build process to remove these linking errors?

/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: CMakeFiles/zf_adas.dir/startup/main/zf_main.c.obj: in function `main':
zf_main.c:(.text.main+0x0): multiple definition of `main'; CMakeFiles/zf_adas.dir/CMakeFiles/3.16.3/CompilerIdC/CMakeCCompilerId.c.obj:CMakeCCompilerId.c:(.text.main+0x0): first defined here
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: /home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/lib/crt0.o: in function `_cpu_init_hook':
/tmp/dgboter/bbs/rhev-vm1--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-elf/build/src/newlib-cygwin/libgloss/aarch64/crt0.S:269: undefined reference to `__stack'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: CMakeFiles/zf_adas.dir/mcal/can/static/src/mcan.c.obj: in function `MCAN_writeMsgNoCpy':
mcan.c:(.text.MCAN_writeMsgNoCpy+0x2e8): undefined reference to `CSL_armR5Dsb'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: CMakeFiles/zf_adas.dir/startup/main/zf_main.c.obj: in function `ti_sysbios_knl_Task_Params_init':
zf_main.c:(.text.ti_sysbios_knl_Task_Params_init+0x28): undefined reference to `ti_sysbios_knl_Task_Params__init__S'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: CMakeFiles/zf_adas.dir/startup/main/zf_main.c.obj: in function `main':
zf_main.c:(.text.main+0x34): undefined reference to `xdc_runtime_Error_init__E'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: zf_main.c:(.text.main+0x84): undefined reference to `ti_sysbios_knl_Task_create'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: zf_main.c:(.text.main+0x9c): undefined reference to `ti_sysbios_BIOS_exit__E'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: zf_main.c:(.text.main+0xa0): undefined reference to `ti_sysbios_BIOS_start__E'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: CMakeFiles/zf_adas.dir/util/app_r5f_Pmu.c.obj: in function `AppUtils_TimerInit':
app_r5f_Pmu.c:(.text.AppUtils_TimerInit+0x18): undefined reference to `CSL_armR5PmuCfg'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: app_r5f_Pmu.c:(.text.AppUtils_TimerInit+0x1c): undefined reference to `CSL_armR5PmuReadCntrOverflowStatus'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: app_r5f_Pmu.c:(.text.AppUtils_TimerInit+0x38): undefined reference to `CSL_armR5PmuClearCntrOverflowStatus'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: app_r5f_Pmu.c:(.text.AppUtils_TimerInit+0x44): undefined reference to `CSL_armR5PmuCfgCntr'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: app_r5f_Pmu.c:(.text.AppUtils_TimerInit+0x4c): undefined reference to `CSL_armR5PmuEnableAllCntrs'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: CMakeFiles/zf_adas.dir/util/app_r5f_Pmu.c.obj: in function `AppUtils_TimerGetCurrTick':
app_r5f_Pmu.c:(.text.AppUtils_TimerGetCurrTick+0x24): undefined reference to `CSL_armR5PmuEnableCntr'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: app_r5f_Pmu.c:(.text.AppUtils_TimerGetCurrTick+0x3c): undefined reference to `CSL_armR5PmuReadCntr'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: CMakeFiles/zf_adas.dir/util/app_utils.c.obj: in function `AppUtils_GetStackUsage':
app_utils.c:(.text.AppUtils_GetStackUsage+0xc): undefined reference to `__stack'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: app_utils.c:(.text.AppUtils_GetStackUsage+0x10): undefined reference to `__stack'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: app_utils.c:(.text.AppUtils_GetStackUsage+0x24): undefined reference to `__STACK_SIZE'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: app_utils.c:(.text.AppUtils_GetStackUsage+0x28): undefined reference to `__STACK_SIZE'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: CMakeFiles/zf_adas.dir/util/app_utils.c.obj: in function `AppUtils_CheckStackAndSectionCorruption':
app_utils.c:(.text.AppUtils_CheckStackAndSectionCorruption+0x14): undefined reference to `__STACK_SIZE'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: app_utils.c:(.text.AppUtils_CheckStackAndSectionCorruption+0x18): undefined reference to `__STACK_SIZE'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: CMakeFiles/zf_adas.dir/util/app_utils.c.obj: in function `AppUtils_Init':
app_utils.c:(.text.AppUtils_Init+0x14): undefined reference to `Board_init'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: CMakeFiles/zf_adas.dir/util/app_utils.c.obj: in function `AppUtils_SetCpuFrequency':
app_utils.c:(.text.AppUtils_SetCpuFrequency+0x1c): undefined reference to `Sciclient_pmGetModuleClkFreq'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: app_utils.c:(.text.AppUtils_SetCpuFrequency+0x34): undefined reference to `Osal_getHwAttrs'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: app_utils.c:(.text.AppUtils_SetCpuFrequency+0x88): undefined reference to `Osal_setHwAttrs'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: CMakeFiles/zf_adas.dir/util/app_utils.c.obj: in function `AppUtils_ModuleClockEnable':
app_utils.c:(.text.AppUtils_ModuleClockEnable+0x4c): undefined reference to `Sciclient_pmGetModuleState'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: app_utils.c:(.text.AppUtils_ModuleClockEnable+0x74): undefined reference to `Sciclient_pmSetModuleState'
/home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: app_utils.c:(.text.AppUtils_ModuleClockEnable+0x98): undefined reference to `Sciclient_pmSetModuleRst'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/zf_adas.dir/build.make:1554: zf_adas] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/zf_adas.dir/all] Error 2

Thanks,

Chetan

  • Hello,

    I have question related to the linker error that I am getting above. I am using aarch64-none-elf-gcc toolchain. I want to build the ti rtos and other related packages with same tool. Please help me to resolve. I am using aarch64-none-elf-gcc compiler and building it for  J721E board. I have used 

    make -s pdk_libs OS=linux BOARD=j721e_evm CORE=mcu1_0

    command to generate the build libraries. Which generated .aer5f files. How I can link these files in my project?

  • Any specific reason why you are using OS=linux? 

    Most of the PDK libraries are supported on TI RTOS or FreeRTOS, so doubtful if Linux is supported. 

    In addition, can you just download PSDKRA, run setup script and then just compile from pdk/packages/ti/build folder? 

    Regards,

    Brijesh

  • Thanks for the reply. My question is about the .aer5f library format. OS=linux is not required (Linux is my build environment). After running make -s pdk_libs BOARD=j721e_evm CORE=mcu1_0, .aer5f libraries are built. 

    When I add these library in linking I am getting error. Below pasting the error.

    error adding symbols: file in wrong format

  • Hi Chetan,

    Can you tell me the sequence of commands you are executing and what do you intend to build after the pdk_libs?

    Regards

    Karan

  • Hello Karan,

    We are building a standalone project. This project uses TI RTOS, CAN, IPC, Watchdog drivers from SDK (MCUSW). We are creating tasks and using SDK for building the project. Below is the environment that we are using 

    Compiler : gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf

    SDK : ti-processor-sdk-rtos-j721e-evm-07_03_00_07

    Core : MCU1_0 core is used from MCU Island of J721E (TDA4VM). 

    OS : TIRTOS

    We are getting linking errors such as 

    app_utils.c:(.text.AppUtils_SetCpuFrequency+0x1c): undefined reference to `Sciclient_pmGetModuleClkFreq'
    /home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: app_utils.c:(.text.AppUtils_SetCpuFrequency+0x34): undefined reference to `Osal_getHwAttrs'
    /home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: app_utils.c:(.text.AppUtils_SetCpuFrequency+0x88): undefined reference to `Osal_setHwAttrs'
    /home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: CMakeFiles/zf_adas.dir/util/app_utils.c.obj: in function `AppUtils_ModuleClockEnable':
    app_utils.c:(.text.AppUtils_ModuleClockEnable+0x4c): undefined reference to `Sciclient_pmGetModuleState'
    /home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: app_utils.c:(.text.AppUtils_ModuleClockEnable+0x74): undefined reference to `Sciclient_pmSetModuleState'
    /home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: app_utils.c:(.text.AppUtils_ModuleClockEnable+0x98): undefined reference to `Sciclient_pmSetModuleRst'

    To remove these errors, We built the PDK libraries and added these libraries in the build process. After that, We are getting below error.

    /home/chetan/ti/gcc-arm-9.2-2019.12-x86_64-aarch64-none-elf/bin/../lib/gcc/aarch64-none-elf/9.2.1/../../../../aarch64-none-elf/bin/ld: ../library/sciclient.aer5f: error adding symbols: file in wrong format
    collect2: error: ld returned 1 exit status

    Please let us know, what we are missing or what should be our strategy. 

    To build the PDK, we are using below command,

     make -s pdk_libs BOARD=j721e_evm CORE=mcu1_0

    This we are executing at 

    /ti/pdk_jacinto_07_03_00_29/packages/ti/build

    BR,

    Chetan

  • Hi Chetan,

    Can you try building the already existing MCUSW demos and see if the build dependencies are sorted?

    cd mcusw/build
    make can_profile_app BUILD_OS_TYPE=tirtos

    Regards

    Karan

  • Hello Karan,

    Yes, can_profile_app .appimage is generated.

    Do I have to use /home/chetan/ti/ti-cgt-arm_20.2.0.LTS/bin/armcl compiler to build my project?

    Could you please let me know the steps to create .appimage? I am using Cmake.

    BR,

    Chetan

  • Hi Chetan,

    Do I have to use /home/chetan/ti/ti-cgt-arm_20.2.0.LTS/bin/armcl compiler to build my project?

    This is the recommended for building MCU binaries from PDK as all the options have been configured for this compiler. 

    You can definitely use aarch64-none-elf-gcc but you'll need to tweak the build to use this.

     

    Could you please let me know the steps to create .appimage? I am using Cmake.

    Can you please elaborate the query a little?

    Regards,
    Parth