binmunge, bihx: SDCC banking hacks
authorAlan Cox <alan@linux.intel.com>
Wed, 31 Dec 2014 22:01:43 +0000 (22:01 +0000)
committerAlan Cox <alan@linux.intel.com>
Wed, 31 Dec 2014 22:01:43 +0000 (22:01 +0000)
commitc093343e1a03ecfc39e0933f11cc9710170ef888
tree6c45a500a409a7e9af64509b95334c59787b0d72
parentb77747716dfb7a734e9e45e2c0f7a37c4f5c614d
binmunge, bihx: SDCC banking hacks

These two tools are the first parts of the hacks to make SDCC generate banked
binaries. It's not a full automatic banker but it's a first step.

sdldz80 is modified to spit out a bihx format, which is a file that contains
lines of the format

XX:Intel IHX - Intel ihex from the : for bank XX
:Intel IHX  - Intel ihex for all the banks used
Bxxxx - Inter bank relocation record

Currently it is hard coded to understand the following segments

CODE "bank 1" - banked code
CODE2 "bank 2" - banked code
CODE3 "bank 3" - banked code
VIDEO "bank 3" - banked code
FONT "bank 3" - data
INITIALIZER common  - data
DATA common  - data
CONST common  - data
COMMONMEM common  - code
DISCARD "bank 3" - banked (discard) code

calls are patched from CD xx xx to use RST8/16/24 xx xx according to the
bank in question. References to banked objects that are made from data
areas or are JP rather than call instructions are fixed up by changing the
vector to point to a 4 byte stub for each problem case that is of the form
RST xx xx RET.

This generates more stubs than we really need right now. Most of them will go
away if the system call table is moved into its own file and we add some
kind of 'DATA2' segment.
Kernel/tools/bihx.c [new file with mode: 0644]
Kernel/tools/binmunge.c [new file with mode: 0644]