diff options
author | Revo <projectrevotpp@hotmail.com> | 2021-03-15 00:47:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-15 00:47:16 -0400 |
commit | 6b3cfc030575c4151ce57063567f5c8efdd54cf9 (patch) | |
tree | 42119a1a1aa406c30b17982a61d045fffdf57167 /tools/asm_processor/compile.sh | |
parent | 4a15dea90f9b17c2efc29bf45dce6b65c50372d3 (diff) | |
parent | b2732f46318cb0061c65c1c5ef083963dcdd4df7 (diff) |
Merge pull request #330 from hondew/asmproc-linkable
Fix asmproc: Produce a linkable object
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" |