diff options
author | red031000 <rubenru09@aol.com> | 2021-03-18 15:19:09 +0000 |
---|---|---|
committer | red031000 <rubenru09@aol.com> | 2021-03-18 15:19:09 +0000 |
commit | 8b699fd13008875cf59601d6a8c9d55bd3f8ae08 (patch) | |
tree | a5c9cb8bc44c13d396ff549a0b2928fd49c2e9cb /tools/asm_processor/compile.sh | |
parent | bee5e11870b47027235c63794f20dc4cccaac92e (diff) | |
parent | 941451f6408b8f92f9e7f5f3d6650f1b2ad2293d (diff) |
Merge branch 'master' of https://github.com/pret/pokediamond
Diffstat (limited to 'tools/asm_processor/compile.sh')
-rw-r--r-- | tools/asm_processor/compile.sh | 34 |
1 files changed, 21 insertions, 13 deletions
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" |