WROVER: E (1367) cpu_start: Could not reserve internal/DMA pool!

jumjum123
Posts: 199
Joined: Mon Oct 17, 2016 3:11 pm

WROVER: E (1367) cpu_start: Could not reserve internal/DMA pool!

Postby jumjum123 » Wed Jan 24, 2018 5:26 pm

Today I got some wrover boards (LOLIN32 PRO).
First test to get my application running failed
- enabled Component config > ESP32-specific > Support for external, SPI-connected RAM
- compiled as usual
- got a binary, 50KB greater than before
- flashed
And got this on reset, any idea what I missed ?

ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x3f (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:2948
load:0x40078000,len:0
load:0x40078000,len:12604
entry 0x40078c6c
E (1367) cpu_start: Could not reserve internal/DMA pool!
abort() was called at PC 0x40080f7a on core 0

ESP_Sprite
Posts: 9708
Joined: Thu Nov 26, 2015 4:08 am

Re: WROVER: E (1367) cpu_start: Could not reserve internal/DMA pool!

Postby ESP_Sprite » Thu Jan 25, 2018 2:19 am

How large is your pool of memory reserved for DMA use? (make menuconfig -> components -> esp32-specific -> SPI RAM config -> Reserve this amount of memory etc)

jumjum123
Posts: 199
Joined: Mon Oct 17, 2016 3:11 pm

Re: WROVER: E (1367) cpu_start: Could not reserve internal/DMA pool!

Postby jumjum123 » Thu Jan 25, 2018 7:38 am

my SPIRAM part of config is this. No change from default,
Some more infos:
- size of binary is more than 1100 KB
- therefore a project related partitions table is used
- make runs in 2 steps, first a template is build, 2nd a project related make (do we need some additional args for compiling/linking ?)
- compiling an example (gatt_client) with spiram enabled runs fine

Code: Select all

CONFIG_SPIRAM_BOOT_INIT=y
CONFIG_SPIRAM_USE_MEMMAP=
CONFIG_SPIRAM_USE_CAPS_ALLOC=
CONFIG_SPIRAM_USE_MALLOC=y
CONFIG_SPIRAM_TYPE_ESPPSRAM32=y
CONFIG_SPIRAM_SIZE=4194304
CONFIG_SPIRAM_SPEED_40M=y
CONFIG_SPIRAM_MEMTEST=y
CONFIG_SPIRAM_CACHE_WORKAROUND=y
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384
CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST=
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768
CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=

ESP_Sprite
Posts: 9708
Joined: Thu Nov 26, 2015 4:08 am

Re: WROVER: E (1367) cpu_start: Could not reserve internal/DMA pool!

Postby ESP_Sprite » Thu Jan 25, 2018 8:26 am

You can try lowering CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL, especially if you do not explicitly use memory for DMA etc, or you can see if you can free up some statically allocated memory. What happens is that DMA can only be done from internal memory, so esp-idf tries to reserve a pool of it so mallocs for DMA-capable memory can succeed even if the rest of the internal memory is all allocated. However, your statically allocated variables also go into internal memory. What happened here is that you have filled up your internal memory with static variables up to the point where there is no room anymore for the 32K pool of reserved DMA memory.

jumjum123
Posts: 199
Joined: Mon Oct 17, 2016 3:11 pm

Re: WROVER: E (1367) cpu_start: Could not reserve internal/DMA pool!

Postby jumjum123 » Thu Jan 25, 2018 10:10 pm

Thanks, that helps.
Reduced that to 16KB and now its starting. :)
Where can I find some docu for this new configuration ?
I checke to use "try to usesPSRAM for WIFI..." and got restart/restart/restart :(

Is there any example how to use ?
I would like to do something like x = malloc_in_PSRAM(131072) or even better malloc(131072) which uses PSRAM on default for big mallocs ? There is a config for that, but I didn't get it working. Still uses RAM or returns 0.
During startup psram is detected:
I (459) spiram: SPI RAM mode: flash 40m sram 40m
I (459) spiram: PSRAM initialized, cache is in normal (1-core) mode.
.....
I (1401) spiram: Adding pool of 4096K of external SPI memory to heap allocator

ESP_Sprite
Posts: 9708
Joined: Thu Nov 26, 2015 4:08 am

Re: WROVER: E (1367) cpu_start: Could not reserve internal/DMA pool!

Postby ESP_Sprite » Fri Jan 26, 2018 4:53 am

You should indeed get psram if you malloc chunks bigger than the treshold set in make menuconfig; if that does not work, I'd love to see an example of it. Alternatively, you can use heap_caps_malloc(..., MALLOC_CAP_SPIRAM) to directly malloc from spiram.

jumjum123
Posts: 199
Joined: Mon Oct 17, 2016 3:11 pm

Re: WROVER: E (1367) cpu_start: Could not reserve internal/DMA pool!

Postby jumjum123 » Fri Jan 26, 2018 9:55 am

Hmmm, first I build an testproject based on helloWorld, called esp_get_free_heap_size() and got 4480548, which is great. :D
But in my project I still get 48040 bytes only after starting everything. :(

Since I've to use my own make, could please someone take a closer look to ESP32 specific part of make ?
Already removed esp32.rom.spiram_incompatible_fns.ld, which was necessary on older version of github (some commits ago) and added some psram-workaround files, without success.

Code: Select all

#
# Definitions for the build of the ESP32
#

ESP32=1

CFLAGS+=-Og -Wpointer-arith -Wno-error=unused-function -Wno-error=unused-but-set-variable \
-Wno-error=unused-variable -Wall -ffunction-sections -fdata-sections -mlongcalls -nostdlib \
-MMD -MP -std=gnu99 -fstrict-volatile-bitfields -fgnu89-inline
SOURCES += targets/esp32/jshardware.c
SOURCES += targets/esp32/esp32_neopixel.c
INCLUDE += -I$(ROOT)/targets/esp32

ifndef ESP_IDF_PATH
$(error "The ESP_IDF_PATH variable must be set")
endif
ifndef ESP_APP_TEMPLATE_PATH
$(error "The ESP_APP_TEMPLATE_PATH variable must be set")
endif
# The prefix for the ESP32 compiler
CCPREFIX=xtensa-esp32-elf-
SOURCES += targets/esp32/main.c
LDFLAGS += -L$(ESP_IDF_PATH)/ld \
-L$(ESP_IDF_PATH)/components/bt/lib \
-L$(ESP_IDF_PATH)/components/esp32/lib \
-L$(ESP_APP_TEMPLATE_PATH)/build/bootloader \
-L$(ESP_APP_TEMPLATE_PATH)/build/bt \
-L$(ESP_APP_TEMPLATE_PATH)/build/driver \
-L$(ESP_APP_TEMPLATE_PATH)/build/esp32 \
-L$(ESP_APP_TEMPLATE_PATH)/build/esptool_py \
-L$(ESP_APP_TEMPLATE_PATH)/build/expat \
-L$(ESP_APP_TEMPLATE_PATH)/build/freertos \
-L$(ESP_APP_TEMPLATE_PATH)/build/json \
-L$(ESP_APP_TEMPLATE_PATH)/build/log \
-L$(ESP_APP_TEMPLATE_PATH)/build/lwip \
-L$(ESP_APP_TEMPLATE_PATH)/build/mbedtls \
-L$(ESP_APP_TEMPLATE_PATH)/build/newlib \
-L$(ESP_APP_TEMPLATE_PATH)/build/nghttp \
-L$(ESP_APP_TEMPLATE_PATH)/build/nvs_flash \
-L$(ESP_APP_TEMPLATE_PATH)/build/partition_table \
-L$(ESP_APP_TEMPLATE_PATH)/build/pthread \
-L$(ESP_APP_TEMPLATE_PATH)/build/heap \
-L$(ESP_APP_TEMPLATE_PATH)/build/soc \
-L$(ESP_APP_TEMPLATE_PATH)/build/spi_flash \
-L$(ESP_APP_TEMPLATE_PATH)/build/tcpip_adapter \
-L$(ESP_APP_TEMPLATE_PATH)/build/vfs \
-L$(ESP_APP_TEMPLATE_PATH)/build/newlib \
-L$(ESP_APP_TEMPLATE_PATH)/build/wpa_supplicant \
-L$(ESP_APP_TEMPLATE_PATH)/build/ethernet \
-L$(ESP_APP_TEMPLATE_PATH)/build/app_update \
-L$(ESP_IDF_PATH)/components/esp32/ld \
-lgcc
ESPTOOL?=
INCLUDE+=\
-I$(ESP_APP_TEMPLATE_PATH)/build/include \
-I$(ESP_IDF_PATH)/components \
-I$(ESP_IDF_PATH)/components/newlib/include \
-I$(ESP_IDF_PATH)/components/bt/include \
-I$(ESP_IDF_PATH)/components/driver/include \
-I$(ESP_IDF_PATH)/components/esp32/include \
-I$(ESP_IDF_PATH)/components/freertos/include \
-I$(ESP_IDF_PATH)/components/json/include \
-I$(ESP_IDF_PATH)/components/log/include \
-I$(ESP_IDF_PATH)/components/lwip/include/lwip \
-I$(ESP_IDF_PATH)/components/lwip/include/lwip/port \
-I$(ESP_IDF_PATH)/components/lwip/include/lwip/posix \
-I$(ESP_IDF_PATH)/components/newlib/include \
-I$(ESP_IDF_PATH)/components/pthread/include \
-I$(ESP_IDF_PATH)/components/spi_flash/include \
-I$(ESP_IDF_PATH)/components/nvs_flash/include \
-I$(ESP_IDF_PATH)/components/tcpip_adapter/include \
-I$(ESP_IDF_PATH)/components/vfs/include \
-I$(ESP_IDF_PATH)/components/heap/include \
-I$(ESP_IDF_PATH)/components/soc/include \
-I$(ESP_IDF_PATH)/components/soc/esp32/include \
-I$(ESP_IDF_PATH)/components/soc/esp32/include/soc \
-Itargets/esp32/include
LDFLAGS+=-nostdlib -u call_user_start_cpu0 -Wl,--gc-sections -Wl,-static -Wl,-EL
LIBS+=-T esp32_out.ld \
-T$(ESP_IDF_PATH)/components/esp32/ld/esp32.common.ld \
-T$(ESP_IDF_PATH)/components/esp32/ld/esp32.rom.ld \
-T$(ESP_IDF_PATH)/components/esp32/ld/esp32.peripherals.ld \
$(ESP_IDF_PATH)/components/esp32/lib/librtc.a \
$(ESP_IDF_PATH)/components/newlib/lib/libc.a \
$(ESP_IDF_PATH)/components/newlib/lib/libm.a \
$(ESP_IDF_PATH)/components/esp32/lib/libwpa2.a \
$(ESP_IDF_PATH)/components/esp32/lib/libwps.a \
$(ESP_IDF_PATH)/components/newlib/lib/libc-psram-workaround.a \
$(ESP_IDF_PATH)/components/newlib/lib/libm-psram-workaround.a \
$(ESP_IDF_PATH)/components/esp32/libstdc++-psram-workaround.a \
-lbt \
-lbtdm_app \
-ldriver \
-lesp32 \
$(ESP_IDF_PATH)/components/esp32/libhal.a  \
-lcore \
-lnet80211 \
-lphy \
-lwpa_supplicant \
-lrtc \
-lpp \
-lwpa \
-lexpat \
-lfreertos \
-ljson \
-llog \
-llwip \
-lmbedtls \
-lnghttp \
-lnvs_flash \
-lheap \
-lpthread \
-lsoc \
-lspi_flash \
-ltcpip_adapter \
-lvfs \
-lnewlib \
-lcoexist \
-lethernet \
-lapp_update \
-lstdc++ \
-lgcc

#needed for using ifdef in wrapper JSON
DEFINES += -DESP32

ifdef USE_BLUETOOTH
SOURCES+= targets/esp32/bluetooth.c \
targets/esp32/BLE/esp32_bluetooth_utils.c \
targets/esp32/BLE/esp32_gap_func.c \
targets/esp32/BLE/esp32_gatts_func.c \
targets/esp32/BLE/esp32_gattc_func.c
INCLUDE+= -I$(ESP_IDF_PATH)/components/bt/bluedroid/include \
-I$(ESP_IDF_PATH)/components/bt/bluedroid/api/include \
-I$(ESP_IDF_PATH)/components/bt/bluedroid/bta/include \
-I$(ESP_IDF_PATH)/components/bt/bluedroid/stack/include \
-I$(ESP_IDF_PATH)/components/bt/bluedroid/stack/gatt/include \
-I$(ESP_IDF_PATH)/components/bt/bluedroid/osi/include
LDFLAGS+= -L$(ESP_APP_TEMPLATE_PATH)/build/components/bt/bluedroid/api \
-L$(ESP_APP_TEMPLATE_PATH)/build/components/bt/bluedroid/bta 
endif

Who is online

Users browsing this forum: No registered users and 89 guests