-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
55 lines (49 loc) · 1.38 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
cmake_minimum_required(VERSION 3.13)
enable_language(ASM)
project(SIMMProgrammer)
# Create a list of all source files common to all architectures
set(SOURCES
drivers/mcp23s17.c
drivers/mcp23s17.h
drivers/parallel_flash.c
drivers/parallel_flash.h
hal/board.h
hal/gpio.h
hal/parallel_bus.h
hal/spi.h
hal/usbcdc.h
tests/simm_electrical_test.c
tests/simm_electrical_test.h
chip_id.h
main.c
led.h
programmer_protocol.h
simm_programmer.c
simm_programmer.h
util.h
)
# Get hardware-specific source files
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "avr")
include(hal/at90usb646/at90usb646_sources.cmake)
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm")
include(hal/m258ke/m258ke_sources.cmake)
else()
message(FATAL_ERROR "unrecognized architecture for build")
endif()
# The actual executable, in ELF format
add_executable(SIMMProgrammer.elf ${SOURCES} ${HWSOURCES})
# Common compiler options
target_compile_options(SIMMProgrammer.elf PRIVATE
-Wall -Os -ffunction-sections -fdata-sections
)
set_property(TARGET SIMMProgrammer.elf PROPERTY C_STANDARD 99)
# Common linker options
target_link_options(SIMMProgrammer.elf PRIVATE
-Wl,-Map,SIMMProgrammer.map -Wl,--gc-sections
)
# Get hardware-specific options
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "avr")
include(hal/at90usb646/at90usb646_options.cmake)
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm")
include(hal/m258ke/m258ke_options.cmake)
endif()