Browse Source

toolchain: add toolchain files for new MCUs & simplify makefile

pull/28/head
gkostka 8 years ago
parent
commit
2a4f69fbab
  1. 83
      Makefile
  2. 9
      toolchain/cortex-m0+.cmake
  3. 2
      toolchain/cortex-m4.cmake
  4. 9
      toolchain/cortex-m4f.cmake
  5. 9
      toolchain/cortex-m7.cmake

83
Makefile

@ -20,72 +20,55 @@ COMMON_DEFINITIONS = \
-DVERSION_PATCH=$(VERSION_PATCH) \
-DVERSION=$(VERSION) \
define generate_common
rm -R -f build_$(1)
mkdir build_$(1)
cd build_$(1) && cmake -G"Unix Makefiles" \
$(COMMON_DEFINITIONS) \
$(2) \
-DCMAKE_TOOLCHAIN_FILE=../toolchain/$(1).cmake ..
endef
generic:
rm -R -f build_generic
mkdir build_generic
cd build_generic && cmake -G"Unix Makefiles" \
$(COMMON_DEFINITIONS) \
-DCMAKE_TOOLCHAIN_FILE=../toolchain/generic.cmake ..
mingw:
rm -R -f build_mingw
mkdir build_mingw
cd build_mingw && cmake -G"Unix Makefiles" \
$(COMMON_DEFINITIONS) \
-DWIN32=1 \
-DCMAKE_TOOLCHAIN_FILE=../toolchain/mingw.cmake ..
avrxmega7:
rm -R -f build_avrxmega7
mkdir build_avrxmega7
cd build_avrxmega7 && cmake -G"Unix Makefiles" \
$(COMMON_DEFINITIONS) \
-DCMAKE_TOOLCHAIN_FILE=../toolchain/avrxmega7.cmake ..
msp430:
rm -R -f build_msp430
mkdir build_msp430
cd build_msp430 && cmake -G"Unix Makefiles" \
$(COMMON_DEFINITIONS) \
-DCMAKE_TOOLCHAIN_FILE=../toolchain/msp430.cmake ..
$(call generate_common,$@)
cortex-m0:
rm -R -f build_cortex-m0
mkdir build_cortex-m0
cd build_cortex-m0 && cmake -G"Unix Makefiles" \
$(COMMON_DEFINITIONS) \
-DCMAKE_TOOLCHAIN_FILE=../toolchain/cortex-m0.cmake ..
$(call generate_common,$@)
cortex-m0+:
$(call generate_common,$@)
cortex-m3:
rm -R -f build_cortex-m3
mkdir build_cortex-m3
cd build_cortex-m3 && cmake -G"Unix Makefiles" \
$(COMMON_DEFINITIONS) \
-DCMAKE_TOOLCHAIN_FILE=../toolchain/cortex-m3.cmake ..
$(call generate_common,$@)
cortex-m4:
rm -R -f build_cortex-m4
mkdir build_cortex-m4
cd build_cortex-m4 && cmake -G"Unix Makefiles" \
$(COMMON_DEFINITIONS) \
-DCMAKE_TOOLCHAIN_FILE=../toolchain/cortex-m4.cmake ..
$(call generate_common,$@)
cortex-m4f:
$(call generate_common,$@)
cortex-m7:
$(call generate_common,$@)
arm-sim:
rm -R -f build_arm-sim
mkdir build_arm-sim
cd build_arm-sim && cmake -G"Unix Makefiles" \
$(COMMON_DEFINITIONS) \
-DCMAKE_TOOLCHAIN_FILE=../toolchain/arm-sim.cmake ..
$(call generate_common,$@)
avrxmega7:
$(call generate_common,$@)
msp430:
$(call generate_common,$@)
mingw:
$(call generate_common,$@,-DWIN32=1)
lib_only:
rm -R -f build_lib_only
mkdir build_lib_only
cd build_lib_only && cmake $(COMMON_DEFINITIONS) -DLIB_ONLY=TRUE ..
all: generic bf518 cortex-m3 cortex-m4 lib_only
all:
generic
clean:
rm -R -f build_*

9
toolchain/cortex-m0+.cmake

@ -0,0 +1,9 @@
# Name of the target
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR cortex-m0)
set(MCPU_FLAGS "-mthumb -mcpu=cortex-m0plus")
set(VFP_FLAGS "")
set(LD_FLAGS "-nostartfiles")
include(${CMAKE_CURRENT_LIST_DIR}/common/arm-none-eabi.cmake)

2
toolchain/cortex-m4.cmake

@ -3,7 +3,7 @@ set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR cortex-m4)
set(MCPU_FLAGS "-mthumb -mcpu=cortex-m4")
set(VFP_FLAGS "-mfloat-abi=hard -mfpu=fpv4-sp-d16")
set(VFP_FLAGS "")
set(LD_FLAGS "-nostartfiles")
include(${CMAKE_CURRENT_LIST_DIR}/common/arm-none-eabi.cmake)

9
toolchain/cortex-m4f.cmake

@ -0,0 +1,9 @@
# Name of the target
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR cortex-m4)
set(MCPU_FLAGS "-mthumb -mcpu=cortex-m4")
set(VFP_FLAGS "-mfloat-abi=hard -mfpu=fpv4-sp-d16")
set(LD_FLAGS "-nostartfiles")
include(${CMAKE_CURRENT_LIST_DIR}/common/arm-none-eabi.cmake)

9
toolchain/cortex-m7.cmake

@ -0,0 +1,9 @@
# Name of the target
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR cortex-m4)
set(MCPU_FLAGS "-mthumb -mcpu=cortex-m7")
set(VFP_FLAGS "-mfloat-abi=hard -mfpu=fpv4-sp-d16")
set(LD_FLAGS "-nostartfiles")
include(${CMAKE_CURRENT_LIST_DIR}/common/arm-none-eabi.cmake)
Loading…
Cancel
Save