Commit graph

21 commits

Author SHA1 Message Date
Dominik Ermel bec0c7f279 drivers/flash/flash_simulator: Fix flash_sim_write
flash_sim_write did not work correctly when simulating flash with
non-0xff erase value.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-07-02 08:24:19 -04:00
Dominik Ermel 849a5432df drivers/flash/fash_simulator: Fix initialization for non-posix
Simulated flash, in non-POSIX compilation path, has been initialized to
incorrect value.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-06-29 15:48:45 -04:00
Dominik Ermel 609b645ac7 drivers/flash: Move write_block_size into flash_parameters
With addition of flash_parameters structure, and supporting API call
to retrieve it, it is no longer needed to store write_block_size as
a part of flash_driver_api and it should be part of flash_parameters.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-06-22 14:35:03 +02:00
Dominik Ermel 6ea6321586 drivers/flash: Add support for flash_get_parameters to drivers
With addition of flash_get_parameters API call, it is needed to provide
support for the API to flash drivers.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-06-22 14:35:03 +02:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Kumar Gala 50345848b4 drivers: flash: flash_simulator: Convert to new DT macros
Convert flash_simulator to use new DT macros and remove associated
defines in dts_fixup.h.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-30 04:47:44 -05:00
Andrzej Puzdrowski 997be3d04d drivers/flash/flash_simulator: erase posix flash in initialization
After startup the native_posix flash was filed by 0x00 instead
of 0xff, which is not coherent with erased byte value which
is 0xff for the native_posix target.

Such inconsistent behavior makes for instance running
a storage system designed(or configured) for a flash device
with 0xff as erased byte values problematic.

This patch makes flash erased after new flash device file creation.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-01-23 10:51:42 -05:00
Jan Van Winkel 8cd4a817d9 drivers/flash/flash_simulator: Added file back end for posix arch
Extended flash simulator for posix architecture to read/write data
from a binary file on the host file system.

Further enable the flash simulator by default on native_posix(_64)
boards and updated the documentation accordingly.

Signed-off-by: Jan Van Winkel <jan.van_winkel@dxplore.eu>
2019-12-09 11:56:21 -05:00
Andrzej Puzdrowski 428c281bc6 drivers/flash/flash_simulator: fix flash size calculation
Flash size calculation was don with assumption that flash page size
is always 1 KB and flash size was parameterized with such granularity.

This patch correct this bug.

Flash pages number under statistic can't be calculated via preprocessor
anymore - thus are parameterized via Kconfig.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-07-17 13:49:26 -07:00
Andrzej Puzdrowski 891ccdc182 drivers/flash/flash_simulator: switch to use DT_FLASH_SIM labels
It Need to start using DT_FLASH_SIM_xxx labels after sim_flash was
un-chosen as zephyr,flash.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-07-17 13:49:26 -07:00
Anas Nashif a2fd7d70ec cleanup: include/: move misc/util.h to sys/util.h
move misc/util.h to sys/util.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif fe051a9055 cleanup: include/: move flash.h to drivers/flash.h
move flash.h to drivers/flash.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 52e0efac97 cleanup: include/: move stats.h to stats/stats.h
move stats.h to stats/stats.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Radoslaw Koppel 617c6fdb24 drivers/flash/flash_simulator: Allow unaligned read
This commit adds the default configuration to the flash_simualtor
to allow unaligned reads.
Disable this option when testing to increase test coverage.

Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
2019-05-28 11:24:48 +02:00
Kamil Piszczek 42b3bd91e7 drivers: flash: flash_simulator: added max len param
Added a new runtime parameter to the Flash Simulator. It can be used to
ignore part of the data that is written to the simulated flash memory.
This parameter works together with max write calls parameter.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-05-27 12:26:20 +02:00
Kamil Piszczek fefc62887c drivers: flash: flash_simulator: added max erase calls param
Added a new runtime parameter to the Flash Simulator. It can be used to
ignore erases to the simulated flash memory after a certain number
of flash erase calls has been executed.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-05-27 12:26:20 +02:00
Kamil Piszczek 4054d2bacf drivers: flash: flash_simulator: added max write calls param
Added a new runtime parameter to the Flash Simulator. It can be used to
ignore any writes to the simulated flash memory after a certain number
of flash write calls has been executed. This behaviour is useful for
simulating power down during the flash write operation.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-05-13 17:07:28 +02:00
Kamil Piszczek 78a39b80aa drivers: flash: covering more flash page with stats sections
Extended the maximum possible number of sections that track statistics
for each flash page.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-05-01 10:33:17 -04:00
Kamil Piszczek 5895f8d8f1 driver: flash: flash_simulator: moved part of Kconfig to DT
Moved part of the KConfig configuration to the Device Tree.

Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-04-24 13:05:11 -07:00
Kamil Piszczek 1c60416135 drivers: flash: fix flash-simulator build crash
Statistic for flash has limitation regards number of pages possible to
be counted. This path introduces check for that in source file as it is
not possible to preserve the limit in Kconfig.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-04-24 13:05:11 -07:00
Kamil Piszczek c837d85c2b drivers: flash: add flash_simulator driver
This commit adds a flash driver implementation that writes to RAM and
exports statistics through stats.h. It can be used to simulate flash
memory for testing purposes.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Kamil Piszczek <Kamil.Piszczek@nordicsemi.no>
2019-04-24 13:05:11 -07:00