-
+TOOLCHAIN = arm-elf-#
MCU_TARGET = cortex-m3
-OPTIMIZE = -O2
+MCU_OPTS = -mthumb
+OPTIMIZE = -Os -fomit-frame-pointer
+DEBUG = -gdwarf-2
+WARNING = -pedantic -Wall -Wstrict-prototypes -Werror
DEFS = -D$(call uc, $(subst -,_,$(MCU_TARGET)))
-FLASHCMD = arm-elf-gdb -x gdb-flash #
-DEP_DIR = deps/
-TEST_DIR = test/
-BIN_DIR = bin/
-TESTBIN_DIR = test_bin/
-TESTSRC_DIR = test_src/
+FLASHCMD = $(OPENOCD) -f openocd.cfg \
+ -c "init" \
+ -c "halt" \
+ -c "flash write_image erase $(1) 0 bin" \
+ -c "reset run" \
+ -c "shutdown"
+DEP_DIR = deps/#
+TEST_DIR = test/#
+BIN_DIR = bin/#
+TESTSRC_DIR = test_src/#
ERASECMD =
-TESTPORT = /dev/ttyUSB1
+TESTPORT = /dev/ttyUSB2
TESTPORTBAUDR = 115200
TESTLOG_DIR = testlog/#
-TESTPREFIX = nessie-
+TESTPREFIX = nessie-#
SPEEDTOOL = host/get_performance.rb
-SPEEDLOG_DIR = speed_log/
+SPEEDLOG_DIR = speed_log/#
SPEEDPREFIX =
SPEEDCMD = performance
SIZE_DIR = size_log/#
LIST_DIR = listings/#
STAT_DIR = stats/#
AUTOASM_DIR = autoasm/#
+LIB_DIR = lib/#
+LIB_NAME = libcrypto.a
AUTOASM_OPT = -S
-CC = arm-elf-gcc
CSTD = gnu99
+LIBS = c gcc
-override CFLAGS_A = -mthumb -ffunction-sections -fdata-sections -MMD \
- -MF$(DEP_DIR)$(patsubst %.o,%.d,$(notdir $(1))) \
- -I. -Itest_src -g -pedantic -std=$(CSTD) \
- -Wall $(OPTIMIZE) -Wstrict-prototypes \
- -mcpu=$(MCU_TARGET) $(DEFS)
-override CFLAGS = -mthumb -ffunction-sections -fdata-sections -MMD \
- -MF$(DEP_DIR)$(patsubst %.o,%.d,$(notdir $@)) \
- -I. -Itest_src -g -pedantic -std=$(CSTD) \
- -Wall $(OPTIMIZE) -Wstrict-prototypes \
- -mcpu=$(MCU_TARGET) $(DEFS)
+COMMON_FLAGS = -ffunction-sections -fdata-sections \
+ $(DEBUG) $(WARNING) -std=$(CSTD) $(OPTIMIZE) \
+ -mcpu=$(MCU_TARGET) $(MCU_OPTS) $(DEFS) -MMD
+override CFLAGS_A = $(COMMON_FLAGS) \
+ -MF$(DEP_DIR)$(patsubst %.o,%.d,$(notdir $(1)))
+override CFLAGS = $(COMMON_FLAGS) \
+ -MF$(DEP_DIR)$(patsubst %.o,%.d,$(notdir $@))
+
override LDFLAGS = -g -T lm3s9b90.ld -Wl,--gc-sections \
- -Wl,--entry=reset_isr -lc -lgcc \
+ -Wl,--entry=reset_isr \
-Wl,-Map,# no space at the end
-override ASFLAGS = -mthumb -mcpu=$(MCU_TARGET) -Wa,--g
+
+override ASFLAGS = -mcpu=$(MCU_TARGET)
SIZESTAT_FILE = sizestats.txt
-OBJCOPY = arm-elf-objcopy
-OBJDUMP = arm-elf-objdump
-SIZE = arm-elf-size
+CC = $(TOOLCHAIN)gcc
+OBJCOPY = $(TOOLCHAIN)objcopy
+OBJDUMP = $(TOOLCHAIN)objdump
+SIZE = $(TOOLCHAIN)size
+OPENOCD = openocd
READELF = readelf
+AR = $(TOOLCHAIN)ar
+CHMOD = chmod
+CHOWN = chown
+CHGRP = chgrp
+RM = rm
RUBY = ruby
GET_TEST = host/get_test.rb
MAKE = make