diff options
author | who-knows-who <j.williams97@outlook.com> | 2021-04-17 12:48:19 +0100 |
---|---|---|
committer | who-knows-who <j.williams97@outlook.com> | 2021-04-17 12:48:19 +0100 |
commit | 996d9d78106cf4ab601815550ba77a92ab678328 (patch) | |
tree | 9a92b4f792a11466cdee719b18ed449dee2e27fc /tools/asm_processor/compile.sh | |
parent | 267cb812e827604d4829d3afe28a82b0970d3706 (diff) | |
parent | 85a8a2bd43633e11af094d66a35f3c32dc7c8bfe (diff) |
Merge branch 'master' into 0202A1E0
Diffstat (limited to 'tools/asm_processor/compile.sh')
-rwxr-xr-x[-rw-r--r--] | tools/asm_processor/compile.sh | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/tools/asm_processor/compile.sh b/tools/asm_processor/compile.sh index 786da404..feef7fc9 100644..100755 --- a/tools/asm_processor/compile.sh +++ b/tools/asm_processor/compile.sh @@ -1,19 +1,30 @@ #!/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" + +arm-none-eabi-objcopy --remove-section .comment "$PADDED_OBJ" "$OBJ" + +rm "$PADDED_SRC" +rm "$PADDED_OBJ" +rm "$PRELUDE" +rm output.txt +rm asm_processor_temp.s +rm asm_processor_temp.o |