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.

Compiler/TMDX570LC43HDK: Linking gcc compiled HAL and F021 library (TI Compiler)

Part Number: TMDX570LC43HDK

Tool/software: TI C/C++ Compiler

Hi,

I'm writing simple bootloader which will have FW update feature, and I need F021 library linked with my HAL code.

HAL is compiled with:

Now, I have object files (HAL obj files) which are compiled with gcc compiler in BE32 format, i.e. HL_errata.o:

I'm trying to use F021 library provided by TI and I was unable to link against those libraries, I'm not getting any errors but linker just "ignores" F021 library.

I've extracted object files from F021 library and did objdump on one of the object files, and I got:

As it appears there is no symbol table, and I disassembled object file and there is some code inside and there is symbol ".text:Fapi_initializeFlashBanks", but apparently there is no symbol table.

Does this mean that I'm unable to use GCC toolchain with F021 library or there is maybe source code that I can obtain and compile it myself or maybe there are already precompiled libraries with GCC toolchain?

Thank you for your time,

Marko

  • Marko,

    It is certainly possible to use the F021 library with other compilers. Please check that you are using the correct options for the gcc tool chain.

    Regards,

    Sunil

  • Hi Sunil,

    From my Makefile:

    CFLAGS:=-mbig-endian -Wall -Werror -mhard-float -march=armv7-r -mcpu=cortex-r4f \
    	-fomit-frame-pointer -fno-strict-aliasing -finline -nostdlib -g -c
    ASFLAGS:=-mbig-endian -mfpu=fpv4-sp-d16 -march=armv7-r -mcpu=cortex-r4f -g -c
    LDFLAGS:=-nostdlib -EB --gc-section

    These options are used for compiling and linking code. I assume that I need to tell linker how to use F021 library, but I'm not sure how to do that.

    Do you maybe know or do you know where to find correct options?

    Sincerely,

    Marko

  • Hi Marko,

    I am not an expert in using GCC. Please look into the options required to indicate to the linker that the F021 API library must be used to find the required function definitions from this library.

    Regards, Sunil

  • Hi Sunil,

    I'm using GNU linker for linking GCC compiled object files which need F021 library. Library is compiled with ARM TI Compiler. As I need to resolve this ASAP, I switched to ARM TI compiler and everything works now. But for the future reference, I'm not sure is this even possible. ARM TI uses different ABI (calling convention, register usage, stack usage, etc.). In order to link them together they must use same ABI. Right now I don't have time to investigate this further. So I'm also afraid that even if I link them together it would lead to some machine code bugs.
    GNU ld uses .symtab section to find functions, but as you can see in image above (in the first post) there is no symbols (no .symtab section in F021 objects).

    From the GNU ld:

    Sincerely,

    Marko

  • Hi Marko,

    The libraries are compiled targeting the ARM EABI standard. I see from an ARM forum post that you need to use arm-eabi-none-gcc for linking in this library.

    Regards, Sunil

  • Hi Sunil,

    I'm already using arm-none-eabi toolchain. In the box below you can find complete console output from arm-none-eabi-ld.

    arm-none-eabi-ld -nostdlib -EB --gc-section -L/home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/newlib/newlib-3.0.0/arm-none-eabi/hard/newlib -L/usr/lib/gcc/arm-none-eabi/6.3.1/ -L../F021 --start-group -lc -lm -lgcc -l:F021_API_CortexR4_BE_V3D16_NDS.lib --end-group -Tsrc/fw.ld -o build/fw.out     build/fw_main.o  build/serial.o  build/hal_serial.o  build/HL_sys_pcr.o  build/Fapi_UserDefinedFunctions.o  build/ti_fee_shutdown.o  build/ti_fee_writeSync.o  build/ti_fee_writeAsync.o  build/ti_fee_Info.o  build/HL_sys_pmm.o  build/HL_sys_main.o  build/ti_fee_invalidateblock.o  build/HL_errata.o  build/ti_fee_ini.o  build/HL_sci.o  build/HL_sys_dma.o  build/HL_esm.o  build/Device_TMS570LC43.o  build/ti_fee_format.o  build/HL_sys_vim.o  build/HL_pinmux.o  build/ti_fee_main.o  build/HL_system.o  build/HL_nmpu.o  build/HL_sys_startup.o  build/ti_fee_cfg.o  build/ti_fee_util.o  build/HL_sys_phantom.o  build/HL_notification.o  build/ti_fee_readSync.o  build/HL_epc.o  build/HL_errata_SSWF021_45.o  build/ti_fee_eraseimmediateblock.o  build/ti_fee_read.o  build/ti_fee_cancel.o  build/HL_sys_pmu.o  build/HL_sys_core.o  build/HL_sys_mpu.o  build/HL_sys_intvecs.o
    build/ti_fee_ini.o: In function `TI_Fee_Init':
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_ini.c:597: undefined reference to `Fapi_initializeFlashBanks'
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_ini.c:610: undefined reference to `Fapi_setActiveFlashBank'
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_ini.c:611: undefined reference to `Fapi_enableEepromBankSectors'
    build/HL_sci.o: In function `sciSetBaudrate':
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/HL_sci.c:209: undefined reference to `floor'
    build/ti_fee_util.o: In function `TI_FeeInternal_BlankCheck':
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_util.c:903: undefined reference to `Fapi_doBlankCheck'
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_util.c:938: undefined reference to `Fapi_doBlankCheck'
    build/ti_fee_util.o: In function `TI_FeeInternal_FindInvalidVirtualSector':
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_util.c:1039: undefined reference to `Fapi_issueAsyncCommand'
    build/ti_fee_util.o: In function `TI_FeeInternal_FindReadyForEraseVirtualSector':
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_util.c:1135: undefined reference to `Fapi_issueAsyncCommand'
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_util.c:1175: undefined reference to `Fapi_setActiveFlashBank'
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_util.c:1180: undefined reference to `Fapi_issueAsyncCommandWithAddress'
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_util.c:1191: undefined reference to `Fapi_enableEepromBankSectors'
    build/ti_fee_util.o: In function `TI_FeeInternal_FeeManager':
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_util.c:2846: undefined reference to `Fapi_setActiveFlashBank'
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_util.c:2851: undefined reference to `Fapi_issueAsyncCommandWithAddress'
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_util.c:2882: undefined reference to `Fapi_enableEepromBankSectors'
    build/ti_fee_util.o: In function `TI_Fee_ErrorRecovery':
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_util.c:3654: undefined reference to `Fapi_initializeFlashBanks'
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_util.c:3657: undefined reference to `Fapi_setActiveFlashBank'
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_util.c:3658: undefined reference to `Fapi_enableEepromBankSectors'
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_util.c:3703: undefined reference to `Fapi_issueAsyncCommandWithAddress'
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_util.c:3711: undefined reference to `Fapi_enableEepromBankSectors'
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_util.c:3731: undefined reference to `Fapi_issueAsyncCommandWithAddress'
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_util.c:3738: undefined reference to `Fapi_enableEepromBankSectors'
    build/ti_fee_util.o: In function `TI_Fee_SuspendResumeErase':
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_util.c:3833: undefined reference to `Fapi_issueAsyncCommand'
    build/ti_fee_util.o: In function `TI_FeeInternal_EnableRequiredFlashSector':
    /home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw/hal/tms570/source/ti_fee_util.c:3889: undefined reference to `Fapi_enableEepromBankSectors'
    Makefile:60: recipe for target 'build/fw.out' failed
    make[1]: *** [build/fw.out] Error 1
    make[1]: Leaving directory '/home/mgrumic/shared/MUTTERS-Bootloader/tms570LC4357ZWT/fw'
    Makefile:53: recipe for target 'fw' failed
    make: *** [fw] Error 2

    Best regards,

    Marko

  • Please include the F021_API_CortexR4_BE_L2FMC_V3D16.lib library for TMS570LC43x parts.

    Regards,

    Sunil

  • Marko,

    We are closing this thread due to inactivity - if you have any updates or questions please feel free to post a reply here, or create a new thread if this thread has locked due to timeout.

    Regards,
    Sahin