1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/native
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
..
backtrace Merge pull request #16809 from kfessel/p-backtrace-fix 2024-05-08 19:57:18 +00:00
cli_eui_provider *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
fs cpu/native: add host fs access via VFS 2023-04-26 00:53:14 +02:00
include cpu/native: Fix C11 atomic sizes for musl 2024-06-05 22:04:43 +02:00
ldscripts cpu/native: add XFA support 2021-02-18 10:46:08 +01:00
mtd native/mtd: drop .write() 2023-12-13 16:50:41 +01:00
netdev_tap native: Remove code used for __MACH__ target 2022-12-22 17:57:25 +01:00
periph drivers/periph_gpio: let gpio_read() return bool 2024-10-23 13:24:09 +02:00
socket_zep *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
stdio_native core/init: call vfs_bind_stdio() in early_init() 2023-01-08 22:26:13 +01:00
vfs *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
async_read.c cpu/native: fix native_async_read_remove_handler() + enable all baudrates 2024-02-10 15:46:00 +01:00
irq_cpu.c cpu/native: fix build with musl 2024-05-31 12:18:33 +02:00
Kconfig *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
Makefile cpu/native: add host fs access via VFS 2023-04-26 00:53:14 +02:00
Makefile.dep cpu/native: netdev_tap implements the legacy netdev API 2024-04-30 09:49:36 +02:00
Makefile.features *Makefile.features: Remove TEST_KCONFIG includes 2024-03-26 14:53:39 +01:00
Makefile.include cpu/native/periph_timer: add missing -lrt to linker flags 2024-08-17 13:52:57 +02:00
native_cpu.c cpu/native: fix build with musl 2024-05-31 12:18:33 +02:00
panic.c cpu/native: return error code on failed assertion 2024-02-22 16:06:32 +01:00
README.md boards/native: Remove macOS as native target 2022-10-25 19:11:23 +02:00
startup.c cpu/native: fix compilation with GCC 14.1 2024-06-04 15:43:53 +02:00
syscalls.c cpu/native: fix build with musl 2024-05-31 12:18:33 +02:00
tramp.S native: Linux/x86_64 support 2024-01-30 16:33:19 +01:00

Valgrind Support

Rebuild your application using the all-valgrind target like this:

make -B clean all-valgrind

That way native will tell Valgrind about RIOT's stacks and prevent Valgrind from reporting lots of false positives. The debug information flag -g is not strictly necessary, but passing it allows Valgrind to tell you precisely which code triggered the error.

To run your application run:

make term-valgrind

All this does is run your application under Valgrind. Now Valgrind will print some information whenever it detects an invalid memory access.

In order to debug the program when this occurs you can use the targets debug-valgrind-server and debug-valgrind. Therefore, you need to open two terminals and run:

make debug-valgrind-server

in the first one and run:

make debug-valgrind

in the seconde one. This starts per default gdb attached to valgrinds gdb server (vgdb).

Network Support

If you compile RIOT for the native cpu and include the netdev_tap module, you need to specify a network interface like this:

make term PORT=tap0

Please note: in case you're using RIOT's default network stack, the GNRC stack, you may also use netdev_default module and also add auto_init_gnrc_netif in order to automatically initialize the interface.

Setting Up A Virtual Network

There is a shellscript in RIOT/dist/tools/tapsetup called tapsetup which you can use to create a network of tap interfaces.

Usage: To create a bridge and two (or count at your option) tap interfaces:

sudo ../../dist/tools/tapsetup/tapsetup [-c [<count>]]

To delete the bridge and all tap interfaces:

sudo ../../dist/tools/tapsetup/tapsetup -d

Please note: If you want to communicate between RIOT and your host operating system, you must not use the tapsetup script, but create and activate the tap interface manually. On Linux you can do so, by calling

sudo ip tuntap add tap0 mode tap user ${USER}
sudo ip link set tap0 up

Daemonization

You can daemonize a riot process. This is useful for larger networks. Valgrind will fork along with the riot process and dump its output in the terminal.

Usage:

./bin/native/default.elf -d

Compile Time Options

Compile with

CFLAGS=-DNATIVE_AUTO_EXIT make

to exit the riot core after the last thread has exited.