tmedicci opened a new pull request, #18874:
URL: https://github.com/apache/nuttx/pull/18874

   ## Summary
   
   * [arch|board]/risc-v: Allow BSS segments on PSRAM for ESP32-P4
     * Enables moving BSS data segments to the external PSRAM on ESP32-P4. This 
is controlled by a Kconfig option.
   
   ## Impact
   
   Impact on user: No.
   
   Impact on build: Yes. Allows .bss specific segments to the external PSRAM.
   
   Impact on hardware: No.
   
   Impact on documentation: No.
   
   Impact on security: No.
   
   Impact on compatibility: No.
   
   ## Testing
   
   We need to force a specific segment to check if it's being properly moved to 
the external PSRAM. `ext_ram.bss.*` segments are located at the external PSRAM. 
To test it, it's possible to enable the `FS_HEAPSIZE` and set 
`FS_HEAPBUF_SECTION=".ext_ram.bss.buf"`. Considering the 
`esp32p4-function-ev-board:psram_usrheap` defconfig as a starting point:
   
   ### Building
   
   ```
   make -j distclean
   ./tools/configure.sh -S esp32p4-function-ev-board:psram_usrheap
   kconfig-tweak -e ESPRESSIF_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
   kconfig-tweak -e FS_TMPFS
   kconfig-tweak --set-val FS_HEAPSIZE 2097152
   kconfig-tweak --set-str FS_HEAPBUF_SECTION ".ext_ram.bss.buf"
   make olddefconfig
   make flash ESPTOOL_PORT=/dev/ttyACM0 
   picocom -b 115200 /dev/ttyUSB1
   ```
   
   ### Running
   
   Check `free` to ensure that the fs_heap has 2MiB and user heap is less than 
the expected 32MiB - 2MiB (the difference is now part of the fs heap).
   
   Also, check NuttX's `nuttx.map` to check if `.ext_ram.bss.buf` is properly 
assigned to the external RAM.
   
   ### Results
   
   #### `free`
   
   ```
   nsh> free
         total       used       free    maxused    maxfree  nused  nfree name
       2097148       1564    2095584       1944    2095584     17      1 heapfs
        601860       5452     596408       8088     594152     24      2 Kmem
      31457276       4276   31453000       4656   31453000      8      1 Umem
   ```
   
   #### `nuttx.map`
   
   ```
   .ext_ram.bss    0x48000000   0x200000
                   0x48000000                        _ext_ram_bss_start = 
ABSOLUTE (.)
    *(.ext_ram.bss .ext_ram.bss.*)
    .ext_ram.bss.buf
                   0x48000000   0x200000 
/home/tiago/Documents/work/espressif/projects/nuttx/nuttxspace/nuttx/staging/libfs.a(fs_heap.o)
                   0x48200000                        . = ALIGN (0x4)
                   0x48200000                        _ext_ram_bss_end = 
ABSOLUTE (.)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to