diff options
author | hondew <pokehondew@gmail.com> | 2021-03-14 23:46:12 -0400 |
---|---|---|
committer | hondew <pokehondew@gmail.com> | 2021-03-15 00:08:20 -0400 |
commit | 19651447d53e96d727e9bcf65cd7901ded8f6d8f (patch) | |
tree | 9cf40dba9aa8127f0cdf8f119a06ad4c6d52380e /tools/asm_processor/compile.sh | |
parent | 4a15dea90f9b17c2efc29bf45dce6b65c50372d3 (diff) |
Make asmproc produce a linkable obj
Document compile.sh
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" |