aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authoriperry <iperry@749a229e-a60e-11de-b98f-4500b42dc123>2010-01-10 07:30:18 +0000
committeriperry <iperry@749a229e-a60e-11de-b98f-4500b42dc123>2010-01-10 07:30:18 +0000
commit8012e52afb9422cfec79df322946836adc12fdf9 (patch)
tree8573d850017e526625c2b820a3a6e39107e312d8 /Makefile
parenta038b4f9875d06be339d3abb33967ec9a89c2f8a (diff)
downloadlibrambutan-8012e52afb9422cfec79df322946836adc12fdf9.tar.gz
librambutan-8012e52afb9422cfec79df322946836adc12fdf9.zip
Tweaked makefile to get rid of silly make flags. Added a udev rule in support/ to eliminate sudo req for make program
git-svn-id: https://leaflabs.googlecode.com/svn/trunk/library@105 749a229e-a60e-11de-b98f-4500b42dc123
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile57
1 files changed, 37 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index 58678df..2570a6a 100644
--- a/Makefile
+++ b/Makefile
@@ -7,13 +7,13 @@ STM_SRC = stm32lib/src
STM_CONF = stm32conf/flash.conf
# ARM/GNU toolchain parameters
-CC = arm-none-eabi-gcc
-CPP = arm-none-eabi-g++
-LD = arm-none-eabi-ld -v
-AR = arm-none-eabi-ar
-AS = arm-none-eabi-as
-CP = arm-none-eabi-objcopy
-OD = arm-none-eabi-objdump
+CC := arm-none-eabi-gcc
+CPP := arm-none-eabi-g++
+LD := arm-none-eabi-ld -v
+AR := arm-none-eabi-ar
+AS := arm-none-eabi-as
+CP := arm-none-eabi-objcopy
+OD := arm-none-eabi-objdump
BUILD_PATH = build
LIB_PATH = lib
@@ -33,7 +33,8 @@ INCLUDES = -Isrc/stm32lib/inc \
-Isrc/wiring \
-Isrc/wiring/comm
-DEFFLAGS=VECT_TAB_BASE
+# default is to upload to flash
+#DEFFLAGS = VECT_TAB_BASE
CFLAGS = -I./ $(INCLUDES) -c \
-Os\
-g -mcpu=cortex-m3 -mthumb -march=armv7-m -nostdlib \
@@ -42,7 +43,7 @@ CFLAGS = -I./ $(INCLUDES) -c \
CPPFLAGS = -fno-rtti -fno-exceptions -Wall
-LINKER=lanchon-stm32.ld
+#LINKER=lanchon-stm32.ld
LFLAGS = -Tstm32conf/$(LINKER) -L stm32conf/lanchon-stm32 \
-mcpu=cortex-m3 -mthumb -Xlinker \
--gc-sections --print-gc-sections --march=armv7-m -Wall
@@ -82,7 +83,7 @@ CPPSRC = wiring/wiring_math.cpp \
wiring/Print.cpp \
wiring/comm/HardwareSerial.cpp \
wiring/comm/HardwareUsb.cpp \
- example_main.cpp
+ main.cpp
# i really have no idea what i'm doing
meep += $(CSRC)
@@ -102,9 +103,6 @@ MSG_ASSEMBLING = Assembling:
MSG_CLEANING = Cleaning project:
MSG_FLASH = Creating load file for Flash:
-# output directories
-all: $(BUILD_PATH)/main.bin
-
$(BUILD_PATH):
mkdir -p build
@@ -113,13 +111,20 @@ _CPPOBJ = $(boop:.cpp=.o)
COBJ = $(patsubst %, $(BUILD_PATH)/%,$(_COBJ))
CPPOBJ = $(patsubst %, $(BUILD_PATH)/%,$(_CPPOBJ))
+.PHONY: install run cscope clean info
-.PHONY: test install run cscope clean
+info:
+ @echo "Maple library help"
+ @echo "------------------:"
+ @echo "Compile targets:"
+ @echo " ram: Compile sketch code for RAM"
+ @echo " flash: Compile sketch code for flash"
+ @echo ""
+ @echo "Programming targets:"
+ @echo " program_ram: Upload code to RAM"
+ @echo " program_flash: Upload code to RAM"
-test: $(CSRC_)
- @echo help
- @echo $(moop)
- @echo done
+all: info
$(OUTDIRS):
@echo Making directory $@
@@ -129,11 +134,13 @@ $(OUTDIRS):
# actual build rules
$(COBJ) : $(BUILD_PATH)/%.o : %.c
@echo $(MSG_COMPILING) $<
+ @echo $(PATH)
$(CC) $(CFLAGS) -c $< -o $@
@echo
$(CPPOBJ) : $(BUILD_PATH)/%.o : %.cpp
@echo $(MSG_COMPILING) $<
+ @echo $(PATH)
$(CPP) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
@echo
@@ -157,13 +164,23 @@ $(BUILD_PATH)/main.bin: $(BUILD_PATH)/$(PROJECT).out
@echo "Final Size:"
arm-none-eabi-size $<
+ram: DEFFLAGS := VECT_TAB_RAM
+ram: LINKER := lanchon-stm32-user-ram.ld
+ram: $(BUILD_PATH)/main.bin
+ @echo "RAM build"
+
+flash: DEFFLAGS := VECT_TAB_BASE
+flash: LINKER := lanchon-stm32-user-rom.ld
+flash: $(BUILD_PATH)/main.bin
+ @echo "Flash build"
install: $(BUILD_PATH)/main.bin
openocd -f stm32conf/flash.cfg
-program:
+program_ram: ram
dfu-util -a0 -d 0110:1001 -D build/main.bin -R
-programFlash:
+
+program_flash: flash
dfu-util -a1 -d 0110:1001 -D build/main.bin -R
run: $(BUILD_PATH)/main.bin