override BUILD_TARGET=arm

DEPTH = ../../../..

include $(DEPTH)/bw/make/commondefs

# private ARM tools
ARMTOOLPATH = ../../tools
ASCII2BIN=$(ARMTOOLPATH)/ascii2bin.py
BIN2C=$(ARMTOOLPATH)/bin2c.py

KEY = 9258a75264960d82676f904456882a73
IV_00 = 00000000000000000000000000000000

CFILES = \
    key.c \
    iv.c \
    bootc.c

ASFILES = boot0_rom1.s 
ASFILES1 = boot0_rom_version.s 

LCINCS = -I../../include
LCDEFS = -Wall -D_LANGUAGE_C
LLOPTS = -ffreestanding -nostdlib -Ttext 0xffff0000 -Xlinker -Map -Xlinker mapfile.txt -T ../boot0.ld
LDLIBS = $(COMLIB)

# order is important for this binary
OBJECTS = $(ASFILES:.s=.o) $(CFILES:.c=.o) $(ASFILES1:.s=.o)

EXE_TARGET = boot0_rom1B.arm

DEFAULT_RULES += boot0_rom1b.hex

include $(DEPTH)/bw/make/commonrules

# special targets for this Makefile
key.c:
	$(ASCII2BIN) $(KEY) | $(BIN2C) -n bootKey -o $@

iv.c:
	$(ASCII2BIN) $(IV_00) | $(BIN2C) -n bootIv -o $@

boot0_rom1b.hex:
	cd $(OUTDIR); \
	$(ELF2HEX) boot0_rom1B.arm; \
	$(HEX2ROM4) boot0_rom1B.hex boot0_rom1B
