4 Replies Latest reply on Mar 3, 2016 11:45 AM by nia.fong_1534961

    Compiling with C++ code

    nia.fong_1534961

      Hi,

         

      I'm trying to add C++ files to the sample projects and am getting a linker error when compiling.  In "Tool Settings" there is:

         

      "ARM Sourcery Windows GCC C++ Compiler" (additional Compiler setting)

         

      "ARM Sourcery Windows GCC C++ Linker" (replaces "ARM Sourcery Windows GCC C Linker)

         

      I've tried to copy all the linker settings from the sample C projects, but must still be missing something.

         

      Here is the error:

         

      'Building target: AFProfileSensor.elf'
      'Invoking: ARM Sourcery Windows GCC C++ Linker'
      arm-none-eabi-gcc -T"C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/firmware/common/fx3.ld" -nostartfiles -Xlinker --gc-sections -Wl,-Map,AFProfileSensor.map -Wl,-d -Wl,--no-wchar-size-warning -Wl,--entry,CyU3PFirmwareEntry "C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/firmware/u3p_firmware/lib/fx3_release/cyu3lpp.a" "C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/firmware/u3p_firmware/lib/fx3_release/cyfxapi.a" "C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/firmware/u3p_firmware/lib/fx3_release/cyu3threadx.a" "C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/arm-none-eabi/lib/libc.a" "C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/lib/gcc/arm-none-eabi/4.5.2/libgcc.a" -mcpu=arm926ej-s -mthumb-interwork -o "AFProfileSensor.elf"  ./af_analyze.o ./cyfx_gcc_startup.o ./cyfxtx.o ./cyfxusbenumdscr.o ./cyfxusbspiregmode.o   
      ./cyfxusbspiregmode.o: In function `main':
      cyfxusbspiregmode.c:(.text.main+0xa8): undefined reference to `CyU3PDeviceConfigureIOMatrix'
      cyfxusbspiregmode.c:(.text.main+0xb4): undefined reference to `_tx_initialize_kernel_enter'
      collect2: ld returned 1 exit status
      cs-make: *** [AFProfileSensor.elf] Error 1

         

      **** Build Finished ****

         

      Here is the original good build with only C files:

         

      'Building target: UsbSpiRegMode.elf'
      'Invoking: ARM Sourcery Windows GCC C Linker'
      arm-none-eabi-gcc  ./cyfx_gcc_startup.o ./cyfxtx.o ./cyfxusbenumdscr.o ./cyfxusbspiregmode.o    -T"C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/firmware/common/fx3.ld" -nostartfiles -Xlinker --gc-sections -Wl,-Map,UsbSpiRegMode.map -Wl,-d -Wl,--no-wchar-size-warning -Wl,--entry,CyU3PFirmwareEntry "C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/firmware/u3p_firmware/lib/fx3_release/cyu3lpp.a" "C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/firmware/u3p_firmware/lib/fx3_release/cyfxapi.a" "C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/firmware/u3p_firmware/lib/fx3_release/cyu3threadx.a" "C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/arm-none-eabi/lib/libc.a" "C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/lib/gcc/arm-none-eabi/4.5.2/libgcc.a" -mcpu=arm926ej-s -mthumb-interwork -o "UsbSpiRegMode.elf"
      'Finished building target: UsbSpiRegMode.elf'
      ' '
      cs-make --no-print-directory post-build
      'Generate boot-loadable binary image'
      'C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\/util/elf2img/elf2img.exe' -i UsbSpiRegMode.elf -o UsbSpiRegMode.img
      Note: 256 bytes of interrupt vector code have been removed from the image.
            Use the "-vectorload yes" option to retain this code.

         

      ' '
      'Invoking: ARM Sourcery Windows GNU Print Size'
      arm-none-eabi-size  --format=berkeley UsbSpiRegMode.elf
         text       data        bss        dec        hex    filename
        82536        660      11588      94784      17240    UsbSpiRegMode.elf
      'Finished building: UsbSpiRegMode.siz'
      ' '

         

      **** Build Finished ****

         

       

         

      Which .a file contains CyU3PDeviceConfigureIOMatrix?

         

      Thanks for any help.