Skip to content

Commit

Permalink
ysyx,loader: refine Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
sashimi-yzh committed Sep 8, 2021
1 parent 9f7b706 commit 73e89f0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions ysyx/loader/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
16 changes: 13 additions & 3 deletions ysyx/loader/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
SRCS ?= loader.c resource.S
NAME ?= loader
_BIN ?= hello.bin
SRCS = loader.c payload.S
NAME = loader

# Note that the loader should be linked to the start address of flash.
# You should modify your linking option if you want to build the loader yourself.
# Then modify BIN_PATH to a binary starting at 0x80000000
BIN_PATH = hello-riscv64-mycpu-start-at-0x80000000.bin
ASFLAGS += -DBIN_PATH=\"$(BIN_PATH)\"

include $(AM_HOME)/Makefile

payload.S: $(BIN_PATH)
touch $@

.PHONY: payload.S
6 changes: 4 additions & 2 deletions ysyx/loader/resource.S → ysyx/loader/payload.S
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.section .rodata
.align 3
.global program_start, program_end
program_start:
.incbin _BIN
#ifdef BIN_PATH
.incbin BIN_PATH
#endif
program_end:

0 comments on commit 73e89f0

Please sign in to comment.