summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorBobby Bingham <koorogi@koorogi.info>2015-07-19 17:17:06 -0500
committerBobby Bingham <koorogi@koorogi.info>2015-09-15 22:43:32 -0500
commitf3885c4b23b0e13d7fe9ef4674a07e746acca320 (patch)
treebaece81713adf89b3c162be7c06dce3a8764747f /Makefile
parente3cbe8f7712fe97d90ff1fb5c675df9a1632eb45 (diff)
build bootloaders from code
This adds the infrastructure for building from source the bootloaders which will go into the application initial program, in the boot sector. As a simple test case, it includes a simple bootloader which merely jumpts to the code address specified in the AIP, with the stack address specified there.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile15
1 files changed, 12 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index af28deb..de590e8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,10 @@
CFLAGS = -Os -pipe -std=c99 -D_POSIX_C_SOURCE=200809L
LDFLAGS =
+BOOTSRCS = $(sort $(wildcard boot/*.c))
+BOOTELFS = $(patsubst %.c,%.elf,$(BOOTSRCS))
+BOOTBINS = $(patsubst boot/%.c,share/%.boot,$(BOOTSRCS))
+
SRCS = $(sort $(wildcard src/*.c))
DATA = $(sort $(wildcard src/*.bin))
OBJS = $(SRCS:.c=.o) $(DATA:.bin=.o)
@@ -8,17 +12,22 @@ BINS = bin/satmkboot
.PHONY: all clean
-all: $(BINS)
+all: $(BINS) $(BOOTBINS)
clean:
- rm -f $(BINS)
- rm -f $(OBJS)
+ rm -f $(BINS) $(OBJS) $(BOOTBINS) $(BOOTELFS)
bin/satmkboot: \
src/satmkboot.o \
src/securitycode.o \
src/symbols.o
+share/%.boot: boot/%.elf
+ saturn-objcopy -O binary $< $@
+
+%.elf: %.c boot/ldscript
+ saturn-gcc -nostdlib -T boot/ldscript $(CFLAGS) $< -o $@
+
%.c: %.bin
tools/bin2c $< > $@