shithub: lwext4

Download patch

ref: 2a4f69fbabf98920717366cd574f0d4aba1aa3a1
parent: dd3f008d8931f870814d139c4b61852cc4d449cb
author: gkostka <kostka.grzegorz@gmail.com>
date: Wed Apr 19 13:55:46 EDT 2017

toolchain: add toolchain files for new MCUs & simplify makefile

--- a/Makefile
+++ b/Makefile
@@ -20,72 +20,55 @@
 	-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 ..
+	$(call generate_common,$@)
 
-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 ..
-
-
 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_*
--- /dev/null
+++ b/toolchain/cortex-m0+.cmake
@@ -1,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)
\ No newline at end of file
--- a/toolchain/cortex-m4.cmake
+++ b/toolchain/cortex-m4.cmake
@@ -3,7 +3,7 @@
 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)
\ No newline at end of file
--- /dev/null
+++ b/toolchain/cortex-m4f.cmake
@@ -1,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)
\ No newline at end of file
--- /dev/null
+++ b/toolchain/cortex-m7.cmake
@@ -1,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)
\ No newline at end of file