aboutsummaryrefslogtreecommitdiff
path: root/Makefile.preamble
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile.preamble')
-rw-r--r--Makefile.preamble25
1 files changed, 25 insertions, 0 deletions
diff --git a/Makefile.preamble b/Makefile.preamble
new file mode 100644
index 0000000..f6e1370
--- /dev/null
+++ b/Makefile.preamble
@@ -0,0 +1,25 @@
+OPT?=-O
+PREFIX?=arm-unknown-eabi-
+CC=$(PREFIX)gcc
+LD=$(PREFIX)ld
+CFLAGS?=$(OPT) -mcpu=cortex-m4 -mthumb -g -lgcc -static -nostartfiles -Iinclude -Iinclude/arch/arm
+LD_FLAGS?=-T linker/linker_script.ld -nostdlib --cref -Map linker/main.map -static
+
+TEST_PREFIX=x86_64-pc-linux-gnu-
+TEST_CFLAGS=-Iinclude -Iinclude/arch/x86_64 -Itest_harness -g3 -ggdb -DFOR_TESTING -Wall
+
+all: _$(PREFIX)_obs/main.elf
+
+_$(PREFIX)_obs/main.bin: _$(PREFIX)_obs/main.elf
+ $(PREFIX)objcopy -O binary _$(PREFIX)_obs/main.elf _$(PREFIX)_obs/main.bin
+
+flash: _$(PREFIX)_obs/main.bin
+ st-flash write _$(PREFIX)_obs/main.bin 0x8000000
+
+clean:
+ rm -rf _*_obs
+ rm -rf tests/build
+ rm -rf test_harness/*.a test_harness/*.o
+
+genmake:
+ ./genmake.pl > Makefile