nuttx icon indicating copy to clipboard operation
nuttx copied to clipboard

[HELP] ESP32-C3 Lower memory on 12.7

Open metarutaiga opened this issue 1 year ago • 6 comments

Description

I upgrade to 12.7 but it show lower memory than 12.6

NuttShell (NSH) NuttX-12.6.0
nsh> free
                 total       used       free    maxused    maxfree  nused  nfree
      Umem:     316092     163716     152376     223768      96304    337      7
NuttShell (NSH) NuttX-12.7.0
nsh> free
                 total       used       free    maxused    maxfree  nused  nfree
      Umem:     282756     136676     146080     137944     145936    230      5

Verification

  • [X] I have verified before submitting the report.

metarutaiga avatar Oct 14 '24 10:10 metarutaiga

Thanks for reporting. Is your apps directory also on the correct release? Please share which configuration and board you are using, then I can verify.

fdcavalcanti avatar Oct 14 '24 10:10 fdcavalcanti

Build

./tools/configure.sh esp32c3-generic:sta_softap
make

12.6

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xf (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x3fcd89a0,len:0x1458
load:0x403c7000,len:0x21cc
load:0x403d0000,len:0x22ec
entry 0x403d2298
[esp32c3] [INF] *** Booting MCUboot build v2.1.0 ***
[esp32c3] [INF] [boot] chip revision: v0.4
[esp32c3] [INF] [boot.esp32c3] SPI Speed      : 40MHz
[esp32c3] [INF] [boot.esp32c3] SPI Mode       : DIO
[esp32c3] [INF] [boot.esp32c3] SPI Flash Size : 4MB
[esp32c3] [INF] [boot] Enabling RNG early entropy source...
[esp32c3] [INF] Primary image: magic=good, swap_type=0x1, copy_done=0x3, image_ok=0x1
[esp32c3] [INF] Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[esp32c3] [INF] Boot source: primary slot
[esp32c3] [INF] Image index: 0, Swap type: none
[esp32c3] [INF] Disabling RNG early entropy source...
[esp32c3] [INF] br_image_off = 0x10000
[esp32c3] [INF] ih_hdr_size = 0x20
[esp32c3] [INF] Loading image 0 - slot 0 from flash, area id: 1
[esp32c3] [INF] DRAM segment: start=0x37199, size=0x1c30, vaddr=0x3fc85990
[esp32c3] [INF] IRAM segment: start=0x31809, size=0x5990, vaddr=0x40380000
[esp32c3] [INF] start=0x4038325e

NuttShell (NSH) NuttX-12.6.0
nsh> free
                 total       used       free    maxused    maxfree  nused  nfree
      Umem:     321756      51212     270544      51568     270512    103      2
nsh> 

12.7

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0xc (RTC_SW_CPU_RST),boot:0xd (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382088
SPIWP:0xee
mode:DIO, clock div:2
load:0x3fcd89a0,len:0x1458
load:0x403c7000,len:0x21cc
load:0x403d0000,len:0x22ec
entry 0x403d2298
[esp32c3] [INF] *** Booting MCUboot build v2.1.0 ***
[esp32c3] [INF] [boot] chip revision: v0.4
[esp32c3] [INF] [boot.esp32c3] SPI Speed      : 40MHz
[esp32c3] [INF] [boot.esp32c3] SPI Mode       : DIO
[esp32c3] [INF] [boot.esp32c3] SPI Flash Size : 4MB
[esp32c3] [INF] [boot] Enabling RNG early entropy source...
[esp32c3] [INF] Primary image: magic=good, swap_type=0x1, copy_done=0x3, image_ok=0x1
[esp32c3] [INF] Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[esp32c3] [INF] Boot source: primary slot
[esp32c3] [INF] Image index: 0, Swap type: none
[esp32c3] [INF] Disabling RNG early entropy source...
[esp32c3] [INF] br_image_off = 0x10000
[esp32c3] [INF] ih_hdr_size = 0x20
[esp32c3] [INF] Loading image 0 - slot 0 from flash, area id: 1
[esp32c3] [INF] DRAM segment: start=0x19798, size=0x19c0, vaddr=0x3fc89760
[esp32c3] [INF] IRAM segment: start=0x10040, size=0x9758, vaddr=0x40380000
[esp32c3] [INF] start=0x4038501a

NuttShell (NSH) NuttX-12.7.0
nsh> free
                 total       used       free    maxused    maxfree  nused  nfree
      Umem:     287668      54316     233352      54672     233320    109      2
nsh> 

metarutaiga avatar Oct 14 '24 14:10 metarutaiga

12.7 with ESP-HAL-8e8e62cf6a7ae8a9659b91706024cab38af29118 (Jul 10, 2024)

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xd (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x3fcd89a0,len:0x1458
load:0x403c7000,len:0x21cc
load:0x403d0000,len:0x22ec
entry 0x403d2298
[esp32c3] [INF] *** Booting MCUboot build v2.1.0 ***
[esp32c3] [INF] [boot] chip revision: v0.4
[esp32c3] [INF] [boot.esp32c3] SPI Speed      : 40MHz
[esp32c3] [INF] [boot.esp32c3] SPI Mode       : DIO
[esp32c3] [INF] [boot.esp32c3] SPI Flash Size : 4MB
[esp32c3] [INF] [boot] Enabling RNG early entropy source...
[esp32c3] [INF] Primary image: magic=good, swap_type=0x1, copy_done=0x3, image_ok=0x1
[esp32c3] [INF] Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[esp32c3] [INF] Boot source: primary slot
[esp32c3] [INF] Image index: 0, Swap type: none
[esp32c3] [INF] Disabling RNG early entropy source...
[esp32c3] [INF] br_image_off = 0x10000
[esp32c3] [INF] ih_hdr_size = 0x20
[esp32c3] [INF] Loading image 0 - slot 0 from flash, area id: 1
[esp32c3] [INF] DRAM segment: start=0x159a8, size=0x15c8, vaddr=0x3fc85970
[esp32c3] [INF] IRAM segment: start=0x10040, size=0x5968, vaddr=0x40380000
[esp32c3] [INF] start=0x40383232

NuttShell (NSH) NuttX-12.7.0-RC0
nsh> free
                 total       used       free    maxused    maxfree  nused  nfree
      Umem:     304380      51220     253160      51576     253128    103      2
nsh>

metarutaiga avatar Oct 15 '24 08:10 metarutaiga

12.7 with ESP-HAL-4da68b02f8d65613d80eadc269034acb84aca756 (Aug 13, 2024)

ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xd (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x3fcd89a0,len:0x1458
load:0x403c7000,len:0x21cc
load:0x403d0000,len:0x22ec
entry 0x403d2298
[esp32c3] [INF] *** Booting MCUboot build v2.1.0 ***
[esp32c3] [INF] [boot] chip revision: v0.4
[esp32c3] [INF] [boot.esp32c3] SPI Speed      : 40MHz
[esp32c3] [INF] [boot.esp32c3] SPI Mode       : DIO
[esp32c3] [INF] [boot.esp32c3] SPI Flash Size : 4MB
[esp32c3] [INF] [boot] Enabling RNG early entropy source...
[esp32c3] [INF] Primary image: magic=good, swap_type=0x1, copy_done=0x3, image_ok=0x1
[esp32c3] [INF] Scratch: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
[esp32c3] [INF] Boot source: primary slot
[esp32c3] [INF] Image index: 0, Swap type: none
[esp32c3] [INF] Disabling RNG early entropy source...
[esp32c3] [INF] br_image_off = 0x10000
[esp32c3] [INF] ih_hdr_size = 0x20
[esp32c3] [INF] Loading image 0 - slot 0 from flash, area id: 1
[esp32c3] [INF] DRAM segment: start=0x191a4, size=0x189c, vaddr=0x3fc89170
[esp32c3] [INF] IRAM segment: start=0x10040, size=0x9164, vaddr=0x40380000
[esp32c3] [INF] start=0x40384a28

NuttShell (NSH) NuttX-12.7.0-RC0
nsh> free
                 total       used       free    maxused    maxfree  nused  nfree
      Umem:     289556      54332     235224      54688     235192    109      2
nsh> 

metarutaiga avatar Oct 15 '24 08:10 metarutaiga

Hi @metarutaiga, Thanks for the details. We will look into that.

eren-terzioglu avatar Oct 15 '24 08:10 eren-terzioglu

Show free memory after make

diff --git a/tools/espressif/Config.mk b/tools/espressif/Config.mk
index 4e76bd1d0c..ab6e659c8b 100644
--- a/tools/espressif/Config.mk
+++ b/tools/espressif/Config.mk
@@ -136,6 +136,10 @@ define MKIMAGE
        imgtool sign $(IMGTOOL_SIGN_ARGS) nuttx.hex nuttx.bin
        $(Q) echo nuttx.bin >> nuttx.manifest
        $(Q) echo "Generated: nuttx.bin (MCUboot compatible)"
+       $(Q) git log -1 --pretty=" * nuttx:%cs (%h)"
+       $(Q) git -C arch/risc-v/src/esp32c3/esp-hal-3rdparty log -1 --pretty=" * hal:%cs (%h)"
+       $(Q) imgtool dumpinfo nuttx.bin | grep img_size | awk -F ' ' '{print " * " "firmware:" 0 + $$2 " (" $$2 ")"}'
+       $(Q) objdump -h nuttx | grep .[di]ram | awk -F ' ' '{print "0x" $$3}' | awk '{s+=$$1} END {print " * " "free:" 16384 + 393216 - s "\n * " "used:" s}'
 endef
 else
 define MKIMAGE

Result

LD: nuttx                                                                       
CP: nuttx.hex
MKIMAGE: NuttX binary
imgtool sign --pad --confirm --align 4 -v 0 -s auto -H 32 --pad-header -S 0x150000 nuttx.hex nuttx.bin
Generated: nuttx.bin (MCUboot compatible)
 * nuttx:2024-10-18 (d39bcd4ad5)
 * hal:2024-06-07 (9bc2c73838)
 * firmware:1038464 (0xfd880)
 * free:296448
 * used:113152

metarutaiga avatar Oct 19 '24 15:10 metarutaiga

I found it updated and replaced the rom codes from 5.1.4 to 5.1.5

Section Size Symbol Note
.wifiextrairam.5 00000080 ieee80211_alloc_tx_buf
.iram0.text 00000270 ieee80211_ampdu_reorder https://github.com/espressif/esp-idf/commit/6f20668b2468baedce2bedfe24aa3687ddf04b29
.wifiextrairam.6 0000019e ieee80211_output_do
.iram0.text 00000294 ieee80211_output_process https://github.com/espressif/esp-idf/commit/039ef51db50992db68764626d5cf73a32d53d6cb
.wifiextrairam.4 0000004e ieee80211_post_hmac_tx
.iram0.text 00000048 lmacAdjustTimestamp
.wifiextrairam.23 000000d6 lmacDiscardFrameExchangeSequence
.iram0.text 00000314 lmacEndFrameExchangeSequence https://github.com/espressif/esp-idf/commit/edbf44b290729b5c3ce935ba1a5ba99dc4e93ee6
.iram0.text 0000005c lmacMSDUAged https://github.com/espressif/esp-idf/commit/36e082d6e222fd29e4cdb770dd6ad37b4fffec01
.wifiextrairam.38 00000138 lmacProcessTxComplete
.wifiextrairam.18 00000104 lmacProcessTxSuccess
.wifiextrairam.5 000001f8 lmacSetTxFrame https://github.com/espressif/esp-idf/commit/b20922c6d582082e151f269e0ddedb5ba7a79ef8
.wifiextrairam.37 00000080 ppAssembleAMPDU https://github.com/espressif/esp-idf/commit/b7d599984bc5fc65459e8959d46efc76615ce8d4
.iram0.text 000002e0 ppCalTxAMPDULength https://github.com/espressif/esp-idf/commit/b7d599984bc5fc65459e8959d46efc76615ce8d4
.wifiextrairam.70 0000006a ppDirectRecycleAmpdu
.iram0.text 00000158 ppMapTxQueue
.wifiextrairam.62 0000012a ppMapWaitTxq https://github.com/espressif/esp-idf/commit/e6efcc407e54713bd31eae1bbdbbf3554ee6deda
.iram0.text 000000b0 ppProcessLifeTime
.wifiextrairam.20 00000194 ppProcTxDone
.wifiextrairam.72 000000a8 ppRegressAmpdu
.iram0.text 0000011c ppRxPkt
.iram0.text 00000118 wDev_AppendRxBlocks
.iram0.text 000002d2 wDev_IndicateFrame
.iram0.text 0000033a wDev_ProcessRxSucData

metarutaiga avatar Nov 11 '24 03:11 metarutaiga