Tutorial: Shell - simonduq/contiki-ng GitHub Wiki
Contiki-NG provides a shell that enables interactive IPv6 host inspection and maintenance.
To enable the shell in your project, simply add it to the module list in your Makefile:
MODULES += os/services/shell
As you have modified the Makefile, you need to clean:
$ make distclean
Now compile the firmware, flash a node, and connect to its serial interface (see tutorial:hello-world). Press enter to get a prompt:
0012.4b00.0616.0fcc>
If the shell is not responding to keystrokes, make sure your terminal emulator is sending the correct EOL character (Contiki-NG expects 0x0A (\n
), whereas some terminal programs send 0x0D \r
).
help
will show you the list of available commands:
> help
Available commands:
'> help': Shows this help
'> reboot': Reboot the board by watchdog_reboot()
'> ip-addr': Shows all IPv6 addresses
'> ip-nbr': Shows all IPv6 neighbors
'> log module level': Sets log level (0--4) for a given module (or "all"). For module "mac", level 4 also enables per-slot logging.
'> ping addr': Pings the IPv6 address 'addr'
'> rpl-set-root 0/1 [prefix]': Sets node as root (1) or not (0). A /64 prefix can be optionally specified.
'> rpl-local-repair': Triggers a RPL local repair
'> rpl-refresh-routes': Refreshes all routes through a DTSN increment
'> rpl-global-repair': Triggers a RPL global repair
'> rpl-status': Shows a summary of the current RPL state
'> rpl-nbr': Shows the RPL neighbor table
'> routes': Shows the route entries
'> radio help': Shows radio command usage.
'> leds [on/off led]': Controls the leds.
Note that depending on your compile-time configuration, different commands might show. For instance, 6TiSCH will come with its own shell commands. With the log
command, if you enable logging for some modules (see tutorial:logging), you will have the ability to change the log level at run-time on a per-module basis, with e.g. >log rpl 2
.
Try ip-addr
:
> ip-addr
Node IPv6 addresses:
-- fe80::212:4b00:616:fcc
Awesome, our node already has an IPv6 address! This is a link-local address (prefix fe80
), auto-configured from the node's MAC address through EUI-64. We will get started with IPv6 communication in tutorial:ipv6-ping.