1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/native
2014-05-07 19:24:55 +02:00
..
include core/cpu/board: moved F_CPU define to board 2014-05-06 10:36:09 +02:00
net native: update support for FreeBSD 2014-04-20 07:31:40 +02:00
rtc fixup for #710: use subfolder in bin dirs (native) 2014-04-09 15:25:05 +02:00
atomic_cpu.c making include directives consistent 2013-12-19 15:31:37 +01:00
crash.c core/cpu: put __builtin_unreachable() into one place 2014-05-07 19:24:55 +02:00
hwtimer_cpu.c hwtimer: clean up of interfaces to board/cpu 2014-03-26 13:19:18 +01:00
irq_cpu.c native: update support for FreeBSD 2014-04-20 07:31:40 +02:00
lpm_cpu.c native: removed unreachable code 2014-02-25 09:02:39 +01:00
Makefile Make: exterminate 'clean' buildtarget 2014-04-09 23:07:52 +02:00
Makefile.include Don't use INCLUDES for building any native at all. 2014-02-27 10:30:30 +01:00
native_cpu.c native: optionally exit() after last thread has ended 2014-04-12 15:47:01 +02:00
README native: optionally exit() after last thread has ended 2014-04-12 15:47:01 +02:00
startup.c native: add help option 2014-04-19 12:44:11 +02:00
syscalls.c native: update support for FreeBSD 2014-04-20 07:31:40 +02:00
tapsetup-freebsd.sh native: add tapsetup-freebsd.sh 2014-04-20 07:31:40 +02:00
tapsetup-osx.sh native cc1100x_ng network 2013-08-15 14:05:26 +02:00
tapsetup.sh allow for custom tap names 2013-11-08 13:59:26 +01:00
tramp.S fix signal trampoline 2014-01-21 17:39:15 +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 RIOTs 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 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:

    ./bin/native/default.elf tap0


SETTING UP A TAP NETWORK
========================

There is a shellscript in RIOT/cpu/native called tapsetup.sh 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:

    ./tapsetup.sh create [count]

To delete the bridge and all tap interfaces:

    ./tapsetup.sh delete


OSX TAP NETWORKING
==================

For tun/tap networking in OSX you will need:
http://tuntaposx.sourceforge.net/

For OSX there is a seperate script called tapsetup-osx.sh.
Run it, (it instructs you to start the RIOT instances).
In contrast to linux you will need to run 'tapsetup-osx.sh delete'
after killing your instances and rerun 'tapsetup-osx.sh create' 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

Use uart redirection if you want to use a shell or get stderr/stdout
output with/from a daemonized process.


UART REDIRECTION
================

You can redirect the processes stdin/stdout/stderr by specifying
options.

Usage:
To redirect stdio to a UNIX socket run:
    ./bin/native/default.elf -u -d
    RIOT pid: 18663

Attach this UNIX socket:
    nc -U /tmp/riot.tty.18663

To redirect stdio to a TCP socket:
    ./bin/native/default.elf -t 4711 -d
    RIOT pid: 18663

Attach this TCP socket:
    nc localhost 4711

Stop the process:
    kill 18663

To redirect stderr to a file:
    ./bin/native/default.elf -d -e
    RIOT pid: 18663

Read from it:
    tail -f /tmp/riot.stderr.18663

To redirect stdout to a file:
    ./bin/native/default.elf -d -o
    RIOT pid: 18663

Read from it:
    tail -f /tmp/riot.stdout.18663

The stdout redirection only writes to file while no socket connection
is established.

Socket redirection is only available when the uart module has been
compiled in.

COMPILE TIME OPTIONS
====================

Compile with
    CFLAGS=-DNATIVE_AUTO_EXIT make

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