Allow this sample in native_sim, and set it as default
integration platform instead of native_posix.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Allow this sample in native_sim, and set it as default
integration platform instead of native_posix.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
native_posix and native_sim are already excluded thru
the lack of required tags.
Let's remove the platform exclude instead of adding also
native_sim to it explicitly.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
Prevent infinite loop inside interrupt handler when there is incoming
data available and ring buffer is full.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
rand32.h does not make much sense, since the random subsystem
provides more APIs than just getting a random 32 bits value.
Rename it to random.h and get consistently with other
subsystems.
Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
Follow up on commit f67dd39bb2
("drivers: ramdisk: use devicetree to instantiate RAM disk").
Unfortunately, the additional argument must be passed for the default
build. Using app.overlay would not always help since the sample has few
board-specific overlays.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Running the HTML code through W3C Validator revealed several issues with
the markup that this commit fixes.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Update webusb README with recent changes after index.html was moved to
sample from the external repository.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This migrates the subsys code samples to the new Sphinx code-sample
extension, making it easier to find relevant samples when browsing
API reference.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
Rework RAM disk driver to be configured using devicetree and
support multiple instances.
This patch also removes a copy of the RAM disk driver,
tests/subsys/fs/fat_fs_dual_drive/src/disk_access_test_drv.c,
that was there for testing multiple disk drivers support.
Bonus: one SYS_INIT() less and a memory region can be exported to the
host.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Use the new code-sample directive and roles to document the filesystem
samples so that they show up as "Related samples" when browsing the API
documentation.
Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
With gcc from the zephyr sdk and -Wold-style-declaration is giving this
output:
zephyr/arch/arm/core/aarch32/cortex_a_r/fault.c:101:1: warning:
'inline' is not at beginning of declaration [-Wold-style-declaration]
101 | static void ALWAYS_INLINE
z_arm_fpu_caller_save(struct __fpu_sf *fpu)
| ^~~~~~
I searched to all of the source code to find these further occurances
where inline is not at the beginning of a function declaration.
Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
Overall, this makes the sample code much simpler and smaller.
Whit the changes introduced in commit commit 57e0da4d80
("boards: add zephyr,code properties to the various gpio-keys nodes")'
this example will work out of the box with any board that has at least
zephyr,code = <INPUT_KEY_0>; in its devicetree.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
There is no need to use SYS_INIT as the HID specific initialisation
can be done in the main before the usb_enable() call.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This is no longer necessary, as this option is selected as a dependency
for class implementations where it is required.
Also remove redundant test cases.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This patch refactors the usage of MS OS 2.0 descriptors in the
WebUSB sample. The function subset header was removed since it
is not allowed for non-composite devices.
Also, a new random GUID was added for automatic driver installation.
Signed-off-by: Maximilian Deubel <maximilian.deubel@nordicsemi.no>
The stm32f207 and stm32f429 target boards only have 4 bidir EP
on the USB FS node. This is not enough to run the sample:
simply exclude those 2 target platforms
Signed-off-by: Francois Ramu <francois.ramu@st.com>
Mass storage sample contains separate Kconfig options for RAM, Flash and
SDMMC disk drivers. All disk drivers can be enabled simultaneously and
therefore the maximum number of concurrent LUNs is 3.
Configure Mass Storage class maximum LUNs to 3 to solve initialization
failures on targets that enable more than one disk driver at a time.
Each additional supported LUN increases the Mass Storage class memory
usage by 48 bytes (struct scsi_ctx) on 32-bit targets. Allocating 3 SCSI
context structures allows the sample to work regardless what disk
drivers are concurrently enabled.
Fixes: #57657
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Add and use specific macros for manufacturer, product, and
serial number string descriptors.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
Add DT overlay to be able to support and test usb_dc_dw driver
(snps,dwc2) on nucleo_f413zh board. This disables STM32 shim
driver described and configured on the SoC and board level.
Obviously,it works with other STM32F4 boards as well, but we
do not have a mechanism to apply it generically yet, upcoming
snippet support may fix that. Until then, we need something for
development and as an example.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
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>
Some of these samples were filtering all POSIX arch
boards out by explictly listing them by name
(and for the nrf52_bsim by lack of usb_device).
Instead filter by the architecture.
There is no functional difference in tree with this change.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
With the minimal C library malloc implementation moving to libc/common, all
of the related Kconfig variables have also changed. Update uses within the
tree.
Signed-off-by: Keith Packard <keithp@keithp.com>
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>
The init infrastructure, found in `init.h`, is currently used by:
- `SYS_INIT`: to call functions before `main`
- `DEVICE_*`: to initialize devices
They are all sorted according to an initialization level + a priority.
`SYS_INIT` calls are really orthogonal to devices, however, the required
function signature requires a `const struct device *dev` as a first
argument. The only reason for that is because the same init machinery is
used by devices, so we have something like:
```c
struct init_entry {
int (*init)(const struct device *dev);
/* only set by DEVICE_*, otherwise NULL */
const struct device *dev;
}
```
As a result, we end up with such weird/ugly pattern:
```c
static int my_init(const struct device *dev)
{
/* always NULL! add ARG_UNUSED to avoid compiler warning */
ARG_UNUSED(dev);
...
}
```
This is really a result of poor internals isolation. This patch proposes
a to make init entries more flexible so that they can accept sytem
initialization calls like this:
```c
static int my_init(void)
{
...
}
```
This is achieved using a union:
```c
union init_function {
/* for SYS_INIT, used when init_entry.dev == NULL */
int (*sys)(void);
/* for DEVICE*, used when init_entry.dev != NULL */
int (*dev)(const struct device *dev);
};
struct init_entry {
/* stores init function (either for SYS_INIT or DEVICE*)
union init_function init_fn;
/* stores device pointer for DEVICE*, NULL for SYS_INIT. Allows
* to know which union entry to call.
*/
const struct device *dev;
}
```
This solution **does not increase ROM usage**, and allows to offer clean
public APIs for both SYS_INIT and DEVICE*. Note that however, init
machinery keeps a coupling with devices.
**NOTE**: This is a breaking change! All `SYS_INIT` functions will need
to be converted to the new signature. See the script offered in the
following commit.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
init: convert SYS_INIT functions to the new signature
Conversion scripted using scripts/utils/migrate_sys_init.py.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
manifest: update projects for SYS_INIT changes
Update modules with updated SYS_INIT calls:
- hal_ti
- lvgl
- sof
- TraceRecorderSource
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
tests: devicetree: devices: adjust test
Adjust test according to the recently introduced SYS_INIT
infrastructure.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
tests: kernel: threads: adjust SYS_INIT call
Adjust to the new signature: int (*init_fn)(void);
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Increase main stack size for next USB device stack config to prevent
stack overflow when FatFs is used. The new main stack size value matches
the value used in old stack mass storage sample config.
Fixes: #55210
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Introduce new USB Mass Storage Bulk-Only Transport implementation
written from scratch. Main goal behind new implementation was to
separate USB and SCSI parts as clearly as possible.
Limited set of SCSI disk commands is implemented in separate source code
file that is internal to USB device stack. While it should be possible
to use the SCSI implementation by other components there is currently no
other user besides USB MSC and therefore SCSI header is kept private.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Remove dependency on usb_device for virtual USB device / hosts sample.
This allows sample to be built in CI.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Disables having USB enabled for boards that configure USB CDC for
console, shell or logging at bootup in applications that enable USB
to prevent a conflict arising whereby USB is registered from
multiple points and later calls fail.
Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
There is no need to block the thread for a second.
Let it sleep for 100 milliseconds, which should be enough
to set the host baud rate.
Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
The old random timer test was not random-looking
enough on some platforms.
Replace with new test which is psuedo-xoshiro.
The generator is still deterministic
and does not depend on entropy at all,
but should look more random for testing.
Change name of generator tree-wide also.
Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Fix all thruthy errors detected by yamllint:
yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
grep '(truthy)'
This only accepts true/false for boolean properties. Seems like python
takes all sort of formats:
https://github.com/yaml/pyyaml/blob/master/lib/yaml/constructor.py#L224-L235
But the current specs only mention "true" or "false"
https://yaml.org/spec/1.2.2/#10212-boolean
Which is the standard yamllint config.
Excluding codeconv and workflow files, as some are using yes/no instead
in the respective documentation.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Clean up occurrences of "#if IS_ENABLED(CONFIG_FOO)" an replace
with classical "#if defined(CONFIG_FOO)".
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>