Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HELP] ESP32-C3 Lower memory on 12.7 #14263

Open
1 task done
metarutaiga opened this issue Oct 14, 2024 · 7 comments
Open
1 task done

[HELP] ESP32-C3 Lower memory on 12.7 #14263

metarutaiga opened this issue Oct 14, 2024 · 7 comments

Comments

@metarutaiga
Copy link

metarutaiga commented Oct 14, 2024

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

  • I have verified before submitting the report.
@fdcavalcanti
Copy link
Contributor

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.

@metarutaiga
Copy link
Author

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
Copy link
Author

metarutaiga commented Oct 15, 2024

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
Copy link
Author

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> 

@eren-terzioglu
Copy link
Contributor

eren-terzioglu commented Oct 15, 2024

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

@metarutaiga
Copy link
Author

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
Copy link
Author

metarutaiga commented Nov 11, 2024

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 espressif/esp-idf@6f20668
.wifiextrairam.6 0000019e ieee80211_output_do
.iram0.text 00000294 ieee80211_output_process espressif/esp-idf@039ef51
.wifiextrairam.4 0000004e ieee80211_post_hmac_tx
.iram0.text 00000048 lmacAdjustTimestamp
.wifiextrairam.23 000000d6 lmacDiscardFrameExchangeSequence
.iram0.text 00000314 lmacEndFrameExchangeSequence espressif/esp-idf@edbf44b
.iram0.text 0000005c lmacMSDUAged espressif/esp-idf@36e082d
.wifiextrairam.38 00000138 lmacProcessTxComplete
.wifiextrairam.18 00000104 lmacProcessTxSuccess
.wifiextrairam.5 000001f8 lmacSetTxFrame espressif/esp-idf@b20922c
.wifiextrairam.37 00000080 ppAssembleAMPDU espressif/esp-idf@b7d5999
.iram0.text 000002e0 ppCalTxAMPDULength espressif/esp-idf@b7d5999
.wifiextrairam.70 0000006a ppDirectRecycleAmpdu
.iram0.text 00000158 ppMapTxQueue
.wifiextrairam.62 0000012a ppMapWaitTxq espressif/esp-idf@e6efcc4
.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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants