Add PMC support to scratch ram, move makefile targets to new makefile

This commit is contained in:
Jeremy Soller
2019-11-20 11:58:36 -07:00
parent 8950a783f4
commit 885fb3ed44
5 changed files with 114 additions and 31 deletions

View File

@@ -10,34 +10,11 @@ CFLAGS+=-DLEVEL=2
# CFLAGS+=-DI2C_DEBUGGER=0x76
# Add scratch ROM source
SCRATCH_SRC=$(wildcard $(BOARD_DIR)/scratch/*.c)
SCRATCH_OBJ=$(patsubst src/%.c,$(BUILD)/%.rel,$(SCRATCH_SRC))
SCRATCH_CC=\
sdcc \
-mmcs51 \
--model-small \
--code-size 2048 \
--Werror
# Convert from binary file to C header
$(BUILD)/include/scratch.h: $(BUILD)/scratch.rom
@mkdir -p $(@D)
xxd --include < $< > $@
# Convert from Intel Hex file to binary file
$(BUILD)/scratch.rom: $(BUILD)/scratch.ihx
@mkdir -p $(@D)
makebin -p < $< > $@
# Link object files into Intel Hex file
$(BUILD)/scratch.ihx: $(SCRATCH_OBJ)
@mkdir -p $(@D)
$(SCRATCH_CC) -o $@ $^
# Compile C files into object files
$(SCRATCH_OBJ): $(BUILD)/%.rel: src/%.c
@mkdir -p $(@D)
$(SCRATCH_CC) -o $@ -c $<
SCRATCH_DIR=$(BOARD_DIR)/scratch
SCRATCH_SRC=$(wildcard $(SCRATCH_DIR)/*.c)
SCRATCH_INCLUDE=$(wildcard $(SCRATCH_DIR)/include/scratch/*.h)
SCRATCH_CFLAGS=-I$(SCRATCH_DIR)/include
include $(SCRATCH_DIR)/scratch.mk
# Require scratch.rom to be compiled before main firmware
CFLAGS+=-I$(BUILD)/include