os/tools/memstats_gnueabil.py : Show all section details dynamically#7352
os/tools/memstats_gnueabil.py : Show all section details dynamically#7352anjana348 wants to merge 1 commit into
Conversation
|
PR #7352 — os/tools/memstats_gnueabil.py : Show all section details dynamically
Repository: Base → Head: HEAD Commit: Scope: Review Summary
Final Verdict: ❗ Request Changes Must-Fix Issues1. Memory summary omits non-library allocated sections from RAM/PSRAM totals
Problem Impact
Evidence
Required Fix
Change outline:
Example patch: diff --git a/os/tools/memstats_gnueabil.py b/os/tools/memstats_gnueabil.py
@@
- activeSections = getActiveSections()
+ activeSections = [
+ sec for sec in displaySections
+ if sectionInfo.get(sec, {}).get('size', 0) > 0 or sec in sectionLibSizes
+ ]
@@
- grandTotal = sum(libMemory[lib]['total'] for lib in sortedLibs)
+ categoryTotals = {'SRAM': 0, 'DRAM': 0, 'PSRAM': 0, 'FLASH': 0, 'OTHER': 0}
+ for secName in activeSections:
+ categoryTotals[categorizeSection(secName)] += sectionInfo.get(secName, {}).get('size', 0)
+ grandTotal = sum(categoryTotals.values())Inference:
Validation Method
Nice-to-Have Improvements1. New regex literals emit Python 3 SyntaxWarning on every invocation
Problem Impact
Recommended Action
Example Validation Matrix
Notable Improvements✔ Dynamic section columns make the library report more complete
✔ Board-aware category labels improve readability
Final AssessmentMust-Fix Summary
Nice-to-Have Summary
Residual Risk
Final Verdict
The dynamic section report is useful, but the memory distribution must be corrected before it is reliable for embedded footprint decisions. |
|
Could you update commit and PR title? |
Current method shows 3 fixed memory sections(.data, .bss, .text), as Mr Nam asked to check for any missing sections, |
1. The updated script dynamically discovers all memory sections from the map file instead of hardcoding only 3 sections '.text/.data/.bss', revealing previously invisible sections like '.iram', '.psram_bss', '.psram_data' that contain significant memory usage 2. Size of sections like(.text) were smaller than actual previously Previous output: .data .bss .text Total 6100 4920 187469 198489 libboard.a Current output: Library/Binary .vectors .text .iram .data .bss .psram_data .psram_bss SRAM PSRAM Flash Other Total ----------------------------------------------------------------------------------------------------------------------------------------------- libboard.a 416 332210 7408 6100 4920 0 11700 18428 11700 332626 0 362754 Usage: python3 os/tools/memstats_gnueabil.py --help -----> It will give all command details For ex - to see memory information python3 os/tools/memstats_gnueabil.py -m -f ../Beken/xip_all/tinyara.map Detected Board: bk7239n Section Categories (dynamically detected from map file): FLASH: .text, .vectors SRAM: .bss, .data, .iram PSRAM: .psram_bss, .psram_data Library/Binary .vectors .text .iram .data .bss .psram_data .psram_bss SRAM PSRAM Flash Other Total ----------------------------------------------------------------------------------------------------------------------------------------------- libboard.a 416 332210 7408 6100 4920 0 11700 18428 11700 332626 0 362754 libbluetooth.a 0 219020 0 20 70692 0 0 70712 0 219020 0 289732 libwifi.a 0 156281 44945 216 46080 0 0 91241 0 156281 0 247522 libbk_phy.a 0 144848 480 168 2396 0 0 3044 0 144848 0 147892 libnet.a 0 66698 16900 152 56008 296 176 73060 472 66698 0 140230 libmiddleware.a 0 49946 5680 356 10260 0 0 16296 0 49946 0 66242 libfs.a 0 63669 0 0 0 0 64 0 64 63669 0 63733 libkernel.a 0 44303 4072 0 0 4 13580 4072 13584 44303 0 61959 libkarch.a 0 16847 2060 528 9220 528 860 11808 1388 16847 0 30043 libkmm.a 0 18267 0 0 0 24 9592 0 9616 18267 0 27883 libkc.a 0 22038 0 0 0 12 296 0 308 22038 0 22346 libcompression.a 0 15776 0 0 0 4 12 0 16 15776 0 15792 libdrivers.a 0 14387 0 0 0 0 360 0 360 14387 0 14747 libse.a 0 7996 0 0 0 140 256 0 396 7996 0 8392 NOLIB 0 6256 0 0 0 0 0 0 0 6256 0 6256 libgcc.a 0 5288 0 0 0 0 0 0 0 5288 0 5288 libpm.a 0 4470 0 0 0 36 60 0 96 4470 0 4566 libbinfmt.a 0 4068 0 0 0 12 40 0 52 4068 0 4120 libstubs.a 0 2182 0 0 0 0 0 0 0 2182 0 2182 libkwque.a 0 1153 0 0 0 0 28 0 28 1153 0 1181 libbk_coex.a 0 764 0 0 24 0 0 24 0 764 0 788 ----------------------------------------------------------------------------------------------------------------------------------------------- TOTAL 416 1196467 81545 7540 199600 1056 37024 288685 38080 1196883 0 1523648 Memory Distribution: SRAM: 288685 bytes (18.95%) PSRAM: 38080 bytes (2.50%) Flash: 1196883 bytes (78.55%)
os/tools/memstats_gnueabil.py : Show all section details dynamically
The updated script dynamically discovers all memory sections from the map file instead of hardcoding only 3 sections '.text/.data/.bss',
revealing previously invisible sections like '.iram', '.psram_bss', '.psram_data' that contain significant memory usage
Size of sections like(.text) were smaller than actual previously
Added total RAM/FLASH memory usage
Previous output:
.data .bss .text Total
6100 4920 187469 198489 libboard.a
Current output:
Library/Binary .vectors .text .iram .data .bss .psram_data .psram_bss SRAM PSRAM Flash Other Total
libboard.a 416 332210 7408 6100 4920 0 11700 18428 11700 332626 0 362754
Usage:
python3 os/tools/memstats_gnueabil.py --help -----> It will give all command details
For ex - to see memory information
python3 os/tools/memstats_gnueabil.py -m -f ../Beken/xip_all/tinyara.map
Detected Board: bk7239n
Section Categories (dynamically detected from map file):
FLASH: .text, .vectors
SRAM: .bss, .data, .iram
PSRAM: .psram_bss, .psram_data
Memory Distribution
SRAM: 288685 bytes (18.95%)
PSRAM: 38080 bytes (2.50%)
Flash: 1196883 bytes (78.55%)