diff --git a/builder/main.py b/builder/main.py index 21348d3..3aabec6 100644 --- a/builder/main.py +++ b/builder/main.py @@ -533,6 +533,12 @@ if any("-Wl,-T" in f for f in env.get("LINKFLAGS", [])): print("Warning! '-Wl,-T' option for specifying linker scripts is deprecated. " "Please use 'board_build.ldscript' option in your 'platformio.ini' file.") +# +# Override memory inspection behavior +# + +env.SConscript("sizedata.py", exports="env") + # # Default targets # diff --git a/builder/sizedata.py b/builder/sizedata.py new file mode 100644 index 0000000..e6e9476 --- /dev/null +++ b/builder/sizedata.py @@ -0,0 +1,26 @@ +import re + +Import("env") + + +def pioSizeIsRamSectionCustom(env, section): + if section and re.search( + r"\.dram0\.data|\.dram0\.bss|\.noinit", section.get("name", "") + ): + return True + + return False + + +def pioSizeIsFlashectionCustom(env, section): + if section and re.search( + r"\.iram0\.text|\.iram0\.vectors|\.dram0\.data|\.flash\.text|\.flash\.rodata|\.flash\.appdesc", + section.get("name", ""), + ): + return True + + return False + + +env.AddMethod(pioSizeIsRamSectionCustom, "pioSizeIsRamSection") +env.AddMethod(pioSizeIsFlashectionCustom, "pioSizeIsFlashSection")