espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.33k stars 7.2k forks source link

Even if I set CONFIG_SPIRAM_IGNORE_NOTFOUND=y in Config, if I try to get the SPIRAM size on a model that does not have SPIRAM, it aborts. (IDFGH-6326) #7988

Open lovyan03 opened 2 years ago

lovyan03 commented 2 years ago

Environment

Problem Description

I am trying to create a program that will use SPIRAM if it is available and work without SPIRAM. When I tried this two years ago, I was able to create it without any problems.

Probably after the following update, it will now "abort" if SPIRAM is not installed. https://github.com/espressif/esp-idf/commit/bff6b5b70e042dbf5014a7463036fa8e9fc44490

Here abort() is written, which used to be return ESP_SPIRAM_SIZE_INVALID;. https://github.com/espressif/esp-idf/blob/fdfa260b9197a0ef57e5d1d741cbd2e767d86128/components/esp_hw_support/port/esp32/spiram.c#L141-L146

Expected Behavior

Perhaps we can call "esp_spiram_is_initialized" in the user program and then branch, but If SPIRAM is not installed, it is desirable to be able to get the size 0.

Actual Behavior

https://github.com/espressif/esp-idf/blob/fdfa260b9197a0ef57e5d1d741cbd2e767d86128/components/esp_hw_support/port/esp32/spiram.c#L160-L171

with SPIRAM : No problem.

esp_spiram_init() … psram_enable() is ESP_OK, set "spiram_inited=true". esp_spiram_get_chip_size() … if (!spiram_inited) ==false, return spiram size.

without SPIRAM : abort.

esp_spiram_init() … psram_enable() is error, NOT set "spiram_inited=true". esp_spiram_get_chip_size() … if (!spiram_inited) ==true, ESP_LOG "SPI RAM not initialized" and abort.

ZweiEuro commented 2 years ago

Same issue for me