diff --git a/.gitignore b/.gitignore index 6f2674aa..320f0b71 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,5 @@ firmware/cpld/**/*.xrpt firmware/cpld/**/*.xsl firmware/cpld/**/*.xst firmware/cpld/**/*.xwbt + +firmware/**/build diff --git a/firmware/sgpio-rx/Makefile b/firmware/CMakeLists.txt similarity index 64% rename from firmware/sgpio-rx/Makefile rename to firmware/CMakeLists.txt index 79ed6509..1f9ae191 100644 --- a/firmware/sgpio-rx/Makefile +++ b/firmware/CMakeLists.txt @@ -1,5 +1,3 @@ -# Hey Emacs, this is a -*- makefile -*- -# # Copyright 2012 Jared Boone # # This file is part of HackRF. @@ -20,16 +18,19 @@ # Boston, MA 02110-1301, USA. # -BINARY = sgpio-rx +# Top directory CMake project for HackRF firmware -SRC = $(BINARY).c \ - ../common/hackrf_core.c \ - ../common/tuning.c \ - ../common/rf_path.c \ - ../common/sgpio.c \ - ../common/si5351c.c \ - ../common/max2837.c \ - ../common/max5864.c \ - ../common/rffc5071.c +cmake_minimum_required(VERSION 2.8.9) +set(CMAKE_TOOLCHAIN_FILE toolchain-arm-cortex-m.cmake) -include ../common/Makefile_inc.mk +project (hackrf_firmware_all) + +add_subdirectory(blinky) +add_subdirectory(mixertx) +add_subdirectory(sgpio) +add_subdirectory(sgpio-rx) +add_subdirectory(simpletx) +add_subdirectory(startup) +add_subdirectory(startup_systick) +add_subdirectory(startup_systick_perfo) +add_subdirectory(hackrf_usb) diff --git a/firmware/Makefile b/firmware/Makefile deleted file mode 100644 index cbd920f0..00000000 --- a/firmware/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -# -# Copyright 2012 Jared Boone -# -# This file is part of 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. -# - -TARGETS = blinky \ - mixertx \ - sgpio \ - sgpio-rx \ - simpletx \ - startup \ - startup_systick \ - startup_systick_perfo \ - hackrf_usb - -all: build - -build: examples - -examples: - $(Q)for i in $(TARGETS); do \ - if [ -d $$i ]; then \ - printf " BUILD $$i\n"; \ - $(MAKE) -C $$i || exit $?; \ - fi; \ - done - -clean: - $(Q)for i in $(addprefix lib/,$(TARGETS)) \ - $(TARGETS); do \ - if [ -d $$i ]; then \ - printf " CLEAN $$i\n"; \ - $(MAKE) -C $$i clean || exit $?; \ - fi; \ - done - -.PHONY: build examples diff --git a/firmware/README b/firmware/README index 42ae0ac8..daa4e402 100644 --- a/firmware/README +++ b/firmware/README @@ -25,10 +25,13 @@ $ make To build and install a standard firmware image for HackRF One: $ cd hackrf_usb -$ make -e BOARD=HACKRF_ONE -$ hackrf_spiflash -w hackrf_usb_rom_to_ram.bin +$ mkdir build +$ cd build +$ cmake .. -DBOARD=HACKRF_ONE +$ make +$ hackrf_spiflash -w hackrf_usb.bin -If you have a Jawbreaker, use BOARD=JAWBREAKER instead. +If you have a Jawbreaker, use -DBOARD=JAWBREAKER instead. For loading firmware into RAM with DFU you will also need: @@ -43,7 +46,10 @@ With dfu-util and dfu-suffix (from the dfu-util package) installed and with the HackRF operating in DFU mode, you can build firmware for RAM and load it with: $ cd hackrf_usb -$ make -e BOARD=HACKRF_ONE RUN_FROM=RAM program +$ mkdir build +$ cd build +$ cmake .. -DRUN_FROM=RAM +$ make program Alternatively you can load a .dfu file from a release package with: diff --git a/firmware/spiflash/Makefile b/firmware/blinky/CMakeLists.txt similarity index 78% rename from firmware/spiflash/Makefile rename to firmware/blinky/CMakeLists.txt index a3a6763c..97eb18de 100644 --- a/firmware/spiflash/Makefile +++ b/firmware/blinky/CMakeLists.txt @@ -1,5 +1,3 @@ -# Hey Emacs, this is a -*- makefile -*- -# # Copyright 2012 Michael Ossmann # Copyright 2012 Jared Boone # @@ -21,13 +19,15 @@ # Boston, MA 02110-1301, USA. # -BINARY = spiflash +cmake_minimum_required(VERSION 2.8.9) +set(CMAKE_TOOLCHAIN_FILE ../toolchain-arm-cortex-m.cmake) -SRC = $(BINARY).c \ - ../common/hackrf_core.c \ - ../common/sgpio.c \ - ../common/si5351c.c \ - ../common/max2837.c \ - ../common/w25q80bv.c +project(blinky) -include ../common/Makefile_inc.mk +include(../hackrf-common.cmake) + +set(SRC_M4 + blinky.c +) + +DeclareTargets() diff --git a/firmware/common/Makefile_inc.mk b/firmware/common/Makefile_inc.mk deleted file mode 100644 index 5e351158..00000000 --- a/firmware/common/Makefile_inc.mk +++ /dev/null @@ -1,238 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -# -# Copyright 2009 Uwe Hermann -# Copyright 2010 Piotr Esden-Tempski -# Copyright 2012 Michael Ossmann -# Copyright 2012 Benjamin Vernoux -# Copyright 2012 Jared Boone -# -# This file is part of 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. -# - -# derived primarily from Makefiles in libopencm3 - -BOARD ?= HACKRF_ONE -RUN_FROM ?= SPIFI - -ifeq ($(BOARD),HACKRF_ONE) - MCU_PARTNO=LPC4320 -else - MCU_PARTNO=LPC4330 -endif - -HACKRF_OPTS = -D$(BOARD) -DLPC43XX -D$(MCU_PARTNO) - -# comment to disable RF transmission -HACKRF_OPTS += -DTX_ENABLE - -# automatic git version when working out of git -VERSION_STRING ?= -D'VERSION_STRING="git-$(shell git log -n 1 --format=%h)"' -HACKRF_OPTS += $(VERSION_STRING) - -PATH_HACKRF ?= ../.. - -PATH_HACKRF_FIRMWARE = $(PATH_HACKRF)/firmware -PATH_HACKRF_FIRMWARE_COMMON = $(PATH_HACKRF_FIRMWARE)/common - -LIBOPENCM3 ?= $(PATH_HACKRF_FIRMWARE)/libopencm3 - -VPATH += $(PATH_HACKRF_FIRMWARE_COMMON)/xapp058 -VPATH += $(PATH_HACKRF_FIRMWARE_COMMON) - -SRC_M4_C ?= $(SRC) -SRC_M0_C ?= $(PATH_HACKRF_FIRMWARE_COMMON)/m0_sleep.c - -BUILD_DIR = build -OBJDIR_M4 = $(BUILD_DIR)/m4 -OBJDIR_M0 = $(BUILD_DIR)/m0 - -OBJ_M4_C = $(patsubst %.c, $(OBJDIR_M4)/%.o, $(notdir $(SRC_M4_C))) -OBJ_M4_S = $(patsubst %.s, $(OBJDIR_M4)/%.o, $(notdir $(SRC_M4_S))) - -OBJ_M0_C = $(patsubst %.c, $(OBJDIR_M0)/%.o, $(notdir $(SRC_M0_C))) -OBJ_M0_S = $(patsubst %.s, $(OBJDIR_M0)/%.o, $(notdir $(SRC_M0_S))) - -LDSCRIPT_M4 += -T$(PATH_HACKRF_FIRMWARE_COMMON)/$(MCU_PARTNO)_M4_memory.ld -ifeq ($(RUN_FROM),RAM) - LDSCRIPT_M4 += -Tlibopencm3_lpc43xx.ld -else - LDSCRIPT_M4 += -Tlibopencm3_lpc43xx_rom_to_ram.ld -endif -LDSCRIPT_M4 += -T$(PATH_HACKRF_FIRMWARE_COMMON)/LPC43xx_M4_M0_image_from_text.ld - -LDSCRIPT_M0 += -T$(PATH_HACKRF_FIRMWARE_COMMON)/LPC43xx_M0_memory.ld -LDSCRIPT_M0 += -Tlibopencm3_lpc43xx_m0.ld - -PREFIX ?= arm-none-eabi -CC = $(PREFIX)-gcc -LD = $(PREFIX)-gcc -OBJCOPY = $(PREFIX)-objcopy -OBJDUMP = $(PREFIX)-objdump -GDB = $(PREFIX)-gdb -TOOLCHAIN_DIR := $(shell dirname `which $(CC)`)/../$(PREFIX) - -CFLAGS_COMMON += -std=gnu99 -Os -g3 -Wall -Wextra -I$(LIBOPENCM3)/include -I$(PATH_HACKRF_FIRMWARE_COMMON) \ - $(HACKRF_OPTS) -fno-common -mthumb -MD -LDFLAGS_COMMON += -mthumb \ - -L$(PATH_HACKRF_FIRMWARE_COMMON) \ - -L$(LIBOPENCM3)/lib -L$(LIBOPENCM3)/lib/lpc43xx \ - -nostartfiles \ - -Wl,--gc-sections \ - -lc -lnosys -CFLAGS_M0 += -mcpu=cortex-m0 -DLPC43XX_M0 -LDFLAGS_M0 += -mcpu=cortex-m0 -DLPC43XX_M0 -LDFLAGS_M0 += $(LDSCRIPT_M0) -LDFLAGS_M0 += --specs=nano.specs -LDFLAGS_M0 += -Xlinker -Map=$(OBJDIR_M0)/m0.map -LDFLAGS_M0 += -lopencm3_lpc43xx_m0 - -CFLAGS_M4 += -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DLPC43XX_M4 -LDFLAGS_M4 += -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -DLPC43XX_M4 -LDFLAGS_M4 += -L$(TOOLCHAIN_DIR)/lib/armv7e-m/fpu -LDFLAGS_M4 += $(LDSCRIPT_M4) -LDFLAGS_M4 += -Xlinker -Map=$(OBJDIR_M4)/m4.map -LDFLAGS_M4 += -lopencm3_lpc43xx -lm - -# Be silent per default, but 'make V=1' will show all compiler calls. -ifneq ($(V),1) -Q := @ -NULL := 2>/dev/null -else -LDFLAGS_COMMON += -Wl,--print-gc-sections -endif - -.SUFFIXES: .elf .bin .hex .srec .list .images -.SECONDEXPANSION: -.SECONDARY: - -all: images - -images: $(BINARY).images -flash: $(BINARY).flash - -program: $(BINARY).dfu - $(Q)dfu-util --device 1fc9:000c --alt 0 --download $(BINARY).dfu - -$(BINARY).images: $(BINARY).bin $(BINARY).hex $(BINARY).srec $(BINARY).list - @#echo "*** $* images generated ***" - -$(BINARY).dfu: $(BINARY).bin - $(Q)rm -f _tmp.dfu _header.bin - $(Q)cp $(BINARY).bin _tmp.dfu - $(Q)dfu-suffix --vid=0x1fc9 --pid=0x000c --did=0x0 -s 0 -a _tmp.dfu - $(Q)python -c "import os.path; import struct; print('0000000: da ff ' + ' '.join(map(lambda s: '%02x' % ord(s), struct.pack(' _header.bin - $(Q)cat _header.bin _tmp.dfu >$(BINARY).dfu - $(Q)rm -f _tmp.dfu _header.bin - -$(BINARY).bin: $(BINARY).elf - @#printf " OBJCOPY $(*).bin\n" - $(Q)$(OBJCOPY) -Obinary $(BINARY).elf $(BINARY).bin - -$(OBJDIR_M0)/m0.bin: $(OBJDIR_M0)/m0.elf - @#printf " OBJCOPY $(*).bin\n" - $(Q)$(OBJCOPY) -Obinary $(OBJDIR_M0)/m0.elf $(OBJDIR_M0)/m0.bin - -#$(OBJDIR_M0)/m0.o: $(OBJDIR_M0)/m0.bin -# $(Q)$(OBJCOPY) -I binary -B arm -O elf32-littlearm $(OBJDIR_M0)/m0.bin $(OBJDIR_M0)/m0.o - -$(BINARY).hex: $(BINARY).elf - @#printf " OBJCOPY $(BINARY).hex\n" - $(Q)$(OBJCOPY) -Oihex $(BINARY).elf $(BINARY).hex - -$(BINARY).srec: $(BINARY).elf - @#printf " OBJCOPY $(BINARY).srec\n" - $(Q)$(OBJCOPY) -Osrec $(BINARY).elf $(BINARY).srec - -$(BINARY).list: $(BINARY).elf - @#printf " OBJDUMP $(BINARY).list\n" - $(Q)$(OBJDUMP) -S $(BINARY).elf > $(BINARY).list - -$(BINARY).elf: obj_m4 - @#printf " LD $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(LD) -o $(BINARY).elf $(OBJ_M4_C) $(OBJ_M4_S) $(OBJDIR_M4)/m0_bin.o $(LDFLAGS_COMMON) $(LDFLAGS_M4) - -$(OBJDIR_M0)/m0.elf: obj_m0 - @#printf " LD $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(LD) -o $(OBJDIR_M0)/m0.elf $(OBJ_M0_C) $(OBJ_M0_S) $(LDFLAGS_COMMON) $(LDFLAGS_M0) - -obj_m4: $(OBJ_M4_C) $(OBJ_M4_S) $(OBJDIR_M4)/m0_bin.o - -obj_m0: $(OBJ_M0_C) $(OBJ_M0_S) - -$(OBJDIR_M4)/%.o: %.c | $(OBJDIR_M4) - @printf " CC $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(CC) $(CFLAGS_COMMON) $(CFLAGS_M4) -o $@ -c $< - -$(OBJDIR_M4)/%.o: %.s | $(OBJDIR_M4) - @printf " CC $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(CC) $(CFLAGS_COMMON) $(CFLAGS_M4) -o $@ -c $< - -$(OBJDIR_M4)/m0_bin.o: m0_bin.s $(OBJDIR_M0)/m0.bin | $(OBJDIR_M4) - @printf " CC $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(CC) $(CFLAGS_COMMON) $(CFLAGS_M4) -o $@ -c $< - -$(OBJDIR_M0)/%.o: %.c | $(OBJDIR_M0) - @printf " CC $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(CC) $(CFLAGS_COMMON) $(CFLAGS_M0) -o $@ -c $< - -$(OBJDIR_M0)/%.o: %.s | $(OBJDIR_M0) - @printf " CC $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(CC) $(CFLAGS_COMMON) $(CFLAGS_M0) -o $@ -c $< - -$(OBJDIR_M4): - $(Q)mkdir -p $@ - -$(OBJDIR_M0): - $(Q)mkdir -p $@ - -clean: - $(Q)rm -f *.o - $(Q)rm -f *.d - $(Q)rm -f *.elf - $(Q)rm -f *.bin - $(Q)rm -f *.dfu - $(Q)rm -f _tmp.dfu _header.bin - $(Q)rm -f *.hex - $(Q)rm -f *.srec - $(Q)rm -f *.list - $(Q)rm -f *.map - $(Q)rm -f *.lst - $(Q)rm -f $(PATH_HACKRF_FIRMWARE)/hackrf_usb/*.o - $(Q)rm -f $(PATH_HACKRF_FIRMWARE)/hackrf_usb/*.d - $(Q)rm -f $(PATH_HACKRF_FIRMWARE)/hackrf_usb/*.lst - $(Q)rm -f $(PATH_HACKRF_FIRMWARE_COMMON)/*.o - $(Q)rm -f $(PATH_HACKRF_FIRMWARE_COMMON)/*.d - $(Q)rm -f $(PATH_HACKRF_FIRMWARE_COMMON)/*.lst - $(Q)rm -f $(PATH_HACKRF_FIRMWARE_COMMON)/xapp058/*.o - $(Q)rm -f $(PATH_HACKRF_FIRMWARE_COMMON)/xapp058/*.d - $(Q)rm -f $(OBJDIR_M4)/*.o - $(Q)rm -f $(OBJDIR_M4)/*.d - $(Q)rm -f $(OBJDIR_M4)/*.elf - $(Q)rm -f $(OBJDIR_M4)/*.bin - $(Q)rm -f $(OBJDIR_M4)/*.map - $(Q)rm -f $(OBJDIR_M0)/*.o - $(Q)rm -f $(OBJDIR_M0)/*.d - $(Q)rm -f $(OBJDIR_M0)/*.elf - $(Q)rm -f $(OBJDIR_M0)/*.bin - $(Q)rm -f $(OBJDIR_M0)/*.map - $(Q)rm -rf $(BUILD_DIR) - -.PHONY: images clean - --include $(OBJ_M4_C:.o=.d) --include $(OBJ_M0_C:.o=.d) diff --git a/firmware/common/m0_bin.s b/firmware/common/m0_bin.s.cmake similarity index 95% rename from firmware/common/m0_bin.s rename to firmware/common/m0_bin.s.cmake index f01f3e09..aa1c78f1 100644 --- a/firmware/common/m0_bin.s +++ b/firmware/common/m0_bin.s.cmake @@ -20,4 +20,4 @@ .data .section .m0_bin, "ax" - .incbin "build/m0/m0.bin" + .incbin "${PROJECT_NAME}_m0.bin" diff --git a/firmware/hackrf-common.cmake b/firmware/hackrf-common.cmake new file mode 100644 index 00000000..df5d5c96 --- /dev/null +++ b/firmware/hackrf-common.cmake @@ -0,0 +1,178 @@ +# Copyright 2009 Uwe Hermann +# Copyright 2010 Piotr Esden-Tempski +# Copyright 2012 Michael Ossmann +# Copyright 2012 Benjamin Vernoux +# Copyright 2012 Jared Boone +# +# This file is part of 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. +# + +# derived primarily from Makefiles in libopencm3 + +enable_language(C CXX ASM) + +SET(PATH_HACKRF ../..) +SET(PATH_HACKRF_FIRMWARE ${PATH_HACKRF}/firmware) +SET(PATH_HACKRF_FIRMWARE_COMMON ${PATH_HACKRF_FIRMWARE}/common) +SET(LIBOPENCM3 ${PATH_HACKRF_FIRMWARE}/libopencm3) + +execute_process( + COMMAND git log -n 1 --format=%h + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + RESULT_VARIABLE GIT_VERSION_FOUND + ERROR_QUIET + OUTPUT_VARIABLE GIT_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE +) +if (GIT_VERSION_FOUND) + set(VERSION "unknown") +else (GIT_VERSION_FOUND) + set(VERSION ${GIT_VERSION}) +endif (GIT_VERSION_FOUND) + +if(NOT DEFINED BOARD) + set(BOARD HACKRF_ONE) +endif() + +if(NOT DEFINED RUN_FROM) + set(RUN_FROM SPIFI) +endif() + +if(BOARD STREQUAL "HACKRF_ONE") + set(MCU_PARTNO LPC4320) +else() + set(MCU_PARTNO LPC4330) +endif() + +if(NOT DEFINED SRC_M0) + set(SRC_M0 "${PATH_HACKRF_FIRMWARE_COMMON}/m0_sleep.c") +endif() + +SET(HACKRF_OPTS "-D${BOARD} -DLPC43XX -D${MCU_PARTNO} -DTX_ENABLE -D'VERSION_STRING=\"git-${VERSION}\"' -DRUN_FROM=${RUN_FROM}") + +SET(LDSCRIPT_M4 "-T${PATH_HACKRF_FIRMWARE_COMMON}/${MCU_PARTNO}_M4_memory.ld") +if( RUN_FROM STREQUAL "RAM") + SET(LDSCRIPT_M4 "${LDSCRIPT_M4} -Tlibopencm3_lpc43xx.ld") +else() + SET(LDSCRIPT_M4 "${LDSCRIPT_M4} -Tlibopencm3_lpc43xx_rom_to_ram.ld") +endif() +SET(LDSCRIPT_M4 "${LDSCRIPT_M4} -T${PATH_HACKRF_FIRMWARE_COMMON}/LPC43xx_M4_M0_image_from_text.ld") + +SET(LDSCRIPT_M0 "-T${PATH_HACKRF_FIRMWARE_COMMON}/LPC43xx_M0_memory.ld -Tlibopencm3_lpc43xx_m0.ld") + +SET(CFLAGS_COMMON "-Os -g3 -Wall -Wextra ${HACKRF_OPTS} ${COMMON_FLAGS} -fno-common -MD") +SET(LDFLAGS_COMMON "-nostartfiles -Wl,--gc-sections") + +if(V STREQUAL "1") + SET(LDFLAGS_COMMON "${LDFLAGS_COMMON} -Wl,--print-gc-sections") +endif() + +SET(CPUFLAGS_M0 "-mthumb -mcpu=cortex-m0 -mfloat-abi=soft") +SET(CFLAGS_M0 "-std=gnu99 ${CFLAGS_COMMON} ${CPUFLAGS_M0} -DLPC43XX_M0") +SET(CXXFLAGS_M0 "-std=gnu++0x ${CFLAGS_COMMON} ${CPUFLAGS_M0} -DLPC43XX_M0") +SET(LDFLAGS_M0 "${LDFLAGS_COMMON} ${CPUFLAGS_M0} ${LDSCRIPT_M0} -Xlinker -Map=m0.map --specs=nano.specs") + +SET(CPUFLAGS_M4 "-mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16") +SET(CFLAGS_M4 "-std=gnu99 ${CFLAGS_COMMON} ${CPUFLAGS_M4} -DLPC43XX_M4") +SET(CXXFLAGS_M4 "-std=gnu++0x ${CFLAGS_COMMON} ${CPUFLAGS_M4} -DLPC43XX_M4") +SET(LDFLAGS_M4 "${LDFLAGS_COMMON} ${CPUFLAGS_M4} ${LDSCRIPT_M4} -Xlinker -Map=m4.map") + +set(BUILD_SHARED_LIBS OFF) + +include_directories("${LIBOPENCM3}/include/") +include_directories("${PATH_HACKRF_FIRMWARE_COMMON}") + +macro(DeclareTargets) + configure_file( + ${PATH_HACKRF_FIRMWARE_COMMON}/m0_bin.s.cmake + m0_bin.s + ) + + link_directories( + "${PATH_HACKRF_FIRMWARE_COMMON}" + "${LIBOPENCM3}/lib" + "${LIBOPENCM3}/lib/lpc43xx" + "${CMAKE_INSTALL_PREFIX}/lib/armv7e-m/fpu" + ) + + add_executable(${PROJECT_NAME}_m0.elf ${SRC_M0}) + + target_link_libraries( + ${PROJECT_NAME}_m0.elf + c + nosys + opencm3_lpc43xx_m0 + ) + + set_target_properties(${PROJECT_NAME}_m0.elf PROPERTIES COMPILE_FLAGS "${CFLAGS_M0}") + set_target_properties(${PROJECT_NAME}_m0.elf PROPERTIES LINK_FLAGS "${LDFLAGS_M0}") + + add_custom_target( + ${PROJECT_NAME}_m0.bin + DEPENDS ${PROJECT_NAME}_m0.elf + COMMAND ${CMAKE_OBJCOPY} -Obinary ${PROJECT_NAME}_m0.elf ${PROJECT_NAME}_m0.bin + ) + + add_executable(${PROJECT_NAME}.elf + ${SRC_M4} + ${PATH_HACKRF_FIRMWARE_COMMON}/hackrf_core.c + ${PATH_HACKRF_FIRMWARE_COMMON}/sgpio.c + ${PATH_HACKRF_FIRMWARE_COMMON}/rf_path.c + ${PATH_HACKRF_FIRMWARE_COMMON}/si5351c.c + ${PATH_HACKRF_FIRMWARE_COMMON}/max2837.c + ${PATH_HACKRF_FIRMWARE_COMMON}/max5864.c + ${PATH_HACKRF_FIRMWARE_COMMON}/rffc5071.c + m0_bin.s + ) + + add_dependencies(${PROJECT_NAME}.elf ${PROJECT_NAME}_m0.bin) + + target_link_libraries( + ${PROJECT_NAME}.elf + c + nosys + opencm3_lpc43xx + m + ) + + set_target_properties(${PROJECT_NAME}.elf PROPERTIES COMPILE_FLAGS "${CFLAGS_M4}") + set_target_properties(${PROJECT_NAME}.elf PROPERTIES LINK_FLAGS "${LDFLAGS_M4}") + + add_custom_target( + ${PROJECT_NAME}.bin + DEPENDS ${PROJECT_NAME}.elf + COMMAND ${CMAKE_OBJCOPY} -Obinary ${PROJECT_NAME}.elf ${PROJECT_NAME}.bin + ) + + add_custom_target( + ${PROJECT_NAME}.dfu ALL + DEPENDS ${PROJECT_NAME}.bin + COMMAND rm -f _tmp.dfu _header.bin + COMMAND cp ${PROJECT_NAME}.bin _tmp.dfu + COMMAND dfu-suffix --vid=0x1fc9 --pid=0x000c --did=0x0 -s 0 -a _tmp.dfu + COMMAND python -c \"import os.path\; import struct\; print\('0000000: da ff ' + ' '.join\(map\(lambda s: '%02x' % ord\(s\), struct.pack\(' _header.bin + COMMAND cat _header.bin _tmp.dfu >${PROJECT_NAME}.dfu + COMMAND rm -f _tmp.dfu _header.bin + ) + + add_custom_target( + ${PROJECT_NAME}-program + DEPENDS ${PROJECT_NAME}.dfu + COMMAND dfu-util --device 1fc9:000c --alt 0 --download ${PROJECT_NAME}.dfu + ) +endmacro() diff --git a/firmware/hackrf_usb/CMakeLists.txt b/firmware/hackrf_usb/CMakeLists.txt new file mode 100644 index 00000000..a4a0b0ee --- /dev/null +++ b/firmware/hackrf_usb/CMakeLists.txt @@ -0,0 +1,55 @@ +# Copyright 2012 Jared Boone +# +# This file is part of 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. +# + +cmake_minimum_required(VERSION 2.8.9) +set(CMAKE_TOOLCHAIN_FILE ../toolchain-arm-cortex-m.cmake) + +project(hackrf_usb) + +include(../hackrf-common.cmake) + +set(SRC_M4 + hackrf_usb.c + "${PATH_HACKRF_FIRMWARE_COMMON}/tuning.c" + "${PATH_HACKRF_FIRMWARE_COMMON}/streaming.c" + sgpio_isr.c + usb_bulk_buffer.c + "${PATH_HACKRF_FIRMWARE_COMMON}/usb.c" + "${PATH_HACKRF_FIRMWARE_COMMON}/usb_request.c" + "${PATH_HACKRF_FIRMWARE_COMMON}/usb_standard_request.c" + usb_descriptor.c + usb_device.c + usb_endpoint.c + usb_api_board_info.c + usb_api_cpld.c + usb_api_register.c + usb_api_spiflash.c + usb_api_transceiver.c + "${PATH_HACKRF_FIRMWARE_COMMON}/usb_queue.c" + "${PATH_HACKRF_FIRMWARE_COMMON}/fault_handler.c" + "${PATH_HACKRF_FIRMWARE_COMMON}/w25q80bv.c" + "${PATH_HACKRF_FIRMWARE_COMMON}/cpld_jtag.c" + "${PATH_HACKRF_FIRMWARE_COMMON}/xapp058/lenval.c" + "${PATH_HACKRF_FIRMWARE_COMMON}/xapp058/micro.c" + "${PATH_HACKRF_FIRMWARE_COMMON}/xapp058/ports.c" + "${PATH_HACKRF_FIRMWARE_COMMON}/rom_iap.c" +) + +DeclareTargets() diff --git a/firmware/hackrf_usb/Makefile b/firmware/hackrf_usb/Makefile deleted file mode 100644 index 8e302bb2..00000000 --- a/firmware/hackrf_usb/Makefile +++ /dev/null @@ -1,61 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- -# -# Copyright 2012 Jared Boone -# -# This file is part of 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. -# - -ifeq ($(RUN_FROM),RAM) - BINARY = hackrf_usb_ram -else - BINARY = hackrf_usb_rom_to_ram -endif - -SRC_M4_C = hackrf_usb.c \ - ../common/rf_path.c \ - ../common/tuning.c \ - ../common/streaming.c \ - sgpio_isr.c \ - usb_bulk_buffer.c \ - ../common/usb.c \ - ../common/usb_request.c \ - ../common/usb_standard_request.c \ - usb_descriptor.c \ - usb_device.c \ - usb_endpoint.c \ - usb_api_board_info.c \ - usb_api_cpld.c \ - usb_api_register.c \ - usb_api_spiflash.c \ - usb_api_transceiver.c \ - ../common/usb_queue.c \ - ../common/fault_handler.c \ - ../common/hackrf_core.c \ - ../common/sgpio.c \ - ../common/si5351c.c \ - ../common/max2837.c \ - ../common/max5864.c \ - ../common/rffc5071.c \ - ../common/w25q80bv.c \ - ../common/cpld_jtag.c \ - ../common/xapp058/lenval.c \ - ../common/xapp058/micro.c \ - ../common/xapp058/ports.c \ - ../common/rom_iap.c - -include ../common/Makefile_inc.mk diff --git a/firmware/mixertx/CMakeLists.txt b/firmware/mixertx/CMakeLists.txt new file mode 100644 index 00000000..84a911d7 --- /dev/null +++ b/firmware/mixertx/CMakeLists.txt @@ -0,0 +1,32 @@ +# Copyright 2014 Jared Boone +# +# This file is part of 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. +# + +cmake_minimum_required(VERSION 2.8.9) +set(CMAKE_TOOLCHAIN_FILE ../toolchain-arm-cortex-m.cmake) + +project(mixertx) + +include(../hackrf-common.cmake) + +set(SRC_M4 + mixertx.c +) + +DeclareTargets() diff --git a/firmware/mixertx/Makefile b/firmware/mixertx/Makefile deleted file mode 100644 index 0f0ab0f0..00000000 --- a/firmware/mixertx/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- - -BINARY = mixertx - -SRC = $(BINARY).c \ - ../common/hackrf_core.c \ - ../common/rf_path.c \ - ../common/sgpio.c \ - ../common/si5351c.c \ - ../common/max2837.c \ - ../common/max5864.c \ - ../common/rffc5071.c - -include ../common/Makefile_inc.mk diff --git a/firmware/sgpio/Makefile b/firmware/sgpio-rx/CMakeLists.txt similarity index 74% rename from firmware/sgpio/Makefile rename to firmware/sgpio-rx/CMakeLists.txt index d9651279..26d91d0e 100644 --- a/firmware/sgpio/Makefile +++ b/firmware/sgpio-rx/CMakeLists.txt @@ -1,5 +1,3 @@ -# Hey Emacs, this is a -*- makefile -*- -# # Copyright 2012 Jared Boone # # This file is part of HackRF. @@ -20,15 +18,16 @@ # Boston, MA 02110-1301, USA. # -BINARY = sgpio_test +cmake_minimum_required(VERSION 2.8.9) +set(CMAKE_TOOLCHAIN_FILE ../toolchain-arm-cortex-m.cmake) -SRC = $(BINARY).c \ - ../common/hackrf_core.c \ - ../common/rf_path.c \ - ../common/sgpio.c \ - ../common/si5351c.c \ - ../common/max2837.c \ - ../common/max5864.c \ - ../common/rffc5071.c +project(sgpio-rx) -include ../common/Makefile_inc.mk +include(../hackrf-common.cmake) + +set(SRC_M4 + sgpio-rx.c + ${PATH_HACKRF_FIRMWARE_COMMON}/tuning.c +) + +DeclareTargets() diff --git a/firmware/sgpio/CMakeLists.txt b/firmware/sgpio/CMakeLists.txt new file mode 100644 index 00000000..1125ae21 --- /dev/null +++ b/firmware/sgpio/CMakeLists.txt @@ -0,0 +1,32 @@ +# Copyright 2012 Jared Boone +# +# This file is part of 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. +# + +cmake_minimum_required(VERSION 2.8.9) +set(CMAKE_TOOLCHAIN_FILE ../toolchain-arm-cortex-m.cmake) + +project(sgpio_test) + +include(../hackrf-common.cmake) + +set(SRC_M4 + sgpio_test.c +) + +DeclareTargets() diff --git a/firmware/sgpio_passthrough/Makefile b/firmware/sgpio_passthrough/CMakeLists.txt similarity index 79% rename from firmware/sgpio_passthrough/Makefile rename to firmware/sgpio_passthrough/CMakeLists.txt index efaf31b9..80c50612 100644 --- a/firmware/sgpio_passthrough/Makefile +++ b/firmware/sgpio_passthrough/CMakeLists.txt @@ -1,5 +1,3 @@ -# Hey Emacs, this is a -*- makefile -*- -# # Copyright 2012 Jared Boone # Copyright 2012 Benjamin Vernoux # @@ -21,12 +19,15 @@ # Boston, MA 02110-1301, USA. # -BINARY = sgpio_passthrough +cmake_minimum_required(VERSION 2.8.9) +set(CMAKE_TOOLCHAIN_FILE ../toolchain-arm-cortex-m.cmake) -SRC = $(BINARY).c \ - ../common/hackrf_core.c \ - ../common/sgpio.c \ - ../common/si5351c.c \ - ../common/max2837.c +project(sgpio_passthrough) -include ../common/Makefile_inc.mk +include(../hackrf-common.cmake) + +set(SRC_M4 + sgpio_passthrough.c +) + +DeclareTargets() diff --git a/firmware/simpletx/CMakeLists.txt b/firmware/simpletx/CMakeLists.txt new file mode 100644 index 00000000..01f7b394 --- /dev/null +++ b/firmware/simpletx/CMakeLists.txt @@ -0,0 +1,32 @@ +# Copyright 2014 Jared Boone +# +# This file is part of 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. +# + +cmake_minimum_required(VERSION 2.8.9) +set(CMAKE_TOOLCHAIN_FILE ../toolchain-arm-cortex-m.cmake) + +project(simpletx) + +include(../hackrf-common.cmake) + +set(SRC_M4 + simpletx.c +) + +DeclareTargets() diff --git a/firmware/simpletx/Makefile b/firmware/simpletx/Makefile deleted file mode 100644 index 2cfc070d..00000000 --- a/firmware/simpletx/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- - -BINARY = simpletx - -SRC = $(BINARY).c \ - ../common/hackrf_core.c \ - ../common/rf_path.c \ - ../common/sgpio.c \ - ../common/si5351c.c \ - ../common/max2837.c \ - ../common/max5864.c \ - ../common/rffc5071.c - -include ../common/Makefile_inc.mk diff --git a/firmware/blinky/Makefile b/firmware/spiflash/CMakeLists.txt similarity index 75% rename from firmware/blinky/Makefile rename to firmware/spiflash/CMakeLists.txt index 57f3e7a2..160caa37 100644 --- a/firmware/blinky/Makefile +++ b/firmware/spiflash/CMakeLists.txt @@ -1,5 +1,3 @@ -# Hey Emacs, this is a -*- makefile -*- -# # Copyright 2012 Michael Ossmann # Copyright 2012 Jared Boone # @@ -21,15 +19,16 @@ # Boston, MA 02110-1301, USA. # -BINARY = blinky +cmake_minimum_required(VERSION 2.8.9) +set(CMAKE_TOOLCHAIN_FILE ../toolchain-arm-cortex-m.cmake) -SRC = $(BINARY).c \ - ../common/hackrf_core.c \ - ../common/sgpio.c \ - ../common/rf_path.c \ - ../common/si5351c.c \ - ../common/max2837.c \ - ../common/max5864.c \ - ../common/rffc5071.c +project(spiflash) -include ../common/Makefile_inc.mk +include(../hackrf-common.cmake) + +set(SRC_M4 + spiflash.c + "${PATH_HACKRF_FIRMWARE_COMMON}/w25q80bv.c" +) + +DeclareTargets() diff --git a/firmware/startup/CMakeLists.txt b/firmware/startup/CMakeLists.txt new file mode 100644 index 00000000..28e1a3f4 --- /dev/null +++ b/firmware/startup/CMakeLists.txt @@ -0,0 +1,32 @@ +# Copyright 2014 Jared Boone +# +# This file is part of 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. +# + +cmake_minimum_required(VERSION 2.8.9) +set(CMAKE_TOOLCHAIN_FILE ../toolchain-arm-cortex-m.cmake) + +project(startup) + +include(../hackrf-common.cmake) + +set(SRC_M4 + startup.c +) + +DeclareTargets() diff --git a/firmware/startup/Makefile b/firmware/startup/Makefile deleted file mode 100644 index 0895e670..00000000 --- a/firmware/startup/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- - -BINARY = startup - -SRC = $(BINARY).c \ - ../common/hackrf_core.c \ - ../common/rf_path.c \ - ../common/sgpio.c \ - ../common/si5351c.c \ - ../common/max2837.c \ - ../common/max5864.c \ - ../common/rffc5071.c - -include ../common/Makefile_inc.mk diff --git a/firmware/startup_systick/CMakeLists.txt b/firmware/startup_systick/CMakeLists.txt new file mode 100644 index 00000000..f2190caf --- /dev/null +++ b/firmware/startup_systick/CMakeLists.txt @@ -0,0 +1,32 @@ +# Copyright 2014 Jared Boone +# +# This file is part of 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. +# + +cmake_minimum_required(VERSION 2.8.9) +set(CMAKE_TOOLCHAIN_FILE ../toolchain-arm-cortex-m.cmake) + +project(startup_systick) + +include(../hackrf-common.cmake) + +set(SRC_M4 + startup_systick.c +) + +DeclareTargets() diff --git a/firmware/startup_systick/Makefile b/firmware/startup_systick/Makefile deleted file mode 100644 index e98f315c..00000000 --- a/firmware/startup_systick/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- - -BINARY = startup_systick - -SRC = $(BINARY).c \ - ../common/hackrf_core.c \ - ../common/rf_path.c \ - ../common/sgpio.c \ - ../common/si5351c.c \ - ../common/max2837.c \ - ../common/max5864.c \ - ../common/rffc5071.c - -include ../common/Makefile_inc.mk diff --git a/firmware/startup_systick_perfo/CMakeLists.txt b/firmware/startup_systick_perfo/CMakeLists.txt new file mode 100644 index 00000000..6d8905d1 --- /dev/null +++ b/firmware/startup_systick_perfo/CMakeLists.txt @@ -0,0 +1,33 @@ +# Copyright 2014 Jared Boone +# +# This file is part of 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. +# + +cmake_minimum_required(VERSION 2.8.9) +set(CMAKE_TOOLCHAIN_FILE ../toolchain-arm-cortex-m.cmake) + +project(startup_systick_perfo_SPIFI) + +include(../hackrf-common.cmake) + +set(SRC_M4 + startup_systick.c + perf_mips.c +) + +DeclareTargets() diff --git a/firmware/startup_systick_perfo/Makefile b/firmware/startup_systick_perfo/Makefile deleted file mode 100644 index 9874184e..00000000 --- a/firmware/startup_systick_perfo/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# Hey Emacs, this is a -*- makefile -*- - -BINARY = startup_systick_perfo_SPIFI - -SRC = startup_systick.c \ - perf_mips.c \ - ../common/hackrf_core.c \ - ../common/rf_path.c \ - ../common/sgpio.c \ - ../common/si5351c.c \ - ../common/max2837.c \ - ../common/max5864.c \ - ../common/rffc5071.c - -include ../common/Makefile_inc.mk diff --git a/firmware/toolchain-arm-cortex-m.cmake b/firmware/toolchain-arm-cortex-m.cmake new file mode 100644 index 00000000..65ddb1c4 --- /dev/null +++ b/firmware/toolchain-arm-cortex-m.cmake @@ -0,0 +1,54 @@ +# Copyright 2014 Jared Boone +# +# This file is part of 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)