1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 05:53:49 +01:00

839 Commits

Author SHA1 Message Date
crasbe
df58de4ba2
Merge pull request #20430 from cogip/native_i2c_mock
cpu/native: introduce periph_i2c_mock
2025-11-03 11:33:59 +00:00
benpicco
0995c466c6
Merge pull request #21786 from fabian18/pr/fix_nrf52_after_soft_ack
cpu/nrf52/radio/nrf802154: fix radio after soft ACK
2025-10-31 10:19:54 +00:00
Gilles DOFFE
dab11d7a9c cpu/native: introduce periph_i2c_mock
This allows I2C emulation on native architecture in the same way than
periph_gpio_mock.

All I2C functions from this driver are set as weak to be easily
overridden in each application.

Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
2025-10-30 23:51:07 +01:00
Gilles DOFFE
197cf51b93 cpu/native: fix GPIO bias flags for kernel >=5.5
Fix duplicate GPIO mode values on native platform when using Linux
kernel 5.5 or later. The kernel renamed GPIOHANDLE_REQUEST_PULL_* flags
to GPIOHANDLE_REQUEST_BIAS_PULL_* in version 5.5.

Without this fix, both GPIO_IN_PU and GPIO_OD_PU would have the same
fallback value (0xFF), causing compilation errors in switch statements.

Error: "duplicate case value"

Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
2025-10-30 23:51:07 +01:00
Fabian Hüßler
76391f8566 cpu/native/socket_zep: native overhead workaround 2025-10-30 22:08:22 +01:00
Gilles DOFFE
aab432ff6d cpu/native: remove unused XTIMER_BACKOFF definitions
XTIMER_BACKOFF and XTIMER_ISR_BACKOFF were defined in periph_conf.h
since 2016 for the legacy xtimer module, which required high backoff
values (200) on native to prevent timer underflow issues.

However, since the migration to ztimer, all code now uses
MODULE_ZTIMER_XTIMER_COMPAT which includes ztimer/xtimer_compat.h
before periph_conf.h. This means xtimer_compat.h always defines
XTIMER_BACKOFF=1 first, and the periph_conf.h definitions are never
used.

Remove these unused definitions as they serve no purpose with the
current ztimer-based implementation.

Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
2025-10-30 08:20:21 +01:00
fabian18
e3fa62f38f
Merge pull request #21533 from fabian18/pr/submac_ack_transmission
ieee802154/submac: add automatic ACK transmission when AUTO_ACK is not supported by driver
2025-10-06 11:05:40 +00:00
Fabian Hüßler
6b065bcea7 socket_zep: remove driver ACK 2025-10-06 10:15:20 +02:00
krzysztof-cabaj
fd36921a29 cpu/native: move licenses to SPDX format 2025-09-25 17:48:55 +02:00
Marian Buschsieweke
cac44edec7
tree-wide: replace multiple empty lines with one
For each C source/header `$file`: `sed -e '/^$/N;/^\n$/D' -i $file`.
2025-05-21 22:51:04 +02:00
KSKNico
fe821eaa1d cpu: replace header guards with #pragma once 2025-05-21 17:13:37 +02:00
Oleg Hahm
af6da3457b cpu/native: use correct isr_stack for valgrind
In 90a3f3ffcc3ae25f07ba5ac9fe2d1444cf7c26ea the ISR stack variable got
renamed from __isr_stack to _isr_stack but the valgrind configuration
hasn't been updated.
2025-05-16 12:23:19 +02:00
Marian Buschsieweke
4ce7ab2133
tree-wide: fix documentation issues
This should fix compilation with -Wdocumentation on LLVM.
2025-04-10 13:37:13 +02:00
Marian Buschsieweke
9a633436ab
cpu/native: configure FD-CAN loop delay
The native CAN implementation relies on the underlying OS to implement
CAN, so we can leave handling the nitty-gritty details such as the loop
delay to the underlying implementation.
2025-04-09 13:10:06 +02:00
benpicco
85dc9be1c9
Merge pull request #20872 from benpicco/stdio_null-frontend
core: add stdio.h to replace stdout functions with stdio_null
2025-04-01 15:30:08 +00:00
Benjamin Valentin
8c25666267 cpu/native: don't implement stdout functions with stdio_null 2025-04-01 14:29:28 +02:00
Marian Buschsieweke
9b417c35c1
Merge pull request #21313 from maribu/cpu/native/async_io/missing-include
cpu/native: add missing include
2025-03-21 21:01:38 +00:00
Marian Buschsieweke
56a553f80d
cpu/native: add missing include
`pid_t` is provided e.g. by `<sys/types.h>`. It seems that on glibc,
`<stdlib.h>` will also provide `pid_t`. But this way it should work on
both musl and glibc.
2025-03-21 21:24:24 +01:00
mguetschow
f3dbed405e
Merge pull request #21294 from benpicco/stdio_default
boards: introduce `stdio_default`
2025-03-21 11:46:27 +00:00
Benjamin Valentin
233a62b792 boards: move to stdio_default 2025-03-20 16:10:09 +01:00
benpicco
a756dcf1c9
Merge pull request #19213 from benpicco/socket_zep_hal-fix
socket_zep: properly implement the radio HAL
2025-03-20 08:30:12 +00:00
Benjamin Valentin
45c6d786f6 socket_zep: simulate RSSI 2025-03-20 02:04:34 +01:00
Benjamin Valentin
460901aa00 socket_zep: properly implement the radio HAL 2025-03-20 02:04:34 +01:00
Benjamin Valentin
4889bb57d9 cpu/native: port stdio to new interface 2025-03-13 00:50:46 +01:00
Benjamin Valentin
4232eb35ae cpu/native: async_read: make sure not to close stdin on reboot 2025-03-13 00:24:09 +01:00
Benjamin Valentin
333e1ea97d cpu/native: bump ASYNC_READ_NUMOF 2025-03-13 00:24:07 +01:00
Benjamin Valentin
bfe42ad20a cpu/native: use async read for stdio_read()
The real_read() function will block the thread but won't preempt it.
That means all other thereads on the same (or higher) priority level
are blocked as RIOT still consideres the thread that called stdio_read()
as running.

Use async_read/isrpipe to properly block the thread when reading from
stdin.
2025-03-13 00:23:40 +01:00
carl
9cad51126e cpu/native: add missing signal.h import 2025-03-11 16:19:39 +01:00
carl
e95be58fb9 cpu/native: rename native_cpu.c, irq_cpu.c, tramp.S 2025-03-11 16:19:39 +01:00
carl
6e5260c2d5 cpu/native: enable 64-bit thread arguments 2025-03-11 16:19:39 +01:00
carl
7d83850395 cpu/native: assembly: gardening 2025-03-11 16:19:39 +01:00
carl
ccc97b0018 cpu/native: restructure CPU 2025-03-11 16:19:39 +01:00
carl
9c96c18566 cpu/native: move valgrind imports into separate header 2025-03-11 16:19:39 +01:00
carl
b5eff6a107 cpu/native: unify ucontext manipulation 2025-03-11 16:19:39 +01:00
carl
64283b52aa cpu/native: doxygen gardening 2025-03-11 16:19:39 +01:00
carl
90a3f3ffcc cpu/native: docs and descriptive naming 2025-03-11 16:19:39 +01:00
carl
aff3b107c1 cpu/native: log with prefix 2025-03-11 16:19:39 +01:00
carl
cf54187b7c cpu/native: move syscalls into separate header 2025-03-11 16:19:39 +01:00
Gilles DOFFE
f5ee91d357 cpu/native: enable CAN FD support
As CAN FD is already supported by SocketCAN on Linux, just enable the
fdcan pseudomodule and allow CAN FD frames.

Signed-off-by: Gilles DOFFE <gilles.doffe@rtone.fr>
2025-01-29 20:51:23 +01:00
Gilles DOFFE
ae51a22fbb can: use frame len instead of can_dlc
RIOT implementation of CAN bus relies on SocketCAN model.
Since commit c398e56 (can: add optional DLC element to Classical CAN
frame structure), '__u8 can_dlc' attribute of struct can_frame is
considered as deprecated in SocketCAN and kept for legacy support.
Attribute '__u8 len' should be used instead.

	union {
		/* CAN frame payload length in byte (0 .. CAN_MAX_DLEN)
		 * was previously named can_dlc so we need to carry that
		 * name for legacy support
		 */
		__u8 len;
		__u8 can_dlc; /* deprecated */
	};

Moreover, CAN FD frame structure does not support legacy attribute
'can_dlc', making 'len' mandatory for incoming CAN FD support in RIOT.

	struct canfd_frame {
		canid_t can_id;  /* 32 bit CAN_ID + EFF/RTR/ERR flags */
		__u8    len;     /* frame payload length in byte */
		__u8    flags;   /* additional flags for CAN FD */
		__u8    __res0;  /* reserved / padding */
		__u8    __res1;  /* reserved / padding */
		__u8    data[CANFD_MAX_DLEN]
__attribute__((aligned(8)));
	};

Signed-off-by: Gilles DOFFE <gilles.doffe@rtone.fr>
2025-01-29 20:51:22 +01:00
Benjamin Valentin
3ba131c0f2 netdev_tap: port to netdev_new_api 2024-11-21 11:45:33 +01:00
Marian Buschsieweke
c2c2cc8592
drivers/periph_gpio: let gpio_read() return bool
Since https://github.com/RIOT-OS/RIOT/pull/20935 gpio_write()
uses a `bool` instead of an `int`. This does the same treatment for
`gpio_read()`.

This does indeed add an instruction to `gpio_read()` implementations.
However, users caring about an instruction more are better served with
`gpio_ll_read()` anyway. And `gpio_read() == 1` is often seen in
newcomer's code, which would now work as expected.
2024-10-23 13:24:09 +02:00
Benjamin Valentin
4627f66caa drivers/periph/gpio: make gpio_write() take a bool 2024-10-22 16:39:48 +02:00
Michael Richardson
7140aef74e doc: note that timer_settime() comes from librt on some systems 2024-08-18 16:02:15 -04:00
Marian Buschsieweke
29a00beaf1
cpu/native/periph_timer: add missing -lrt to linker flags
This fixes https://github.com/RIOT-OS/RIOT/pull/20009#issuecomment-2294803168
2024-08-17 13:52:57 +02:00
Marian Buschsieweke
21151691d7
cpu/native: Fix C11 atomic sizes for musl
musl and glibc have different types for fast atomic integers. This
selects the correct size depending on the used library.
2024-06-05 22:04:43 +02:00
Marian Buschsieweke
ff3f055dc7
cpu/native: fix compilation with GCC 14.1
The first argument to `calloc()` is the number of members, the
second the member size. This fixes an instance where the arguments
where switched.
2024-06-04 15:43:53 +02:00
Marian Buschsieweke
f34cd3f7c1
cpu/native: fix build with musl
This changes a bunch of things that allows building with the musl C lib,
provided that `libucontext-dev` and `pkg-config` are installed.

Note that installing libucontext makes absolutely zero sense on C libs
that do natively provide this deprecated System V API, such as glibc.
Hence, it no sane glibc setup is expected to ever have libucontext
installed.

A main pain point was that argv and argc are expected to be passed to
init_fini handlers, but that is actually a glibc extension. This just
parses `/proc/self/cmdline` by hand to populate argv and argc during
startup, unless running on glibc.
2024-05-31 12:18:33 +02:00
Karl Fessel
2bdca8d6c9
Merge pull request #16809 from kfessel/p-backtrace-fix
native/backtrace: improve its print capabilitys and test
2024-05-08 19:57:18 +00:00
Karl Fessel
37627ce2b8 native/backtrace: improve print capabilitys and test 2024-05-08 12:53:57 +02:00