From b001c0711b42bbc5c155af55e9e97eb92ceadb99 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 9 Feb 2018 10:06:14 -0500 Subject: 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. --- tools/build_memory_info.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tools') 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 -- cgit v1.2.3