diff options
-rw-r--r-- | arm9/asm/nonmatchings/GenerateFontHalfRowLookupTable.s | 12 | ||||
-rw-r--r-- | arm9/temp.c | 0 | ||||
-rw-r--r-- | tools/asm_processor/asm_processor.py | 12 | ||||
-rw-r--r-- | tools/asm_processor/compile.sh | 34 |
4 files changed, 33 insertions, 25 deletions
diff --git a/arm9/asm/nonmatchings/GenerateFontHalfRowLookupTable.s b/arm9/asm/nonmatchings/GenerateFontHalfRowLookupTable.s index 2d51a2ae..a083bf2e 100644 --- a/arm9/asm/nonmatchings/GenerateFontHalfRowLookupTable.s +++ b/arm9/asm/nonmatchings/GenerateFontHalfRowLookupTable.s @@ -1,11 +1,11 @@ - .include "asm/macros.inc" - .include "global.inc" - .extern UNK_021C570C - .extern UNK_021C5734 +.section .text + +glabel GenerateFontHalfRowLookupTable + +.extern UNK_021C570C +.extern UNK_021C5734 - thumb_func_start GenerateFontHalfRowLookupTable -GenerateFontHalfRowLookupTable: ; 0x0201C05C push {r3-r7, lr} sub sp, #0x30 ldr r3, _0201C0F8 ; =UNK_021C570C diff --git a/arm9/temp.c b/arm9/temp.c deleted file mode 100644 index e69de29b..00000000 --- a/arm9/temp.c +++ /dev/null diff --git a/tools/asm_processor/asm_processor.py b/tools/asm_processor/asm_processor.py index e3226cb2..e1540c0c 100644 --- a/tools/asm_processor/asm_processor.py +++ b/tools/asm_processor/asm_processor.py @@ -575,7 +575,7 @@ class GlobalAsmBlock: self.add_sized(int(line.split()[1], 0), real_line)
elif line.startswith('.balign') or line.startswith('.align'):
align = int(line.split()[1])
- if align != 2:
+ if align != 4:
self.fail("only .balign 4 is supported", real_line)
self.align4()
elif line.startswith('.asci'):
@@ -586,9 +586,6 @@ class GlobalAsmBlock: # Branches are 4 bytes long
elif line.startswith('bl'):
self.add_sized(4, real_line)
- elif line.startswith('.'):
- # .macro, ...
- self.fail("asm directive not supported", real_line)
else:
# Unfortunately, macros are hard to support for .rodata --
# we don't know how how space they will expand to before
@@ -1027,8 +1024,11 @@ def fixup_objfile(objfile_name, functions, asm_prelude, assembler, output_enc): loc1 = asm_objfile.symtab.find_symbol_in_section(temp_name + '_asm_start', source)
loc2 = asm_objfile.symtab.find_symbol_in_section(temp_name + '_asm_end', source)
assert loc1 == pos, "assembly and C files don't line up for section " + sectype + ", " + fn_desc
- if loc2 - loc1 != count:
- raise Failure("incorrectly computed size for section " + sectype + ", " + fn_desc + ". If using .double, make sure to provide explicit alignment padding.")
+ # Since we are nonmatching whole functions, we don't need to insert the correct
+ # amount of padding into the src file. We don't actually need to insert padding
+ # at all. We can just plop the asm's text section into the objfile.
+ # if loc2 - loc1 != count:
+ # raise Failure("incorrectly computed size for section " + sectype + ", " + fn_desc + ". If using .double, make sure to provide explicit alignment padding.")
if sectype == '.bss' or sectype == '.sbss2':
continue
target = objfile.find_section(sectype, n_text if sectype == '.text' else 0)
diff --git a/tools/asm_processor/compile.sh b/tools/asm_processor/compile.sh index 786da404..8c367b3e 100644 --- a/tools/asm_processor/compile.sh +++ b/tools/asm_processor/compile.sh @@ -1,19 +1,27 @@ #!/bin/bash CC="$1" -shift -AS="$1" -shift +AS="$2" +OBJ="$3" +SRC="$4" -temp="$(mktemp)" -../tools/asm_processor/asm_processor.py "$2" --assembler "$AS" > "$temp.c" && -$CC -c "$temp.c" -o "$1" +PADDED_SRC="$(mktemp --suffix=.c padded-XXXXXX)" +PADDED_OBJ="$(mktemp --suffix=.o padded-XXXXXX)" -prelude=$(mktemp prelude.XXXXXX) -cat ../include/macros.inc >> "$prelude" -cat global.inc >> "$prelude" +# Create a .c file replacing the nonmatching function with volatile int writes, +# and compile. +../tools/asm_processor/asm_processor.py "$SRC" --assembler "$AS" > "$PADDED_SRC" +$CC -c "$PADDED_SRC" -o "$PADDED_OBJ" -../tools/asm_processor/asm_processor.py "$2" --post-process "$1" --assembler "$AS" --asm-prelude "$prelude" -arm-none-eabi-objcopy --remove-section .comment "$1" "$1" -rm "$prelude" -rm "$temp" +PRELUDE=$(mktemp) +cat ../include/macros.inc >> "$PRELUDE" +cat global.inc >> "$PRELUDE" + +# Inject the matching assembly into the padded obj file. +../tools/asm_processor/asm_processor.py "$SRC" --post-process "$PADDED_OBJ" --assembler "$AS" --asm-prelude "$PRELUDE" + +$DEVKITARM/bin/arm-none-eabi-objcopy --remove-section .comment "$PADDED_OBJ" "$OBJ" + +rm "$PADDED_SRC" +rm "$PADDED_OBJ" +rm "$PRELUDE" |