2 Replies Latest reply on Feb 21, 2019 5:23 AM by vmikhailikov_3896716

    Undefined references in DFU

    vmikhailikov_3896716

      Hi there!

       

      I found the issue in DFU package which is a bit strange for me: undefined references. Here it is the fault:

       

      ~/ModusToolbox_1.0/tools/gcc-7.2.1-1.0/bin/arm-none-eabi-gcc -mcpu=cortex-m0plus -mthumb -Os -ffunction-sections -fdata-sections -Wall  -g -T "/home/tanuki/Development/Universa/cypress_firmware/Loader_mainapp_cm0p/cy8c6xx7_cm0plus.ld" -Xlinker --gc-sections -Wl,-Map,"Loader_mainapp_cm0p.map" --specs=nano.specs -ffat-lto-objects -g --enable-objc-gc -o "Loader_mainapp_cm0p.elf" -Wl,--start-group  ./psoc6sw-1.0/components/psoc6pdl/devices/psoc6/startup/gcc/startup_psoc6_01_cm0plus.o  ./psoc6sw-1.0/components/psoc6pdl/devices/psoc6/startup/system_psoc6_cm0plus.o  ./psoc6sw-1.0/components/psoc6mw/dfu/cy_dfu.o  ./Source_cm0p/main.o  ./Loader_config/GeneratedSource/cycfg.o ./Loader_config/GeneratedSource/cycfg_clocks.o ./Loader_config/GeneratedSource/cycfg_connectivity.o ./Loader_config/GeneratedSource/cycfg_peripherals.o ./Loader_config/GeneratedSource/cycfg_pins.o ./Loader_config/GeneratedSource/cycfg_platform.o  /home/tanuki/Development/Universa/cypress_firmware/Loader_mainapp_cm0p_psoc6pdl/Release/libLoader_mainapp_cm0p_psoc6pdl.a  -Wl,--end-group

      ./psoc6sw-1.0/components/psoc6mw/dfu/cy_dfu.o: In function `Cy_DFU_GetAppMetadata':

      /home/tanuki/ModusToolbox_1.0/libraries/psoc6sw-1.0/components/psoc6mw/dfu/cy_dfu.c:497: undefined reference to `__cy_boot_metadata_addr'

      ./psoc6sw-1.0/components/psoc6mw/dfu/cy_dfu.o: In function `Cy_DFU_ValidateMetadata':

      /home/tanuki/ModusToolbox_1.0/libraries/psoc6sw-1.0/components/psoc6mw/dfu/cy_dfu.c:1359: undefined reference to `__cy_boot_metadata_length'

      ./psoc6sw-1.0/components/psoc6mw/dfu/cy_dfu.o: In function `Cy_DFU_SetAppMetadata':

      /home/tanuki/ModusToolbox_1.0/libraries/psoc6sw-1.0/components/psoc6mw/dfu/cy_dfu.c:2062: undefined reference to `__cy_boot_metadata_length'

      /home/tanuki/ModusToolbox_1.0/libraries/psoc6sw-1.0/components/psoc6mw/dfu/cy_dfu.c:2062: undefined reference to `__cy_boot_metadata_addr'

      ./Source_cm0p/main.o: In function `HandleMetadata':

      /home/tanuki/Development/Universa/cypress_firmware/Loader_mainapp_cm0p/Release/../Source_cm0p/main.c:286: undefined reference to `__cy_boot_metadata_addr'

      /home/tanuki/Development/Universa/cypress_firmware/Loader_mainapp_cm0p/Release/../Source_cm0p/main.c:286: undefined reference to `__cy_boot_metadata_length'

      ./Source_cm0p/main.o: In function `main':

      /home/tanuki/Development/Universa/cypress_firmware/Loader_mainapp_cm0p/Release/../Source_cm0p/main.c:192: undefined reference to `__cy_app_core1_start_addr'

      /home/tanuki/Development/Universa/cypress_firmware/Loader_mainapp_cm0p/Release/../Source_cm0p/main.c:192: undefined reference to `__cy_boot_signature_size'

      collect2: error: ld returned 1 exit status

       

      As you can see, there is the wrong definitions inside DFU component, so linker dies on symbols __cy_boot_metadata_addr and __cy_boot_metadata_length. Here it is the readelf output for this particular two:

       

      0000001c  00005e02 R_ARM_ABS32       00000000   __cy_boot_metadata_add

      00000020  00006f02 R_ARM_ABS32       00000000   __cy_boot_metadata_len

      000000a4  00006f02 R_ARM_ABS32       00000000   __cy_boot_metadata_len

      000000a8  00005e02 R_ARM_ABS32       00000000   __cy_boot_metadata_add

      000003c0  00005e02 R_ARM_ABS32       00000000   __cy_boot_metadata_add

      000003c4  00006f02 R_ARM_ABS32       00000000   __cy_boot_metadata_len

          94: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __cy_boot_metadata_addr

         111: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __cy_boot_metadata_length

       

      Any ideas?