Flash ROM code usage

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

Flash ROM code usage

Postby Vader_Mester » Thu Oct 25, 2018 7:09 am

Hi All,

This is mainly called out to the devs. I'm happy to discuss these in PM as I'm having some other flash related questions, before I start my next project.

I was checking the SPI FLASH code, and I'm curious, if there is a reason for using the ROM code functions, after user application is booted?
I was trying to track down where they are used in IDF, and so far, I've only seen them in \esp-idf\components\spi_flash\flash_ops.c.
It looks as if the IDF functions are mostly wrappers for ROM code functions.

Are you planning to supplement ROM code stuff in IDF with an actual driver?
Also one question:
I was trying to figure it out by looking at the code, but I'm a bit confused so I ask here:
When the 2nd stage bootloader finished and user app starts running, the caches and MMU are already configured right?
So essentially only read and write stuff happens afterwards, while the user app is being executed?

Since there is no .c file for ROM code functions, I could not dig into them deeper, but I just want to understadn what the following functions actually do, and do they perform flash operations, or are they only doing something internal, and which ROM functions call them?

esp_rom_spiflash_result_t esp_rom_spiflash_lock(void);

esp_rom_spiflash_result_t esp_rom_spiflash_unlock(void);

Thanks for the answers in advance!
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);
}

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Flash ROM code usage

Postby WiFive » Thu Oct 25, 2018 8:09 am

https://github.com/espressif/esp-idf/bl ... tch.c#L349

The advantage to using rom functions when possible is they don't have to be placed in iram

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

Re: Flash ROM code usage

Postby Vader_Mester » Thu Oct 25, 2018 8:50 am

WiFive wrote:https://github.com/espressif/esp-idf/bl ... tch.c#L349

The advantage to using rom functions when possible is they don't have to be placed in iram
Damn I didn't check this file :D I'll take a quick glance of it, and see what falls into my lap.

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);
}

Who is online

Users browsing this forum: ESP_Sprite and 110 guests