diff options
Diffstat (limited to 'tools/build_memory_info.py')
| -rw-r--r-- | tools/build_memory_info.py | 10 |
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 |
