Commit graph

40 commits

Author SHA1 Message Date
Manuel Argüelles 87e40d8b6d samples: enable flash samples for mr_canhubk3 board
Various samples enabled to use the on-board QSPI memory.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-07-26 09:44:14 +02:00
Francois Ramu 7f8342775f samples: drivers: jesd216 jedec ID and SFDP from quad-flash
This adds the support jedec configuration to run
the jedec sample application. So target board can display
the content of the quad-NOR flash.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-06-23 10:51:06 +00:00
Gerard Marull-Paretas 93b63df762 samples, tests: convert string-based twister lists to YAML lists
Twister now supports using YAML lists for all fields that were written
as space-separated lists. Used twister_to_list.py script. Some artifacts
on string length are due to how ruamel dumps content.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-05-10 09:52:37 +02:00
Keith Packard 0b90fd5adf samples, tests, boards: Switch main return type from void to int
As both C and C++ standards require applications running under an OS to
return 'int', adapt that for Zephyr to align with those standard. This also
eliminates errors when building with clang when not using -ffreestanding,
and reduces the need for compiler flags to silence warnings for both clang
and gcc.

Most of these changes were automated using coccinelle with the following
script:

@@
@@
- void
+ int
main(...) {
	...
-	return;
+	return 0;
	...
}

Approximately 40 files had to be edited by hand as coccinelle was unable to
fix them.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-14 07:49:41 +09:00
Francois Ramu ad4cc3a577 samples: drivers: stm32h5 octospi driver testing
Add the config for testing the jesd jedec sfdp of the octoNor flash
on the stm32h573 disco kit.
The external octoflash is the macronix  MX25LM51245 or micron.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-04-07 08:33:51 +00:00
Dominik Ermel d00dfa8a45 sample/drivers/jesd216: Reduce nrf52840dk SPI overlay
Reduce nrf52840dk_nrf52480_spi.overlay to use default board
definition of spi2.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2023-02-23 08:58:34 +01:00
YuLong Yao 1dd0ffbe40 Revert "samples: jesd216: add support for gd32a503v_eval board"
This reverts commit 0f28a8d120.

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-01-16 09:42:28 +01:00
YuLong Yao 0f28a8d120 samples: jesd216: add support for gd32a503v_eval board
add support for gd32a503v_eval board

Signed-off-by: YuLong Yao <feilongphone@gmail.com>
2023-01-12 21:45:38 +01:00
Fabio Baltieri 792469aae9 yamllint: indentation: fix files in samples/
Fix the YAML files indentation for files in samples/.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 14:23:53 +01:00
Fabio Baltieri 7db1d17ee3 yamllint: fix all yamllint line-length errors
Fix all line-length errors detected by yamllint:

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(line-length)'

Using a limit is set to 100 columns, not touching the commandlines in
GitHub workflows (at least for now).

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-01-04 01:16:45 +09:00
Anas Nashif 37c4110104 samples: jesd216: fix integration platforms
Fix integration platforms to match what is allowed (platform_allow).

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-12-05 14:55:00 +01:00
Andrzej Puzdrowski 0e8005e860 sample/drivers/jesd216: spi-nor config for nrf52840dk
Added configuration which allows to test the sample using SPI_NOR
driver instead of NRF_QSPI driver.
SPI_NOR driver is generic, so nice to add possibility to check
how it is working.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2022-12-05 12:11:29 +01:00
Francois Ramu b839a0f9db samples: drivers: jesd216 jedec ID and SFDP from octo-flash
This adds the support jedec configuration to run
the jedec  sample application. So target boards can display
the content of the octo-NOR flash
of the stm32u585 and stm32l562 or stm32h735 disco boards.
The sfdp-bfp table is provided as example (overlay file),
to run this sample on the stm32l562e_dk platform.
It has to be defined in the deviceTree "in cases were runtime
retrieval of SFDP data is not desired."

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-29 09:32:22 +00:00
Francois Ramu 819cb95438 boards: arm: stm32l562e_dk includes the sdfp table for its octoflash
Moving the SDFP table property from the sample to the device tree
of the stm32l562e_dk disco kit.
The MX52lm51245 Nor octoflash mounted on this boarddoes not
provide its own internal SFDP parameters.
With this patch, the SFDP table is given by the board DTS.
So that the stm32 ospi driver can initialized the  NOR octoflash
correctly with the parameter from that property instead of
relying on the nor octoflash.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-24 09:37:07 +01:00
Francois Ramu d24f3b9baa samples: drivers: jesd216 jedec ID and SFDP from octo-flash
This adds the support jedec configuration to run
the jedec  sample application. So target boards can display
the content of the octo-NOR flash
of the stm32u585 and stm32l562 or stm32h735 disco boards.
The sfdp-bfp table is provided as example (overlay file),
to run this sample on the stm32l562e_dk platform.
It has to be defined in the deviceTree "in cases were runtime
retrieval of SFDP data is not desired."

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-11-22 14:26:57 +00:00
Gerard Marull-Paretas 79e6b0e0f6 includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h>
As of today <zephyr/zephyr.h> is 100% equivalent to <zephyr/kernel.h>.
This patch proposes to then include <zephyr/kernel.h> instead of
<zephyr/zephyr.h> since it is more clear that you are including the
Kernel APIs and (probably) nothing else. <zephyr/zephyr.h> sounds like a
catch-all header that may be confusing. Most applications need to
include a bunch of other things to compile, e.g. driver headers or
subsystem headers like BT, logging, etc.

The idea of a catch-all header in Zephyr is probably not feasible
anyway. Reason is that Zephyr is not a library, like it could be for
example `libpython`. Zephyr provides many utilities nowadays: a kernel,
drivers, subsystems, etc and things will likely grow. A catch-all header
would be massive, difficult to keep up-to-date. It is also likely that
an application will only build a small subset. Note that subsystem-level
headers may use a catch-all approach to make things easier, though.

NOTE: This patch is **NOT** removing the header, just removing its usage
in-tree. I'd advocate for its deprecation (add a #warning on it), but I
understand many people will have concerns.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-09-05 16:31:47 +02:00
Gerard Marull-Paretas a202341958 devices: constify device pointers initialized at compile time
Many device pointers are initialized at compile and never changed. This
means that the device pointer can be constified (immutable).

Automated using:

```
perl -i -pe 's/const struct device \*(?!const)(.*)= DEVICE/const struct
device *const $1= DEVICE/g' **/*.c
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-08-22 17:08:26 +02:00
Gerard Marull-Paretas c7b5b3c419 samples: migrate includes to contain <zephyr/...> prefix
In order to bring consistency in-tree, migrate all samples to the use
the new prefix <zephyr/...>. Note that the conversion has been scripted:

```python
from pathlib import Path
import re

EXTENSIONS = ("c", "h", "cpp", "rst")

for p in Path(".").glob("samples/**/*"):
    if not p.is_file() or p.suffix and p.suffix[1:] not in EXTENSIONS:
        continue

    content = ""
    with open(p) as f:
        for line in f:
            m = re.match(r"^(.*)#include <(.*)>(.*)$", line)
            if (m and
                not m.group(2).startswith("zephyr/") and
                (Path(".") / "include" / "zephyr" / m.group(2)).exists()):
                content += (
                    m.group(1) +
                    "#include <zephyr/" + m.group(2) +">" +
                    m.group(3) + "\n"
                )
            else:
                content += line

    with open(p, "w") as f:
        f.write(content)
```

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 11:29:59 +02:00
Gerard Marull-Paretas 260deccb6e doc: use :kconfig:option: domain role
Kconfig options now belong to the Kconfig domain, therefore, the
:kconfig:option: role needs to be used.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-02 09:28:37 +01:00
Katsuhiro Suzuki ffdd60675e samples: jesd216: Exclude hifive_unleashed and unmatched boards
The HiFive Unleashed and HiFive Unmatched boards do not enable the
SPI0 controller that the flash is connected to. This test will not
build on these platforms because SPI0 bus controller is missing.

Signed-off-by: Katsuhiro Suzuki <katsuhiro@katsuster.net>
2021-09-03 09:52:26 -04:00
Torsten Rasmussen 1cccc8a8fe cmake: increase minimal required version to 3.20.0
Move to CMake 3.20.0.

At the Toolchain WG it was decided to move to CMake 3.20.0.

The main reason for increasing CMake version is better toolchain
support.

Better toolchain support is added in the following CMake versions:
- armclang, CMake 3.15
- Intel oneAPI, CMake 3.20
- IAR, CMake 3.15 and 3.20

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2021-08-20 09:47:34 +02:00
Crist Xu 36e646f7b8 lpspi: the lpspi driver for rt1170
enable the  lpspi1 for the rt1170 evk board

Signed-off-by: Crist Xu <crist.xu@nxp.com>
2021-07-15 07:50:31 -05:00
Kumar Gala 629b270ac5 samples: jesd216: Exclude hifive1 board from sample
By default the hifive1 board doesn't enable the SPI controller that
the flash is on.  As such this test will not build on that platform
due to lack of a missing SPI bus controller device.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-07-14 13:09:33 -04:00
Gerard Marull-Paretas 9dfbdf1997 doc: use kconfig role and directive
Stop using :option: for Kconfig options.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-06-29 10:26:28 -04:00
Martí Bolívar c0c471b8f2 samples: jesd216: drop device_get_binding/DT_INST
Use DEVICE_DT_GET/DT_COMPAT_GET_ANY_STATUS_OKAY.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-05-05 20:46:43 +02:00
Peter Bigot 6c4312605c drivers: flash: jesd216: improve support for address size selection
Add a helper function to decode the address byte support data from the
SFDP BFP.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-04-27 14:21:15 +02:00
NavinSankar Velliangiri d56e820f76 samples: drivers: jesd216: Enable Nordic QPSI driver
Enable Nordic QPSI driver for nordic board.

Signed-off-by: NavinSankar Velliangiri <navin@linumiz.com>
2021-02-23 16:31:41 -06:00
Peter Bigot 855b39ecbd samples: drivers: jesd216: add support for Nordic QSPI driver
Remove the overlay and set up to enable the QSPI variant.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot 5fd3246a62 drivers: flash: jesd216: add support for DW16 decoding
DW16 provides information on mechanisms to enter and exit 4-Byte
address modes, returning the device to reset state, and how to
manipulate the values in the first status register.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot 52545411d2 drivers: flash: jesd216: add support for DW15 decoding
DW15 provides information on entry and exit from QSPI modes.  In
particular, it specifies whether and how the status register must be
updated for this feature.

Add a JESD216 devicetree property for the Quad Enable Requirements
value.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot 3911380c54 samples: jesd216: fix bound on BFP DW parsing
DW indexes start from 1, so the proper upper bound includes the value
of len_dw.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-18 16:58:09 -05:00
Peter Bigot e017441ca0 boards: remove has-be32k from SPI NOR mtd nodes
Use of this property has no effect since it was by SFDP erase data in
Zephyr 2.4.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2021-01-13 11:58:37 -06:00
Tomasz Bursztyka e18fcbba5a device: Const-ify all device driver instance pointers
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.

A coccinelle rule is used for this:

@r_const_dev_1
  disable optional_qualifier
@
@@
-struct device *
+const struct device *

@r_const_dev_2
 disable optional_qualifier
@
@@
-struct device * const
+const struct device *

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Peter Bigot 75f82dc09a samples: fix reStructuredText target directives
Without the leading underscore these are comments.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-28 12:54:40 +02:00
Henrik Brix Andersen 8b94d67dc8 samples: drivers: jesd216: check return value of flash_sfdp_read()
Check the return value of flash_sfdp_read() and print error message if
not successful.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-08-24 11:06:48 +02:00
Peter A. Bigot ea8432b92e samples: jesd216: update output to reflect recent bug fix
An off-by-one error calculating the number of parameter headers caused
a third table to not be displayed.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-08-21 13:57:46 -04:00
Peter A. Bigot c04c40a34e samples: jesd216: fix printf argument to match format
The relative offset will always be small so downcast it to avoid
cross-platform size differences.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-08-21 13:57:46 -04:00
Peter Bigot e86e6fa769 samples: jesd16: correct interpretation of NPH field
A zero value in the NPH header indicates one parameter header.
Increase the upper bound to process the last provided table.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-18 09:27:30 +02:00
Peter Bigot bb86e1958c samples: jesd16: fix overlay cs-gpios settings
GPIO CSn active level transitioned from default active-low to
devicetree defined since the last time this sample was verified,
requiring the flags parameter in devicetree to be updated.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-08-18 09:27:30 +02:00
Peter A. Bigot 506f02e89e samples: drivers: jesd216: support JESD216 API
Demonstrate use of the JESD216 API as a utility to display the
discoverable parameters.

Signed-off-by: Peter A. Bigot <pab@pabigot.com>
2020-08-17 13:38:14 -04:00