[MicroPython ESP32] 内存分析

[MicroPython ESP32] 内存分析

[(1)芯片:ESP32-WROOM-DA]

手册:

芯片资源简介:

  ESP32-D0WDQ6 内置两个低功耗 Xtensa® 32-bit LX6 MCU。

  片上存储包括:

  • 448 KB 的 ROM,用于程序启动和内核功能调用

  • 用于数据和指令存储的 520 KB 片上 SRAM

  • RTC 快速存储器,为 8 KB 的 SRAM,可以在 Deep-sleep 模式下 RTC 启动时用于数据存储以及被主 CPU 访问

  • RTC 慢速存储器,为 8 KB 的 SRAM,可以在 Deep-sleep 模式下被协处理器访问

  • 1 Kbit 的 eFuse,其中 256 bit 为系统专用(MAC 地址和芯片设置); 其余 768 bit 保留给用户程序, 这些 程序包括 flash 加密和芯片 ID。

  • 内部还集成了一颗4MB的Flash芯片,代码就存储在这里。

 

烧录了MicroPython固件后的内存占用情况。

The WROOM device has 4 MB of Flash and about 500k of RAM. The Flash memory is used for the firmware and the file system. Most of the RAM is used by the RTOS and MicroPython interpreter itself, such that for the Python Heap 110k of RAM remain. That is the working space for Python scripts.

  • 用于数据和指令存储的 520 KB 片上 SRAM
  • 内部还集成了一颗4MB的Flash芯片,代码就存储在这里。(Flash中存储了MicroPython固件和集成了文件系统)
  • 520KB的片上SRAM,大部分被RTOS和MicroPython解释器本身所使用,如果你使用micropython.mem_info()获取到的内存大小时大概只有110Kb的RAM可以使用。
MicroPython v1.19.1-528-gb8982ec5f-dirty on 2022-10-09; ESP32 module with ESP32
Type "help()" for more information.
>>> import micropython
>>> micropython.mem_info()
stack: 704 out of 15360
GC: total: 111168, used: 1584, free: 109584
 No. of 1-blocks: 27, 2-blocks: 8, max blk sz: 18, max free sz: 6836

 

 FLASH读取:

import esp

esp.osdebug(None)       # turn off vendor O/S debugging messages
esp.osdebug(0)          # redirect vendor O/S debugging messages to UART(0)

# low level methods to interact with flash storage
esp.flash_size()
esp.flash_user_start()
esp.flash_erase(sector_no)
esp.flash_write(byte_offset, buffer)
esp.flash_read(byte_offset, buffer)

实例:4M - FLASH

>>> esp.flash_size()/1024/1024
4.0

 

 

 

 

 

 

 


 

参考链接:

[1] ESP32 4 MB 闪存?

posted on 2022-10-10 14:43  iBoundary  阅读(1591)  评论(0编辑  收藏  举报

导航