ESP32编译时的一些问题
-
在编译带psram模块的固件时,常规psram和psram-oct的区别
参考https://iot.stackexchange.com/questions/6608/unable-to-run-micropython-on-esp32-wroom

上图是部分esp32-s3模块的flash类型和psram类型情况,在psram为2M时,使用的是QuadSPI,则选择常规psram。psram为8M时,使用的是OctalSPI,选择psram-oct选项
对应./micropython/ports/esp32/boards里的sdkconfig.spiram或sdkconfig.spiram_oct配置
所有芯片/模组的psram类型可以在乐鑫官方的选型工具中查看:
(https://products.espressif.com/#/product-selector?language=zh&names=) -
在psram为8M时,在micropython里能利用上全部的8M内存吗?
参考https://github.com/orgs/micropython/discussions/11018
不可以,因为esp32的关系,在系统默认的情况时,只能使用4M内存。 -
自定义固件创建流程, 这里我使用esp32 8M flash, 8M psram模块.
- micropython\ports\esp32\boards\ESP32_GENERIC中创建新的sdkconfig, 我把它起名叫sdkconfig.custom
# MicroPython on ESP32, ESP IDF configuration with SPIRAM support CONFIG_SPIRAM=y CONFIG_SPIRAM_CACHE_WORKAROUND=y CONFIG_SPIRAM_IGNORE_NOTFOUND=y CONFIG_SPIRAM_USE_MALLOC=y CONFIG_SPIRAM_MODE_QUAD= CONFIG_SPIRAM_MODE_OCT=y # This is the threshold for preferring small allocations from internal memory # first, before failing over to PSRAM. CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=8192 # SPIRAM increases the size of the firmware and overflows iram0_0_seg, due # to PSRAM bug workarounds. Apply some options to reduce the firmware size. CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y # CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH=y # Workaround required: see main_esp32/linker.lf CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH=y # 8M flash CONFIG_ESPTOOLPY_FLASHSIZE_4MB=n CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y CONFIG_ESPTOOLPY_FLASHSIZE_16MB=n CONFIG_PARTITION_TABLE_CUSTOM=y CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-8MiB.csv"- micropython\ports\esp32\boards\ESP32_GENERIC\mpconfigboard.cmake中新增配置项
if(MICROPY_BOARD_VARIANT STREQUAL "CUSTOM") set(SDKCONFIG_DEFAULTS ${SDKCONFIG_DEFAULTS} boards/ESP32_GENERIC/sdkconfig.custom ) list(APPEND MICROPY_DEF_BOARD MICROPY_HW_BOARD_NAME="Generic ESP32 module with SPIRAM" ) endif()- 删除已有的build文件夹, 否则新的sdkconfig文件不会生效
- 进入micropython\ports\esp32, 执行指令
make BOARD=ESP32_GENERIC BOARD_VARIANT=CUSTOM

浙公网安备 33010602011771号