AS7 cant generate .elf file

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,

 

I started to compile a bootloader for Arduino MKRZero , but cant get the output files ( .elf, .hex )

 

I get the same behaviour on two different Win10 PCs.

 

Output window looks like this:

 

------ Rebuild All started: Project: SAMD21_mini-M0_bootloader, Configuration: Debug ARM ------
Build started.
Project "SAMD21_mini-M0_bootloader.cproj" (Clean target(s)):
Target "Clean" in file "C:\Program Files (x86)\Atmel\Studio\7.0\Vs\Compiler.targets" from project "C:\Users\snusk\Documents\Atmel Studio\7.0\SAMD21_mini-M0_bootloader\SAMD21_mini-M0_bootloader\SAMD21_mini-M0_bootloader.cproj" (entry point):
    Task "RunCompilerTask"
        Shell Utils Path C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils
        C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils\make.exe clean
        rm -rf  board_driver_i2c.o board_driver_jtag.o board_driver_led.o board_driver_pmic.o board_driver_serial.o board_driver_usb.o board_init.o Device_Startup/startup_samd21.o Device_Startup/system_samd21.o main.o sam_ba_cdc.o sam_ba_monitor.o sam_ba_serial.o sam_ba_usb.o   
        rm -rf  board_driver_i2c.d board_driver_jtag.d board_driver_led.d board_driver_pmic.d board_driver_serial.d board_driver_usb.d board_init.d Device_Startup/startup_samd21.d Device_Startup/system_samd21.d main.d sam_ba_cdc.d sam_ba_monitor.d sam_ba_serial.d sam_ba_usb.d   
        rm -rf "SAMD21_mini-M0_bootloader.elf" "SAMD21_mini-M0_bootloader.a" "SAMD21_mini-M0_bootloader.hex" "SAMD21_mini-M0_bootloader.bin" "SAMD21_mini-M0_bootloader.lss" "SAMD21_mini-M0_bootloader.eep" "SAMD21_mini-M0_bootloader.map" "SAMD21_mini-M0_bootloader.srec"
    Done executing task "RunCompilerTask".
Done building target "Clean" in project "SAMD21_mini-M0_bootloader.cproj".
Done building project "SAMD21_mini-M0_bootloader.cproj".

Build succeeded.
------ Rebuild All started: Project: SAMD21_mini-M0_bootloader, Configuration: Debug ARM ------
Build started.
Project "SAMD21_mini-M0_bootloader.cproj" (default targets):
Target "PreBuildEvent" skipped, due to false condition; ('$(PreBuildEvent)'!='') was evaluated as (''!='').
Target "CoreBuild" in file "C:\Program Files (x86)\Atmel\Studio\7.0\Vs\Compiler.targets" from project "C:\Users\snusk\Documents\Atmel Studio\7.0\SAMD21_mini-M0_bootloader\SAMD21_mini-M0_bootloader\SAMD21_mini-M0_bootloader.cproj" (target "Build" depends on it):
    Task "RunCompilerTask"
        Shell Utils Path C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils
        C:\Program Files (x86)\Atmel\Studio\7.0\shellUtils\make.exe all --jobs 4 --output-sync
        Building file: .././board_driver_jtag.c
        Invoking: ARM/GNU C Compiler : 6.3.1
        "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe"  -x c -mthumb -D__SAMD21G18A__ -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\arm\CMSIS\5.4.0\CMSIS\Core\Include" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAMD21_DFP\1.3.331\samd21a\include"  -Os -ffunction-sections -fdata-sections -mlong-calls -g3 -Wall -mcpu=cortex-m0plus -c -std=gnu99 -MD -MP -MF "board_driver_jtag.d" -MT"board_driver_jtag.d" -MT"board_driver_jtag.o"   -o "board_driver_jtag.o" ".././board_driver_jtag.c"
        Finished building: .././board_driver_jtag.c
        Building file: .././board_driver_i2c.c
        Invoking: ARM/GNU C Compiler : 6.3.1
        "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe"  -x c -mthumb -D__SAMD21G18A__ -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\arm\CMSIS\5.4.0\CMSIS\Core\Include" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAMD21_DFP\1.3.331\samd21a\include"  -Os -ffunction-sections -fdata-sections -mlong-calls -g3 -Wall -mcpu=cortex-m0plus -c -std=gnu99 -MD -MP -MF "board_driver_i2c.d" -MT"board_driver_i2c.d" -MT"board_driver_i2c.o"   -o "board_driver_i2c.o" ".././board_driver_i2c.c"
        Finished building: .././board_driver_i2c.c
        Building file: .././board_driver_led.c
        Invoking: ARM/GNU C Compiler : 6.3.1
        "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe"  -x c -mthumb -D__SAMD21G18A__ -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\arm\CMSIS\5.4.0\CMSIS\Core\Include" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAMD21_DFP\1.3.331\samd21a\include"  -Os -ffunction-sections -fdata-sections -mlong-calls -g3 -Wall -mcpu=cortex-m0plus -c -std=gnu99 -MD -MP -MF "board_driver_led.d" -MT"board_driver_led.d" -MT"board_driver_led.o"   -o "board_driver_led.o" ".././board_driver_led.c"
        Finished building: .././board_driver_led.c
        Building file: .././board_driver_pmic.c
        Invoking: ARM/GNU C Compiler : 6.3.1
        "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe"  -x c -mthumb -D__SAMD21G18A__ -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\arm\CMSIS\5.4.0\CMSIS\Core\Include" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAMD21_DFP\1.3.331\samd21a\include"  -Os -ffunction-sections -fdata-sections -mlong-calls -g3 -Wall -mcpu=cortex-m0plus -c -std=gnu99 -MD -MP -MF "board_driver_pmic.d" -MT"board_driver_pmic.d" -MT"board_driver_pmic.o"   -o "board_driver_pmic.o" ".././board_driver_pmic.c"
        Finished building: .././board_driver_pmic.c
        Building file: .././board_driver_usb.c
        Invoking: ARM/GNU C Compiler : 6.3.1
        "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe"  -x c -mthumb -D__SAMD21G18A__ -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\arm\CMSIS\5.4.0\CMSIS\Core\Include" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAMD21_DFP\1.3.331\samd21a\include"  -Os -ffunction-sections -fdata-sections -mlong-calls -g3 -Wall -mcpu=cortex-m0plus -c -std=gnu99 -MD -MP -MF "board_driver_usb.d" -MT"board_driver_usb.d" -MT"board_driver_usb.o"   -o "board_driver_usb.o" ".././board_driver_usb.c"
        Finished building: .././board_driver_usb.c
        Building file: .././board_init.c
        Invoking: ARM/GNU C Compiler : 6.3.1
        "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe"  -x c -mthumb -D__SAMD21G18A__ -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\arm\CMSIS\5.4.0\CMSIS\Core\Include" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAMD21_DFP\1.3.331\samd21a\include"  -Os -ffunction-sections -fdata-sections -mlong-calls -g3 -Wall -mcpu=cortex-m0plus -c -std=gnu99 -MD -MP -MF "board_init.d" -MT"board_init.d" -MT"board_init.o"   -o "board_init.o" ".././board_init.c"
        Finished building: .././board_init.c
        Building file: ../Device_Startup/startup_samd21.c
        Invoking: ARM/GNU C Compiler : 6.3.1
        "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe"  -x c -mthumb -D__SAMD21G18A__ -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\arm\CMSIS\5.4.0\CMSIS\Core\Include" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAMD21_DFP\1.3.331\samd21a\include"  -Os -ffunction-sections -fdata-sections -mlong-calls -g3 -Wall -mcpu=cortex-m0plus -c -std=gnu99 -MD -MP -MF "Device_Startup/startup_samd21.d" -MT"Device_Startup/startup_samd21.d" -MT"Device_Startup/startup_samd21.o"   -o "Device_Startup/startup_samd21.o" "../Device_Startup/startup_samd21.c"
        Finished building: ../Device_Startup/startup_samd21.c
        Building file: .././board_driver_serial.c
        Invoking: ARM/GNU C Compiler : 6.3.1
        "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe"  -x c -mthumb -D__SAMD21G18A__ -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\arm\CMSIS\5.4.0\CMSIS\Core\Include" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAMD21_DFP\1.3.331\samd21a\include"  -Os -ffunction-sections -fdata-sections -mlong-calls -g3 -Wall -mcpu=cortex-m0plus -c -std=gnu99 -MD -MP -MF "board_driver_serial.d" -MT"board_driver_serial.d" -MT"board_driver_serial.o"   -o "board_driver_serial.o" ".././board_driver_serial.c"
        Finished building: .././board_driver_serial.c
        Building file: ../Device_Startup/system_samd21.c
        Invoking: ARM/GNU C Compiler : 6.3.1
        "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe"  -x c -mthumb -D__SAMD21G18A__ -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\arm\CMSIS\5.4.0\CMSIS\Core\Include" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAMD21_DFP\1.3.331\samd21a\include"  -Os -ffunction-sections -fdata-sections -mlong-calls -g3 -Wall -mcpu=cortex-m0plus -c -std=gnu99 -MD -MP -MF "Device_Startup/system_samd21.d" -MT"Device_Startup/system_samd21.d" -MT"Device_Startup/system_samd21.o"   -o "Device_Startup/system_samd21.o" "../Device_Startup/system_samd21.c"
        Finished building: ../Device_Startup/system_samd21.c
        Building file: .././sam_ba_cdc.c
        Invoking: ARM/GNU C Compiler : 6.3.1
        "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe"  -x c -mthumb -D__SAMD21G18A__ -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\arm\CMSIS\5.4.0\CMSIS\Core\Include" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAMD21_DFP\1.3.331\samd21a\include"  -Os -ffunction-sections -fdata-sections -mlong-calls -g3 -Wall -mcpu=cortex-m0plus -c -std=gnu99 -MD -MP -MF "sam_ba_cdc.d" -MT"sam_ba_cdc.d" -MT"sam_ba_cdc.o"   -o "sam_ba_cdc.o" ".././sam_ba_cdc.c"
        Finished building: .././sam_ba_cdc.c
        Building file: .././main.c
        Invoking: ARM/GNU C Compiler : 6.3.1
        "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe"  -x c -mthumb -D__SAMD21G18A__ -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\arm\CMSIS\5.4.0\CMSIS\Core\Include" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAMD21_DFP\1.3.331\samd21a\include"  -Os -ffunction-sections -fdata-sections -mlong-calls -g3 -Wall -mcpu=cortex-m0plus -c -std=gnu99 -MD -MP -MF "main.d" -MT"main.d" -MT"main.o"   -o "main.o" ".././main.c"
        Finished building: .././main.c
        Building file: .././sam_ba_monitor.c
        Invoking: ARM/GNU C Compiler : 6.3.1
        "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe"  -x c -mthumb -D__SAMD21G18A__ -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\arm\CMSIS\5.4.0\CMSIS\Core\Include" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAMD21_DFP\1.3.331\samd21a\include"  -Os -ffunction-sections -fdata-sections -mlong-calls -g3 -Wall -mcpu=cortex-m0plus -c -std=gnu99 -MD -MP -MF "sam_ba_monitor.d" -MT"sam_ba_monitor.d" -MT"sam_ba_monitor.o"   -o "sam_ba_monitor.o" ".././sam_ba_monitor.c"
        Finished building: .././sam_ba_monitor.c
        Building file: .././sam_ba_serial.c
        Invoking: ARM/GNU C Compiler : 6.3.1
        "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe"  -x c -mthumb -D__SAMD21G18A__ -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\arm\CMSIS\5.4.0\CMSIS\Core\Include" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAMD21_DFP\1.3.331\samd21a\include"  -Os -ffunction-sections -fdata-sections -mlong-calls -g3 -Wall -mcpu=cortex-m0plus -c -std=gnu99 -MD -MP -MF "sam_ba_serial.d" -MT"sam_ba_serial.d" -MT"sam_ba_serial.o"   -o "sam_ba_serial.o" ".././sam_ba_serial.c"
        Finished building: .././sam_ba_serial.c
        Building file: .././sam_ba_usb.c
        Invoking: ARM/GNU C Compiler : 6.3.1
        "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe"  -x c -mthumb -D__SAMD21G18A__ -DDEBUG  -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\arm\CMSIS\5.4.0\CMSIS\Core\Include" -I"C:\Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\SAMD21_DFP\1.3.331\samd21a\include"  -Os -ffunction-sections -fdata-sections -mlong-calls -g3 -Wall -mcpu=cortex-m0plus -c -std=gnu99 -MD -MP -MF "sam_ba_usb.d" -MT"sam_ba_usb.d" -MT"sam_ba_usb.o"   -o "sam_ba_usb.o" ".././sam_ba_usb.c"
        Finished building: .././sam_ba_usb.c
        Building target: SAMD21_mini-M0_bootloader.elf
        Invoking: ARM/GNU Linker : 6.3.1
        c:/program files (x86)/atmel/studio/7.0/toolchain/arm/arm-gnu-toolchain/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld.exe:samd21g18a_flash.ld:38: syntax error
collect2.exe(0,0): error: ld returned 1 exit status
        make: *** [SAMD21_mini-M0_bootloader.elf] Error 1
        "C:\Program Files (x86)\Atmel\Studio\7.0\toolchain\arm\arm-gnu-toolchain\bin\arm-none-eabi-gcc.exe" -o SAMD21_mini-M0_bootloader.elf  board_driver_i2c.o board_driver_jtag.o board_driver_led.o board_driver_pmic.o board_driver_serial.o board_driver_usb.o board_init.o Device_Startup/startup_samd21.o Device_Startup/system_samd21.o main.o sam_ba_cdc.o sam_ba_monitor.o sam_ba_serial.o sam_ba_usb.o   -mthumb -nostartfiles -nodefaultlibs -nostdlib -Wl,-Map="SAMD21_mini-M0_bootloader.map" -Wl,--start-group -lm  -Wl,--end-group -L"..\\Device_Startup"  -Wl,--gc-sections -mcpu=cortex-m0plus -Tsamd21g18a_flash.ld  
C:\Users\snusk\Documents\Atmel Studio\7.0\SAMD21_mini-M0_bootloader\SAMD21_mini-M0_bootloader\Debug\Makefile(265,1): error: recipe for target 'SAMD21_mini-M0_bootloader.elf' failed
        The command exited with code 2.
    Done executing task "RunCompilerTask" -- FAILED.
Done building target "CoreBuild" in project "SAMD21_mini-M0_bootloader.cproj" -- FAILED.
Done building project "SAMD21_mini-M0_bootloader.cproj" -- FAILED.

Build FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

 

Might be a linker issue, any suggestions ?

 

Last Edited: Thu. Oct 22, 2020 - 09:21 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

henneberg wrote:
Arduino MKRZero

That's a SAM D21 - ARM Cortex-M0+ - not an AVR.

 

henneberg wrote:
Might be a linker issue

The error message tells you - there's a syntax error in your linker script:

Finished building: .././sam_ba_usb.c
        Building target: SAMD21_mini-M0_bootloader.elf
        Invoking: ARM/GNU Linker : 6.3.1
        c:/program files (x86)/atmel/studio/7.0/toolchain/arm/arm-gnu-toolchain/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld.exe:samd21g18a_flash.ld:38: syntax error
collect2.exe(0,0): error: ld returned 1 exit status
        make: *** [SAMD21_mini-M0_bootloader.elf] Error 1

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Thu. Oct 22, 2020 - 08:53 AM