Compile with HW_HAS_FLASH

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
Posts: 16
Joined: Thu Nov 30, 2017 7:30 pm

Compile with HW_HAS_FLASH

Post by codyhanks » Thu Nov 30, 2017 8:03 pm

I am working with building new firmware and have some questions about the HW_HAS_FLASH configuration object in "mpconfigboard.h". I have looked through the documentation with Google searches and am unable to find details on what this option is for. Is this related to the internal flash memory or an external IC? if an external IC where would I find compatible IC's and details on connections. If this is not an external IC related option, why would it cause long latency issues when enabled on a build. I am working with a custom board I designed and built with the f407vgt6 processor.

User avatar
Posts: 3229
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada

Re: Compile with HW_HAS_FLASH

Post by dhylands » Thu Nov 30, 2017 9:37 pm

The MICROPY_HW_HAS_FLASH is used here: ... #L194-L196

The Flash module allows python code to access the internal flash blocks directly (as a block protocol). You can find the implementation of the Flash module in storage.c. But unless you instantiate a Flash object from your python code, that code should never be executed.

There is a constant called MICROPY_HW_FLASH_LATENCY which is defined in the mpconfigboard.h files. It determines the number of wait states that need to be used and IIRC it varies based on the processor clock speed and type. This applies to the internal flash.

If you have an separate external flash module connected, then presumably you'd be using the FMC module (for a parallel interface) or the SPI modules (for a serial interface). If you're using the the FMC module, then you'd need to setup all of the timing registers etc to match your flash module.

Post Reply