1##
2##   ______                              _
3##  / _____)             _              | |
4## ( (____  _____ ____ _| |_ _____  ____| |__
5##  \____ \| ___ |    (_   _) ___ |/ ___)  _ \
6##  _____) ) ____| | | || |_| ____( (___| | | |
7## (______/|_____)_|_|_| \__)_____)\____)_| |_|
8## (C)2013-2017 Semtech
9##  ___ _____ _   ___ _  _____ ___  ___  ___ ___
10## / __|_   _/_\ / __| |/ / __/ _ \| _ \/ __| __|
11## \__ \ | |/ _ \ (__| ' <| _| (_) |   / (__| _|
12## |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
13## embedded.connectivity.solutions.==============
14##
15## License:  Revised BSD License, see LICENSE.TXT file included in the project
16## Authors:  Johannes Bruder (STACKFORCE), Miguel Luis (Semtech) and
17##           Marten Lootsma(TWTG) on behalf of Microchip/Atmel (c)2017
18##
19project(SAMR34)
20cmake_minimum_required(VERSION 3.6)
21enable_language(ASM)
22
23#---------------------------------------------------------------------------------------
24# Target
25#---------------------------------------------------------------------------------------
26
27list(APPEND ${PROJECT_NAME}_SOURCES
28    "${CMAKE_CURRENT_SOURCE_DIR}/board.c"
29    "${CMAKE_CURRENT_SOURCE_DIR}/delay-board.c"
30    "${CMAKE_CURRENT_SOURCE_DIR}/eeprom-board.c"
31    "${CMAKE_CURRENT_SOURCE_DIR}/gpio-board.c"
32    "${CMAKE_CURRENT_SOURCE_DIR}/rtc-board.c"
33    "${CMAKE_CURRENT_SOURCE_DIR}/spi-board.c"
34    "${CMAKE_CURRENT_SOURCE_DIR}/sx1276-board.c"
35    "${CMAKE_CURRENT_SOURCE_DIR}/uart-board.c"
36    "${CMAKE_CURRENT_SOURCE_DIR}/i2c-board.c"
37    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/utilities.c"
38    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hw_timer.c"
39    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/saml21b/gcc/gcc/startup_saml21.c"
40    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/saml21b/gcc/system_saml21.c"
41    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hal/src/hal_atomic.c"
42    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hal/src/hal_delay.c"
43    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hal/src/hal_ext_irq.c"
44    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hal/src/hal_gpio.c"
45    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hal/src/hal_init.c"
46    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hal/src/hal_io.c"
47    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hal/src/hal_sleep.c"
48    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hal/src/hal_spi_m_sync.c"
49    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hal/src/hal_usart_sync.c"
50    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hal/src/hal_i2c_m_sync.c"
51    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hal/utils/src/utils_assert.c"
52    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hal/utils/src/utils_syscalls.c"
53    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hal/utils/src/utils_event.c"
54    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hal/utils/src/utils_list.c"
55    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/core/hpl_core_m0plus_base.c"
56    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/core/hpl_init.c"
57    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/dmac/hpl_dmac.c"
58    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/eic/hpl_eic.c"
59    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/gclk/hpl_gclk.c"
60    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/mclk/hpl_mclk.c"
61    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/osc32kctrl/hpl_osc32kctrl.c"
62    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/oscctrl/hpl_oscctrl.c"
63    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/pm/hpl_pm.c"
64    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/systick/hpl_systick.c"
65    "${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/sercom/hpl_sercom.c"
66)
67
68add_library(${PROJECT_NAME} OBJECT EXCLUDE_FROM_ALL ${${PROJECT_NAME}_SOURCES})
69
70target_compile_definitions(${PROJECT_NAME} PUBLIC -D__SAML21J18B__)
71
72# Add define if debbuger support is enabled
73target_compile_definitions(${PROJECT_NAME} PUBLIC $<$<BOOL:${USE_DEBUGGER}>:USE_DEBUGGER>)
74
75# Add define if radio debug pins support is enabled
76target_compile_definitions(${PROJECT_NAME} PUBLIC $<$<BOOL:${USE_RADIO_DEBUG}>:USE_RADIO_DEBUG>)
77
78# For debug builds set the symbol DEBUG
79set(CMAKE_C_FLAGS_DEBUG -DDEBUG)
80
81target_include_directories(${PROJECT_NAME} PUBLIC
82    ${CMAKE_CURRENT_SOURCE_DIR}
83    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu
84    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21
85    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/saml21b/include
86    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/cmsis
87    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/config
88    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/Device_Startup
89    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hal/include
90    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hal/utils/include
91    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/core
92    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/dmac
93    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/eic
94    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/gclk
95    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/mclk
96    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/osc32kctrl
97    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/oscctrl
98    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/pm
99    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/port
100    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/rtc
101    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/sercom
102    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hpl/systick
103    ${CMAKE_CURRENT_SOURCE_DIR}/../mcu/saml21/hri
104    $<TARGET_PROPERTY:board,INTERFACE_INCLUDE_DIRECTORIES>
105    $<TARGET_PROPERTY:system,INTERFACE_INCLUDE_DIRECTORIES>
106    $<TARGET_PROPERTY:radio,INTERFACE_INCLUDE_DIRECTORIES>
107    $<TARGET_PROPERTY:peripherals,INTERFACE_INCLUDE_DIRECTORIES>
108)
109
110set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 11)
111