More cleanup
This commit is contained in:
parent
9259a5d339
commit
3a539c977b
|
@ -1,24 +0,0 @@
|
|||
Workflow:
|
||||
- Compile vwf.c and ext.c (and others as desired) to object files. Don't link yet
|
||||
- Generate m2-compiled.asm:
|
||||
- Get function symbol addresses (objdump -t). Don't forget to offset by the compiled base address (i.e., 0x8100000)
|
||||
- For each address, emit ".definelabel <function name>,<address>
|
||||
- Run armips on m2-hack.asm. Generate an armips symbol table
|
||||
- Emit "SECTIONS { .text 0x8000000 : { *(.text .rodata) } }" to the linker script
|
||||
- Pull all undefined symbols from code object files (vwf.o, ext.o, etc.)
|
||||
- For each undefined symbol, look up value in armips symbol table. Output to linker script: "<symbol name> = <value>;"
|
||||
- Run the linker on the compiled code (vwf.o and ext.o)
|
||||
- Extract the .text section of linked.o and place directly into the ROM at the compiled address
|
||||
- Remove the symbol table entry that says the compiled code section is data
|
||||
|
||||
For reference, extern functions that originate in the assembly and need
|
||||
to be called from C should be defined in vwf.h as (for example):
|
||||
|
||||
extern void copy_tile_up(int x, int y);
|
||||
|
||||
...and due to a bug (http://stackoverflow.com/a/43283331/1188632) in the
|
||||
linker, *also* defined in ext.c as:
|
||||
|
||||
__attribute__((naked)) void copy_tile_up(int x, int y){}
|
||||
|
||||
Because armips exports all symbols in lower-case, all such extern functions must be lower-case.
|
Loading…
Reference in New Issue