Require firmware to specify the end of its codespace in its Makefile,
and use this to determine where the start of available flash is. Should
give compile time errors if either there's no room left for storage, or
if there's not enough room for code.
include ../Version
endif
-CFLAGS=--model-small --debug --opt-code-speed
+CFLAGS=--model-small --debug --opt-code-speed -DCODESIZE=$(CODESIZE)
-LDFLAGS=--out-fmt-ihx --code-loc 0x0000 --code-size 0x8000 \
+CODESIZE ?= 0x8000
+
+LDFLAGS=--out-fmt-ihx --code-loc 0x0000 --code-size $(CODESIZE) \
--xram-loc 0xf000 --xram-size 0xda2 --iram-size 0xff
INC = \
#define FCTL_WRITE (1 << 1)
#define FCTL_ERASE (1 << 0)
-#define ENDOFCODE (0x51f0 + 1500)
+#define ENDOFCODE (CODESIZE)
#define NUM_PAGES ((0x8000-ENDOFCODE)/1024)
#define SIZE (1024*NUM_PAGES)
#define LOCN (0x8000 - SIZE)
PRODUCT=TeleMini-v0.1
PRODUCT_DEF=-DTELEMINI_V_0_1
IDPRODUCT=0x000a
+CODESIZE=0x6700