Skip to content

Modify SPI flash driver to be compatible with stacks in PSRAM (IDFGH-14813) #15544

Open
@jonsmirl

Description

@jonsmirl

Is your feature request related to a problem?

This originally came up on esp-matter. espressif/esp-matter#1249

It would really be useful if the spi_flash driver had a menu config option telling it to switch onto it's own dedicated stack in internal RAM before doing anything.

Use case is a system running Lua. Lua uses a LOT of stack while running, too much to be in internal memory for larger Lua programs. Lua allocates all of its local variables on the stack. To get a lot of room it is easy to give Lua a PSRAM based stack, but then none of the flash calls work any more - like the file system. This is not so simple to fix in the application. Everything which touches flash has to be fixed not to use PSRAM stacks. All calls to NVM, file systems, OTA, etc... Much easier if the spi_flash driver just switched onto it's own stack when called.

Describe the solution you'd like.

Menuconfig option in the spi_flash driver telling it to use a private stack for internal operations. Alternatively, check the stack pointer in the spi_flash component and if it is in PSRAM switch stacks automatically.

Describe alternatives you've considered.

Fixing this problem at every call site in the user app. This is a lot of work and error prone.

Additional context.

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions