mirror of
https://github.com/dougg3/mac-rom-simm-programmer.git
synced 2024-11-21 15:32:14 +00:00
Set up CMake build
This allows building with CMake instead of Eclipse. The reasoning behind this is to make the code more easily portable to other architectures, and to move away from being dependent on Eclipse.
This commit is contained in:
parent
174bcdb370
commit
bf1031127d
50
CMakeLists.txt
Normal file
50
CMakeLists.txt
Normal file
@ -0,0 +1,50 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
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)
|
||||
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)
|
||||
endif()
|
29
hal/at90usb646/at90usb646_options.cmake
Normal file
29
hal/at90usb646/at90usb646_options.cmake
Normal file
@ -0,0 +1,29 @@
|
||||
# AVR-specific include paths
|
||||
target_include_directories(SIMMProgrammer.elf PRIVATE
|
||||
hal/at90usb646
|
||||
)
|
||||
|
||||
# AVR-specific compiler definitions
|
||||
target_compile_definitions(SIMMProgrammer.elf PRIVATE
|
||||
F_CPU=16000000UL
|
||||
F_USB=16000000UL
|
||||
USE_LUFA_CONFIG_HEADER
|
||||
)
|
||||
|
||||
# AVR-specific compiler options
|
||||
target_compile_options(SIMMProgrammer.elf PRIVATE
|
||||
-fpack-struct -fshort-enums -funsigned-char -funsigned-bitfields -mmcu=at90usb646
|
||||
)
|
||||
|
||||
# AVR-specific linker options
|
||||
target_link_options(SIMMProgrammer.elf PRIVATE
|
||||
-mmcu=at90usb646
|
||||
)
|
||||
|
||||
# AVR-specific command/target to generate .bin file from the ELF file. This program
|
||||
# is flashed using a bootloader, so there's no need to generate a HEX file.
|
||||
add_custom_command(OUTPUT SIMMProgrammer.bin
|
||||
COMMAND ${CMAKE_OBJCOPY} -R .eeprom -O binary SIMMProgrammer.elf SIMMProgrammer.bin
|
||||
DEPENDS SIMMProgrammer.elf
|
||||
)
|
||||
add_custom_target(SIMMProgrammer_bin ALL DEPENDS SIMMProgrammer.bin)
|
70
hal/at90usb646/at90usb646_sources.cmake
Normal file
70
hal/at90usb646/at90usb646_sources.cmake
Normal file
@ -0,0 +1,70 @@
|
||||
set(HWSOURCES
|
||||
hal/at90usb646/LUFA/Common/Architectures.h
|
||||
hal/at90usb646/LUFA/Common/ArchitectureSpecific.h
|
||||
hal/at90usb646/LUFA/Common/Attributes.h
|
||||
hal/at90usb646/LUFA/Common/BoardTypes.h
|
||||
hal/at90usb646/LUFA/Common/Common.h
|
||||
hal/at90usb646/LUFA/Common/CompilerSpecific.h
|
||||
hal/at90usb646/LUFA/Common/Endianness.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c
|
||||
hal/at90usb646/LUFA/Drivers/USB/Class/CDCClass.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Class/Common/CDCClassCommon.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.c
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.c
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/AVR8/EndpointStream_AVR8.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.c
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/AVR8/Host_AVR8.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/AVR8/OTG_AVR8.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.c
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/AVR8/Pipe_AVR8.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.c
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/AVR8/PipeStream_AVR8.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.c
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/AVR8/USBInterrupt_AVR8.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/ConfigDescriptor.c
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/ConfigDescriptor.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/DeviceStandardReq.c
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/DeviceStandardReq.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/Device.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/Endpoint.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/EndpointStream.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/Events.c
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/Events.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/Host.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/HostStandardReq.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/OTG.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/Pipe.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/PipeStream.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/StdDescriptors.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/StdRequestType.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/USBController.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/USBInterrupt.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/USBMode.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/USBTask.c
|
||||
hal/at90usb646/LUFA/Drivers/USB/Core/USBTask.h
|
||||
hal/at90usb646/LUFA/Drivers/USB/USB.h
|
||||
hal/at90usb646/LUFA/Version.h
|
||||
hal/at90usb646/LUFAConfig.h
|
||||
|
||||
hal/at90usb646/board.c
|
||||
hal/at90usb646/board_hw.h
|
||||
hal/at90usb646/cdc_device_definition.c
|
||||
hal/at90usb646/cdc_device_definition.h
|
||||
hal/at90usb646/Descriptors.c
|
||||
hal/at90usb646/Descriptors.h
|
||||
hal/at90usb646/gpio.c
|
||||
hal/at90usb646/gpio_hw.h
|
||||
hal/at90usb646/hardware.h
|
||||
hal/at90usb646/LUFAConfig.h
|
||||
hal/at90usb646/parallel_bus.c
|
||||
hal/at90usb646/spi.c
|
||||
hal/at90usb646/spi_private.h
|
||||
hal/at90usb646/usbcdc.c
|
||||
hal/at90usb646/usbcdc_hw.h
|
||||
)
|
Loading…
Reference in New Issue
Block a user