mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-04 23:45:26 +00:00
Add CMake firmware build system.
This commit is contained in:
parent
500a651bcf
commit
cf5ac441ae
76
firmware/CMakeLists.txt
Normal file
76
firmware/CMakeLists.txt
Normal file
@ -0,0 +1,76 @@
|
||||
# Copyright 2016 Jared Boone <jared@sharebrained.com>
|
||||
#
|
||||
# This file is part of PortaPack.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.9)
|
||||
set(CMAKE_TOOLCHAIN_FILE ../toolchain-arm-cortex-m.cmake)
|
||||
|
||||
project(portapack-h1-firmware)
|
||||
|
||||
execute_process(
|
||||
COMMAND git log -n 1 --format=%h
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
RESULT_VARIABLE GIT_REVISION_FOUND
|
||||
ERROR_QUIET
|
||||
OUTPUT_VARIABLE GIT_REVISION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if (GIT_REVISION_FOUND)
|
||||
set(VERSION "unknown")
|
||||
else (GIT_REVISION_FOUND)
|
||||
set(VERSION ${GIT_REVISION})
|
||||
endif (GIT_REVISION_FOUND)
|
||||
|
||||
set(COMMON ${PROJECT_SOURCE_DIR}/common)
|
||||
set(CHIBIOS ${PROJECT_SOURCE_DIR}/chibios)
|
||||
set(CHIBIOS_PORTAPACK ${PROJECT_SOURCE_DIR}/chibios-portapack)
|
||||
|
||||
set(HACKRF_FIRMWARE_FILENAME hackrf_one_usb_ram.dfu)
|
||||
set(HACKRF_FIRMWARE_IMAGE ${PROJECT_SOURCE_DIR}/${HACKRF_FIRMWARE_FILENAME})
|
||||
set(MAKE_SPI_IMAGE ${PROJECT_SOURCE_DIR}/tools/make_spi_image.py)
|
||||
set(LICENSE_PATH ${PROJECT_SOURCE_DIR}/../LICENSE)
|
||||
|
||||
add_subdirectory(application)
|
||||
add_subdirectory(baseband)
|
||||
add_subdirectory(bootstrap)
|
||||
|
||||
add_custom_target(
|
||||
${PROJECT_NAME}.bin
|
||||
COMMAND ${MAKE_SPI_IMAGE} ${bootstrap_BINARY_DIR}/bootstrap.bin ${HACKRF_FIRMWARE_IMAGE} ${baseband_BINARY_DIR}/baseband.img ${application_BINARY_DIR}/application.bin ${PROJECT_NAME}.bin
|
||||
DEPENDS bootstrap.bin baseband.img application.bin
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
program
|
||||
COMMAND dfu-util --device 1fc9:000c --download ${HACKRF_FIRMWARE_IMAGE} --reset
|
||||
COMMAND sleep 1s
|
||||
COMMAND hackrf_spiflash -w ${PROJECT_NAME}.bin
|
||||
DEPENDS ${PROJECT_NAME}.bin
|
||||
)
|
||||
|
||||
# TODO: Bad hack to fix location of LICENSE file for tar.
|
||||
add_custom_target(
|
||||
release
|
||||
COMMAND cp ${LICENSE_PATH} LICENSE
|
||||
COMMAND cp ${HACKRF_FIRMWARE_IMAGE} ${HACKRF_FIRMWARE_FILENAME}
|
||||
COMMAND tar -c -j -f ${PROJECT_NAME}-${GIT_REVISION}.tar.bz2 ${PROJECT_NAME}.bin ${HACKRF_FIRMWARE_FILENAME} LICENSE
|
||||
COMMAND zip -9 -q ${PROJECT_NAME}-${GIT_REVISION}.zip ${PROJECT_NAME}.bin ${HACKRF_FIRMWARE_FILENAME} LICENSE
|
||||
COMMAND rm -f LICENSE ${HACKRF_FIRMWARE_FILENAME}
|
||||
DEPENDS ${PROJECT_NAME}.bin
|
||||
)
|
307
firmware/application/CMakeLists.txt
Normal file
307
firmware/application/CMakeLists.txt
Normal file
@ -0,0 +1,307 @@
|
||||
#
|
||||
# Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
||||
#
|
||||
# This file is part of PortaPack.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
# Build global options
|
||||
# NOTE: Can be overridden externally.
|
||||
#
|
||||
|
||||
enable_language(C CXX ASM)
|
||||
|
||||
project(application)
|
||||
|
||||
# Compiler options here.
|
||||
set(USE_OPT "-Os --specs=nano.specs")
|
||||
|
||||
# C specific options here (added to USE_OPT).
|
||||
set(USE_COPT "-std=gnu99")
|
||||
|
||||
# C++ specific options here (added to USE_OPT).
|
||||
set(USE_CPPOPT "-std=c++11 -fno-rtti -fno-exceptions")
|
||||
|
||||
# Enable this if you want the linker to remove unused code and data
|
||||
set(USE_LINK_GC yes)
|
||||
|
||||
# Linker extra options here.
|
||||
set(USE_LDOPT)
|
||||
|
||||
# Enable this if you want link time optimizations (LTO)
|
||||
set(USE_LTO no)
|
||||
|
||||
# If enabled, this option allows to compile the application in THUMB mode.
|
||||
set(USE_THUMB yes)
|
||||
|
||||
# Enable this if you want to see the full log while compiling.
|
||||
set(USE_VERBOSE_COMPILE no)
|
||||
|
||||
#
|
||||
# Build global options
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# Architecture or project specific options
|
||||
#
|
||||
|
||||
# Enables the use of FPU on Cortex-M4 (no, softfp, hard).
|
||||
set(USE_FPU no)
|
||||
|
||||
#
|
||||
# Architecture or project specific options
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# Project, sources and paths
|
||||
#
|
||||
|
||||
# Imported source files and paths
|
||||
include(${CHIBIOS_PORTAPACK}/boards/GSG_HACKRF_ONE/board.cmake)
|
||||
include(${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx_M0/platform.cmake)
|
||||
include(${CHIBIOS}/os/hal/hal.cmake)
|
||||
include(${CHIBIOS_PORTAPACK}/os/ports/GCC/ARMCMx/LPC43xx_M0/port.cmake)
|
||||
include(${CHIBIOS}/os/kernel/kernel.cmake)
|
||||
include(${CHIBIOS_PORTAPACK}/os/various/fatfs_bindings/fatfs.cmake)
|
||||
include(${CHIBIOS}/test/test.cmake)
|
||||
|
||||
# Define linker script file here
|
||||
set(LDSCRIPT ${PORTLD}/LPC43xx_M0.ld)
|
||||
|
||||
# C sources that can be compiled in ARM or THUMB mode depending on the global
|
||||
# setting.
|
||||
set(CSRC
|
||||
${PORTSRC}
|
||||
${KERNSRC}
|
||||
${TESTSRC}
|
||||
${HALSRC}
|
||||
${PLATFORMSRC}
|
||||
${BOARDSRC}
|
||||
${FATFSSRC}
|
||||
)
|
||||
|
||||
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
|
||||
# setting.
|
||||
set(CPPSRC
|
||||
main.cpp
|
||||
irq_lcd_frame.cpp
|
||||
irq_controls.cpp
|
||||
irq_rtc.cpp
|
||||
${COMMON}/event.cpp
|
||||
event_m0.cpp
|
||||
${COMMON}/message_queue.cpp
|
||||
${COMMON}/hackrf_hal.cpp
|
||||
portapack.cpp
|
||||
${COMMON}/portapack_shared_memory.cpp
|
||||
baseband_api.cpp
|
||||
${COMMON}/portapack_persistent_memory.cpp
|
||||
${COMMON}/portapack_io.cpp
|
||||
${COMMON}/i2c_pp.cpp
|
||||
spi_pp.cpp
|
||||
clock_manager.cpp
|
||||
si5351.cpp
|
||||
${COMMON}/wm8731.cpp
|
||||
radio.cpp
|
||||
baseband_cpld.cpp
|
||||
tuning.cpp
|
||||
rf_path.cpp
|
||||
rffc507x.cpp
|
||||
rffc507x_spi.cpp
|
||||
max2837.cpp
|
||||
max5864.cpp
|
||||
debounce.cpp
|
||||
touch.cpp
|
||||
touch_adc.cpp
|
||||
encoder.cpp
|
||||
audio.cpp
|
||||
${COMMON}/lcd_ili9341.cpp
|
||||
${COMMON}/ui.cpp
|
||||
${COMMON}/ui_text.cpp
|
||||
${COMMON}/ui_widget.cpp
|
||||
${COMMON}/ui_painter.cpp
|
||||
${COMMON}/ui_focus.cpp
|
||||
ui_navigation.cpp
|
||||
ui_menu.cpp
|
||||
ui_rssi.cpp
|
||||
ui_channel.cpp
|
||||
ui_audio.cpp
|
||||
ui_font_fixed_8x16.cpp
|
||||
ui_setup.cpp
|
||||
ui_debug.cpp
|
||||
ui_baseband_stats_view.cpp
|
||||
ui_sd_card_status_view.cpp
|
||||
ui_sd_card_debug.cpp
|
||||
ui_console.cpp
|
||||
ui_receiver.cpp
|
||||
ui_record_view.cpp
|
||||
ui_spectrum.cpp
|
||||
recent_entries.cpp
|
||||
receiver_model.cpp
|
||||
spectrum_color_lut.cpp
|
||||
analog_audio_app.cpp
|
||||
${COMMON}/ais_baseband.cpp
|
||||
${COMMON}/ais_packet.cpp
|
||||
ais_app.cpp
|
||||
tpms_app.cpp
|
||||
${COMMON}/tpms_packet.cpp
|
||||
ert_app.cpp
|
||||
${COMMON}/ert_packet.cpp
|
||||
capture_app.cpp
|
||||
sd_card.cpp
|
||||
time.cpp
|
||||
file.cpp
|
||||
log_file.cpp
|
||||
${COMMON}/png_writer.cpp
|
||||
capture_thread.cpp
|
||||
${COMMON}/manchester.cpp
|
||||
string_format.cpp
|
||||
temperature_logger.cpp
|
||||
${COMMON}/utility.cpp
|
||||
${COMMON}/chibios_cpp.cpp
|
||||
${COMMON}/debug.cpp
|
||||
${COMMON}/gcc.cpp
|
||||
${COMMON}/lfsr_random.cpp
|
||||
core_control.cpp
|
||||
${COMMON}/cpld_max5.cpp
|
||||
${COMMON}/jtag.cpp
|
||||
cpld_update.cpp
|
||||
${COMMON}/portapack_cpld_data.cpp
|
||||
)
|
||||
|
||||
# C sources to be compiled in ARM mode regardless of the global setting.
|
||||
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
|
||||
# option that results in lower performance and larger code size.
|
||||
set(ACSRC)
|
||||
|
||||
# C++ sources to be compiled in ARM mode regardless of the global setting.
|
||||
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
|
||||
# option that results in lower performance and larger code size.
|
||||
set(ACPPSRC)
|
||||
|
||||
# C sources to be compiled in THUMB mode regardless of the global setting.
|
||||
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
|
||||
# option that results in lower performance and larger code size.
|
||||
set(TCSRC)
|
||||
|
||||
# C sources to be compiled in THUMB mode regardless of the global setting.
|
||||
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
|
||||
# option that results in lower performance and larger code size.
|
||||
set(TCPPSRC)
|
||||
|
||||
# List ASM source files here
|
||||
set(ASMSRC ${PORTASM})
|
||||
|
||||
set(INCDIR ${COMMON} ${PORTINC} ${KERNINC} ${TESTINC}
|
||||
${HALINC} ${PLATFORMINC} ${BOARDINC}
|
||||
${FATFSINC}
|
||||
${CHIBIOS}/os/various
|
||||
)
|
||||
|
||||
#
|
||||
# Project, sources and paths
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# Compiler settings
|
||||
#
|
||||
|
||||
# TODO: Entertain using MCU=cortex-m0.small-multiply for LPC43xx M0 core.
|
||||
# However, on GCC-ARM-Embedded 4.9 2015q2, it seems to produce non-functional
|
||||
# binaries.
|
||||
set(MCU cortex-m0)
|
||||
|
||||
# ARM-specific options here
|
||||
set(AOPT)
|
||||
|
||||
# THUMB-specific options here
|
||||
set(TOPT "-mthumb -DTHUMB")
|
||||
|
||||
# Define C warning options here
|
||||
set(CWARN "-Wall -Wextra -Wstrict-prototypes")
|
||||
|
||||
# Define C++ warning options here
|
||||
set(CPPWARN "-Wall -Wextra")
|
||||
|
||||
#
|
||||
# Compiler settings
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# Start of default section
|
||||
#
|
||||
|
||||
# List all default C defines here, like -D_DEBUG=1
|
||||
# TODO: Switch -DCRT0_INIT_DATA depending on load from RAM or SPIFI?
|
||||
# NOTE: _RANDOM_TCC to kill a GCC 4.9.3 error with std::max argument types
|
||||
set(DDEFS -DLPC43XX -DLPC43XX_M0 -D__NEWLIB__ -DHACKRF_ONE -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D_RANDOM_TCC=0 -DGIT_REVISION=\"${GIT_REVISION}\")
|
||||
|
||||
# List all default ASM defines here, like -D_DEBUG=1
|
||||
set(DADEFS)
|
||||
|
||||
# List all default directories to look for include files here
|
||||
set(DINCDIR)
|
||||
|
||||
# List the default directory to look for the libraries here
|
||||
set(DLIBDIR)
|
||||
|
||||
# List all default libraries here
|
||||
set(DLIBS)
|
||||
|
||||
#
|
||||
# End of default section
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# Start of user section
|
||||
#
|
||||
|
||||
# List all user C define here, like -D_DEBUG=1
|
||||
set(UDEFS)
|
||||
|
||||
# Define ASM defines here
|
||||
set(UADEFS)
|
||||
|
||||
# List all user directories here
|
||||
set(UINCDIR)
|
||||
|
||||
# List the user directory to look for the libraries here
|
||||
set(ULIBDIR)
|
||||
|
||||
# List all user libraries here
|
||||
set(ULIBS)
|
||||
|
||||
#
|
||||
# End of user defines
|
||||
##############################################################################
|
||||
|
||||
set(RULESPATH ${CHIBIOS}/os/ports/GCC/ARMCMx)
|
||||
include(${RULESPATH}/rules.cmake)
|
||||
|
||||
##############################################################################
|
||||
|
||||
add_executable(${PROJECT_NAME}.elf ${CSRC} ${CPPSRC} ${ASMSRC} ${LDSCRIPT})
|
||||
add_definitions(${DEFS})
|
||||
include_directories(. ${INCDIR})
|
||||
link_directories(${LLIBDIR})
|
||||
target_link_libraries(${PROJECT_NAME}.elf ${LIBS})
|
||||
|
||||
add_custom_target(
|
||||
${PROJECT_NAME}.bin
|
||||
COMMAND ${CMAKE_OBJCOPY} -O binary ${PROJECT_NAME}.elf ${PROJECT_NAME}.bin
|
||||
DEPENDS ${PROJECT_NAME}.elf
|
||||
)
|
339
firmware/baseband/CMakeLists.txt
Normal file
339
firmware/baseband/CMakeLists.txt
Normal file
@ -0,0 +1,339 @@
|
||||
#
|
||||
# Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
||||
#
|
||||
# This file is part of PortaPack.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
# Build global options
|
||||
# NOTE: Can be overridden externally.
|
||||
#
|
||||
|
||||
enable_language(C CXX ASM)
|
||||
|
||||
project(baseband)
|
||||
|
||||
# Compiler options here.
|
||||
set(USE_OPT "-O3 -falign-functions=16 -fno-math-errno --specs=nano.specs")
|
||||
|
||||
# C specific options here (added to USE_OPT).
|
||||
set(USE_COPT "-std=gnu99")
|
||||
|
||||
# C++ specific options here (added to USE_OPT).
|
||||
set(USE_CPPOPT "-std=c++11 -fno-rtti -fno-exceptions")
|
||||
|
||||
# Enable this if you want the linker to remove unused code and data
|
||||
set(USE_LINK_GC yes)
|
||||
|
||||
# Linker extra options here.
|
||||
set(USE_LDOPT)
|
||||
|
||||
# Enable this if you want link time optimizations (LTO)
|
||||
set(USE_LTO no)
|
||||
|
||||
# If enabled, this option allows to compile the application in THUMB mode.
|
||||
set(USE_THUMB yes)
|
||||
|
||||
# Enable this if you want to see the full log while compiling.
|
||||
set(USE_VERBOSE_COMPILE no)
|
||||
|
||||
#
|
||||
# Build global options
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# Architecture or project specific options
|
||||
#
|
||||
|
||||
# Enables the use of FPU on Cortex-M4 (no, softfp, hard).
|
||||
set(USE_FPU hard)
|
||||
|
||||
#
|
||||
# Architecture or project specific options
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# Project, sources and paths
|
||||
#
|
||||
|
||||
# Imported source files and paths
|
||||
include(${CHIBIOS_PORTAPACK}/boards/GSG_HACKRF_ONE/board.cmake)
|
||||
include(${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx_M4/platform.cmake)
|
||||
include(${CHIBIOS}/os/hal/hal.cmake)
|
||||
include(${CHIBIOS_PORTAPACK}/os/ports/GCC/ARMCMx/LPC43xx_M4/port.cmake)
|
||||
include(${CHIBIOS}/os/kernel/kernel.cmake)
|
||||
|
||||
include(${CHIBIOS}/test/test.cmake)
|
||||
|
||||
# Define linker script file here
|
||||
set(LDSCRIPT ${PORTLD}/LPC43xx_M4.ld)
|
||||
|
||||
# C sources that can be compiled in ARM or THUMB mode depending on the global
|
||||
# setting.
|
||||
set(CSRC
|
||||
${PORTSRC}
|
||||
${KERNSRC}
|
||||
${TESTSRC}
|
||||
${HALSRC}
|
||||
${PLATFORMSRC}
|
||||
${BOARDSRC}
|
||||
)
|
||||
|
||||
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
|
||||
# setting.
|
||||
set(CPPSRC
|
||||
main.cpp
|
||||
${COMMON}/message_queue.cpp
|
||||
${COMMON}/event.cpp
|
||||
event_m4.cpp
|
||||
${COMMON}/thread_wait.cpp
|
||||
${COMMON}/gpdma.cpp
|
||||
baseband_dma.cpp
|
||||
${COMMON}/baseband_sgpio.cpp
|
||||
${COMMON}/portapack_shared_memory.cpp
|
||||
baseband_thread.cpp
|
||||
baseband_processor.cpp
|
||||
baseband_stats_collector.cpp
|
||||
dsp_decimate.cpp
|
||||
dsp_demodulate.cpp
|
||||
matched_filter.cpp
|
||||
spectrum_collector.cpp
|
||||
stream_input.cpp
|
||||
dsp_squelch.cpp
|
||||
clock_recovery.cpp
|
||||
packet_builder.cpp
|
||||
${COMMON}/dsp_fft.cpp
|
||||
${COMMON}/dsp_fir_taps.cpp
|
||||
${COMMON}/dsp_iir.cpp
|
||||
fxpt_atan2.cpp
|
||||
rssi.cpp
|
||||
rssi_dma.cpp
|
||||
rssi_thread.cpp
|
||||
audio_compressor.cpp
|
||||
audio_output.cpp
|
||||
audio_dma.cpp
|
||||
audio_stats_collector.cpp
|
||||
touch_dma.cpp
|
||||
${COMMON}/utility.cpp
|
||||
${COMMON}/chibios_cpp.cpp
|
||||
${COMMON}/debug.cpp
|
||||
${COMMON}/gcc.cpp
|
||||
)
|
||||
|
||||
# C sources to be compiled in ARM mode regardless of the global setting.
|
||||
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
|
||||
# option that results in lower performance and larger code size.
|
||||
set(ACSRC)
|
||||
|
||||
# C++ sources to be compiled in ARM mode regardless of the global setting.
|
||||
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
|
||||
# option that results in lower performance and larger code size.
|
||||
set(ACPPSRC)
|
||||
|
||||
# C sources to be compiled in THUMB mode regardless of the global setting.
|
||||
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
|
||||
# option that results in lower performance and larger code size.
|
||||
set(TCSRC)
|
||||
|
||||
# C sources to be compiled in THUMB mode regardless of the global setting.
|
||||
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
|
||||
# option that results in lower performance and larger code size.
|
||||
set(TCPPSRC)
|
||||
|
||||
# List ASM source files here
|
||||
set(ASMSRC ${PORTASM})
|
||||
|
||||
set(INCDIR ${COMMON} ${PORTINC} ${KERNINC} ${TESTINC}
|
||||
${HALINC} ${PLATFORMINC} ${BOARDINC}
|
||||
${CHIBIOS}/os/various
|
||||
)
|
||||
|
||||
#
|
||||
# Project, sources and paths
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# Compiler settings
|
||||
#
|
||||
|
||||
set(MCU cortex-m4)
|
||||
|
||||
# ARM-specific options here
|
||||
set(AOPT)
|
||||
|
||||
# THUMB-specific options here
|
||||
set(TOPT "-mthumb -DTHUMB")
|
||||
|
||||
# Define C warning options here
|
||||
set(CWARN "-Wall -Wextra -Wstrict-prototypes")
|
||||
|
||||
# Define C++ warning options here
|
||||
set(CPPWARN "-Wall -Wextra")
|
||||
|
||||
#
|
||||
# Compiler settings
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# Start of default section
|
||||
#
|
||||
|
||||
# List all default C defines here, like -D_DEBUG=1
|
||||
# TODO: Switch -DCRT0_INIT_DATA depending on load from RAM or SPIFI?
|
||||
# NOTE: _RANDOM_TCC to kill a GCC 4.9.3 error with std::max argument types
|
||||
set(DDEFS -DLPC43XX -DLPC43XX_M4 -D__NEWLIB__ -DHACKRF_ONE -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -D_RANDOM_TCC=0 -DGIT_REVISION=\"${GIT_REVISION}\")
|
||||
|
||||
# List all default ASM defines here, like -D_DEBUG=1
|
||||
set(DADEFS)
|
||||
|
||||
# List all default directories to look for include files here
|
||||
set(DINCDIR)
|
||||
|
||||
# List the default directory to look for the libraries here
|
||||
set(DLIBDIR)
|
||||
|
||||
# List all default libraries here
|
||||
set(DLIBS)
|
||||
|
||||
#
|
||||
# End of default section
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# Start of user section
|
||||
#
|
||||
|
||||
# List all user C define here, like -D_DEBUG=1
|
||||
set(UDEFS)
|
||||
|
||||
# Define ASM defines here
|
||||
set(UADEFS)
|
||||
|
||||
# List all user directories here
|
||||
set(UINCDIR)
|
||||
|
||||
# List the user directory to look for the libraries here
|
||||
set(ULIBDIR)
|
||||
|
||||
# List all user libraries here
|
||||
set(ULIBS)
|
||||
|
||||
#
|
||||
# End of user defines
|
||||
##############################################################################
|
||||
|
||||
set(RULESPATH ${CHIBIOS}/os/ports/GCC/ARMCMx)
|
||||
include(${RULESPATH}/rules.cmake)
|
||||
|
||||
#######################################################################
|
||||
|
||||
add_library(${PROJECT_NAME} OBJECT ${CSRC} ${CPPSRC} ${ASMSRC})
|
||||
include_directories(. ${INCDIR})
|
||||
|
||||
#######################################################################
|
||||
|
||||
set(BASEBAND_IMAGES)
|
||||
|
||||
macro(DeclareTargets)
|
||||
include(${RULESPATH}/rules.cmake)
|
||||
add_executable(${PROJECT_NAME}.elf $<TARGET_OBJECTS:baseband> ${MODE_CPPSRC} ${LDSCRIPT})
|
||||
add_definitions(${DEFS})
|
||||
include_directories(. ${INCDIR})
|
||||
link_directories(${LLIBDIR})
|
||||
target_link_libraries(${PROJECT_NAME}.elf ${LIBS})
|
||||
|
||||
add_custom_target(
|
||||
${PROJECT_NAME}.bin
|
||||
COMMAND ${CMAKE_OBJCOPY} -O binary ${PROJECT_NAME}.elf ${PROJECT_NAME}.bin
|
||||
DEPENDS ${PROJECT_NAME}.elf
|
||||
)
|
||||
|
||||
set(BASEBAND_IMAGES ${BASEBAND_IMAGES} ${PROJECT_NAME}.bin)
|
||||
endmacro()
|
||||
|
||||
### AIS
|
||||
|
||||
project(baseband_ais)
|
||||
set(MODE_CPPSRC
|
||||
proc_ais.cpp
|
||||
)
|
||||
DeclareTargets()
|
||||
|
||||
### AM Audio
|
||||
|
||||
project(baseband_am_audio)
|
||||
set(MODE_CPPSRC
|
||||
proc_am_audio.cpp
|
||||
)
|
||||
DeclareTargets()
|
||||
|
||||
### Capture
|
||||
|
||||
project(baseband_capture)
|
||||
set(MODE_CPPSRC
|
||||
proc_capture.cpp
|
||||
)
|
||||
DeclareTargets()
|
||||
|
||||
### ERT
|
||||
|
||||
project(baseband_ert)
|
||||
set(MODE_CPPSRC
|
||||
proc_ert.cpp
|
||||
)
|
||||
DeclareTargets()
|
||||
|
||||
### NFM Audio
|
||||
|
||||
project(baseband_nfm_audio)
|
||||
set(MODE_CPPSRC
|
||||
proc_nfm_audio.cpp
|
||||
)
|
||||
DeclareTargets()
|
||||
|
||||
### TPMS
|
||||
|
||||
project(baseband_tpms)
|
||||
set(MODE_CPPSRC
|
||||
proc_tpms.cpp
|
||||
)
|
||||
DeclareTargets()
|
||||
|
||||
### WFM Audio
|
||||
|
||||
project(baseband_wfm_audio)
|
||||
set(MODE_CPPSRC
|
||||
proc_wfm_audio.cpp
|
||||
)
|
||||
DeclareTargets()
|
||||
|
||||
### Wideband Spectrum
|
||||
|
||||
project(baseband_wideband_spectrum)
|
||||
set(MODE_CPPSRC
|
||||
proc_wideband_spectrum.cpp
|
||||
)
|
||||
DeclareTargets()
|
||||
|
||||
#######################################################################
|
||||
|
||||
add_custom_target(
|
||||
baseband.img
|
||||
COMMAND cat ${BASEBAND_IMAGES} >baseband.img
|
||||
DEPENDS ${BASEBAND_IMAGES}
|
||||
)
|
206
firmware/bootstrap/CMakeLists.txt
Normal file
206
firmware/bootstrap/CMakeLists.txt
Normal file
@ -0,0 +1,206 @@
|
||||
#
|
||||
# Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
||||
#
|
||||
# This file is part of PortaPack.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
# Build global options
|
||||
# NOTE: Can be overridden externally.
|
||||
#
|
||||
|
||||
enable_language(C CXX ASM)
|
||||
|
||||
project(bootstrap)
|
||||
|
||||
# Compiler options here.
|
||||
set(USE_OPT "-Os -falign-functions=16 -fno-math-errno --specs=nano.specs")
|
||||
|
||||
# C specific options here (added to USE_OPT).
|
||||
set(USE_COPT "-std=gnu99")
|
||||
|
||||
# C++ specific options here (added to USE_OPT).
|
||||
set(USE_CPPOPT "-std=c++11 -fno-rtti -fno-exceptions")
|
||||
|
||||
# Enable this if you want the linker to remove unused code and data
|
||||
set(USE_LINK_GC yes)
|
||||
|
||||
# Linker extra options here.
|
||||
set(USE_LDOPT)
|
||||
|
||||
# Enable this if you want link time optimizations (LTO)
|
||||
set(USE_LTO no)
|
||||
|
||||
# If enabled, this option allows to compile the application in THUMB mode.
|
||||
set(USE_THUMB yes)
|
||||
|
||||
# Enable this if you want to see the full log while compiling.
|
||||
set(USE_VERBOSE_COMPILE no)
|
||||
|
||||
#
|
||||
# Build global options
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# Architecture or project specific options
|
||||
#
|
||||
|
||||
# Enables the use of FPU on Cortex-M4 (no, softfp, hard).
|
||||
set(USE_FPU no)
|
||||
|
||||
#
|
||||
# Architecture or project specific options
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# Project, sources and paths
|
||||
#
|
||||
|
||||
# Define linker script file here
|
||||
set(LDSCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/m4.ld)
|
||||
|
||||
# C sources that can be compiled in ARM or THUMB mode depending on the global
|
||||
# setting.
|
||||
set(CSRC
|
||||
bootstrap.c
|
||||
)
|
||||
|
||||
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
|
||||
# setting.
|
||||
set(CPPSRC)
|
||||
|
||||
# C sources to be compiled in ARM mode regardless of the global setting.
|
||||
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
|
||||
# option that results in lower performance and larger code size.
|
||||
set(ACSRC)
|
||||
|
||||
# C++ sources to be compiled in ARM mode regardless of the global setting.
|
||||
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
|
||||
# option that results in lower performance and larger code size.
|
||||
set(ACPPSRC)
|
||||
|
||||
# C sources to be compiled in THUMB mode regardless of the global setting.
|
||||
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
|
||||
# option that results in lower performance and larger code size.
|
||||
set(TCSRC)
|
||||
|
||||
# C sources to be compiled in THUMB mode regardless of the global setting.
|
||||
# NOTE: Mixing ARM and THUMB mode enables the -mthumb-interwork compiler
|
||||
# option that results in lower performance and larger code size.
|
||||
set(TCPPSRC)
|
||||
|
||||
# List ASM source files here
|
||||
set(ASMSRC startup_ARMCM4.S)
|
||||
|
||||
set(INCDIR
|
||||
${CHIBIOS}/os/ports/common/ARMCMx/CMSIS/include
|
||||
${CHIBIOS}/os/ports/common/ARMCMx
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx_M4
|
||||
)
|
||||
|
||||
#
|
||||
# Project, sources and paths
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# Compiler settings
|
||||
#
|
||||
|
||||
set(MCU cortex-m4)
|
||||
|
||||
# ARM-specific options here
|
||||
set(AOPT)
|
||||
|
||||
# THUMB-specific options here
|
||||
set(TOPT "-mthumb -DTHUMB")
|
||||
|
||||
# Define C warning options here
|
||||
set(CWARN "-Wall -Wextra -Wstrict-prototypes")
|
||||
|
||||
# Define C++ warning options here
|
||||
set(CPPWARN "-Wall -Wextra")
|
||||
|
||||
#
|
||||
# Compiler settings
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# Start of default section
|
||||
#
|
||||
|
||||
# List all default C defines here, like -D_DEBUG=1
|
||||
# TODO: Switch -DCRT0_INIT_DATA depending on load from RAM or SPIFI?
|
||||
# NOTE: _RANDOM_TCC to kill a GCC 4.9.3 error with std::max argument types
|
||||
set(DDEFS -DLPC43XX -DLPC43XX_M4 -D__START=main -DGIT_REVISION=\"${GIT_REVISION}\")
|
||||
|
||||
# List all default ASM defines here, like -D_DEBUG=1
|
||||
set(DADEFS)
|
||||
|
||||
# List all default directories to look for include files here
|
||||
set(DINCDIR)
|
||||
|
||||
# List the default directory to look for the libraries here
|
||||
set(DLIBDIR)
|
||||
|
||||
# List all default libraries here
|
||||
set(DLIBS)
|
||||
|
||||
#
|
||||
# End of default section
|
||||
##############################################################################
|
||||
|
||||
##############################################################################
|
||||
# Start of user section
|
||||
#
|
||||
|
||||
# List all user C define here, like -D_DEBUG=1
|
||||
set(UDEFS)
|
||||
|
||||
# Define ASM defines here
|
||||
set(UADEFS)
|
||||
|
||||
# List all user directories here
|
||||
set(UINCDIR)
|
||||
|
||||
# List the user directory to look for the libraries here
|
||||
set(ULIBDIR)
|
||||
|
||||
# List all user libraries here
|
||||
set(ULIBS)
|
||||
|
||||
#
|
||||
# End of user defines
|
||||
##############################################################################
|
||||
|
||||
set(RULESPATH ${CHIBIOS}/os/ports/GCC/ARMCMx)
|
||||
include(${RULESPATH}/rules.cmake)
|
||||
|
||||
##############################################################################
|
||||
|
||||
add_executable(${PROJECT_NAME}.elf ${CSRC} ${CPPSRC} ${ASMSRC} ${LDSCRIPT})
|
||||
add_definitions(${DEFS})
|
||||
include_directories(. ${INCDIR})
|
||||
link_directories(${LLIBDIR})
|
||||
target_link_libraries(${PROJECT_NAME}.elf ${LIBS})
|
||||
|
||||
add_custom_target(
|
||||
${PROJECT_NAME}.bin
|
||||
COMMAND ${CMAKE_OBJCOPY} -O binary ${PROJECT_NAME}.elf ${PROJECT_NAME}.bin
|
||||
DEPENDS ${PROJECT_NAME}.elf
|
||||
)
|
@ -0,0 +1,9 @@
|
||||
# List of all the board related files.
|
||||
set(BOARDSRC
|
||||
${CHIBIOS_PORTAPACK}/boards/GSG_HACKRF_ONE/board.c
|
||||
)
|
||||
|
||||
# Required include directories
|
||||
set(BOARDINC
|
||||
${CHIBIOS_PORTAPACK}/boards/GSG_HACKRF_ONE
|
||||
)
|
@ -0,0 +1,17 @@
|
||||
# List of all the LPC43xx M0 platform files.
|
||||
set(PLATFORMSRC
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx_M0/hal_lld.c
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx/gpt_lld.c
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx/i2c_lld.c
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx/pal_lld.c
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx/rtc_lld.c
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx/sdc_lld.c
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx/serial_lld.c
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx/spi_lld.c
|
||||
)
|
||||
|
||||
# Required include directories
|
||||
set(PLATFORMINC
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx_M0
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx
|
||||
)
|
@ -0,0 +1,17 @@
|
||||
# List of all the LPC43xx M4 platform files.
|
||||
set(PLATFORMSRC
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx_M4/hal_lld.c
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx/gpt_lld.c
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx/i2c_lld.c
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx/pal_lld.c
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx/rtc_lld.c
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx/sdc_lld.c
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx/serial_lld.c
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx/spi_lld.c
|
||||
)
|
||||
|
||||
# Required include directories
|
||||
set(PLATFORMINC
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx_M4
|
||||
${CHIBIOS_PORTAPACK}/os/hal/platforms/LPC43xx
|
||||
)
|
@ -0,0 +1,21 @@
|
||||
# List of the ChibiOS/RT Cortex-M0 LPC43xx port files.
|
||||
set(PORTSRC
|
||||
${CHIBIOS}/os/ports/GCC/ARMCMx/crt0.c
|
||||
${CHIBIOS_PORTAPACK}/os/ports/GCC/ARMCMx/LPC43xx_M0/vectors.c
|
||||
${CHIBIOS}/os/ports/GCC/ARMCMx/chcore.c
|
||||
${CHIBIOS}/os/ports/GCC/ARMCMx/chcore_v6m.c
|
||||
${CHIBIOS}/os/ports/common/ARMCMx/nvic.c
|
||||
)
|
||||
|
||||
set(PORTASM)
|
||||
|
||||
set(PORTINC
|
||||
${CHIBIOS}/os/ports/common/ARMCMx/CMSIS/include
|
||||
${CHIBIOS}/os/ports/common/ARMCMx
|
||||
${CHIBIOS}/os/ports/GCC/ARMCMx
|
||||
${CHIBIOS_PORTAPACK}/os/ports/GCC/ARMCMx/LPC43xx_M0
|
||||
)
|
||||
|
||||
set(PORTLD
|
||||
${CHIBIOS_PORTAPACK}/os/ports/GCC/ARMCMx/LPC43xx_M0/ld
|
||||
)
|
@ -0,0 +1,21 @@
|
||||
# List of the ChibiOS/RT Cortex-M4 LPC43xx port files.
|
||||
set(PORTSRC
|
||||
${CHIBIOS}/os/ports/GCC/ARMCMx/crt0.c
|
||||
${CHIBIOS_PORTAPACK}/os/ports/GCC/ARMCMx/LPC43xx_M4/vectors.c
|
||||
${CHIBIOS}/os/ports/GCC/ARMCMx/chcore.c
|
||||
${CHIBIOS}/os/ports/GCC/ARMCMx/chcore_v7m.c
|
||||
${CHIBIOS}/os/ports/common/ARMCMx/nvic.c
|
||||
)
|
||||
|
||||
set(PORTASM)
|
||||
|
||||
set(PORTINC
|
||||
${CHIBIOS}/os/ports/common/ARMCMx/CMSIS/include
|
||||
${CHIBIOS}/os/ports/common/ARMCMx
|
||||
${CHIBIOS}/os/ports/GCC/ARMCMx
|
||||
${CHIBIOS_PORTAPACK}/os/ports/GCC/ARMCMx/LPC43xx_M4
|
||||
)
|
||||
|
||||
set(PORTLD
|
||||
${CHIBIOS_PORTAPACK}/os/ports/GCC/ARMCMx/LPC43xx_M4/ld
|
||||
)
|
@ -0,0 +1,10 @@
|
||||
# FATFS files.
|
||||
set(FATFSSRC
|
||||
${CHIBIOS_PORTAPACK}/os/various/fatfs_bindings/fatfs_diskio.c
|
||||
${CHIBIOS_PORTAPACK}/os/various/fatfs_bindings/fatfs_syscall.c
|
||||
${CHIBIOS_PORTAPACK}/ext/fatfs/src/ff.c
|
||||
)
|
||||
|
||||
set(FATFSINC
|
||||
${CHIBIOS_PORTAPACK}/ext/fatfs/src
|
||||
)
|
29
firmware/chibios/os/hal/hal.cmake
Normal file
29
firmware/chibios/os/hal/hal.cmake
Normal file
@ -0,0 +1,29 @@
|
||||
# List of all the ChibiOS/RT HAL files, there is no need to remove the files
|
||||
# from this list, you can disable parts of the HAL by editing halconf.h.
|
||||
set(HALSRC
|
||||
${CHIBIOS}/os/hal/src/hal.c
|
||||
${CHIBIOS}/os/hal/src/adc.c
|
||||
${CHIBIOS}/os/hal/src/can.c
|
||||
${CHIBIOS}/os/hal/src/ext.c
|
||||
${CHIBIOS}/os/hal/src/gpt.c
|
||||
${CHIBIOS}/os/hal/src/i2c.c
|
||||
${CHIBIOS}/os/hal/src/icu.c
|
||||
${CHIBIOS}/os/hal/src/mac.c
|
||||
${CHIBIOS}/os/hal/src/mmc_spi.c
|
||||
${CHIBIOS}/os/hal/src/mmcsd.c
|
||||
${CHIBIOS}/os/hal/src/pal.c
|
||||
${CHIBIOS}/os/hal/src/pwm.c
|
||||
${CHIBIOS}/os/hal/src/rtc.c
|
||||
${CHIBIOS}/os/hal/src/sdc.c
|
||||
${CHIBIOS}/os/hal/src/serial.c
|
||||
${CHIBIOS}/os/hal/src/serial_usb.c
|
||||
${CHIBIOS}/os/hal/src/spi.c
|
||||
${CHIBIOS}/os/hal/src/tm.c
|
||||
${CHIBIOS}/os/hal/src/uart.c
|
||||
${CHIBIOS}/os/hal/src/usb.c
|
||||
)
|
||||
|
||||
# Required include directories
|
||||
set(HALINC
|
||||
${CHIBIOS}/os/hal/include
|
||||
)
|
27
firmware/chibios/os/kernel/kernel.cmake
Normal file
27
firmware/chibios/os/kernel/kernel.cmake
Normal file
@ -0,0 +1,27 @@
|
||||
# List of all the ChibiOS/RT kernel files, there is no need to remove the files
|
||||
# from this list, you can disable parts of the kernel by editing chconf.h.
|
||||
set(KERNSRC
|
||||
${CHIBIOS}/os/kernel/src/chsys.c
|
||||
${CHIBIOS}/os/kernel/src/chdebug.c
|
||||
${CHIBIOS}/os/kernel/src/chlists.c
|
||||
${CHIBIOS}/os/kernel/src/chvt.c
|
||||
${CHIBIOS}/os/kernel/src/chschd.c
|
||||
${CHIBIOS}/os/kernel/src/chthreads.c
|
||||
${CHIBIOS}/os/kernel/src/chdynamic.c
|
||||
${CHIBIOS}/os/kernel/src/chregistry.c
|
||||
${CHIBIOS}/os/kernel/src/chsem.c
|
||||
${CHIBIOS}/os/kernel/src/chmtx.c
|
||||
${CHIBIOS}/os/kernel/src/chcond.c
|
||||
${CHIBIOS}/os/kernel/src/chevents.c
|
||||
${CHIBIOS}/os/kernel/src/chmsg.c
|
||||
${CHIBIOS}/os/kernel/src/chmboxes.c
|
||||
${CHIBIOS}/os/kernel/src/chqueues.c
|
||||
${CHIBIOS}/os/kernel/src/chmemcore.c
|
||||
${CHIBIOS}/os/kernel/src/chheap.c
|
||||
${CHIBIOS}/os/kernel/src/chmempools.c
|
||||
)
|
||||
|
||||
# Required include directories
|
||||
set(KERNINC
|
||||
${CHIBIOS}/os/kernel/include
|
||||
)
|
107
firmware/chibios/os/ports/GCC/ARMCMx/rules.cmake
Normal file
107
firmware/chibios/os/ports/GCC/ARMCMx/rules.cmake
Normal file
@ -0,0 +1,107 @@
|
||||
# ARM Cortex-Mx common makefile scripts and rules.
|
||||
|
||||
##############################################################################
|
||||
# Processing options coming from the upper Makefile.
|
||||
#
|
||||
|
||||
# Compiler options
|
||||
set(OPT ${USE_OPT})
|
||||
set(COPT ${USE_COPT})
|
||||
set(CPPOPT ${USE_CPPOPT})
|
||||
|
||||
# Garbage collection
|
||||
if(USE_LINK_GC STREQUAL "yes")
|
||||
set(OPT "${OPT} -ffunction-sections -fdata-sections -fno-common")
|
||||
set(LDOPT ",--gc-sections")
|
||||
else()
|
||||
set(LDOPT)
|
||||
endif()
|
||||
|
||||
# Linker extra options
|
||||
if(DEFINED USE_LDOPT)
|
||||
set(LDOPT "${LDOPT},${USE_LDOPT}")
|
||||
endif()
|
||||
|
||||
# Link time optimizations
|
||||
if(USE_LTO STREQUAL "yes")
|
||||
set(OPT "${OPT} -flto")
|
||||
endif()
|
||||
|
||||
# FPU-related options
|
||||
if(NOT DEFINED USE_FPU)
|
||||
set(USE_FPU no)
|
||||
endif()
|
||||
if(NOT USE_FPU STREQUAL "no")
|
||||
set(OPT "${OPT} -mfloat-abi=${USE_FPU} -mfpu=fpv4-sp-d16 -fsingle-precision-constant")
|
||||
set(DDEFS ${DDEFS} -DCORTEX_USE_FPU=TRUE)
|
||||
set(DADEFS ${DADEFS} -DCORTEX_USE_FPU=TRUE)
|
||||
else()
|
||||
set(DDEFS ${DDEFS} -DCORTEX_USE_FPU=FALSE)
|
||||
set(DADEFS ${DADEFS} -DCORTEX_USE_FPU=FALSE)
|
||||
endif()
|
||||
|
||||
# Source files groups and paths
|
||||
if(USE_THUMB STREQUAL "yes")
|
||||
set(TCSRC ${TCSRC} ${CSRC})
|
||||
set(TCPPSRC ${TCPPSRC} ${CPPSRC})
|
||||
else()
|
||||
set(ACSRC ${ACSRC} ${CSRC})
|
||||
set(ACPPSRC ${ACPPSRC} ${CPPSRC})
|
||||
endif()
|
||||
set(ASRC ${ACSRC} ${ACPPSRC})
|
||||
set(TSRC ${TCSRC} ${TCPPSRC})
|
||||
|
||||
# Paths
|
||||
set(IINCDIR ${INCDIR} ${DINCDIR} ${UINCDIR})
|
||||
set(LLIBDIR ${DLIBDIR} ${ULIBDIR})
|
||||
|
||||
# Macros
|
||||
set(DEFS ${DDEFS} ${UDEFS})
|
||||
set(ADEFS ${DADEFS} ${UADEFS})
|
||||
|
||||
# Libs
|
||||
set(LIBS ${DLIBS} ${ULIBS})
|
||||
|
||||
# Various settings
|
||||
set(MCFLAGS -mcpu=${MCU})
|
||||
set(ODFLAGS "-x --syms")
|
||||
set(ASFLAGS "${MCFLAGS} ${ADEFS}")
|
||||
set(ASXFLAGS "${MCFLAGS} ${ADEFS}")
|
||||
set(CFLAGS "${MCFLAGS} ${OPT} ${COPT} ${CWARN}")
|
||||
set(CPPFLAGS "${MCFLAGS} ${OPT} ${CPPOPT} ${CPPWARN}")
|
||||
set(LDFLAGS "-nostartfiles -Wl,-Map=${PROJECT_NAME}.map,--cref,--no-warn-mismatch,--library-path=${RULESPATH},--script=${LDSCRIPT}${LDOPT}")
|
||||
|
||||
# Thumb interwork enabled only if needed because it kills performance.
|
||||
if(DEFINED TSRC)
|
||||
set(CFLAGS "${CFLAGS}")
|
||||
set(CPPFLAGS "${CPPFLAGS}")
|
||||
set(ASFLAGS "${ASFLAGS}")
|
||||
set(DEFS ${DEFS} -DTHUMB_PRESENT)
|
||||
set(ADEFS ${ADEFS} -DTHUMB_PRESENT)
|
||||
if(DEFINED ASRC)
|
||||
# Mixed ARM and THUMB mode.
|
||||
set(CFLAGS "${CFLAGS} -mthumb-interwork")
|
||||
set(CPPFLAGS "${CPPFLAGS} -mthumb-interwork")
|
||||
set(ASFLAGS "${ASFLAGS} -mthumb-interwork")
|
||||
set(LDFLAGS "${LDFLAGS} -mthumb-interwork")
|
||||
else()
|
||||
# Pure THUMB mode, THUMB C code cannot be called by ARM asm code directly.
|
||||
set(CFLAGS "${CFLAGS} -mno-thumb-interwork")
|
||||
set(CPPFLAGS "${CPPFLAGS} -mno-thumb-interwork")
|
||||
set(ASFLAGS "${ASFLAGS} -mno-thumb-interwork -mthumb")
|
||||
set(LDFLAGS "${LDFLAGS} -mno-thumb-interwork -mthumb")
|
||||
set(DEFS ${DEFS} -DTHUMB_NO_INTERWORKING)
|
||||
set(ADEFS ${ADEFS} -DTHUMB_NO_INTERWORKING)
|
||||
endif()
|
||||
else()
|
||||
# Pure ARM mode
|
||||
set(CFLAGS "${CFLAGS} -mno-thumb-interwork")
|
||||
set(CPPFLAGS "${CPPFLAGS} -mno-thumb-interwork")
|
||||
set(ASFLAGS "${ASFLAGS} -mno-thumb-interwork")
|
||||
set(LDFLAGS "${LDFLAGS} -mno-thumb-interwork")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS "${CFLAGS} ${TOPT}")
|
||||
set(CMAKE_CXX_FLAGS "${CPPFLAGS} ${TOPT}")
|
||||
set(CMAKE_AS_FLAGS "${ASFLAGS} ${TOPT}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${LDFLAGS}")
|
20
firmware/chibios/test/test.cmake
Normal file
20
firmware/chibios/test/test.cmake
Normal file
@ -0,0 +1,20 @@
|
||||
# List of all the ChibiOS/RT test files.
|
||||
set(TESTSRC
|
||||
${CHIBIOS}/test/test.c
|
||||
${CHIBIOS}/test/testthd.c
|
||||
${CHIBIOS}/test/testsem.c
|
||||
${CHIBIOS}/test/testmtx.c
|
||||
${CHIBIOS}/test/testmsg.c
|
||||
${CHIBIOS}/test/testmbox.c
|
||||
${CHIBIOS}/test/testevt.c
|
||||
${CHIBIOS}/test/testheap.c
|
||||
${CHIBIOS}/test/testpools.c
|
||||
${CHIBIOS}/test/testdyn.c
|
||||
${CHIBIOS}/test/testqueues.c
|
||||
${CHIBIOS}/test/testbmk.c
|
||||
)
|
||||
|
||||
# Required include directories
|
||||
set(TESTINC
|
||||
${CHIBIOS}/test
|
||||
)
|
55
firmware/toolchain-arm-cortex-m.cmake
Normal file
55
firmware/toolchain-arm-cortex-m.cmake
Normal file
@ -0,0 +1,55 @@
|
||||
# Copyright 2014 Jared Boone <jared@sharebrained.com>
|
||||
#
|
||||
# This file is part of PortaPack.
|
||||
# This file was borrowed from HackRF.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; see the file COPYING. If not, write to
|
||||
# the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Generic)
|
||||
set(CMAKE_SYSTEM_VERSION 1)
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm)
|
||||
|
||||
include(CMakeForceCompiler)
|
||||
|
||||
CMAKE_FORCE_C_COMPILER(arm-none-eabi-gcc GNU)
|
||||
CMAKE_FORCE_CXX_COMPILER(arm-none-eabi-g++ GNU)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_C_COMPILER} -print-file-name=libc.a
|
||||
OUTPUT_VARIABLE CMAKE_INSTALL_PREFIX
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
get_filename_component(CMAKE_INSTALL_PREFIX
|
||||
"${CMAKE_INSTALL_PREFIX}" PATH
|
||||
)
|
||||
get_filename_component(CMAKE_INSTALL_PREFIX
|
||||
"${CMAKE_INSTALL_PREFIX}/.." REALPATH
|
||||
)
|
||||
set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE FILEPATH
|
||||
"Install path prefix, prepended onto install directories.")
|
||||
|
||||
message(STATUS "Cross-compiling with the gcc-arm-embedded toolchain")
|
||||
message(STATUS "Toolchain prefix: ${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
|
||||
#set(CMAKE_LD ${CMAKE_INSTALL_PREFIX}/bin/ld CACHE INTERNAL "ld tool")
|
||||
set(CMAKE_OBJCOPY ${CMAKE_INSTALL_PREFIX}/bin/objcopy CACHE INTERNAL "objcopy tool")
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH ${CMAKE_INSTALL_PREFIX})
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
Loading…
Reference in New Issue
Block a user