summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2018-02-09 10:06:14 -0500
committerDan Halbert <halbert@halwitz.org>2018-02-09 11:31:18 -0500
commitb001c0711b42bbc5c155af55e9e97eb92ceadb99 (patch)
tree46066491ecd472e2366d12b2771526c14472025b /tools
parent6be6df6ae49ab635e63af74f9c908689c3470545 (diff)
Correct _etext location; clean up .ld files
1. Make _extext and _sidata coincide. Old _etext location did not include .ARM.exidx sections, which were usually absent but not always. So flash data was copied to RAM in wrong place. 2. Use decimal constants with "K" and "M" suffixes in .ld files instead of hex constants, to make them easier to read and check for accuracy.
Diffstat (limited to 'tools')
-rw-r--r--tools/build_memory_info.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/build_memory_info.py b/tools/build_memory_info.py
index af871c0ce..a8f84bbb6 100644
--- a/tools/build_memory_info.py
+++ b/tools/build_memory_info.py
@@ -24,8 +24,16 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
+import re
import sys
+# Handle size constants with K or M suffixes (allowed in .ld but not in Python).
+K_PATTERN = re.compile(r'([0-9]+)K')
+K_REPLACE = r'(\1*1024)'
+
+M_PATTERN = re.compile(r'([0-9]+)M')
+M_REPLACE = r'(\1*1024*1024)'
+
print()
text = 0
@@ -49,6 +57,8 @@ for region in regions:
space = regions[region]
if "/*" in space:
space = space.split("/*")[0]
+ space = K_PATTERN.sub(K_REPLACE, space)
+ space = M_PATTERN.sub(M_REPLACE, space)
regions[region] = eval(space)
free_flash = regions["FLASH"] - text - data