Internal Flash Driver

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome.
neums
Posts: 137
Joined: Fri May 08, 2015 1:09 pm
Location: Dresden, Germany
Has thanked: 10 times
Been thanked: 5 times

Internal Flash Driver

Postby neums » Wed Aug 24, 2016 12:25 pm

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.
Attachments
iflash_lld.zip
(2.57 KiB) Downloaded 101 times

User avatar
Giovanni
Site Admin
Posts: 12098
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 549 times
Been thanked: 469 times
Contact:

Re: Internal Flash Driver

Postby Giovanni » Wed Aug 24, 2016 1:22 pm

Hi,

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

Giovanni

neums
Posts: 137
Joined: Fri May 08, 2015 1:09 pm
Location: Dresden, Germany
Has thanked: 10 times
Been thanked: 5 times

Re: Internal Flash Driver

Postby neums » Wed Aug 24, 2016 2:53 pm

Hi,
in consequence there has to be hal_stm32f4_flash.c and hal_stm32f4_flash.h files?

User avatar
Giovanni
Site Admin
Posts: 12098
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 549 times
Been thanked: 469 times
Contact:

Re: Internal Flash Driver

Postby Giovanni » Wed Aug 24, 2016 3:10 pm

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

neums
Posts: 137
Joined: Fri May 08, 2015 1:09 pm
Location: Dresden, Germany
Has thanked: 10 times
Been thanked: 5 times

Re: Internal Flash Driver

Postby neums » Wed Aug 24, 2016 4:16 pm

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?

User avatar
Giovanni
Site Admin
Posts: 12098
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 549 times
Been thanked: 469 times
Contact:

Re: Internal Flash Driver

Postby Giovanni » Wed Aug 24, 2016 8:02 pm

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

User avatar
russian
Posts: 314
Joined: Mon Oct 29, 2012 3:17 am
Location: Jersey City, USA
Has thanked: 12 times
Been thanked: 5 times

Re: Internal Flash Driver

Postby russian » Thu Feb 07, 2019 11:44 pm

What is the current state of this? I see hal_flash but no stm32 internal flash implementation?
http://rusefi.com/ - electronic fuel injection

User avatar
Giovanni
Site Admin
Posts: 12098
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 549 times
Been thanked: 469 times
Contact:

Re: Internal Flash Driver

Postby Giovanni » Fri Feb 08, 2019 8:06 am

Hi,

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

Giovanni

faisal
Posts: 249
Joined: Wed Jul 19, 2017 12:44 am
Has thanked: 35 times
Been thanked: 32 times

Re: Internal Flash Driver

Postby faisal » Tue Feb 12, 2019 10:44 pm

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 ...

User avatar
Giovanni
Site Admin
Posts: 12098
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 549 times
Been thanked: 469 times
Contact:

Re: Internal Flash Driver

Postby Giovanni » Wed Feb 13, 2019 8:30 am

It is definitely something I wish included.

Giovanni


Return to “Development and Feedback”

Who is online

Users browsing this forum: No registered users and 5 guests