one binary for wroom and wrover ?

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

one binary for wroom and wrover ?

Postby jumjum123 » Mon Feb 05, 2018 9:13 am

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.

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

Re: one binary for wroom and wrover ?

Postby ESP_Sprite » Mon Feb 05, 2018 9:18 am

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?

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

Re: one binary for wroom and wrover ?

Postby jumjum123 » Mon Feb 05, 2018 9:41 am

That would be a good solution, and I would like to get it soon :D

User avatar
Vader_Mester
Posts: 300
Joined: Tue Dec 05, 2017 8:28 pm
Location: Hungary
Contact:

Re: one binary for wroom and wrover ?

Postby Vader_Mester » Wed Feb 07, 2018 9:34 am

I need the same thing, so I could have easier management for OTA updates.

Vader [BEN]

Code: Select all

task_t coffeeTask()
{
	while(atWork){
		if(!xStreamBufferIsEmpty(mug)){
			coffeeDrink(mug);
		} else {
			xTaskCreate(sBrew, "brew", 9000, &mug, 1, NULL);
			xSemaphoreTake(sCoffeeRdy, portMAX_DELAY);
		}
	}
	vTaskDelete(NULL);
}

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

Re: one binary for wroom and wrover ?

Postby jumjum123 » Fri Feb 09, 2018 9:59 am

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!");
.
.
.


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

Re: one binary for wroom and wrover ?

Postby ESP_Sprite » Sat Feb 10, 2018 4:05 pm

That is pretty similar to the merge request I have in the queue; it should be eventually merged in ESP-IDF.

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

Re: one binary for wroom and wrover ?

Postby jumjum123 » Thu Feb 22, 2018 10:38 am

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"

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

Re: one binary for wroom and wrover ?

Postby ESP_Sprite » Thu Feb 22, 2018 12:06 pm

That's a bug, I think. Mind making an issue for that on Github so I won't forget and we can track it?

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

Re: one binary for wroom and wrover ?

Postby jumjum123 » Mon Feb 26, 2018 6:59 am

Tried to reproduce it in a short example and failed.
Looks like being a bug in my sources :(

Who is online

Users browsing this forum: No registered users and 87 guests