summaryrefslogtreecommitdiff
path: root/tools/sort_map.py
diff options
context:
space:
mode:
authorRemy Oukaour <remy.oukaour@gmail.com>2018-01-03 14:52:32 -0500
committerRemy Oukaour <remy.oukaour@gmail.com>2018-01-03 14:52:32 -0500
commitc07ffc7633fca8ccdb55856d67f5265638dcbe9a (patch)
tree98dc4e990c0dd48a4a405c640ae81983cc8a844e /tools/sort_map.py
parent927d392a02ba10d0070bd90e84e2ef1b3cc0af88 (diff)
Handle unused banks (notably OAM and HRAM)
Diffstat (limited to 'tools/sort_map.py')
-rw-r--r--tools/sort_map.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/sort_map.py b/tools/sort_map.py
index f842ca878..9f7f0f4b3 100644
--- a/tools/sort_map.py
+++ b/tools/sort_map.py
@@ -23,6 +23,7 @@ def total_bank_size(type):
return sizes[type]
def sorted_mapfile(input):
+ unused_rx = re.compile(r'^([A-Z]+):$')
bank_rx = re.compile(r'^([A-Z]+) Bank #([0-9]+)')
section_rx = re.compile(r' +SECTION: \$([0-9A-F]+)(?:-\$([0-9A-F]+))? \(\$([0-9A-F]+) bytes\) \["(.+)"\]')
label_rx = re.compile(r' +\$([0-9A-F]+) = (.+)')
@@ -40,6 +41,16 @@ def sorted_mapfile(input):
# empty banks have their entire capacity as slack
line = ' SLACK: $%04X bytes\n' % total_bank_size(bank_type)
+ x = re.match(unused_rx, line)
+ if x:
+ # start an unused bank
+ bank_type = x.group(1)
+ bank_number = '00'
+ bank_size = 0
+ bank_queue.clear()
+ section_queue.clear()
+ continue
+
x = re.match(bank_rx, line)
if x:
# start a new bank