2011-09-13 07:32:09 +02:00
|
|
|
# Try "make help" first
|
2010-08-31 21:21:09 +02:00
|
|
|
|
2011-09-13 07:32:09 +02:00
|
|
|
.DEFAULT_GOAL := sketch
|
make: Modularize makefiles, add dependency tracking, build-type tracking
Major build system rewrite. New and exciting:
1. Proper dependency tracking. All source files including header files
should be properly tracked and recompiled as necessary when they are
changed.
2. Build-type tracking. If the target changes from 'ram' to 'flash,'
for example, the build system will force a rebuild rather than
incorrectly link modules to a different address.
3. New targets:
The old 'ram,' 'flash,' and 'jtag' targets have been replaced with
the environment variable MAPLE_TARGET, which controls the link address.
Users can either export it to their environment, or pass MAPLE_TARGET on
the command-line. Once this is set, sketches can be compiled with 'make
sketch,' or simply 'make.'
Note: the default is MAPLE_TARGET='flash.'
The target 'install' now automagically uploads the sketch to the board
using the appropriate method.
The 'run' target has been renamed to 'debug.' It starts an openocd gdb
server.
4. Odds and ends:
-Verbose and 'quiet' modes. Set V=1 for verbose compilation, the default
is quiet.
-Object file sizes and disassembly information is generated and placed
in build/$(BOARD).sizes and build/$(BOARD).disas, respectively.
-Parallel make with -j should speed things up if you have multiple
cores.
2010-06-24 17:16:26 +02:00
|
|
|
|
2011-09-13 07:32:09 +02:00
|
|
|
##
|
|
|
|
## Useful paths, constants, etc.
|
|
|
|
##
|
2011-04-01 08:33:53 +02:00
|
|
|
|
2010-08-30 02:29:31 +02:00
|
|
|
ifeq ($(LIB_MAPLE_HOME),)
|
2010-09-02 23:39:52 +02:00
|
|
|
SRCROOT := .
|
2010-08-30 02:29:31 +02:00
|
|
|
else
|
|
|
|
SRCROOT := $(LIB_MAPLE_HOME)
|
|
|
|
endif
|
make: Modularize makefiles, add dependency tracking, build-type tracking
Major build system rewrite. New and exciting:
1. Proper dependency tracking. All source files including header files
should be properly tracked and recompiled as necessary when they are
changed.
2. Build-type tracking. If the target changes from 'ram' to 'flash,'
for example, the build system will force a rebuild rather than
incorrectly link modules to a different address.
3. New targets:
The old 'ram,' 'flash,' and 'jtag' targets have been replaced with
the environment variable MAPLE_TARGET, which controls the link address.
Users can either export it to their environment, or pass MAPLE_TARGET on
the command-line. Once this is set, sketches can be compiled with 'make
sketch,' or simply 'make.'
Note: the default is MAPLE_TARGET='flash.'
The target 'install' now automagically uploads the sketch to the board
using the appropriate method.
The 'run' target has been renamed to 'debug.' It starts an openocd gdb
server.
4. Odds and ends:
-Verbose and 'quiet' modes. Set V=1 for verbose compilation, the default
is quiet.
-Object file sizes and disassembly information is generated and placed
in build/$(BOARD).sizes and build/$(BOARD).disas, respectively.
-Parallel make with -j should speed things up if you have multiple
cores.
2010-06-24 17:16:26 +02:00
|
|
|
BUILD_PATH = build
|
2010-08-30 02:29:31 +02:00
|
|
|
LIBMAPLE_PATH := $(SRCROOT)/libmaple
|
2011-09-14 20:18:13 +02:00
|
|
|
WIRISH_PATH := $(SRCROOT)/wirish
|
2010-08-30 02:29:31 +02:00
|
|
|
SUPPORT_PATH := $(SRCROOT)/support
|
2012-08-31 22:12:14 +02:00
|
|
|
LIBRARIES_PATH := $(SRCROOT)/libraries
|
2011-09-13 07:32:09 +02:00
|
|
|
# Support files for linker
|
|
|
|
LDDIR := $(SUPPORT_PATH)/ld
|
|
|
|
# Support files for this Makefile
|
|
|
|
MAKEDIR := $(SUPPORT_PATH)/make
|
2012-06-07 07:18:01 +02:00
|
|
|
BOARD_INCLUDE_DIR := $(MAKEDIR)/board-includes
|
2011-09-13 07:32:09 +02:00
|
|
|
|
|
|
|
##
|
|
|
|
## Target-specific configuration. This determines some compiler and
|
|
|
|
## linker options/flags.
|
|
|
|
##
|
|
|
|
|
|
|
|
# Try "make help" for more information on BOARD and MEMORY_TARGET;
|
|
|
|
# these default to a Maple Flash build.
|
|
|
|
BOARD ?= maple
|
|
|
|
MEMORY_TARGET ?= flash
|
|
|
|
|
|
|
|
# $(BOARD)- and $(MEMORY_TARGET)-specific configuration
|
|
|
|
include $(MAKEDIR)/target-config.mk
|
|
|
|
|
2012-08-05 18:59:36 +02:00
|
|
|
##
|
|
|
|
## Build rules and useful templates
|
|
|
|
##
|
|
|
|
|
|
|
|
include $(MAKEDIR)/build-rules.mk
|
|
|
|
include $(MAKEDIR)/build-templates.mk
|
|
|
|
|
2011-09-13 07:32:09 +02:00
|
|
|
##
|
|
|
|
## Compilation flags
|
|
|
|
##
|
make: Modularize makefiles, add dependency tracking, build-type tracking
Major build system rewrite. New and exciting:
1. Proper dependency tracking. All source files including header files
should be properly tracked and recompiled as necessary when they are
changed.
2. Build-type tracking. If the target changes from 'ram' to 'flash,'
for example, the build system will force a rebuild rather than
incorrectly link modules to a different address.
3. New targets:
The old 'ram,' 'flash,' and 'jtag' targets have been replaced with
the environment variable MAPLE_TARGET, which controls the link address.
Users can either export it to their environment, or pass MAPLE_TARGET on
the command-line. Once this is set, sketches can be compiled with 'make
sketch,' or simply 'make.'
Note: the default is MAPLE_TARGET='flash.'
The target 'install' now automagically uploads the sketch to the board
using the appropriate method.
The 'run' target has been renamed to 'debug.' It starts an openocd gdb
server.
4. Odds and ends:
-Verbose and 'quiet' modes. Set V=1 for verbose compilation, the default
is quiet.
-Object file sizes and disassembly information is generated and placed
in build/$(BOARD).sizes and build/$(BOARD).disas, respectively.
-Parallel make with -j should speed things up if you have multiple
cores.
2010-06-24 17:16:26 +02:00
|
|
|
|
Move public headers to include directories; related cleanups.
Move libmaple/*.h to (new) libmaple/include/libmaple/. The new
accepted way to include a libmaple header foo.h is with:
#include <libmaple/foo.h>
This is more polite in terms of the include namespace. It also allows
us to e.g. implement the Arduino SPI library at all (which has header
SPI.h; providing it was previously impossible on case-insensitive
filesystems due to libmaple's spi.h).
Similarly for Wirish.
The old include style (#include "header.h") is now deprecated.
libmaple/*.h:
- Change include guard #defines from _FOO_H_ to _LIBMAPLE_FOO_H_.
- Add license headers where they're missing
- Add conditional extern "C" { ... } blocks where they're missing
(they aren't always necessary, but we might was well do it against
the future, while we're at it.).
- Change includes from #include "foo.h" to #include <libmaple/foo.h>.
- Move includes after extern "C".
- Remove extra trailing newlines
Note that this doesn't include the headers under libmaple/usb/ or
libmaple/usb/usb_lib. These will get fixed later.
libmaple/*.c:
- Change includes from #include "foo.h" to #include <libmaple/foo.h>.
Makefile:
- Add I$(LIBMAPLE_PATH)/include/libmaple to GLOBAL_FLAGS. This allows
for users (including Wirish) to migrate their code, but should go
away ASAP, since it slows down compilation.
Wirish:
- Move wirish/**/*.h to (new) wirish/include/wirish/. This ignores
the USB headers, which, as usual, are getting handled after
everything else.
- Similarly generify wirish/boards/ structure. For each supported
board "foo", move wirish/boards/foo.h and wirish/boards/foo.cpp to
wirish/boards/foo/include/board/board.h and
wirish/boards/foo/board.cpp, respectively. Also remove the #ifdef
hacks around the .cpp files.
- wirish/rules.mk: put wirish/boards/foo/include in the include path
(and add wirish/boards/foo/board.cpp to the list of sources to be
compiled). This allows saying:
#include <board/board.h>
instead of the hack currently in place. We can allow the user to
override this setting later to make adding custom board definitions
easier.
- Disable -Werror in libmaple/rules.mk, as the current USB warnings
don't let the olimex_stm32_h103 board compile. We can re-enable
-Werror once we've moved the board-specific bits out of libmaple
proper.
libraries, examples:
- Update includes accordingly.
- Miscellaneous cosmetic fixups.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2011-11-15 18:45:43 +01:00
|
|
|
# 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.
|
2011-11-21 23:12:45 +01:00
|
|
|
TARGET_FLAGS += -I$(LIBMAPLE_PATH)/include/libmaple \
|
Move public headers to include directories; related cleanups.
Move libmaple/*.h to (new) libmaple/include/libmaple/. The new
accepted way to include a libmaple header foo.h is with:
#include <libmaple/foo.h>
This is more polite in terms of the include namespace. It also allows
us to e.g. implement the Arduino SPI library at all (which has header
SPI.h; providing it was previously impossible on case-insensitive
filesystems due to libmaple's spi.h).
Similarly for Wirish.
The old include style (#include "header.h") is now deprecated.
libmaple/*.h:
- Change include guard #defines from _FOO_H_ to _LIBMAPLE_FOO_H_.
- Add license headers where they're missing
- Add conditional extern "C" { ... } blocks where they're missing
(they aren't always necessary, but we might was well do it against
the future, while we're at it.).
- Change includes from #include "foo.h" to #include <libmaple/foo.h>.
- Move includes after extern "C".
- Remove extra trailing newlines
Note that this doesn't include the headers under libmaple/usb/ or
libmaple/usb/usb_lib. These will get fixed later.
libmaple/*.c:
- Change includes from #include "foo.h" to #include <libmaple/foo.h>.
Makefile:
- Add I$(LIBMAPLE_PATH)/include/libmaple to GLOBAL_FLAGS. This allows
for users (including Wirish) to migrate their code, but should go
away ASAP, since it slows down compilation.
Wirish:
- Move wirish/**/*.h to (new) wirish/include/wirish/. This ignores
the USB headers, which, as usual, are getting handled after
everything else.
- Similarly generify wirish/boards/ structure. For each supported
board "foo", move wirish/boards/foo.h and wirish/boards/foo.cpp to
wirish/boards/foo/include/board/board.h and
wirish/boards/foo/board.cpp, respectively. Also remove the #ifdef
hacks around the .cpp files.
- wirish/rules.mk: put wirish/boards/foo/include in the include path
(and add wirish/boards/foo/board.cpp to the list of sources to be
compiled). This allows saying:
#include <board/board.h>
instead of the hack currently in place. We can allow the user to
override this setting later to make adding custom board definitions
easier.
- Disable -Werror in libmaple/rules.mk, as the current USB warnings
don't let the olimex_stm32_h103 board compile. We can re-enable
-Werror once we've moved the board-specific bits out of libmaple
proper.
libraries, examples:
- Update includes accordingly.
- Miscellaneous cosmetic fixups.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
2011-11-15 18:45:43 +01:00
|
|
|
-I$(WIRISH_PATH)/include/wirish
|
2012-08-31 22:12:14 +02:00
|
|
|
TARGET_FLAGS += -I$(LIBRARIES_PATH) # for internal lib. includes, e.g. <Wire/WireBase.h>
|
2012-08-05 20:39:34 +02:00
|
|
|
GLOBAL_CFLAGS := -Os -g3 -gdwarf-2 -nostdlib \
|
|
|
|
-ffunction-sections -fdata-sections \
|
2011-11-21 23:12:45 +01:00
|
|
|
-Wl,--gc-sections $(TARGET_FLAGS)
|
|
|
|
GLOBAL_CXXFLAGS := -fno-rtti -fno-exceptions -Wall $(TARGET_FLAGS)
|
2012-08-05 20:39:34 +02:00
|
|
|
GLOBAL_ASFLAGS := -x assembler-with-cpp $(TARGET_FLAGS)
|
2012-08-05 19:27:13 +02:00
|
|
|
LDFLAGS = $(TARGET_LDFLAGS) $(TOOLCHAIN_LDFLAGS) -mcpu=cortex-m3 -mthumb \
|
2012-06-27 05:17:20 +02:00
|
|
|
-Xlinker --gc-sections \
|
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>
2012-06-27 00:24:49 +02:00
|
|
|
-Xassembler --march=armv7-m -Wall
|
2012-06-27 05:17:20 +02:00
|
|
|
# -Xlinker --print-gc-sections \
|
|
|
|
|
2011-09-13 07:32:09 +02:00
|
|
|
##
|
|
|
|
## Set all submodules here
|
|
|
|
##
|
|
|
|
|
2012-06-15 05:43:48 +02:00
|
|
|
LIBMAPLE_MODULES += $(SRCROOT)/libmaple
|
2012-06-03 12:00:41 +02:00
|
|
|
LIBMAPLE_MODULES += $(SRCROOT)/libmaple/usb # The USB module is kept separate
|
2011-11-29 08:06:33 +01:00
|
|
|
LIBMAPLE_MODULES += $(LIBMAPLE_MODULE_SERIES) # STM32 series submodule in libmaple
|
2010-08-30 02:29:31 +02:00
|
|
|
LIBMAPLE_MODULES += $(SRCROOT)/wirish
|
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>
2012-06-27 00:24:49 +02:00
|
|
|
|
2010-12-27 23:09:34 +01:00
|
|
|
# Official libraries:
|
2011-04-01 07:01:22 +02:00
|
|
|
LIBMAPLE_MODULES += $(SRCROOT)/libraries/Servo
|
2010-12-27 23:09:34 +01:00
|
|
|
LIBMAPLE_MODULES += $(SRCROOT)/libraries/LiquidCrystal
|
|
|
|
LIBMAPLE_MODULES += $(SRCROOT)/libraries/Wire
|
2011-06-21 17:02:06 +02:00
|
|
|
# Experimental libraries:
|
|
|
|
LIBMAPLE_MODULES += $(SRCROOT)/libraries/FreeRTOS
|
|
|
|
|
2012-06-15 05:43:48 +02:00
|
|
|
# User modules:
|
|
|
|
ifneq ($(USER_MODULES),)
|
|
|
|
LIBMAPLE_MODULES += $(USER_MODULES)
|
|
|
|
endif
|
|
|
|
|
2011-09-13 07:32:09 +02:00
|
|
|
# Call each module's rules.mk:
|
make: Modularize makefiles, add dependency tracking, build-type tracking
Major build system rewrite. New and exciting:
1. Proper dependency tracking. All source files including header files
should be properly tracked and recompiled as necessary when they are
changed.
2. Build-type tracking. If the target changes from 'ram' to 'flash,'
for example, the build system will force a rebuild rather than
incorrectly link modules to a different address.
3. New targets:
The old 'ram,' 'flash,' and 'jtag' targets have been replaced with
the environment variable MAPLE_TARGET, which controls the link address.
Users can either export it to their environment, or pass MAPLE_TARGET on
the command-line. Once this is set, sketches can be compiled with 'make
sketch,' or simply 'make.'
Note: the default is MAPLE_TARGET='flash.'
The target 'install' now automagically uploads the sketch to the board
using the appropriate method.
The 'run' target has been renamed to 'debug.' It starts an openocd gdb
server.
4. Odds and ends:
-Verbose and 'quiet' modes. Set V=1 for verbose compilation, the default
is quiet.
-Object file sizes and disassembly information is generated and placed
in build/$(BOARD).sizes and build/$(BOARD).disas, respectively.
-Parallel make with -j should speed things up if you have multiple
cores.
2010-06-24 17:16:26 +02:00
|
|
|
$(foreach m,$(LIBMAPLE_MODULES),$(eval $(call LIBMAPLE_MODULE_template,$(m))))
|
|
|
|
|
2011-09-13 07:32:09 +02:00
|
|
|
##
|
|
|
|
## Targets
|
|
|
|
##
|
|
|
|
|
|
|
|
# main target
|
2011-05-22 01:39:12 +02:00
|
|
|
include $(SRCROOT)/build-targets.mk
|
make: Modularize makefiles, add dependency tracking, build-type tracking
Major build system rewrite. New and exciting:
1. Proper dependency tracking. All source files including header files
should be properly tracked and recompiled as necessary when they are
changed.
2. Build-type tracking. If the target changes from 'ram' to 'flash,'
for example, the build system will force a rebuild rather than
incorrectly link modules to a different address.
3. New targets:
The old 'ram,' 'flash,' and 'jtag' targets have been replaced with
the environment variable MAPLE_TARGET, which controls the link address.
Users can either export it to their environment, or pass MAPLE_TARGET on
the command-line. Once this is set, sketches can be compiled with 'make
sketch,' or simply 'make.'
Note: the default is MAPLE_TARGET='flash.'
The target 'install' now automagically uploads the sketch to the board
using the appropriate method.
The 'run' target has been renamed to 'debug.' It starts an openocd gdb
server.
4. Odds and ends:
-Verbose and 'quiet' modes. Set V=1 for verbose compilation, the default
is quiet.
-Object file sizes and disassembly information is generated and placed
in build/$(BOARD).sizes and build/$(BOARD).disas, respectively.
-Parallel make with -j should speed things up if you have multiple
cores.
2010-06-24 17:16:26 +02:00
|
|
|
|
2012-06-07 07:24:01 +02:00
|
|
|
.PHONY: install sketch clean help cscope tags ctags ram flash jtag doxygen mrproper list-boards
|
make: Modularize makefiles, add dependency tracking, build-type tracking
Major build system rewrite. New and exciting:
1. Proper dependency tracking. All source files including header files
should be properly tracked and recompiled as necessary when they are
changed.
2. Build-type tracking. If the target changes from 'ram' to 'flash,'
for example, the build system will force a rebuild rather than
incorrectly link modules to a different address.
3. New targets:
The old 'ram,' 'flash,' and 'jtag' targets have been replaced with
the environment variable MAPLE_TARGET, which controls the link address.
Users can either export it to their environment, or pass MAPLE_TARGET on
the command-line. Once this is set, sketches can be compiled with 'make
sketch,' or simply 'make.'
Note: the default is MAPLE_TARGET='flash.'
The target 'install' now automagically uploads the sketch to the board
using the appropriate method.
The 'run' target has been renamed to 'debug.' It starts an openocd gdb
server.
4. Odds and ends:
-Verbose and 'quiet' modes. Set V=1 for verbose compilation, the default
is quiet.
-Object file sizes and disassembly information is generated and placed
in build/$(BOARD).sizes and build/$(BOARD).disas, respectively.
-Parallel make with -j should speed things up if you have multiple
cores.
2010-06-24 17:16:26 +02:00
|
|
|
|
2010-07-09 04:27:37 +02:00
|
|
|
# Target upload commands
|
2012-06-05 21:38:22 +02:00
|
|
|
# USB ID for DFU upload -- FIXME: do something smarter with this
|
|
|
|
BOARD_USB_VENDOR_ID := 1EAF
|
|
|
|
BOARD_USB_PRODUCT_ID := 0003
|
2010-08-30 02:29:31 +02:00
|
|
|
UPLOAD_ram := $(SUPPORT_PATH)/scripts/reset.py && \
|
2010-07-09 04:27:37 +02:00
|
|
|
sleep 1 && \
|
2012-06-05 21:38:22 +02:00
|
|
|
$(DFU) -a0 -d $(BOARD_USB_VENDOR_ID):$(BOARD_USB_PRODUCT_ID) -D $(BUILD_PATH)/$(BOARD).bin -R
|
2010-08-30 02:29:31 +02:00
|
|
|
UPLOAD_flash := $(SUPPORT_PATH)/scripts/reset.py && \
|
2010-07-09 04:27:37 +02:00
|
|
|
sleep 1 && \
|
2012-06-05 21:38:22 +02:00
|
|
|
$(DFU) -a1 -d $(BOARD_USB_VENDOR_ID):$(BOARD_USB_PRODUCT_ID) -D $(BUILD_PATH)/$(BOARD).bin -R
|
2010-07-09 04:27:37 +02:00
|
|
|
|
2011-09-13 07:32:09 +02:00
|
|
|
# Conditionally upload to whatever the last build was
|
2010-07-09 04:27:37 +02:00
|
|
|
install: INSTALL_TARGET = $(shell cat $(BUILD_PATH)/build-type 2>/dev/null)
|
|
|
|
install: $(BUILD_PATH)/$(BOARD).bin
|
2011-09-26 21:50:12 +02:00
|
|
|
@echo "Install target:" $(INSTALL_TARGET)
|
2010-07-09 04:27:37 +02:00
|
|
|
$(UPLOAD_$(INSTALL_TARGET))
|
make: Modularize makefiles, add dependency tracking, build-type tracking
Major build system rewrite. New and exciting:
1. Proper dependency tracking. All source files including header files
should be properly tracked and recompiled as necessary when they are
changed.
2. Build-type tracking. If the target changes from 'ram' to 'flash,'
for example, the build system will force a rebuild rather than
incorrectly link modules to a different address.
3. New targets:
The old 'ram,' 'flash,' and 'jtag' targets have been replaced with
the environment variable MAPLE_TARGET, which controls the link address.
Users can either export it to their environment, or pass MAPLE_TARGET on
the command-line. Once this is set, sketches can be compiled with 'make
sketch,' or simply 'make.'
Note: the default is MAPLE_TARGET='flash.'
The target 'install' now automagically uploads the sketch to the board
using the appropriate method.
The 'run' target has been renamed to 'debug.' It starts an openocd gdb
server.
4. Odds and ends:
-Verbose and 'quiet' modes. Set V=1 for verbose compilation, the default
is quiet.
-Object file sizes and disassembly information is generated and placed
in build/$(BOARD).sizes and build/$(BOARD).disas, respectively.
-Parallel make with -j should speed things up if you have multiple
cores.
2010-06-24 17:16:26 +02:00
|
|
|
|
2011-09-13 07:32:09 +02:00
|
|
|
# Force a rebuild if the target changed
|
2010-07-09 04:27:37 +02:00
|
|
|
PREV_BUILD_TYPE = $(shell cat $(BUILD_PATH)/build-type 2>/dev/null)
|
2010-07-08 07:06:33 +02:00
|
|
|
build-check:
|
2010-08-26 00:21:51 +02:00
|
|
|
ifneq ($(PREV_BUILD_TYPE), $(MEMORY_TARGET))
|
2010-07-08 07:06:33 +02:00
|
|
|
$(shell rm -rf $(BUILD_PATH))
|
|
|
|
endif
|
|
|
|
|
|
|
|
sketch: build-check MSG_INFO $(BUILD_PATH)/$(BOARD).bin
|
2010-02-12 21:57:45 +01:00
|
|
|
|
make: Modularize makefiles, add dependency tracking, build-type tracking
Major build system rewrite. New and exciting:
1. Proper dependency tracking. All source files including header files
should be properly tracked and recompiled as necessary when they are
changed.
2. Build-type tracking. If the target changes from 'ram' to 'flash,'
for example, the build system will force a rebuild rather than
incorrectly link modules to a different address.
3. New targets:
The old 'ram,' 'flash,' and 'jtag' targets have been replaced with
the environment variable MAPLE_TARGET, which controls the link address.
Users can either export it to their environment, or pass MAPLE_TARGET on
the command-line. Once this is set, sketches can be compiled with 'make
sketch,' or simply 'make.'
Note: the default is MAPLE_TARGET='flash.'
The target 'install' now automagically uploads the sketch to the board
using the appropriate method.
The 'run' target has been renamed to 'debug.' It starts an openocd gdb
server.
4. Odds and ends:
-Verbose and 'quiet' modes. Set V=1 for verbose compilation, the default
is quiet.
-Object file sizes and disassembly information is generated and placed
in build/$(BOARD).sizes and build/$(BOARD).disas, respectively.
-Parallel make with -j should speed things up if you have multiple
cores.
2010-06-24 17:16:26 +02:00
|
|
|
clean:
|
2011-09-01 21:05:32 +02:00
|
|
|
rm -rf build
|
|
|
|
|
|
|
|
mrproper: clean
|
|
|
|
rm -rf doxygen
|
make: Modularize makefiles, add dependency tracking, build-type tracking
Major build system rewrite. New and exciting:
1. Proper dependency tracking. All source files including header files
should be properly tracked and recompiled as necessary when they are
changed.
2. Build-type tracking. If the target changes from 'ram' to 'flash,'
for example, the build system will force a rebuild rather than
incorrectly link modules to a different address.
3. New targets:
The old 'ram,' 'flash,' and 'jtag' targets have been replaced with
the environment variable MAPLE_TARGET, which controls the link address.
Users can either export it to their environment, or pass MAPLE_TARGET on
the command-line. Once this is set, sketches can be compiled with 'make
sketch,' or simply 'make.'
Note: the default is MAPLE_TARGET='flash.'
The target 'install' now automagically uploads the sketch to the board
using the appropriate method.
The 'run' target has been renamed to 'debug.' It starts an openocd gdb
server.
4. Odds and ends:
-Verbose and 'quiet' modes. Set V=1 for verbose compilation, the default
is quiet.
-Object file sizes and disassembly information is generated and placed
in build/$(BOARD).sizes and build/$(BOARD).disas, respectively.
-Parallel make with -j should speed things up if you have multiple
cores.
2010-06-24 17:16:26 +02:00
|
|
|
|
|
|
|
help:
|
2010-01-10 08:30:18 +01:00
|
|
|
@echo ""
|
2012-06-07 07:19:24 +02:00
|
|
|
@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 ""
|
2012-06-07 10:15:06 +02:00
|
|
|
@echo "(Multiple source files? Link with libmaple.a (\`$$ make library')"
|
|
|
|
@echo "or hack build-targets.mk appropriately.)"
|
|
|
|
@echo ""
|
2012-06-07 07:19:24 +02:00
|
|
|
@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"
|
2012-06-07 10:59:41 +02:00
|
|
|
@echo " help: Show this message"
|
2012-06-07 07:19:24 +02:00
|
|
|
@echo " mrproper: Remove all generated files"
|
|
|
|
@echo ""
|
2009-12-17 03:37:07 +01:00
|
|
|
|
make: Modularize makefiles, add dependency tracking, build-type tracking
Major build system rewrite. New and exciting:
1. Proper dependency tracking. All source files including header files
should be properly tracked and recompiled as necessary when they are
changed.
2. Build-type tracking. If the target changes from 'ram' to 'flash,'
for example, the build system will force a rebuild rather than
incorrectly link modules to a different address.
3. New targets:
The old 'ram,' 'flash,' and 'jtag' targets have been replaced with
the environment variable MAPLE_TARGET, which controls the link address.
Users can either export it to their environment, or pass MAPLE_TARGET on
the command-line. Once this is set, sketches can be compiled with 'make
sketch,' or simply 'make.'
Note: the default is MAPLE_TARGET='flash.'
The target 'install' now automagically uploads the sketch to the board
using the appropriate method.
The 'run' target has been renamed to 'debug.' It starts an openocd gdb
server.
4. Odds and ends:
-Verbose and 'quiet' modes. Set V=1 for verbose compilation, the default
is quiet.
-Object file sizes and disassembly information is generated and placed
in build/$(BOARD).sizes and build/$(BOARD).disas, respectively.
-Parallel make with -j should speed things up if you have multiple
cores.
2010-06-24 17:16:26 +02:00
|
|
|
cscope:
|
2012-06-07 10:59:41 +02:00
|
|
|
rm -rf cscope.*
|
2011-03-02 06:30:19 +01:00
|
|
|
find . -name '*.[hcS]' -o -name '*.cpp' | xargs cscope -b
|
2009-12-17 03:37:07 +01:00
|
|
|
|
2010-04-11 20:28:08 +02:00
|
|
|
tags:
|
|
|
|
etags `find . -name "*.c" -o -name "*.cpp" -o -name "*.h"`
|
|
|
|
@echo "Made TAGS file for EMACS code browsing"
|
|
|
|
|
2010-06-09 18:27:15 +02:00
|
|
|
ctags:
|
|
|
|
ctags-exuberant -R .
|
|
|
|
@echo "Made tags file for VIM code browsing"
|
2010-07-07 22:12:19 +02:00
|
|
|
|
|
|
|
ram:
|
2010-08-26 00:21:51 +02:00
|
|
|
@$(MAKE) MEMORY_TARGET=ram --no-print-directory sketch
|
2010-07-07 22:12:19 +02:00
|
|
|
|
|
|
|
flash:
|
2010-08-26 00:21:51 +02:00
|
|
|
@$(MAKE) MEMORY_TARGET=flash --no-print-directory sketch
|
2010-07-07 22:12:19 +02:00
|
|
|
|
|
|
|
jtag:
|
2010-08-26 00:21:51 +02:00
|
|
|
@$(MAKE) MEMORY_TARGET=jtag --no-print-directory sketch
|
2011-06-12 01:25:29 +02:00
|
|
|
|
|
|
|
doxygen:
|
|
|
|
doxygen $(SUPPORT_PATH)/doxygen/Doxyfile
|
2012-06-07 07:18:01 +02:00
|
|
|
|
|
|
|
# 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))))"
|