Commit d03ecc26 authored by Erik Strand's avatar Erik Strand
Browse files

Build with cmake!

The key is to use an object library instead of a static library. The
linker was throwing out the startup code because it's never called.
parent 9812d32e
......@@ -5,17 +5,27 @@ set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_CROSSCOMPILING 1)
set(CMAKE_C_COMPILER "arm-none-eabi-gcc")
#set(CMAKE_C_LINKER "arm-none-eabi-gcc")
set(CMAKE_CXX_COMPILER "arm-none-eabi-g++")
set(CMAKE_AR "arm-none-eabi-ar")
set(CMAKE_RANLIB "arm-none-eabi-ranlib")
set(CMAKE_C_FLAGS "")
set(CMAKE_C_LINK_FLAGS "")
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(MCU_DEFINE "__SAMD51J19A__")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_BUILD_TYPE "Release")
endif()
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
add_library(asf
add_library(asf OBJECT
samd51/startup/startup_samd51.c
samd51/startup/system_samd51.c
)
......@@ -29,7 +39,7 @@ target_link_libraries(asf m)
target_link_options(asf PUBLIC
-mthumb
-mabi=aapcs-linux
#-mlong-calls
-mlong-calls
-mcpu=cortex-m4
-mfpu=fpv4-sp-d16
-mfloat-abi=softfp
......@@ -53,7 +63,7 @@ target_compile_options(asf PUBLIC
-std=gnu99
-mthumb # use T32 instruction set instead of A32 (don't know if this matters)
-mabi=aapcs-linux
#-mlong-calls # changes how functions are called
-mlong-calls # changes how functions are called
-mcpu=cortex-m4
-mfpu=fpv4-sp-d16
-mfloat-abi=softfp # this flag specifies whether to use software or hardware float operations
......
# Atmel-ICE JTAG/SWD in-circuit debugger.
interface cmsis-dap
transport select swd
# Chip info
set CHIPNAME at91samd51j18
source [find target/atsame5x.cfg]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment