Skip to content

Commit 2865654

Browse files
committed
Override default behavior of memory analysis feature
1 parent a47ecbf commit 2865654

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

builder/main.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,12 @@ def __fetch_fs_size(target, source, env):
533533
print("Warning! '-Wl,-T' option for specifying linker scripts is deprecated. "
534534
"Please use 'board_build.ldscript' option in your 'platformio.ini' file.")
535535

536+
#
537+
# Override memory inspection behavior
538+
#
539+
540+
env.SConscript("sizedata.py", exports="env")
541+
536542
#
537543
# Default targets
538544
#

builder/sizedata.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import re
2+
3+
Import("env")
4+
5+
6+
def pioSizeIsRamSectionCustom(env, section):
7+
if section and re.search(
8+
r"\.dram0\.data|\.dram0\.bss|\.noinit", section.get("name", "")
9+
):
10+
return True
11+
12+
return False
13+
14+
15+
def pioSizeIsFlashectionCustom(env, section):
16+
if section and re.search(
17+
r"\.iram0\.text|\.iram0\.vectors|\.dram0\.data|\.flash\.text|\.flash\.rodata|\.flash\.appdesc",
18+
section.get("name", ""),
19+
):
20+
return True
21+
22+
return False
23+
24+
25+
env.AddMethod(pioSizeIsRamSectionCustom, "pioSizeIsRamSection")
26+
env.AddMethod(pioSizeIsFlashectionCustom, "pioSizeIsFlashSection")

0 commit comments

Comments
 (0)