1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/native
Leandro Lanzieri df7ce1c647
makefiles/kconfig: use two lists for boards and CPUs default configs
This introduces KCONFIG_BOARD_CONFIG and KCONFIG_CPU_CONFIG variable for
boards and CPUs (including common directories) to add default
configuration files to be merged. The current approach, as it uses
Makefile.features, would include boards first, not allowing them to
override CPU configurations.
2021-12-13 12:33:21 +01:00
..
backtrace cpu/native/backtrace: add module to Kconfig 2020-11-18 10:08:00 +01:00
cli_eui_provider socket_zep: allow to specify MAC address of ZEP device 2021-02-16 18:57:27 +01:00
include Merge pull request #16932 from benpicco/socket_zep-hal 2021-12-07 18:24:33 +01:00
ldscripts cpu/native: add XFA support 2021-02-18 10:46:08 +01:00
mtd drivers/mtd: fix Kconfig dependencies 2021-09-22 09:22:51 +02:00
netdev_tap netdev_tap: avoid explicit cast to netdev 2021-07-09 10:38:34 +02:00
osx-libc-extra cpu/native: fix doxygen grouping 2018-06-11 19:12:02 +02:00
periph cpu/native: migrate periph_rtc to ztimer 2021-11-11 10:54:30 +01:00
socket_zep socket_zep: add Kconfig 2021-11-18 14:17:29 +01:00
stdio_native stdio_native: initial import 2019-12-18 14:15:40 +01:00
vfs sys/vfs: model Kconfig 2021-11-29 10:30:49 +01:00
async_read.c cpu/native/async_read: close fds on cleanup 2020-07-28 14:47:59 +02:00
irq_cpu.c cpu/native: align stack in thread_stack_init() 2021-11-06 20:22:10 +01:00
Kconfig sys/vfs: model Kconfig 2021-11-29 10:30:49 +01:00
Makefile socket_zep: allow to specify MAC address of ZEP device 2021-02-16 18:57:27 +01:00
Makefile.dep Merge pull request #16932 from benpicco/socket_zep-hal 2021-12-07 18:24:33 +01:00
Makefile.features makefiles/kconfig: use two lists for boards and CPUs default configs 2021-12-13 12:33:21 +01:00
Makefile.include cpu/native: remove unused can_linux module 2020-11-13 09:11:50 +01:00
native_cpu.c cpu/native: align stack in thread_stack_init() 2021-11-06 20:22:10 +01:00
native.config cpu/native: add default configuration 2020-11-18 10:07:58 +01:00
panic.c cpu/native: fix doxygen grouping 2018-06-11 19:12:02 +02:00
README.md treewide: replace gnrc_netdev_default with netdev_default 2021-09-06 15:43:40 +02:00
startup.c socket_zep: allow to specify MAC address of ZEP device 2021-02-16 18:57:27 +01:00
syscalls.c cpu/native: align stack in thread_stack_init() 2021-11-06 20:22:10 +01:00
tramp.S native: add syscall-leave trampoline 2016-10-15 07:50:44 +02: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>]]

On OSX you need to start the RIOT instance at some point during the script's execution. The script will instruct you when to do that.

To delete the bridge and all tap interfaces:

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

For OSX you have to run this after killing your RIOT instance and rerun sudo ../../dist/tools/tapsetup [-c [<count>]] before restarting.

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.