1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-15 17:43:51 +01:00

827 Commits

Author SHA1 Message Date
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
Marian Buschsieweke
9462ab576e
cpu/native: netdev_tap implements the legacy netdev API 2024-04-30 09:49:36 +02:00
Ollrogge
2f67249ae1 Revert "cpu/native: extend flashpage API"
This reverts commit cdd9f303cfaf065cd06bc41fc15b7c660a0bb8da.
2024-04-04 17:37:15 +02:00
Karl Fessel
3e2ab59f4d
Merge pull request #20431 from cogip/native_fixes
cpu/native: add gpio-mock
2024-03-28 22:07:10 +00:00
MrKevinWeiss
e0fdc3c16c
*Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
MrKevinWeiss
7a68fb0d5e
*Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
MrKevinWeiss
0a9c51fdf9
*.config: Modify all .config kconfig files 2024-03-26 14:53:40 +01:00
MrKevinWeiss
0f2b71c60e
*Makefile.features: Remove TEST_KCONFIG includes 2024-03-26 14:53:39 +01:00
Gilles DOFFE
ebf95d2545 cpu/native: enhance GPIO mocking with 2D array representation
This commit introduces a more robust GPIO mocking mechanism by utilizing
a 2-dimensional array. Each element of the array holds a gpio_mock_t
structure describing a pin's attributes such as value, mode, flank,
interruption callback, and callback argument.

This enhancement allows for the arbitrary simulation of GPIOs across
various microcontroller architectures using the current API, while
maintaining consistency through the use of the GPIO_PIN macro.

Additionally, it should be noted that only the maximum number of ports
and maximum number of pins can be altered according to the context.

The implemented API in gpio_mock.c remains rudimentary, providing no
validation but fulfilling the required functions. However, it remains
customizable as all its functions are marked as weak.

Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
2024-03-24 23:12:24 +01:00
Gilles DOFFE
24d9657b40 cpu/native: mark gpio_mock function as weak
This allows developpers to override gpio behavior into their
applications.

Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
2024-03-15 20:27:11 +01:00
Gilles DOFFE
5b4c8fe92d cpu/native: return 0 for all gpio_init*() calls
If the gpio is initialized as an input or interruptable pin, the
gpio_mock driver returns -1 leading to failed initialization.
However that is not because nothing can change the GPIO state that it
has to be an error.
Return 0 in all cases.

Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
2024-03-15 20:27:11 +01:00
Gilles DOFFE
3bfabb4a6c cpu/native/periph/qdec: remove useless loop
Signed-off-by: Gilles DOFFE <g.doffe@gmail.com>
2024-03-15 20:27:11 +01:00
Benjamin Valentin
5164a6cc59 cpu/native: return _native_retval with NATIVE_AUTO_EXIT 2024-03-04 14:08:52 +01:00