1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/native/README.md

89 lines
2.4 KiB
Markdown
Raw Normal View History

Valgrind Support
2013-09-30 14:07:10 +02:00
================
Rebuild your application using the all-valgrind target like this:
2014-02-04 18:41:38 +01:00
make -B clean all-valgrind
2013-09-30 14:07:10 +02:00
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.
2013-09-30 14:07:10 +02:00
2014-02-04 18:41:38 +01:00
To run your application run:
2013-10-24 12:58:28 +02:00
make term-valgrind
2013-10-24 12:58:28 +02:00
All this does is run your application under Valgrind.
Now Valgrind will print some information whenever it detects an
2014-02-04 18:41:38 +01:00
invalid memory access.
2013-10-24 12:58:28 +02:00
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:
2013-10-24 12:58:28 +02:00
make debug-valgrind-server
2013-10-24 12:58:28 +02:00
in the first one and run:
2013-10-24 12:58:28 +02:00
make debug-valgrind
2013-09-30 14:07:10 +02:00
in the seconde one. This starts per default gdb attached to valgrinds gdb
server (vgdb).
2013-09-30 14:07:10 +02:00
Network Support
2013-09-30 14:07:10 +02:00
===============
If you compile RIOT for the native cpu and include the `netdev_tap`
module, you need to specify a network interface like this:
2013-10-24 12:58:28 +02:00
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:
2013-10-24 12:58:28 +02:00
sudo ../../dist/tools/tapsetup/tapsetup [-c [<count>]]
2013-10-24 12:58:28 +02:00
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:
2014-02-01 12:10:08 +01:00
./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.