Add const to function declaration. Const objects cannot access const
safe functions, a compiler error is thrown if one tries to do so. This
helps ensure that the object calling the method will not be modified.
This is espescially desirable in functions where all we need to do is
query existing data and not make any alterations.
[Q/O/SPIFBlockDevice::erase() begin with an alignment check,
after which unaligned erases should not happen or be allowed.
If the erase address is not aligned to the value returned by
sfdp_iterate_next_largest_erase_type(), it indicates an
internal error in erase table parsing which should not be
hidden.
Prior to this PR, the minimum program size (QSPI_MIN_PROG_SIZE) of
QSPIFBlockDevice was 256 by default and 512 for some targets.
Those values were in fact page sizes, not program sizes.
Here's an explanation:
* Most QSPI flashes can be programmed to a granularity of a
single byte or a few bytes - no need to be a whole page.
This should be the value of QSPI_MIN_PROG_SIZE. Applications
need to align buffer sizes to this granularity when
programming QSPI flashes.
* Each sending of the underlying QSPI program signal requires
destination bytes to be located within the same page.
If a QSPIFBlockDevice::program() call crosses page boundaries,
this function breaks down the operation into multiple chunks,
so it's not a concern for the application.
So this PR changes the default program size to 1 (byte), and
for targets with a 4-byte (1-word) read size it overrides the
program size.
Note: No config is needed for the page size, as it comes from
the SFDP table parsed during initialisation.
Aside from the core mbed-os CMake target, a number of targets have been created so they can optionally be included by application executables that require them using `target_link_libraries()`.
Co-authored-by: Martin Kojtal <martin.kojtal@arm.com>
Co-authored-by: Rajkumar Kanagaraj <rajkumar.kanagaraj@arm.com>
The first revision (1.0) of SFDP (ref: JESD216) does not include
fields for software reset support. It's only been added in the
second revision (1.5) (ref: JESD216A).
Some Mbed OS targets such as DISCO_F746NG include flashes with
legacy SFDP, thus we add an option to preset the reset mode.