Use this short header style in all Kconfig files:
# <description>
# <copyright>
# <license>
...
Also change all <description>s from
# Kconfig[.extension] - Foo-related options
to just
# Foo-related options
It's clear enough that it's about Kconfig.
The <description> cleanup was done with this command, along with some
manual cleanup (big letter at the start, etc.)
git ls-files '*Kconfig*' | \
xargs sed -i -E '1 s/#\s*Kconfig[\w.-]*\s*-\s*/# /'
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
If the flash device is not configured, return an error rather than
dereferencing a null device pointer.
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
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>
move flash_map.h to storage/flash_map.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>
Fix that removes magic numbers from the code that
leaded to the error codes that was hard to explain.
Signed-off-by: Radoslaw Koppel <radoslaw.koppel@nordicsemi.no>
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier. Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.
By default all files without license information are under the default
license of Zephyr, which is Apache version 2.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Introduce API for get driver structure belongs to the flash_area.
Some more complex operation on flash areas might want to be done using
driver directly. It not make sense to wrap every possible flash related
operation by flash_map API.
For instance mcuboot will require this patch.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Zephyr's flash_map code is largely copied wholesale from MCUboot, but
the copyrights were done incorrectly when the copy/pasting happened.
The current copyright holders are listed as Nordic and Runtime. This
is the patch which removed it from MCUboot; there is no copyright
holder explicitly named:
b788c71c08 (diff-e4c0c184210793513328934f14840a4c)
In fact, I was the author of a nontrivial portion of it, introduced
here:
dc4c42bf62 (diff-e4c0c184210793513328934f14840a4c)
At the time, I was working for Linaro, so add their copyright to the
copy of this file introduced into Zephyr.
Signed-off-by: Marti Bolivar <marti@foundries.io>
This Patch add functionality for automatic generation of the flash map
using DTS description. Automatic generation allows to replace
C-hardcoded flash_map.
We generate a set of defines based on the index of a partiion:
#define DT_FLASH_AREA_<IDX>_OFFSET 0
#define DT_FLASH_AREA_<IDX>_SIZE 131072
#define DT_FLASH_AREA_<IDX>_DEV "FLASH_CTRL"
#define DT_FLASH_AREA_<IDX>_LABEL MCUBOOT
Additionally we also define:
#define DT_FLASH_AREA_NUM 4
and:
#define DT_FLASH_AREA_<PARTNAME>_ID 0
Signed-off-by: Findlay Feng <i@fengch.me>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This patch enables the support for FLASH_PAGE_LAYOUT and
FLASH_MAP for the generic spin nor flash driver.
Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
flash_map should be made extern in flash_map.c since it is defined
in flash_map_default.c. Not having flash_map as extern will result
in build errors.
Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
These changes were obtained by running a script created by
Ulf Magnusson <Ulf.Magnusson@nordicsemi.no> for the following
specification:
1. Read the contents of all dts_fixup.h files in Zephyr
2. Check the left-hand side of the #define macros (i.e. the X in
#define X Y)
3. Check if that name is also the name of a Kconfig option
3.a If it is, then do nothing
3.b If it is not, then replace CONFIG_ with DT_ or add DT_ if it
has neither of these two prefixes
4. Replace the use of the changed #define in the code itself
(.c, .h, .ld)
Additionally, some tweaks had to be added to this script to catch some
of the macros used in the code in a parameterized form, e.g.:
- CONFIG_GPIO_STM32_GPIO##__SUFFIX##_BASE_ADDRESS
- CONFIG_UART_##idx##_TX_PIN
- I2C_SBCON_##_num##_BASE_ADDR
and to prevent adding DT_ prefix to the following symbols:
- FLASH_START
- FLASH_SIZE
- SRAM_START
- SRAM_SIZE
- _ROM_ADDR
- _ROM_SIZE
- _RAM_ADDR
- _RAM_SIZE
which are surprisingly also defined in some dts_fixup.h files.
Finally, some manual corrections had to be done as well:
- name##_IRQ -> DT_##name##_IRQ in uart_stm32.c
Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
Some applications might want to check whether flash_areas binds to
any flash drive in the system. It might be better to do that while
sanity check at application start-up then while regular run process.
Example of such application is the mcuboot.
This patch introduce such API for checking whether device bindings
were resolved properly during system startup.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Bool symbols implicitly default to 'n'.
A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though.
Remove some 'default ""' properties on string symbols too.
Also make definitions more consistent by converting some
config FOO
<type>
prompt "foo"
definitions to a shorter form:
config FOO
<type> "foo"
This shorthand works for int/hex/string symbols too, not just for bool
symbols.
Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
FS_FLASH_MAP_STORAGE keyword enables the storage partition,
but it was depend on flash_map module which is unused by
NFFS. This patch makes it independent thanks
to it is possible to enable the storage partition
without flash_map module.
FS_FLASH_MAP_STORAGE was renamed to
CONFIG_FS_FLASH_STORAGE_PARTITION
as it is independent for flash_map.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
The NFFS partition at the end of flash is also useful for any other
file system or even the Flash Circular Buffer (FCB). Rename the
partition from 'nffs_partition' to 'storage_partition' and make it
depend on a new hidden Kconfig entry which the relevant users will
select (such as NFFS and FCB).
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
It was possible to have enable flash module while no flash driver
implementation was enabled. This cause coverity issues and unnecessary
initialization call.
This pat introduce FLASH_HAS_DRIVER_ENABLED Kconfig keyword which is
selected once any flash driver is enabled. flash_map switch its
dependency to this keyword.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Loop counter was type of signed int while it was compared
to unsigned lvalue in loop condition.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Prior to this commit, `flash_area_layout()` was being passed a pointer
to the incorrect type (`uint32_t *` where `int *` was expected). This
caused the following warning to be reported:
```
[...]/subsys/storage/flash_map/flash_map.c: In
function 'flash_area_get_sectors':
[...]/subsys/storage/flash_map/flash_map.c:191:32:
warning: passing argument 2 of 'flash_area_layout' from incompatible
pointer type [-Wincompatible-pointer-types]
return flash_area_layout(idx, cnt, ret, get_sectors_cb, &data);
^~~
[...]/subsys/storage/flash_map/flash_map.c:136:12:
note: expected 'int *' but argument is of type 'uint32_t * {aka long
unsigned int *}'
static int flash_area_layout(int idx, int *cnt, void *ret,
^~~~~~~~~~~~~~~~~
```
This commit changes the argument type to `u32_t` for both functions.
Signed-off-by: Christopher Collins <ccollins@apache.org>
Prior to this commit, the old `FLASH_DRIVER_NAME` macro was being used
in the definition of the flash drivers array. This caused the array to
have a size of 0.
This commit changes the code to use the newer `FLASH_DEV_NAME` macro,
causing the configured flash device to be present in the table.
Signed-off-by: Christopher Collins <ccollins@apache.org>
Replace seldom occurrences of FLASH_DRIVER_NAME by equivalent
and commonly used FLASH_DEV_NAME.
Fixes#5919.
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Moved fetch of flash device bindings to early initialization of the
application.
Device bindings are constant while the application is running so
it is better to fetch it at startup, and not every time flash_map
procedures are called.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Introduce flas_map module is abstraction over flash memory and its
driver for using flash memories along with description of
available flash areas.
Module provides simple API for write/read/erase and so one.
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>