Page 1 of 1

Flash - missing bracket  Topic is solved

Posted: Thu Jul 11, 2019 10:43 am
by steved
In os\hal\lib\complex\serial_nor\devices\macronix_mx25\hal_flash_device.h line 201 there's a missing bracket (modified file attached).

Also, the size field has been removed from type flash_descriptor_t in hal_flash.h, but is still present and set up in the device-specific code for both mx25 and n25q. (Looks as if it can just be deleted - value doesn't appear to be used).

Looking at what's changed for SPI-type flash device drivers, the current naming scheme appears to preclude having support for several different devices in a single code file, and selecting one at run-time (so that multiple device manufacturers can be supported). This capability can be useful in case of supply shortages - devices from different manufacturers are often pin-compatible.

Re: Flash - missing bracket

Posted: Thu Jul 11, 2019 12:45 pm
by Giovanni
Hi,

Thanks for the fix, I am merging.

About the size field, it is present in trunk, not present in 19.x. It has been added in latest version. Being a descriptor it is not used in code, outer layers may use it.

If you need devices selectable at runtime then you need to write a "device files" set with runtime checks on the chip IDs and all the required checks to handle command differences. Currently it is not supported but it should not require code changes in the common parts.

Giovanni

Re: Flash - missing bracket

Posted: Thu Jul 11, 2019 12:49 pm
by Giovanni
Fixed as bug #1038.

Giovanni

Re: Flash - missing bracket

Posted: Thu Jul 11, 2019 1:49 pm
by steved
Giovanni wrote:Hi,
If you need devices selectable at runtime then you need to write a "device files" set with runtime checks on the chip IDs and all the required checks to handle command differences. Currently it is not supported but it should not require code changes in the common parts.
Giovanni

But the device-specific files all have the same names, so there's likely to be compiler confusion if you try and include support for more than one device.
Or am I missing something here?

Re: Flash - missing bracket

Posted: Thu Jul 11, 2019 1:57 pm
by Giovanni
You would include a single set of device files, one crafted to support multiple devices. Current device files are not designed for that.

Giovanni

Re: Flash - missing bracket

Posted: Fri Jul 12, 2019 11:58 am
by steved
Giovanni wrote:You would include a single set of device files, one crafted to support multiple devices. Current device files are not designed for that.

Giovanni

I wondered if that was what you had in mind.
At one point you added a NULL field at the beginning of each flash descriptor with a view to supporting linked lists, and there were unique names for the interface routines of each type of flash. Could have made supporting multiple device types quite straightforward.