Page 1 of 1

Flash ROM code usage

Posted: Thu Oct 25, 2018 7:09 am
by Vader_Mester
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]

Re: Flash ROM code usage

Posted: Thu Oct 25, 2018 8:09 am
by WiFive
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

Re: Flash ROM code usage

Posted: Thu Oct 25, 2018 8:50 am
by Vader_Mester
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.