Page 1 of 3

Internal Flash Driver

Posted: Wed Aug 24, 2016 12:25 pm
by neums
Hi,
are there any intentions to implement an internal flash driver which is able to write to the internal flash ROM and erase sectors at runtime?

The toolchain has to ensure that the memory area is reserved at compilation time so that the application does not try to erase itself, maybe via a kept section in the linker script. The flash ROM layout is very specific to the microcontroller so the lld had to define a memory layout definition or table. The write command could be a memory to memory dma transfer or?

The usecase is everywhere you need a non volatile memory without the need of an external storage device. For example to store configuration or calibration data.

To realize my application i wrote a simple specific iflash lld for the stm32f4 but in this initial version there is no dma tranfer and no layout table. There are just application blocking functions till now. There is a function to erase and write data. So there is no high level driver. But i think that it is possible because all controllers provide such a internal flash functionality.

If somebody needs the files look for the attachments.

Re: Internal Flash Driver

Posted: Wed Aug 24, 2016 1:22 pm
by Giovanni
Hi,

In trunk code there is a generic flash class that could be used also for this.

Giovanni

Re: Internal Flash Driver

Posted: Wed Aug 24, 2016 2:53 pm
by neums
Hi,
in consequence there has to be hal_stm32f4_flash.c and hal_stm32f4_flash.h files?

Re: Internal Flash Driver

Posted: Wed Aug 24, 2016 3:10 pm
by Giovanni
Hi,

Flash drivers could be located into device directories /hal/ports/STM32/STM32F4xx, in this case just hal_flash_lld.c/h.

If multiple devices can use the same flash driver then we could handle them as FLASHv1, FLASHv2 etc under /hal/ports/STM32/LLD/...

Such drivers do not exist yet, just a base class, so we can decide the conventions here.

Giovanni

Re: Internal Flash Driver

Posted: Wed Aug 24, 2016 4:16 pm
by neums
That sounds good.
When the generic flash contents will move to stable?
Shall the hal_flash.c and hal_flash.h also be the plattform independent high level part of the flash driver?

For data transfer we should use a DMA memory to memory transfer instead of a blocking software driven variant or?

Re: Internal Flash Driver

Posted: Wed Aug 24, 2016 8:02 pm
by Giovanni
Hi,

It will be in next stable release.

The files you mentioned are the abstract interface and some common routines.

I think DMA is not required, the driver is synchronous with a "polled" option for erase operations. An example implementation is here \os\ex\Micron, it is for an external flash however, you don't need the JEST216 subclass.

Giovanni

Re: Internal Flash Driver

Posted: Thu Feb 07, 2019 11:44 pm
by russian
What is the current state of this? I see hal_flash but no stm32 internal flash implementation?

Re: Internal Flash Driver

Posted: Fri Feb 08, 2019 8:06 am
by Giovanni
Hi,

The flash infrastructure changed in last release, probably that contributed code has to be adapted.

Giovanni

Re: Internal Flash Driver

Posted: Tue Feb 12, 2019 10:44 pm
by faisal
Would you consider adding LLD internal drivers that use the hal_flash abstraction to ChibiOS/HAL? There may be some code out there which could be contributed ...

Re: Internal Flash Driver

Posted: Wed Feb 13, 2019 8:30 am
by Giovanni
It is definitely something I wish included.

Giovanni