diff options
author | Marti Bolivar <mbolivar@leaflabs.com> | 2012-06-26 18:24:49 -0400 |
---|---|---|
committer | Marti Bolivar <mbolivar@leaflabs.com> | 2012-06-26 18:32:57 -0400 |
commit | f005bd3a5c087e3d5559f2858a1e7898a4f92a8d (patch) | |
tree | 0701628a68056f7b5f92d5a5af5f281f58e6a71e /Makefile | |
parent | 761e059962e8f53f3cceef61d65bf2bf3025319a (diff) | |
parent | c6073e4886da4606679bc3e9d770c9cff9390597 (diff) | |
download | librambutan-f005bd3a5c087e3d5559f2858a1e7898a4f92a8d.tar.gz librambutan-f005bd3a5c087e3d5559f2858a1e7898a4f92a8d.zip |
Merge branch 'wip-family-support'
Merge the long-lived (too long; future changes like these will need to
proceed more incrementally) development branch of libmaple, containing
experimental STM32F2 and STM32F1 value line support, into master.
This required many changes to the structure of the library. The most
important structural reorganizations occurred in:
- 954f9e5: moves public headers to include directories
- 3efa313: uses "series" instead of "family"
- c0d60e3: adds board files to the build system, to make it easier to
add new boards
- 096d86c: adds build logic for targeting different STM32 series
(e.g. STM32F1, STM32F2)
This last commit in particular (096d86c) is the basis for the
repartitioning of libmaple into portable sections, which work on all
supported MCUs, and nonportable sections, which are segregated into
separate directories and contain all series-specific code. Moving
existing STM32F1-only code into libmaple/stm32f1 and wirish/stm32f1,
along with adding equivalents under .../stm32f2 directories, was the
principal project of this branch.
Important API changes occur in several places. Existing code is still
expected to work on STM32F1 targets, but there have been many
deprecations. A detailed changelog explaining the situation needs to
be prepared.
F2 and F1 value line support is not complete; the merge is proceeding
prematurely in this respect. We've been getting more libmaple patches
from the community lately, and I'm worried that the merge conflicts
with the old tree structure will become painful to manage.
Conflicts:
Makefile
Resolved Makefile conflicts manually; this required propagating
-Xlinker usage into support/make/target-config.mk.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 112 |
1 files changed, 58 insertions, 54 deletions
@@ -19,10 +19,7 @@ SUPPORT_PATH := $(SRCROOT)/support LDDIR := $(SUPPORT_PATH)/ld # Support files for this Makefile MAKEDIR := $(SUPPORT_PATH)/make - -# USB ID for DFU upload -VENDOR_ID := 1EAF -PRODUCT_ID := 0003 +BOARD_INCLUDE_DIR := $(MAKEDIR)/board-includes ## ## Target-specific configuration. This determines some compiler and @@ -41,40 +38,42 @@ include $(MAKEDIR)/target-config.mk ## Compilation flags ## -GLOBAL_FLAGS := -D$(VECT_BASE_ADDR) \ - -DBOARD_$(BOARD) -DMCU_$(MCU) \ - -DERROR_LED_PORT=$(ERROR_LED_PORT) \ - -DERROR_LED_PIN=$(ERROR_LED_PIN) \ - -D$(DENSITY) +# FIXME: the following allows for deprecated include style, e.g.: +# #include "libmaple.h" +# or +# #include "wirish.h" +# It slows compilation noticeably; remove after 1 release. +TARGET_FLAGS += -I$(LIBMAPLE_PATH)/include/libmaple \ + -I$(WIRISH_PATH)/include/wirish GLOBAL_CFLAGS := -Os -g3 -gdwarf-2 -mcpu=cortex-m3 -mthumb -march=armv7-m \ -nostdlib -ffunction-sections -fdata-sections \ - -Wl,--gc-sections $(GLOBAL_FLAGS) -GLOBAL_CXXFLAGS := -fno-rtti -fno-exceptions -Wall $(GLOBAL_FLAGS) + -Wl,--gc-sections $(TARGET_FLAGS) +GLOBAL_CXXFLAGS := -fno-rtti -fno-exceptions -Wall $(TARGET_FLAGS) GLOBAL_ASFLAGS := -mcpu=cortex-m3 -march=armv7-m -mthumb \ - -x assembler-with-cpp $(GLOBAL_FLAGS) -LDFLAGS = -T$(LDDIR)/$(LDSCRIPT) -L$(LDDIR) \ - -mcpu=cortex-m3 -mthumb -Xlinker -L $(LD_FAMILY_PATH) \ - -Xlinker --gc-sections -Xlinker --print-gc-sections \ - -Xassembler --march=armv7-m -Wall + -x assembler-with-cpp $(TARGET_FLAGS) +LDFLAGS = $(TARGET_LDFLAGS) -mcpu=cortex-m3 -mthumb \ + -Xlinker --gc-sections -Xlinker --print-gc-sections \ + -Xassembler --march=armv7-m -Wall ## ## Build rules and useful templates ## -include $(SUPPORT_PATH)/make/build-rules.mk -include $(SUPPORT_PATH)/make/build-templates.mk +include $(MAKEDIR)/build-rules.mk +include $(MAKEDIR)/build-templates.mk ## ## Set all submodules here ## LIBMAPLE_MODULES += $(SRCROOT)/libmaple -LIBMAPLE_MODULES += $(LIBMAPLE_MODULE_FAMILY) # family submodule in libmaple +LIBMAPLE_MODULES += $(SRCROOT)/libmaple/usb # The USB module is kept separate +LIBMAPLE_MODULES += $(LIBMAPLE_MODULE_SERIES) # STM32 series submodule in libmaple LIBMAPLE_MODULES += $(SRCROOT)/wirish + # Official libraries: LIBMAPLE_MODULES += $(SRCROOT)/libraries/Servo LIBMAPLE_MODULES += $(SRCROOT)/libraries/LiquidCrystal LIBMAPLE_MODULES += $(SRCROOT)/libraries/Wire - # Experimental libraries: LIBMAPLE_MODULES += $(SRCROOT)/libraries/FreeRTOS @@ -93,16 +92,18 @@ $(foreach m,$(LIBMAPLE_MODULES),$(eval $(call LIBMAPLE_MODULE_template,$(m)))) # main target include $(SRCROOT)/build-targets.mk -.PHONY: install sketch clean help debug cscope tags ctags ram flash jtag doxygen mrproper +.PHONY: install sketch clean help cscope tags ctags ram flash jtag doxygen mrproper list-boards # Target upload commands +# USB ID for DFU upload -- FIXME: do something smarter with this +BOARD_USB_VENDOR_ID := 1EAF +BOARD_USB_PRODUCT_ID := 0003 UPLOAD_ram := $(SUPPORT_PATH)/scripts/reset.py && \ sleep 1 && \ - $(DFU) -a0 -d $(VENDOR_ID):$(PRODUCT_ID) -D $(BUILD_PATH)/$(BOARD).bin -R + $(DFU) -a0 -d $(BOARD_USB_VENDOR_ID):$(BOARD_USB_PRODUCT_ID) -D $(BUILD_PATH)/$(BOARD).bin -R UPLOAD_flash := $(SUPPORT_PATH)/scripts/reset.py && \ sleep 1 && \ - $(DFU) -a1 -d $(VENDOR_ID):$(PRODUCT_ID) -D $(BUILD_PATH)/$(BOARD).bin -R -UPLOAD_jtag := $(OPENOCD_WRAPPER) flash + $(DFU) -a1 -d $(BOARD_USB_VENDOR_ID):$(BOARD_USB_PRODUCT_ID) -D $(BUILD_PATH)/$(BOARD).bin -R # Conditionally upload to whatever the last build was install: INSTALL_TARGET = $(shell cat $(BUILD_PATH)/build-type 2>/dev/null) @@ -127,38 +128,37 @@ mrproper: clean help: @echo "" - @echo " libmaple Makefile help" - @echo " ----------------------" - @echo " " - @echo " Programming targets:" - @echo " sketch: Compile for BOARD to MEMORY_TARGET (default)." - @echo " install: Compile and upload code over USB, using Maple bootloader" - @echo " " - @echo " You *must* set BOARD if not compiling for Maple (e.g." - @echo " use BOARD=maple_mini for mini, etc.), and MEMORY_TARGET" - @echo " if not compiling to Flash." - @echo " " - @echo " Valid BOARDs:" - @echo " maple, maple_mini, maple_RET6, maple_native" - @echo " " - @echo " Valid MEMORY_TARGETs (default=flash):" - @echo " ram: Compile sketch code to ram" - @echo " flash: Compile sketch code to flash" - @echo " jtag: Compile sketch code for jtag; overwrites bootloader" - @echo " " - @echo " Other targets:" - @echo " debug: Start OpenOCD gdb server on port 3333, telnet on port 4444" - @echo " clean: Remove all build and object files" - @echo " help: Show this message" - @echo " doxygen: Build Doxygen HTML and XML documentation" - @echo " mrproper: Remove all generated files" - @echo " " - -debug: - $(OPENOCD_WRAPPER) debug + @echo "Basic usage (BOARD defaults to maple):" + @echo " $$ cp your-main.cpp main.cpp" + @echo " $$ make BOARD=your_board" + @echo " $$ make BOARD=your_board install" + @echo "" + @echo "(Multiple source files? Link with libmaple.a (\`$$ make library')" + @echo "or hack build-targets.mk appropriately.)" + @echo "" + @echo "Important targets:" + @echo " sketch: Compile for BOARD to MEMORY_TARGET (default)." + @echo " install: Compile and upload over USB using Maple bootloader" + @echo "" + @echo "You *must* set BOARD if not compiling for Maple (e.g." + @echo "use BOARD=maple_mini for mini, etc.), and MEMORY_TARGET" + @echo "if not compiling to Flash. Run \`$$ make list-boards' for" + @echo "a list of all boards." + @echo "" + @echo "Valid MEMORY_TARGETs (default=flash):" + @echo " ram: Compile to RAM (doesn't touch Flash)" + @echo " flash: Compile to Flash (for Maple bootloader)" + @echo " jtag: Compile for JTAG/SWD upload (overwrites bootloader)" + @echo "" + @echo "Other targets:" + @echo " clean: Remove all build and object files" + @echo " doxygen: Build Doxygen HTML and XML documentation" + @echo " help: Show this message" + @echo " mrproper: Remove all generated files" + @echo "" cscope: - rm -rf *.cscope + rm -rf cscope.* find . -name '*.[hcS]' -o -name '*.cpp' | xargs cscope -b tags: @@ -180,3 +180,7 @@ jtag: doxygen: doxygen $(SUPPORT_PATH)/doxygen/Doxyfile + +# This output is kind of ugly, but I don't understand make very well. +list-boards: + @echo " $(addsuffix "\\n",$(basename $(notdir $(wildcard $(BOARD_INCLUDE_DIR)/*.mk))))" |