Page 1 of 1
one binary for wroom and wrover ?
Posted: Mon Feb 05, 2018 9:13 am
by jumjum123
Is there a way to create a binary which recognizes and the supports psram, available on wrover based boards ?
And still works if there is no psram found, like wroom based boards ?
Otherwise we had to support 2 versions which ends in a lot of work/time for user and developer.
Re: one binary for wroom and wrover ?
Posted: Mon Feb 05, 2018 9:18 am
by ESP_Sprite
Hmm, I don't think we have that yet... in theory, we could just add an option to skip adding PSRAM to the heap when we detect an issue with initializing PSRAM, in contrast to panic'ing as we do now. Would that work for you?
Re: one binary for wroom and wrover ?
Posted: Mon Feb 05, 2018 9:41 am
by jumjum123
That would be a good solution, and I would like to get it soon
Re: one binary for wroom and wrover ?
Posted: Wed Feb 07, 2018 9:34 am
by Vader_Mester
I need the same thing, so I could have easier management for OTA updates.
Vader [BEN]
Re: one binary for wroom and wrover ?
Posted: Fri Feb 09, 2018 9:59 am
by jumjum123
I've done a first simple test.
At least in my application, everything runs fine.
Its tested on a WROOM board and on a WROVER board.
Usuallly, things looking that easy to implement, have some sideeffects, ........
In components/esp32/Kconfig
Code: Select all
config SPIRAM_MODE_ON_NOPSRAM
bool "Abort on no SPI RAM available"
default "y"
help
If no SPI RAM is found, startup aborts
or ignores if disabled
choice SPIRAM_USE
And in components/esp32/cpu_start.c
Code: Select all
bool psramFound = false;
.
.
.
#if CONFIG_SPIRAM_BOOT_INIT
esp_spiram_init_cache();
if (esp_spiram_init() != ESP_OK) {
#if SPIRAM_MODE_ON_NOPSRAM
ESP_EARLY_LOGE(TAG, "Failed to init external RAM!");
abort();
#else
ESP_EARLY_LOGE(TAG, "Ignored no SPI RAM found");
#endif
}
else psramFound = true;
#endif
.
.
.
#if CONFIG_SPIRAM_MEMTEST
if(psramFound){
bool ext_ram_ok=esp_spiram_test();
if (!ext_ram_ok) {
ESP_EARLY_LOGE(TAG, "External RAM failed memory test!");
abort();
}
}
#endif
.
.
.
#if CONFIG_SPIRAM_BOOT_INIT && (CONFIG_SPIRAM_USE_CAPS_ALLOC || CONFIG_SPIRAM_USE_MALLOC)
if(psramFound){
esp_err_t r=esp_spiram_add_to_heapalloc();
if (r != ESP_OK) {
ESP_EARLY_LOGE(TAG, "External RAM could not be added to heap!");
.
.
.
Re: one binary for wroom and wrover ?
Posted: Sat Feb 10, 2018 4:05 pm
by ESP_Sprite
That is pretty similar to the merge request I have in the queue; it should be eventually merged in ESP-IDF.
Re: one binary for wroom and wrover ?
Posted: Thu Feb 22, 2018 10:38 am
by jumjum123
Just had the problem, that binary, based on my settings crashed on wroom.
At the end it turned out, the reason was uart_driver_delete which should "reset" an uart defined for gpio16/17 (tx,rx)
In my case it is 3rd uart, which is not used (yet), so its easy to remove.
Could there come up a problem, because ?
- gpio16/17 are available pins on wroom based boards
- gpio16/17 are used for PSRAM on wrover based boards
- something happens in esp_spiram_init_cache() or esp_spiram_init() with GPIO16/17 which is not reset in case of "no PSRAM found"
Re: one binary for wroom and wrover ?
Posted: Thu Feb 22, 2018 12:06 pm
by ESP_Sprite
That's a bug, I think. Mind making an issue for that on Github so I won't forget and we can track it?
Re: one binary for wroom and wrover ?
Posted: Mon Feb 26, 2018 6:59 am
by jumjum123
Tried to reproduce it in a short example and failed.
Looks like being a bug in my sources