arm: working bootloader, example app

'make' will produce two outputs:
- bootloader.elf to be loaded into the bitstream
- app.bin to be loaded through the programmer

Loading app.bin is as simple as:
- reset the board
- `python3 prog.py app.bin`
This commit is contained in:
2022-05-10 11:20:02 -07:00
parent 43d245bae2
commit b8b0d94065
10 changed files with 231 additions and 46 deletions

View File

@@ -11,7 +11,7 @@ CFLAGS = -march=armv6-m -g -ffunction-sections -fdata-sections -O2 -Werror -Wall
CXXFLAGS = $(CFLAGS) -std=c++20 -fno-exceptions
LDFLAGS = -march=armv6-m \
-g --specs=nano.specs --specs=nosys.specs \
-Wl,--gc-sections -Wl,-T$(linker_script) -O2 \
-Wl,--gc-sections -O2 \
-Wl,--print-memory-usage
sources += hal/lib/common/xil_assert.c
@@ -20,21 +20,25 @@ includes += -Ihal/lib/common
sources += hal/uart/xuartlite.c hal/uart/xuartlite_stats.c
includes += -Ihal/uart
objects = main.o vector_table.o $(sources:.c=.o)
bootloader_objects = uart.o bootloader.o vector_table.o $(sources:.c=.o)
app_objects = app_init.o main.o
CFLAGS += $(includes)
all: bootloader.elf
all: bootloader.elf app.bin
%.bin: %.elf
$(OBJCOPY) -O binary $< $@
bootloader.elf: $(objects)
bootloader.elf: $(bootloader_objects)
$(LD) -Wl,-Tbootloader.ld $(LDFLAGS) -o $@ $^
app.elf: $(app_objects)
%.elf:
$(LD) $(LDFLAGS) -o $@ $^
$(LD) -Wl,-Tapp.ld $(LDFLAGS) -o $@ $^
.PHONY: clean
clean:
rm -rf *.elf *.bin $(objects)
rm -rf *.elf *.bin $(app_objects) $(bootloader_objects)