summaryrefslogtreecommitdiff
path: root/tools/sort_symfile.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/sort_symfile.sh')
-rwxr-xr-xtools/sort_symfile.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/sort_symfile.sh b/tools/sort_symfile.sh
new file mode 100755
index 00000000..a712b97c
--- /dev/null
+++ b/tools/sort_symfile.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+TEMP_FILE=$(mktemp)
+sed \
+ -e "s/^..:[0-3]/0_ROM0@&/g" \
+ -e "s/^..:[4-7]/1_ROMX@&/g" \
+ -e "s/^..:[8-9]/2_VRAM@&/g" \
+ -e "s/^..:[A-Ba-b]/3_SRAM@&/g" \
+ -e "s/^00:[C-Dc-d]/4_WRAM0@&/g" \
+ -e "s/^..:[D-Dd-d]/5_WRAMX@&/g" \
+ -e "s/^..:[F-Ff-f]/6_HRAM@&/g" \
+ $1 \
+| sort \
+| sed -e "s/^.*@//g" > $TEMP_FILE
+mv $TEMP_FILE $1