I am trying to use the `ram_report` tool and the results seem to have some issues:
1. The total size reported is much more that that reported when linking the zephyr.elf executable.
2. Data from the RO sections seem to be in the RAM report.
I used the location sample (nrf/samples/nrf9160/location).
west build -p -b nrf9160dk_nrf9160_ns west build -t ram_report
The build gives a RAM size of 44472 bytes:
[314/316] Linking C executable zephyr/zephyr.elf Memory region Used Size Region Size %age Used FLASH: 144668 B 992 KB 14.24% RAM: 44472 B 211608 B 21.02% IDT_LIST: 0 GB 2 KB 0.00% [316/316] Generating zephyr/merged.hex
The ram_report gives a total size of 67452 bytes:
[0/18] Performing build step for 'tfm' ninja: no work to do. [2/4] Performing install step for 'tfm' -- Install configuration: "MinSizeRel" [3/4] cd /home/serrano/projects/phywi/nrf-connect-sdk/ncs/nrf/samples/nrf9160/location/build && /usr/b.../samples/nrf9160/location/build --workspace=/home/serrano/projects/phywi/nrf-connect-sdk/ncs -d 99 ram WARN: Symbol 'tfm_psa_call_veneer' is not in RAM or ROM Path Size % ============================================================================================================== Root 67452 100.00%
In addition, the ram_report seems to include some read-only data:
│ │ │ ├── location.c 46 0.07% │ │ │ │ ├── LOCATION_METHOD_CELLULAR_STR 9 0.01% │ │ │ │ ├── LOCATION_METHOD_GNSS_STR 5 0.01% │ │ │ │ ├── LOCATION_METHOD_INTERNAL_WIFI_CELLULAR_STR 17 0.03% │ │ │ │ ├── LOCATION_METHOD_UNKNOWN_STR 8 0.01% │ │ │ │ ├── LOCATION_METHOD_WIFI_STR 6 0.01% │ │ │ │ └── initialized 1 0.00%
These symbols are in the RO section as shown by the zephyr.map file:
.rodata.LOCATION_METHOD_UNKNOWN_STR 0x0000000000029231 0x8 modules/nrf/lib/location/lib..__nrf__lib__location.a(location.c.obj) .rodata.LOCATION_METHOD_INTERNAL_WIFI_CELLULAR_STR 0x0000000000029239 0x11 modules/nrf/lib/location/lib..__nrf__lib__location.a(location.c.obj) .rodata.LOCATION_METHOD_WIFI_STR 0x000000000002924a 0x6 modules/nrf/lib/location/lib..__nrf__lib__location.a(location.c.obj) .rodata.LOCATION_METHOD_GNSS_STR 0x0000000000029250 0x5 modules/nrf/lib/location/lib..__nrf__lib__location.a(location.c.obj) .rodata.LOCATION_METHOD_CELLULAR_STR 0x0000000000029255 0x9 modules/nrf/lib/location/lib..__nrf__lib__location.a(location.c.obj)
I am using v2.4.0 of the nrf library. I have downgraded the anytree python library to v2.8.0 to avoid issues as described here:https://github.com/zephyrproject-rtos/zephyr/issues/60213
The puncover tool provides a different RAM size, closer to that indicated by the linker:
Thanks!