1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/native
2015-09-19 10:35:58 +02:00
..
include cpu: native: remove hwtimer traces 2015-09-16 10:58:53 +02:00
netdev2_tap netdev2_tap: set maximum buffer size correctly 2015-09-12 12:02:48 +02:00
periph cpu: native: minor timer-related doxygen updates 2015-09-16 10:58:53 +02:00
irq_cpu.c core: cpu: fix check for DEVELHELP 2015-09-12 12:43:15 +02:00
lpm_cpu.c native: remove uart0 2015-09-04 17:46:23 +02:00
Makefile sys: net: replace dev_eth with netdev2, adapt native tap driver 2015-09-04 15:39:04 +02:00
Makefile.include cpu: native: remove hwtimer_compat dependency 2015-09-16 10:58:51 +02:00
native_cpu.c Merge pull request #3164 from kaspar030/remove_uart0 2015-09-04 18:54:30 +02:00
panic.c core: cpu: fix check for DEVELHELP 2015-09-12 12:43:15 +02:00
README.md native: remove uart0 2015-09-04 17:46:23 +02:00
startup.c Merge pull request #3164 from kaspar030/remove_uart0 2015-09-04 18:54:30 +02:00
syscalls.c native/syscalls: Use restoreIRQ 2015-09-19 10:35:58 +02:00
tramp.S native: irq: Get rid of dINT() and eINT() 2015-07-29 16:51:22 +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 pass the --db-attach parameter to Valgrind. E.g:

valgrind --db-attach=yes ./bin/native/default.elf tap0

Now, you will be asked whether you would like to attach the running process to gdb whenever a problem occurs.

In order for this to work under Linux 3.4 or newer, you might need to disable the ptrace access restrictions: As root call:

echo 0 > /proc/sys/kernel/yama/ptrace_scope

Network Support

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

make term PORT=tap0

Setting Up A Tap 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:

../../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:

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

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

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.