include $(ROOT)/usr/include/make/SCdefs

TARGETS = test.bin

ASFILES = ../tests.s
CFILES = testc.c \
	test_mem.c \
	../lib.c

KEY = 9258a75264960d82676f904456882a73
IV = 1162d3da4455821afb651c7c80a4f54f

default: $(TARGETS)

exports install: default
	$(INSTALL) $(TARGETS) $(ROOT)/usr/bin/sc

include $(COMMONRULES)

LLDLIBS = -lioslibc
LLDOPTS = -T $(DA_LINK)
#LCOPTS = -mthumb
OPTIMIZER = -Os

test.elf: $(OBJECTS)
	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS)

test.pad: test.bin
	cat test.bin /dev/zero | dd of=$@ bs=16384 count=1

test.aes: test.pad
	$(ROOT)/usr/bin/x86/aes_encode -k $(KEY) -i $(IV) $^ $@

test.512: test.aes
	$(ROOT)/usr/bin/x86/flashify.py -p 512 $^ > $@

test.2048: test.aes
	$(ROOT)/usr/bin/x86/flashify.py -p 2048 $^ > $@

test.dis: test.elf
	/opt/crosstool/bin/arm-elf-objdump -d $^ > $@

