├── slides ├── .gitignore ├── tutorial-slides.pdf ├── preamble-caption.tex ├── README.md ├── scripts │ ├── overlay │ └── pandoc-svg ├── Makefile └── pictures │ ├── overview-net.svg │ ├── overview-net-sock.svg │ ├── overview-net-netdev.svg │ ├── gnrc_minimal_eth_dep.svg │ ├── gnrc_ccn_lite_relay.svg │ ├── gnrc_minimal_eth.svg │ ├── lwip_sock.svg │ ├── gnrc_minimal_ieee802154_dep.svg │ ├── netapi-lego.svg │ ├── gnrc_minimal_ieee802154.svg │ ├── gnrc_networking_eth_dep.svg │ ├── gnrc_networking_eth.svg │ ├── gnrc_minimal_app.svg │ └── gnrc-pkt-dup.svg ├── .gitignore ├── phytec.png ├── SAM-R21.jpg ├── overview-net.png ├── .gitmodules ├── task-01 ├── main.c ├── Makefile └── README.md ├── task-03 ├── main.c ├── Makefile └── README.md ├── task-02 ├── main.c ├── Makefile └── README.md ├── Vagrantfile ├── task-05 ├── main.c ├── Makefile └── README.md ├── task-04 ├── main.c ├── Makefile └── README.md ├── task-06 ├── main.c ├── Makefile ├── udp.c └── README.md ├── .github └── workflows │ └── build.yml ├── task-08 ├── Makefile ├── main.c └── README.md ├── task-09 ├── Makefile ├── README.md ├── main.c └── udp.c ├── task-07 └── README.md └── README.md /slides/.gitignore: -------------------------------------------------------------------------------- 1 | pictures/*.psvg 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | .swp 3 | *~ 4 | *.pdf 5 | .vagrant 6 | -------------------------------------------------------------------------------- /phytec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RIOT-OS/Tutorials/HEAD/phytec.png -------------------------------------------------------------------------------- /SAM-R21.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RIOT-OS/Tutorials/HEAD/SAM-R21.jpg -------------------------------------------------------------------------------- /overview-net.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RIOT-OS/Tutorials/HEAD/overview-net.png -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "RIOT"] 2 | path = RIOT 3 | url = https://github.com/RIOT-OS/RIOT.git 4 | -------------------------------------------------------------------------------- /slides/tutorial-slides.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RIOT-OS/Tutorials/HEAD/slides/tutorial-slides.pdf -------------------------------------------------------------------------------- /slides/preamble-caption.tex: -------------------------------------------------------------------------------- 1 | \setbeamertemplate{caption}{% 2 | \begin{beamercolorbox}[wd=.5\paperwidth, sep=.2ex]{block body}\insertcaption% 3 | \end{beamercolorbox}% 4 | } 5 | -------------------------------------------------------------------------------- /task-01/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "shell.h" 5 | 6 | int main(void) 7 | { 8 | puts("This is Task-01"); 9 | 10 | char line_buf[SHELL_DEFAULT_BUFSIZE]; 11 | shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE); 12 | 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /slides/README.md: -------------------------------------------------------------------------------- 1 | Slides for Presentation 2 | ======================= 3 | 4 | Find the markdown version [here](slides.md) (attention: interwoven YAML and 5 | LaTex ;-). 6 | 7 | Compiling this version to PDF requires `pandoc`, `texlive` and the `pandocfilters` 8 | library for python (on Ubuntu): 9 | 10 | ```sh 11 | sudo apt-get pandoc texlive-full pip make 12 | sudo pip install pandocfilters 13 | ``` 14 | 15 | Build using `make` 16 | 17 | ```sh 18 | make 19 | ``` 20 | -------------------------------------------------------------------------------- /task-03/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "shell.h" 5 | #include "thread.h" 6 | 7 | char stack[THREAD_STACKSIZE_MAIN]; 8 | 9 | void *thread_handler(void *arg) 10 | { 11 | (void) arg; 12 | puts("I'm in \"thread\" now"); 13 | return NULL; 14 | } 15 | 16 | int main(void) 17 | { 18 | puts("This is Task-03"); 19 | 20 | /* ... */ 21 | 22 | char line_buf[SHELL_DEFAULT_BUFSIZE]; 23 | shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE); 24 | 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /task-02/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "shell.h" 5 | 6 | int echo(int argc, char **argv) 7 | { 8 | /* ... */ 9 | (void)argc; 10 | (void)argv; 11 | 12 | return 0; 13 | } 14 | 15 | static const shell_command_t commands[] = { 16 | { NULL, NULL, NULL } 17 | }; 18 | 19 | int main(void) 20 | { 21 | puts("This is Task-02"); 22 | 23 | char line_buf[SHELL_DEFAULT_BUFSIZE]; 24 | shell_run(commands, line_buf, SHELL_DEFAULT_BUFSIZE); 25 | 26 | return 0; 27 | } 28 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | require 'fileutils' 5 | 6 | riot_vagrantfile = File.expand_path('RIOT/Vagrantfile') 7 | RIOTBASE ||= "RIOT/" 8 | 9 | if File.exists?(riot_vagrantfile) 10 | load riot_vagrantfile 11 | else 12 | abort "No Vagrantfile found in the RIOT directory. ABORTING!" 13 | end 14 | 15 | Vagrant.configure(2) do |config| 16 | config.vm.provider "virtualbox" do |vb| 17 | vb.name = "RIOT VM - Tutorials" 18 | end 19 | config.vm.synced_folder ".", "/home/vagrant/Tutorials" 20 | end 21 | -------------------------------------------------------------------------------- /task-05/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "msg.h" 5 | #include "net/gnrc/netreg.h" 6 | #include "net/gnrc/pktdump.h" 7 | #include "shell.h" 8 | #include "xtimer.h" 9 | 10 | int main(void) 11 | { 12 | puts("This is Task-05"); 13 | 14 | /* initialize and register pktdump to print received packets */ 15 | gnrc_netreg_entry_t dump = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL, 16 | gnrc_pktdump_pid); 17 | gnrc_netreg_register(GNRC_NETTYPE_UNDEF, &dump); 18 | 19 | char line_buf[SHELL_DEFAULT_BUFSIZE]; 20 | shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE); 21 | 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /task-01/Makefile: -------------------------------------------------------------------------------- 1 | # name of your application 2 | APPLICATION = Task01 3 | 4 | # If no BOARD is found in the environment, use this default: 5 | BOARD ?= native 6 | 7 | # This has to be the absolute path to the RIOT base directory: 8 | RIOTBASE ?= $(CURDIR)/../RIOT 9 | 10 | # Comment this out to disable code in RIOT that does safety checking 11 | # which is not needed in a production environment but helps in the 12 | # development process: 13 | CFLAGS += -DDEVELHELP 14 | 15 | # Change this to 0 show compiler invocation lines by default: 16 | QUIET ?= 1 17 | 18 | # Modules to include: 19 | USEMODULE += shell 20 | USEMODULE += shell_commands 21 | USEMODULE += ps 22 | 23 | include $(RIOTBASE)/Makefile.include 24 | -------------------------------------------------------------------------------- /task-02/Makefile: -------------------------------------------------------------------------------- 1 | # name of your application 2 | APPLICATION = Task02 3 | 4 | # If no BOARD is found in the environment, use this default: 5 | BOARD ?= native 6 | 7 | # This has to be the absolute path to the RIOT base directory: 8 | RIOTBASE ?= $(CURDIR)/../RIOT 9 | 10 | # Comment this out to disable code in RIOT that does safety checking 11 | # which is not needed in a production environment but helps in the 12 | # development process: 13 | CFLAGS += -DDEVELHELP 14 | 15 | # Change this to 0 show compiler invocation lines by default: 16 | QUIET ?= 1 17 | 18 | # Modules to include: 19 | USEMODULE += shell 20 | USEMODULE += shell_commands 21 | USEMODULE += ps 22 | 23 | include $(RIOTBASE)/Makefile.include 24 | -------------------------------------------------------------------------------- /task-03/Makefile: -------------------------------------------------------------------------------- 1 | # name of your application 2 | APPLICATION = Task03 3 | 4 | # If no BOARD is found in the environment, use this default: 5 | BOARD ?= native 6 | 7 | # This has to be the absolute path to the RIOT base directory: 8 | RIOTBASE ?= $(CURDIR)/../RIOT 9 | 10 | # Comment this out to disable code in RIOT that does safety checking 11 | # which is not needed in a production environment but helps in the 12 | # development process: 13 | CFLAGS += -DDEVELHELP 14 | 15 | # Change this to 0 show compiler invocation lines by default: 16 | QUIET ?= 1 17 | 18 | # Modules to include: 19 | USEMODULE += shell 20 | USEMODULE += shell_commands 21 | USEMODULE += ps 22 | 23 | include $(RIOTBASE)/Makefile.include 24 | -------------------------------------------------------------------------------- /task-04/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "shell.h" 5 | #include "thread.h" 6 | #include "xtimer.h" 7 | 8 | char stack[THREAD_STACKSIZE_MAIN]; 9 | 10 | void *thread_handler(void *arg) 11 | { 12 | /* ... */ 13 | (void)arg; 14 | return NULL; 15 | } 16 | 17 | int main(void) 18 | { 19 | puts("This is Task-04"); 20 | 21 | thread_create(stack, sizeof(stack), 22 | THREAD_PRIORITY_MAIN - 1, 23 | THREAD_CREATE_STACKTEST, 24 | thread_handler, NULL, 25 | "thread"); 26 | 27 | char line_buf[SHELL_DEFAULT_BUFSIZE]; 28 | shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE); 29 | 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /task-04/Makefile: -------------------------------------------------------------------------------- 1 | # name of your application 2 | APPLICATION = Task04 3 | 4 | # If no BOARD is found in the environment, use this default: 5 | BOARD ?= native 6 | 7 | # This has to be the absolute path to the RIOT base directory: 8 | RIOTBASE ?= $(CURDIR)/../RIOT 9 | 10 | # Comment this out to disable code in RIOT that does safety checking 11 | # which is not needed in a production environment but helps in the 12 | # development process: 13 | CFLAGS += -DDEVELHELP 14 | 15 | # Change this to 0 show compiler invocation lines by default: 16 | QUIET ?= 1 17 | 18 | # Modules to include: 19 | USEMODULE += shell 20 | USEMODULE += shell_commands 21 | USEMODULE += ps 22 | USEMODULE += xtimer 23 | 24 | include $(RIOTBASE)/Makefile.include 25 | -------------------------------------------------------------------------------- /task-06/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "msg.h" 5 | #include "shell.h" 6 | 7 | #define MAIN_QUEUE_SIZE (8) 8 | static msg_t _main_msg_queue[MAIN_QUEUE_SIZE]; 9 | 10 | extern int udp_send(int argc, char **argv); 11 | extern int udp_server(int argc, char **argv); 12 | 13 | static const shell_command_t shell_commands[] = { 14 | { "udp", "send udp packets", udp_send }, 15 | { "udps", "start udp server", udp_server }, 16 | { NULL, NULL, NULL } 17 | }; 18 | 19 | int main(void) 20 | { 21 | msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE); 22 | puts("This is Task-06"); 23 | 24 | char line_buf[SHELL_DEFAULT_BUFSIZE]; 25 | shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE); 26 | 27 | return 0; 28 | } 29 | -------------------------------------------------------------------------------- /task-05/Makefile: -------------------------------------------------------------------------------- 1 | # name of your application 2 | APPLICATION = Task05 3 | 4 | # If no BOARD is found in the environment, use this default: 5 | BOARD ?= native 6 | 7 | # This has to be the absolute path to the RIOT base directory: 8 | RIOTBASE ?= $(CURDIR)/../RIOT 9 | 10 | # Comment this out to disable code in RIOT that does safety checking 11 | # which is not needed in a production environment but helps in the 12 | # development process: 13 | CFLAGS += -DDEVELHELP 14 | 15 | # Change this to 0 show compiler invocation lines by default: 16 | QUIET ?= 1 17 | 18 | # Modules to include: 19 | USEMODULE += shell 20 | USEMODULE += shell_commands 21 | USEMODULE += ps 22 | USEMODULE += gnrc_pktdump 23 | USEMODULE += gnrc_txtsnd 24 | USEMODULE += gnrc_netdev_default 25 | USEMODULE += auto_init_gnrc_netif 26 | 27 | include $(RIOTBASE)/Makefile.include 28 | -------------------------------------------------------------------------------- /task-04/README.md: -------------------------------------------------------------------------------- 1 | [previous task](../task-03) 2 | 3 | # Task 4: Timers 4 | [`xtimer`](https://doc.riot-os.org/group__sys__xtimer.html) is the high level API of RIOT to multiplex hardware timers. 5 | For this task we need only the following functions 6 | 7 | - `xtimer_now_usec()` to get current system time in microseconds 8 | - `xtimer_sleep(sec)` to sleep `sec` seconds 9 | - `xtimer_usleep(usec)` to sleep `usec` microseconds 10 | 11 | ## Task 4.1: Use `xtimer` 12 | * Note the inclusion of `xtimer` in the [Makefile](Makefile) 13 | ```Makefile 14 | USEMODULE += xtimer 15 | ``` 16 | * Create a thread in [`main.c`](main.c#L12) that prints the current system time every 2 seconds 17 | * Check the existence of the thread with `ps` shell command 18 | 19 | [Read the doc](https://doc.riot-os.org/group__sys__xtimer.html) 20 | 21 | [next task](../task-05) 22 | -------------------------------------------------------------------------------- /task-06/Makefile: -------------------------------------------------------------------------------- 1 | # name of your application 2 | APPLICATION = Task06 3 | 4 | # If no BOARD is found in the environment, use this default: 5 | BOARD ?= native 6 | 7 | # This has to be the absolute path to the RIOT base directory: 8 | RIOTBASE ?= $(CURDIR)/../RIOT 9 | 10 | # Uncomment this to enable scheduler statistics for ps: 11 | #CFLAGS += -DSCHEDSTATISTICS 12 | 13 | # Comment this out to disable code in RIOT that does safety checking 14 | # which is not needed in a production environment but helps in the 15 | # development process: 16 | CFLAGS += -DDEVELHELP 17 | 18 | # Change this to 0 show compiler invocation lines by default: 19 | QUIET ?= 1 20 | 21 | # Modules to include: 22 | USEMODULE += shell 23 | USEMODULE += shell_commands 24 | USEMODULE += ps 25 | USEMODULE += gnrc_netdev_default 26 | USEMODULE += auto_init_gnrc_netif 27 | USEMODULE += gnrc_ipv6_default 28 | USEMODULE += gnrc_icmpv6_echo 29 | USEMODULE += gnrc_sock_udp 30 | 31 | include $(RIOTBASE)/Makefile.include 32 | -------------------------------------------------------------------------------- /task-03/README.md: -------------------------------------------------------------------------------- 1 | [previous task](../task-02) 2 | 3 | # Task 3: Multithreading 4 | Threads in RIOT are functions with signature 5 | ```C 6 | void *thread_handler(void *arg); 7 | ``` 8 | Use [`thread_create()`](https://doc.riot-os.org/thread_8h.html#a87c94d383e64a09974fc8665f82a99b3) from 9 | [`thread.h`](https://doc.riot-os.org/thread_8h.html) to start it 10 | ```C 11 | thread_create(stack, sizeof(stack), 12 | THREAD_PRIORITY_MAIN - 1, 13 | THREAD_CREATE_STACKTEST, 14 | thread_handler, 15 | NULL, "thread"); 16 | ``` 17 | thread_create returns a kernel_pid_t type, which can be helpful to assign to a variable (but not necessary for this lesson). 18 | 19 | ## Task 3.1: Start a thread 20 | * Start the thread `"thread"` from within [`main()`](main.c#L15-L25) 21 | * Run the application on `native`: `make all term` 22 | * Check your output, it should read: `I'm in "thread" now` 23 | 24 | [Read the doc](https://doc.riot-os.org/group__core__thread.html) 25 | 26 | [next task](../task-04) 27 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build-test 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - '*' 10 | schedule: 11 | - cron: '0 3 * * 5' 12 | 13 | jobs: 14 | build-test: 15 | runs-on: ubuntu-22.04 16 | strategy: 17 | fail-fast: false 18 | matrix: 19 | board: 20 | - native 21 | - samr21-xpro 22 | - pba-d-01-kw2x 23 | env: 24 | BUILD_IN_DOCKER: 1 25 | WERROR: 0 # some variables are not used intentionally 26 | BOARD: ${{ matrix.board }} 27 | steps: 28 | - uses: actions/checkout@v2 29 | with: 30 | submodules: recursive 31 | - run: make -C task-01 -j all 32 | - run: make -C task-02 -j all 33 | - run: make -C task-03 -j all 34 | - run: make -C task-04 -j all 35 | - run: make -C task-05 -j all 36 | - run: make -C task-06 -j all 37 | - name: Run make -C task-07 -j all 38 | run: | 39 | make -C RIOT/examples/gnrc_minimal -j all 40 | make -C RIOT/examples/gnrc_networking -j all 41 | - run: make -C task-08 -j all 42 | - run: make -C task-09 -j all 43 | 44 | -------------------------------------------------------------------------------- /slides/scripts/overlay: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """overlay_filter 4 | 5 | Simplistic pandoc filter to include beamer overlay specifications on 6 | inline tex in markdown 7 | 8 | Whereas in normal beamer LaTeX you'd write 9 | 10 | \cmd{...} 11 | 12 | in markdown write 13 | 14 | \cmd{}{...} 15 | 16 | then process with 17 | 18 | pandoc --filter overlay_filter 19 | 20 | Environments are passed through to LaTeX, so there's no need to filter 21 | them; write onlyenv as normal, for example. 22 | 23 | Requires pandocfilters (pip install pandocfilters). 24 | """ 25 | 26 | from pandocfilters import toJSONFilter, RawInline 27 | import re 28 | 29 | ov_pat = re.compile(r'^(\\\w+)(\{<[0-9-+,]+>})({.*)$',flags=re.DOTALL) 30 | 31 | def overlay_filter(key, value, fmt, meta): 32 | if key == 'RawInline' and value[0] == 'tex': 33 | m = ov_pat.match(value[1]) 34 | if m: 35 | c = m.group(1) 36 | c += re.sub(r'^\{|}$', "", m.group(2)) 37 | c += m.group(3) 38 | return RawInline("tex", c) 39 | 40 | if __name__ == "__main__": 41 | toJSONFilter(overlay_filter) 42 | 43 | 44 | -------------------------------------------------------------------------------- /slides/Makefile: -------------------------------------------------------------------------------- 1 | SRC := slides.md 2 | SCRIPTDIR=scripts 3 | FILENAME := tutorial-slides 4 | DEPS := preamble-caption.tex 5 | PDFLAGS := -s -t beamer+smart --pdf-engine=xelatex --slide-level=2 6 | PDFLAGS += --filter=$(SCRIPTDIR)/pandoc-svg 7 | PDFLAGS += --filter=$(SCRIPTDIR)/overlay 8 | DEPS += $(patsubst %.svg,%.pdf,$(wildcard pictures/6lowpan-route-over*.svg)\ 9 | $(wildcard pictures/overview-net*.svg)\ 10 | $(wildcard pictures/exp-setup*.svg)) 11 | DEPS += pictures/gnrc-arch-netif.pdf 12 | 13 | ifneq (,$(wildcard template.tex)) 14 | PDFLAGS += --template=template.tex 15 | DEPS += template.tex 16 | endif 17 | 18 | ifeq (,$(shell type pandoc 2> /dev/null)) 19 | $(error Need `pandoc` (including python-lib pandocfilters) to compile) 20 | endif 21 | 22 | .PHONY: all clean 23 | 24 | all: $(FILENAME).pdf 25 | 26 | $(FILENAME).pdf: $(SRC) $(DEPS) 27 | pandoc $(foreach H,$(filter preamble-%.tex,$^),-H $(H))\ 28 | $(foreach B,$(filter before-%.tex,$^),-B $(B)) -o $@ $(PDFLAGS) $< 29 | 30 | pictures/%.pdf: pictures/%.svg 31 | inkscape --export-latex=$@ $< 32 | 33 | clean: 34 | rm -f $(FILENAME)* $(filter pictures/%.pdf,$(DEPS)) \ 35 | $(patsubst %.psvg,%,$(wildcard pictures/*.psvg)) \ 36 | $(wildcard pictures/*.psvg) 37 | -------------------------------------------------------------------------------- /task-08/Makefile: -------------------------------------------------------------------------------- 1 | APPLICATION = Task08 2 | 3 | # If no BOARD is found in the environment, use this default: 4 | BOARD ?= native 5 | 6 | # This has to be the absolute path to the RIOT base directory: 7 | RIOTBASE ?= $(CURDIR)/../RIOT 8 | 9 | BOARD_WHITELIST := fox iotlab-m3 msba2 mulle native pba-d-01-kw2x samr21-xpro 10 | 11 | 12 | # This has to be the absolute path to the RIOT base directory: 13 | RIOTBASE ?= $(CURDIR)/../.. 14 | 15 | CFLAGS += -DDEVELHELP 16 | CFLAGS += -DUSE_LINKLAYER 17 | CFLAGS += -DUSE_RONR 18 | CFLAGS += -DCCNL_UAPI_H_ 19 | CFLAGS += -DUSE_SUITE_NDNTLV 20 | CFLAGS += -DNEEDS_PREFIX_MATCHING 21 | CFLAGS += -DNEEDS_PACKET_CRAFTING 22 | 23 | # Change this to 0 show compiler invocation lines by default: 24 | QUIET ?= 1 25 | 26 | USEMODULE += ps 27 | USEMODULE += shell 28 | USEMODULE += shell_commands 29 | # Include packages that pull up and auto-init the link layer. 30 | # NOTE: 6LoWPAN will be included if IEEE802.15.4 devices are present 31 | USEMODULE += gnrc_netdev_default 32 | USEMODULE += auto_init_gnrc_netif 33 | USEMODULE += timex 34 | USEMODULE += xtimer 35 | USEMODULE += random 36 | USEMODULE += prng_minstd 37 | 38 | USEPKG += tlsf 39 | 40 | USEPKG += ccn-lite 41 | USEMODULE += ccn-lite-utils 42 | 43 | include $(RIOTBASE)/Makefile.include 44 | -------------------------------------------------------------------------------- /task-02/README.md: -------------------------------------------------------------------------------- 1 | [previous task](../task-01) 2 | 3 | # Task 2: Custom shell handlers 4 | ## Task 2.1: A simple echo command handler 5 | Extend the `echo()` function in [`main.c`](main.c#L8) to print the first argument to the command handler 6 | ```c 7 | int cmd_handler(int argc, char **argv); 8 | ``` 9 | Any parameters following the shell command in the RIOT shell are accessible 10 | from the `argv` variable. `argc` contains the number of parameters used to call 11 | this shell command plus one for the name of the command. 12 | 13 | Your function must return `0` if it runs successfully and or anything else if 14 | an error occurs. 15 | 16 | Shell commands need to be added manually to the shell on initialization 17 | ```c 18 | #include "shell.h" 19 | 20 | static const shell_command_t shell_commands[] = { 21 | { "command name", "command description", cmd_handler }, 22 | { NULL, NULL, NULL } 23 | }; 24 | 25 | /* ... */ 26 | shell_run(commands, line_buf, SHELL_DEFAULT_BUFSIZE) 27 | /* ... */ 28 | ``` 29 | 30 | Please note, that the list of shell commands must be terminated with an empty entry. 31 | 32 | ## Task 2.2: Control the hardware 33 | 1. Include the [`led.h`](https://doc.riot-os.org/led_8h.html) file to get access 34 | to the `LED0_TOGGLE` macro. 35 | 2. Write a command handler `toggle` in [`main.c`](main.c) that toggles the 36 | primary LED on the board using the `LED0_TOGGLE` macro. 37 | 38 | [Read the Doc](https://doc.riot-os.org/group__sys__shell.html) 39 | 40 | [next task](../task-03) 41 | -------------------------------------------------------------------------------- /slides/scripts/pandoc-svg: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | """ 3 | Pandoc filter to convert svg files to pdf as suggested at: 4 | https://github.com/jgm/pandoc/issues/265#issuecomment-27317316 5 | """ 6 | 7 | __author__ = "Jerome Robert" 8 | 9 | import mimetypes 10 | import subprocess 11 | import os 12 | import sys 13 | from pandocfilters import toJSONFilter, Image 14 | 15 | # TODO add emf export if fmt=="docx" ? 16 | fmt_to_option = { 17 | "latex": ("--export-latex", "pdf"), 18 | "beamer": ("--export-latex", "pdf"), 19 | # because of IE 20 | "html": ("--export-png", "png") 21 | } 22 | 23 | 24 | def svg_to_any(key, value, fmt, meta): 25 | if key == 'Image': 26 | alt, [src, title] = value[1], value[-1] 27 | mimet, _ = mimetypes.guess_type(src) 28 | option = fmt_to_option.get(fmt) 29 | if mimet == 'image/svg+xml' and option: 30 | base_name, _ = os.path.splitext(src) 31 | eps_name = base_name + "." + option[1] 32 | try: 33 | mtime = os.path.getmtime(eps_name) 34 | except OSError: 35 | mtime = -1 36 | if mtime < os.path.getmtime(src): 37 | cmd_line = ['inkscape', option[0], eps_name, src] 38 | sys.stderr.write("Running %s\n" % " ".join(cmd_line)) 39 | subprocess.call(cmd_line, stdout=sys.stderr.fileno()) 40 | open(eps_name + ".psvg", 'a').close() 41 | return Image(['', [], []], alt, [eps_name, title]) 42 | 43 | if __name__ == "__main__": 44 | toJSONFilter(svg_to_any) 45 | -------------------------------------------------------------------------------- /task-05/README.md: -------------------------------------------------------------------------------- 1 | [previous task](../task-04) 2 | 3 | # Task 5: Using network devices 4 | 5 | ## RIOT's Networking architecture 6 | Network devices are accessed through [`netdev`](https://doc.riot-os.org/group__drivers__netdev__api.html) driver API 7 | 8 | ![Networking overview](../overview-net.png) 9 | 10 | It has capabilities for receiving and sending data and for getting and setting 11 | options or states. 12 | 13 | Note inclusion of `netdev` modules in the [Makefile](Makefile) 14 | 15 | ```Makefile 16 | USEMODULE += gnrc_netdev_default 17 | USEMODULE += auto_init_gnrc_netif 18 | ``` 19 | 20 | ## Virtual network interface on `native` 21 | * Use `tapsetup` script in RIOT repository: 22 | 23 | ```sh 24 | sudo ./../RIOT/dist/tools/tapsetup/tapsetup -c 2 25 | ``` 26 | 27 | * Creates 28 | - Two TAP interfaces `tap0` and `tap1` and 29 | - A bridge between them (`tapbr0` on Linux, `bridge0` on OSX) 30 | * Check with `ifconfig` or `ip link`! 31 | 32 | ## Task 5.1 -- Your first networking application 33 | * Run the application on `native`: `make all term PORT=tap0` 34 | * Type `help` 35 | * Run a second instance with `make all term PORT=tap1` 36 | * Type `ifconfig` on both to get hardware address and interface number 37 | * Use `txtsnd` command to exchange messages between the two instances 38 | 39 | ## Task 5.2 -- Use your application on real hardware 40 | * Compile, flash, and run on the board `BOARD=samr21-xpro make all flash term` 41 | * Type `ifconfig` to get your hardware addresses 42 | * Use `txtsnd` to send one of your neighbors a friendly message 43 | 44 | [Read the Doc](https://doc.riot-os.org/group__drivers__netdev__api.html) 45 | 46 | [next task](../task-06) 47 | -------------------------------------------------------------------------------- /task-08/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Inria 3 | * 4 | * This file is subject to the terms and conditions of the GNU Lesser 5 | * General Public License v2.1. See the file LICENSE in the top level 6 | * directory for more details. 7 | */ 8 | 9 | /** 10 | * @ingroup examples 11 | * @{ 12 | * 13 | * @file 14 | * @brief Basic ccn-lite relay example (produce and consumer via shell) 15 | * 16 | * @author Oliver Hahm 17 | * 18 | * @} 19 | */ 20 | 21 | #include 22 | 23 | #include "tlsf.h" 24 | #include "msg.h" 25 | #include "shell.h" 26 | #include "ccn-lite-riot.h" 27 | #include "net/gnrc/netif.h" 28 | 29 | /* main thread's message queue */ 30 | #define MAIN_QUEUE_SIZE (8) 31 | static msg_t _main_msg_queue[MAIN_QUEUE_SIZE]; 32 | 33 | /* 10kB buffer for the heap should be enough for everyone */ 34 | #define TLSF_BUFFER (10240 / sizeof(uint32_t)) 35 | static uint32_t _tlsf_heap[TLSF_BUFFER]; 36 | 37 | int main(void) 38 | { 39 | tlsf_create_with_pool(_tlsf_heap, sizeof(_tlsf_heap)); 40 | msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE); 41 | 42 | puts("Basic CCN-Lite example"); 43 | 44 | ccnl_core_init(); 45 | 46 | ccnl_start(); 47 | 48 | /* get the default interface */ 49 | gnrc_netif_t *netif = gnrc_netif_iter(NULL); 50 | 51 | /* set the relay's PID, configure the interface to interface to use CCN 52 | * nettype */ 53 | if ((netif == NULL) || (ccnl_open_netif(netif->pid, GNRC_NETTYPE_CCN) < 0)) { 54 | puts("Error registering at network interface!"); 55 | return -1; 56 | } 57 | 58 | char line_buf[SHELL_DEFAULT_BUFSIZE]; 59 | shell_run(NULL, line_buf, SHELL_DEFAULT_BUFSIZE); 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /task-09/Makefile: -------------------------------------------------------------------------------- 1 | # name of your application 2 | APPLICATION = task-09 3 | 4 | # If no BOARD is found in the environment, use this default: 5 | BOARD ?= native 6 | 7 | # This has to be the absolute path to the RIOT base directory: 8 | RIOTBASE ?= $(CURDIR)/../RIOT 9 | 10 | BOARD_INSUFFICIENT_MEMORY := airfy-beacon chronos msb-430 msb-430h nrf51dongle \ 11 | nrf6310 nucleo-f103 nucleo-f334 pca10000 pca10005 spark-core \ 12 | stm32f0discovery telosb weio wsn430-v1_3b wsn430-v1_4 \ 13 | yunjia-nrf51822 z1 nucleo-f072 14 | 15 | # Include packages that pull up and auto-init the link layer. 16 | # NOTE: 6LoWPAN will be included if IEEE802.15.4 devices are present 17 | USEMODULE += gnrc_netdev_default 18 | USEMODULE += auto_init_gnrc_netif 19 | # Specify the mandatory networking modules for IPv6 and UDP 20 | USEMODULE += gnrc_ipv6_router_default 21 | USEMODULE += gnrc_udp 22 | # Add a routing protocol 23 | USEMODULE += gnrc_rpl 24 | USEMODULE += auto_init_gnrc_rpl 25 | # This application dumps received packets to STDIO using the pktdump module 26 | USEMODULE += gnrc_pktdump 27 | # Additional networking modules that can be dropped if not needed 28 | USEMODULE += gnrc_icmpv6_echo 29 | # Add also the shell, some shell commands 30 | USEMODULE += shell 31 | USEMODULE += shell_commands 32 | USEMODULE += ps 33 | USEMODULE += netstats_l2 34 | USEMODULE += netstats_ipv6 35 | USEMODULE += netstats_rpl 36 | 37 | # Set a custom 802.15.4 channel if needed 38 | DEFAULT_CHANNEL ?= 26 39 | CFLAGS += -DDEFAULT_CHANNEL=$(DEFAULT_CHANNEL) 40 | 41 | CFLAGS += -DGNRC_RPL_LIFETIME_UNIT=1 -DGNRC_RPL_DEFAULT_LIFETIME=32 42 | CFLAGS += -DGNRC_RPL_REGULAR_DAO_INTERVAL=13 43 | CFLAGS += -DGNRC_RPL_DEFAULT_DIO_INTERVAL_DOUBLINGS=13 44 | 45 | # Comment this out to disable code in RIOT that does safety checking 46 | # which is not needed in a production environment but helps in the 47 | # development process: 48 | CFLAGS += -DDEVELHELP 49 | 50 | # Comment this out to join RPL DODAGs even if DIOs do not contain 51 | # DODAG Configuration Options (see the doc for more info) 52 | # CFLAGS += -DGNRC_RPL_DODAG_CONF_OPTIONAL_ON_JOIN 53 | 54 | # Change this to 0 show compiler invocation lines by default: 55 | QUIET ?= 1 56 | 57 | include $(RIOTBASE)/Makefile.include 58 | -------------------------------------------------------------------------------- /task-09/README.md: -------------------------------------------------------------------------------- 1 | [previous task](../task-08) 2 | 3 | # Task 9: RIOT and RPL 4 | 5 | This task will demonstrate basic routing functionalities in RIOT provided by the [RPL](https://tools.ietf.org/html/rfc6550) (IPv6 Routing Protocol for Low-Power and Lossy Networks) routing protocol and multihop communication. 6 | 7 | It uses an adapted version of the default [`gnrc_networking`](https://github.com/RIOT-OS/RIOT/tree/master/examples/gnrc_networking) example in the RIOT repository. 8 | 9 | ## Prerequisites 10 | 11 | * Compile the application and run on your `BOARD` 12 | * For this task you need at least three boards (you can form groups with your neighbors) 13 | * Each "group" should change to an individual RF channel. It can be changed by e.g. 14 | 15 | ``` 16 | ifconfig set chan 11 17 | 18 | ``` 19 | 20 | Use the `ifconfig` command to obtain the ``. 21 | 22 | * Check if this worked by looking at the output of `ifconfig` again. Also have a look at the preconfigured IPv6 addresses that all have a local scope. 23 | 24 | 25 | ## Task 9.1: Initialize RPL 26 | 27 | * First of all we need to initialize RPL in all nodes using `rpl init`: 28 | 29 | ``` 30 | rpl init 31 | ``` 32 | 33 | * In order to use RPL we have to choose **one** RPL root node and configure a global IPv6 address for it. This is simply done by adding the address to the network interface (``) via `ifconfig`: 34 | 35 | ``` 36 | ifconfig add 2001:db8::1 37 | ``` 38 | 39 | * To start the routing process and the generation of a RPL DODAG (Destination Oriented Directed Acyclic Graph), we need to start the root node with an Instance ID (here `1`) and a DODAG ID (here its global IPv6 address) 40 | 41 | ``` 42 | rpl root 1 2001:db8::1 43 | ``` 44 | 45 | ## Analyse the topology 46 | 47 | * On not-root nodes, look at the output of `ifconfig` again. You should see that a global unicast IPv6 address has been set automatically. 48 | 49 | * Typing `rpl` gives you some information about the nodes position in the DODAG. Check the local IPv6 address of the selected parent node. Look for value `R:` which describes the "rank" or more general, the position in the DODAG according to the metric. What is the increment for one hop? 50 | 51 | * RPL fills the FIB (Forwarding Information Base) table which is consulted when forwarding packets. Check the entries on the root node and see the relation between the destination and next hop addresses. 52 | 53 | 54 | ## Pinging "distant" nodes 55 | 56 | * Use the ping command to ping global address of a "distant" node. 57 | * Most likely, in this setup the root node will be the only intermediate hop. It should print some rough information about forwarding IPv6 packets 58 | * Additionally you can try to transmit UDP packets (explore the `udp` commandset) 59 | -------------------------------------------------------------------------------- /task-06/udp.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "net/sock/udp.h" 6 | #include "net/ipv6/addr.h" 7 | #include "thread.h" 8 | 9 | #define SERVER_MSG_QUEUE_SIZE (8) 10 | #define SERVER_BUFFER_SIZE (64) 11 | 12 | static bool server_running = false; 13 | static sock_udp_t sock; 14 | static char server_buffer[SERVER_BUFFER_SIZE]; 15 | static char server_stack[THREAD_STACKSIZE_DEFAULT]; 16 | static msg_t server_msg_queue[SERVER_MSG_QUEUE_SIZE]; 17 | 18 | void *_udp_server(void *args) 19 | { 20 | sock_udp_ep_t server = { .port = atoi(args), .family = AF_INET6 }; 21 | msg_init_queue(server_msg_queue, SERVER_MSG_QUEUE_SIZE); 22 | 23 | if(sock_udp_create(&sock, &server, NULL, 0) < 0) { 24 | return NULL; 25 | } 26 | 27 | server_running = true; 28 | printf("Success: started UDP server on port %u\n", server.port); 29 | 30 | while (1) { 31 | int res; 32 | 33 | if ((res = sock_udp_recv(&sock, server_buffer, 34 | sizeof(server_buffer) - 1, SOCK_NO_TIMEOUT, 35 | NULL)) < 0) { 36 | puts("Error while receiving"); 37 | } 38 | else if (res == 0) { 39 | puts("No data received"); 40 | } 41 | else { 42 | server_buffer[res] = '\0'; 43 | printf("Recvd: %s\n", server_buffer); 44 | } 45 | } 46 | 47 | return NULL; 48 | } 49 | 50 | int udp_send(int argc, char **argv) 51 | { 52 | int res; 53 | sock_udp_ep_t remote = { .family = AF_INET6 }; 54 | 55 | if (argc != 4) { 56 | puts("Usage: udp "); 57 | return -1; 58 | } 59 | 60 | if (ipv6_addr_from_str((ipv6_addr_t *)&remote.addr, argv[1]) == NULL) { 61 | puts("Error: unable to parse destination address"); 62 | return 1; 63 | } 64 | if (ipv6_addr_is_link_local((ipv6_addr_t *)&remote.addr)) { 65 | /* choose first interface when address is link local */ 66 | gnrc_netif_t *netif = gnrc_netif_iter(NULL); 67 | remote.netif = (uint16_t)netif->pid; 68 | } 69 | remote.port = atoi(argv[2]); 70 | if((res = sock_udp_send(NULL, argv[3], strlen(argv[3]), &remote)) < 0) { 71 | puts("could not send"); 72 | } 73 | else { 74 | printf("Success: send %u byte to %s\n", (unsigned) res, argv[1]); 75 | } 76 | return 0; 77 | } 78 | 79 | int udp_server(int argc, char **argv) 80 | { 81 | if (argc != 2) { 82 | puts("Usage: udps "); 83 | return -1; 84 | } 85 | 86 | if ((server_running == false) && 87 | thread_create(server_stack, sizeof(server_stack), THREAD_PRIORITY_MAIN - 1, 88 | THREAD_CREATE_STACKTEST, _udp_server, argv[1], "UDP Server") 89 | <= KERNEL_PID_UNDEF) { 90 | return -1; 91 | } 92 | 93 | return 0; 94 | } 95 | -------------------------------------------------------------------------------- /task-07/README.md: -------------------------------------------------------------------------------- 1 | [previous task](../task-06) 2 | 3 | # Task 7: The GNRC network stack 4 | 5 | This task is a little bit more advanced so don't be discouraged if things are 6 | a little bit harder. With the knowledge you gathered from the previous tasks 7 | you should be able to handle it. 8 | 9 | It uses the [example applications in the RIOT repository](https://github.com/RIOT-OS/RIOT/tree/master/examples). 10 | 11 | ## Task 7.1: Compile the `gnrc_minimal` application 12 | * Go to the [`gnrc_minimal` application](https://github.com/RIOT-OS/RIOT/tree/master/examples/gnrc_minimal) 13 | * Compile and run on `native` 14 | * Should print something like `My address is fe80::d403:24ff:fe89:2460` 15 | * Ping RIOT instance from Linux: 16 | 17 | ```sh 18 | ping %tapbr0 19 | ``` 20 | Note: on MAC use `bridge0` instead of `tapbr0`. 21 | 22 | ## Task 7.2: Extend `gnrc_minimal` application 23 | * Add the `gnrc_udp` module to the application's 24 | [Makefile](https://github.com/RIOT-OS/RIOT/blob/master/examples/gnrc_minimal/Makefile) 25 | * To be able to receive packets, a [message queue](http://doc.riot-os.org/group__net__gnrc.html) must be 26 | created using [msg_init_queue](https://doc.riot-os.org/group__core__msg.html#ga480e6f32c8ab18579b62a890f3fda2cd): 27 | 28 | ```C 29 | msg_t msg_queue[num]; 30 | msg_init_queue(msg_queue, num); 31 | ``` 32 | 33 | Note: `num` must be in powers of 2. 34 | 35 | * You can register for packets of a certain type and context (port 8888 in our 36 | case) using `gnrc_netreg_register()` from [`net/gnrc/netreg.h`](https://doc.riot-os.org/group__net__gnrc__netreg.html): 37 | * The current thread can be obtained with the `thread_getpid()` function from 38 | `thread.h` 39 | 40 | ```C 41 | gnrc_netreg_entry_t server = GNRC_NETREG_ENTRY_INIT_PID(8888, thread_getpid()); 42 | gnrc_netreg_register(GNRC_NETTYPE_UDP, &server); 43 | ``` 44 | 45 | * Packets can be received using the IPC receive function [msg_receive()](https://doc.riot-os.org/group__core__msg.html#gae3e05f08bd71d6f65dc727624c4d5f7a): 46 | 47 | ```C 48 | msg_t msg; 49 | msg_receive(&msg); 50 | ``` 51 | 52 | Remember to remove the packet after reception (otherwise the packet buffer 53 | will overflow)! 54 | 55 | ```C 56 | #include "net/gnrc/pktbuf.h" 57 | 58 | /* ... */ 59 | 60 | gnrc_pktsnip_t *pkt = (gnrc_pktsnip_t *)msg.content.ptr; 61 | gnrc_pktbuf_release(pkt); 62 | ``` 63 | 64 | 65 | 1. Extend `gnrc_minimal` as such that it counts received UDP packets on port 8888. 66 | 2. Use `netcat` on your host to test your application on native node. 67 | 68 | ## Task 7.3: Send your neighbor some messages again 69 | * Go to the [`gnrc_networking` application](https://github.com/RIOT-OS/RIOT/tree/master/examples/gnrc_networking) 70 | * Have a look in `udp.c` how packets are constructed and send 71 | * Compile, flash, and run on the board `BOARD=samr21-xpro make all flash term` 72 | * Type `help` 73 | * Start UDP server on port 8888 using `udp server 8888` 74 | * Get your IPv6 address using `ifconfig` 75 | * Send your neighbor some messages using `udp send` 76 | 77 | [Read the Doc](https://doc.riot-os.org/group__net__gnrc.html) 78 | 79 | [next task](../task-08) 80 | -------------------------------------------------------------------------------- /task-08/README.md: -------------------------------------------------------------------------------- 1 | [previous task](../task-07) 2 | # Task 8: CCN-Lite on RIOT 3 | 4 | This application demonstrates how to use the Content-Centric Networking stack 5 | from [CCN-Lite](http://www.ccn-lite.net/) on RIOT. In the current state you can 6 | use only one packet format, `ndn2013`, and only relay over the link-layer 7 | (Ethernet, IEEE~802.15.4 or what else is supported by your network device). 8 | 9 | *Please note that compiling this application will clone the CCN-Lite remote repository.* 10 | 11 | ## The shell commands 12 | 13 | RIOT provides three shell to interact with the CCN-Lite stack: 14 | * `ccnl_int` - generates and sends out an Interest. The command expects one 15 | mandatory and one optional parameter. The first parameter 16 | specifies the exact name (or a prefix) to request, the second 17 | parameter specifies the link-layer address of the relay to use. 18 | If the second parameter is omitted, the Interest will be 19 | broadcasted. You may call it like this: 20 | `ccnl_int /riot/peter/schmerzl b6:e5:94:26:ab:da` 21 | * `ccnl_cs` - dumps CS or generates and populates content. If the command is 22 | called without parameters, it will print all content items in 23 | the cache. Otherwise, the command expects two parameters. The 24 | first parameter specifies the name of the content to be created, 25 | the second parameter specifies the content itself. The second 26 | parameter may include spaces, e.g. you can call: 27 | `ccnl_cs /riot/peter/schmerzl Hello World! Hello RIOT!` 28 | * `ccnl_fib` - modifies the FIB or shows its current state. If the command is 29 | called without parameters, it will print the current state of 30 | the FIB. It can also be called with the action parameters `add` 31 | or `del` to add or delete an entry from the FIB, e.g. 32 | `ccnl_fib add /riot/peter/schmerzl ab:cd:ef:01:23:45:67:89` 33 | will add an entry for `/riot/peter/schmerzl` with 34 | `ab:cd:ef:01:23:45:67:89` as a next hop and 35 | `ccnl_fib del /riot/peter/schmerzl` 36 | will remove the entry for `/riot/peter/schmerzl` and 37 | `ccnl_fib del ab:cd:ef:01:23:45:67:89` 38 | will remove all entries with `ab:cd:ef:01:23:45:67:89` as a 39 | next hop. 40 | 41 | ## Task 8.1: Generate content and discover other content 42 | 43 | * You can use the shell commands above to create some content chunks and send 44 | out interests for a specific name 45 | * Create some content for /dagstuhl/m2m/ 46 | * Send an interest for /dagstuhl/m2m/ 47 | 48 | ## Task 8.2: Modify the default shell commands (advanced task) 49 | 50 | * Take a look at the default shell commands in `sys/shell/commands/sc_ccnl.c` 51 | * Create a new command to send an interest with a shorter timeout 52 | (see [https://doc.riot-os.org/group__pkg__ccnlite.html](https://doc.riot-os.org/group__pkg__ccnlite.html) 53 | * Use `ccnl_set_local_producer()` to create content on the fly 54 | 55 | [next task](../task-09) 56 | -------------------------------------------------------------------------------- /task-01/README.md: -------------------------------------------------------------------------------- 1 | # Task 1: Starting the RIOT 2 | 3 | ## Task 1.1: Run your first application as Linux process 4 | 5 | 1. Compile and run on `native` platform: 6 | ```sh 7 | make all term 8 | ``` 9 | 10 | 2. Run `help` to see a list of all available commands 11 | ``` 12 | > help 13 | help 14 | Command Description 15 | --------------------------------------- 16 | reboot Reboot the node 17 | version Prints current RIOT_VERSION 18 | pm interact with layered PM subsystem 19 | ps Prints information about running threads. 20 | ``` 21 | 22 | 3. Look at the output of `ps` 23 | ``` 24 | > ps 25 | ps 26 | pid | name | state Q | pri | stack ( used) ( free) | base addr | current 27 | - | isr_stack | - - | - | 8192 ( -1) ( 8193) | 0x565b8380 | 0x565b8380 28 | 1 | idle | pending Q | 15 | 8192 ( 436) ( 7756) | 0x565b60a0 | 0x565b7f00 29 | 2 | main | running Q | 7 | 12288 ( 3196) ( 9092) | 0x565b30a0 | 0x565b5f00 30 | | SUM | | | 28672 ( 3632) (25040) 31 | ``` 32 | 33 | 4. Add a print statement to the `main()` function to output the name of the board. 34 | ``` 35 | printf("This application runs on %s\n", RIOT_BOARD); 36 | ``` 37 | 38 | Recompile and run again: 39 | ```sh 40 | make all term 41 | ``` 42 | 43 | ## Task 1.2: Run your first application on real hardware 44 | 1. Get to know your hardware 45 | 46 | *Atmel SAM R21 Xplained Pro* 47 | 48 | ![SAMR21-XPRO](../SAM-R21.jpg) 49 | 50 | MCU | ATSAMR21G18A 51 | -----------------------|------------------------------------ 52 | Family | ARM Cortex-M0+ 53 | Vendor | Atmel 54 | RAM/ROM | 32Kb / 256Kb 55 | Frequency | up to 48MHz 56 | Timers | 6 (1x 16-bit, 2x 24-bit, 3x 32-bit) 57 | ADCs | 1x 12-bit (8 channels) 58 | UARTs / SPIs / I2Cs | max 5 (shared) 59 | Vcc | 1.8V - 3.6V 60 | Radio | IEEE802.15.4 @ 2,4GHz 61 | Sensors | none 62 | 63 | *Phytec phyNODE KW22* 64 | 65 | ![phyNODE](../phytec.png) 66 | 67 | MCU | MKW22D512 68 | -----------------------|------------------------------------ 69 | Family | ARM Cortex-M4 70 | Vendor | Kinetis 71 | RAM/ROM | 65Kb / 512Kb 72 | Frequency | up to 50MHz 73 | Timers | up to 12 (16-bit, 24-bit, 32-bit) 74 | ADCs | 1x 16-bit (8 channels) 75 | UARTs / SPIs / I2Cs | 3 / 1 / 2 76 | Vcc | 1.8V - 3.6V 77 | Radio | IEEE802.15.4 @ 2,4GHZ 78 | Sensors | diverse 79 | 80 | 2. To compile an application for a specific board, we can make use of the `BOARD` environment 81 | variable. 82 | 83 | In case you are running on an Atmel board, type: 84 | ```sh 85 | BOARD=samr21-xpro make all flash term 86 | ``` 87 | 88 | For the (yellow) phyNODE use; 89 | ```sh 90 | BOARD=pba-d-01-kw2x make all flash term 91 | ``` 92 | 93 | This command will compile the application, burn the image onto the board and open a 94 | connection to the RIOT shell. 95 | 96 | 3. Verify the output of `RIOT_BOARD` matches your hardware. 97 | 98 | [next task](../task-02) 99 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tutorials for RIOT 2 | 3 | ## Preparations 4 | 5 | For links go to [https://github.com/RIOT-OS/Tutorials](https://github.com/RIOT-OS/Tutorials) 6 | 7 | **Quick Setup using a Virtual Machine (recommended for this Tutorial)** 8 | 9 | * Install and set up [git](https://help.github.com/articles/set-up-git/) 10 | * Install latest [VirtualBox](https://www.virtualbox.org/wiki/Downloads) & [VirtualBox Extension Pack](https://www.virtualbox.org/wiki/Downloads) for **your system** 11 | * Install [Vagrant](https://www.vagrantup.com/downloads.html) 12 | * Linux, OSX: 13 | ```Shell 14 | git clone --recursive https://github.com/RIOT-OS/Tutorials 15 | cd Tutorials 16 | ``` 17 | * Windows: 18 | * set 19 | ```Shell 20 | git config --global core.autocrlf input 21 | ``` 22 | before cloning 23 | * clone the `Tutorials` and the `RIOT` submodule as follows: 24 | ```Shell 25 | git clone https://github.com/RIOT-OS/Tutorials 26 | cd Tutorials 27 | git submodule update --init --recursive 28 | ``` 29 | * In case a virtual machine is disseminated locally, adapt the path for the vagrant box `vagrant box add RIOT/ubuntu1804 ` 30 | * Run `vagrant up` and `vagrant ssh` afterwards. See the [Vagrant RIOT Setup](https://github.com/RIOT-OS/RIOT/blob/master/dist/tools/vagrant/README.md) for a more general explanation. 31 | 32 | **Regular Setup without using a VM (recommended for RIOT developement)** 33 | 34 | * Install and set up [git](https://help.github.com/articles/set-up-git/) 35 | * Install the build-essential packet (make, gcc etc.). This varies based on the operating system in use. 36 | * Install [Native dependencies](https://github.com/RIOT-OS/RIOT/wiki/Family:-native#dependencies) 37 | * Install [OpenOCD](https://github.com/RIOT-OS/RIOT/wiki/OpenOCD) 38 | * Install [GCC Arm Embedded Toolchain](https://launchpad.net/gcc-arm-embedded) 39 | * On OS X: install [Tuntap for OS X](http://tuntaposx.sourceforge.net/) 40 | * [additional tweaks](https://github.com/RIOT-OS/RIOT/wiki/Board:-Samr21-xpro) necessary to work with the targeted hardware (ATSAMR21) 41 | * Install `netcat` with IPv6 support (if necessary) 42 | 43 | ```bash 44 | sudo apt-get install netcat-openbsd 45 | ``` 46 | 47 | * `git clone --recursive https://github.com/RIOT-OS/Tutorials` 48 | * Go to the Tutorials directory: `cd Tutorials` 49 | 50 | ## Tasks 51 | * [Task 1: Starting the RIOT](task-01/) 52 | * [Task 2: Custom shell handlers](task-02/) 53 | * [Task 3: Multithreading](task-03/) 54 | * [Task 4: Timers](task-04/) 55 | * [Task 5: Using network devices](task-05/) 56 | * [Task 6: Sending and receiving UDP packets](task-06/) 57 | * [Task 7: The GNRC network stack](task-07/) 58 | * [Task 8: CCN-Lite on RIOT](task-08/) 59 | * [Task 9: RIOT and RPL](task-09/) 60 | 61 | ## Troubleshooting 62 | 63 | ### If you get the following error after running `vagrant up` 64 | 65 | > The guest machine entered an invalid state while waiting for it to boot. Valid states are 'starting, running'. The machine is in the 'poweroff' state. 66 | 67 | Make sure you have the [Extension Pack](https://www.virtualbox.org/wiki/Downloads) installed. 68 | 69 | ### If you cannot flash a connected board (`/dev/ttyXXXX` does not exist) 70 | 71 | Make sure your user is a member of the usergroup `vboxusers`. On Linux you can add the current user with 72 | 73 | `usermod -a -G vboxusers $USER`. 74 | 75 | You can check the groups of your user with 76 | 77 | `groups`. 78 | 79 | Note that you need to log out once to reload a Linux user's group assignments 80 | 81 | ## License 82 | This work and all its related code and documents are licensed under a 83 | [Creative Commons Attribution-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/) 84 | -------------------------------------------------------------------------------- /task-06/README.md: -------------------------------------------------------------------------------- 1 | [previous task](../task-05) 2 | 3 | # 6. UDP Client / Server 4 | 5 | The transport layer (UDP, TCP, etc) is accessed through [`sock`](https://doc.riot-os.org/group__net__sock.html) driver API 6 | 7 | ![Networking overview](../overview-net.png) 8 | 9 | Look at the new modules in the [`Makefile`](Makefile) 10 | ``` 11 | USEMODULE += gnrc_ipv6_default 12 | USEMODULE += gnrc_icmpv6_echo 13 | USEMODULE += gnrc_sock_udp 14 | ``` 15 | 16 | [`udp.c`](udp.c) utilizes `sock_udp_send()` and `sock_udp_recv()` to exchange UDP packets 17 | 18 | ## Task 6.1: Use UDP for messaging 19 | 1. Compile and run on two `native` instances 20 | 2. We have two new shell commands: `udps` to start a server and `udp` to send a message. 21 | ``` 22 | > help 23 | help 24 | Command Description 25 | --------------------------------------- 26 | udp send udp packets 27 | udps start udp server 28 | reboot Reboot the node 29 | version Prints current RIOT_VERSION 30 | pm interact with layered PM subsystem 31 | ps Prints information about running threads. 32 | ping Ping via ICMPv6 33 | random_init initializes the PRNG 34 | random_get returns 32 bit of pseudo randomness 35 | nib Configure neighbor information base 36 | ifconfig Configure network interfaces 37 | > 38 | ``` 39 | 40 | 3. Start a UDP server on port 8888 with `udps 8888`. 41 | Look at the output of `ps` 42 | ``` 43 | > ps 44 | ps 45 | pid | name | state Q | pri | stack ( used) ( free) | base addr | current 46 | - | isr_stack | - - | - | 8192 ( -1) ( 8193) | 0x5664a540 | 0x5664a540 47 | 1 | idle | pending Q | 15 | 8192 ( 436) ( 7756) | 0x56648260 | 0x5664a0c0 48 | 2 | main | running Q | 7 | 12288 ( 3196) ( 9092) | 0x56645260 | 0x566480c0 49 | 3 | ipv6 | bl rx _ | 4 | 8192 ( 1616) ( 6576) | 0x56654540 | 0x566563a0 50 | 4 | udp | bl rx _ | 5 | 8192 ( 1008) ( 7184) | 0x566524c0 | 0x56654320 51 | 5 | gnrc_netdev_tap | bl rx _ | 2 | 8192 ( 2460) ( 5732) | 0x566568e0 | 0x56658740 52 | 6 | UDP Server | bl mbox _ | 6 | 8192 ( 2452) ( 5740) | 0x56643220 | 0x56645080 53 | | SUM | | | 61440 (11168) (50272) 54 | > 55 | ``` 56 | The new thread for the UDP server has the PID 6 in this example. 57 | 58 | 4. Get your IPv6 address using `ifconfig` 59 | ``` 60 | > ifconfig 61 | ifconfig 62 | Iface 5 HWaddr: 36:1D:81:86:7D:21 63 | L2-PDU:1500 MTU:1500 HL:64 Source address length: 6 64 | Link type: wired 65 | inet6 addr: fe80::341d:81ff:fe86:7d21 scope: link VAL 66 | inet6 group: ff02::1 67 | inet6 group: ff02::1:ff86:7d21 68 | ``` 69 | 70 | 5. From the second instance, send a udp packet with the `udp` command. 71 | ``` 72 | > udp fe80::341d:81ff:fe86:7d21 8888 hello 73 | udp fe80::341d:81ff:fe86:7d21 8888 hello 74 | Success: send 5 byte to fe80::341d:81ff:fe86:7d21 75 | ``` 76 | 77 | ## Task 6.2: Communicate with Linux 78 | 1. Compile and run on two `native` instances 79 | 2. Start a UDP server on port 8888 with `udps 8888`. 80 | 3. Send a packet to RIOT from Linux using `netcat` 81 | ```sh 82 | echo "hello" | nc -6u %tapbr0 8888 83 | ``` 84 | Note: on MAC use `bridge0` instead of `tapbr0`. 85 | 86 | 4. Start a UDP server on the host machine with `netcat`. 87 | ``` 88 | nc -6lu 8888 89 | ``` 90 | And in RIOT ... 91 | ``` 92 | udp 8888 hello 93 | ``` 94 | [Read the Doc](https://doc.riot-os.org/group__net__sock.html) 95 | 96 | ## Task 6.3 -- Exchange UDP packets with your neighbors 97 | * Compile, flash and run on the board `BOARD=samr21-xpro make all flash term` 98 | * Send and receive UDP messages to and from your neighbors using `udp` and `udps` 99 | 100 | [next task](../task-07) 101 | -------------------------------------------------------------------------------- /task-09/main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-18 Freie Universität Berlin 3 | * Copyright (C) 2016 Hochschule für Angewandte Wissenschaften Hamburg 4 | * 5 | * This file is subject to the terms and conditions of the GNU Lesser 6 | * General Public License v2.1. See the file LICENSE in the top level 7 | * directory for more details. 8 | */ 9 | 10 | /** 11 | * @ingroup examples 12 | * @{ 13 | * 14 | * @file 15 | * @brief Example application for demonstrating the RIOT network stack 16 | * 17 | * @author Hauke Petersen 18 | * @author Martine Lenders 19 | * @author Peter Kietzmann 20 | * 21 | * @} 22 | */ 23 | 24 | #include 25 | 26 | #include "shell.h" 27 | #include "msg.h" 28 | #include "thread.h" 29 | 30 | #include "net/gnrc.h" 31 | #include "net/gnrc/netif.h" 32 | #include "net/gnrc/ipv6.h" 33 | 34 | #define MAIN_QUEUE_SIZE (8) 35 | static msg_t _main_msg_queue[MAIN_QUEUE_SIZE]; 36 | 37 | extern int udp_cmd(int argc, char **argv); 38 | 39 | static const shell_command_t shell_commands[] = { 40 | { "udp", "send data over UDP and listen on UDP ports", udp_cmd }, 41 | { NULL, NULL, NULL } 42 | }; 43 | 44 | #ifdef MODULE_GNRC_SIXLOWPAN 45 | static char _stack[THREAD_STACKSIZE_MAIN]; 46 | 47 | static void *_ipv6_fwd_eventloop(void *arg) 48 | { 49 | (void)arg; 50 | 51 | msg_t msg, msg_q[8]; 52 | gnrc_netreg_entry_t me_reg = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL, 53 | thread_getpid()); 54 | 55 | msg_init_queue(msg_q, 8); 56 | 57 | gnrc_netreg_register(GNRC_NETTYPE_SIXLOWPAN, &me_reg); 58 | 59 | while(1) { 60 | msg_receive(&msg); 61 | gnrc_pktsnip_t *pkt = msg.content.ptr; 62 | if(msg.type == GNRC_NETAPI_MSG_TYPE_SND) { 63 | gnrc_pktsnip_t *ipv6 = gnrc_pktsnip_search_type(pkt, GNRC_NETTYPE_IPV6); 64 | ipv6_addr_t addrs[CONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF]; 65 | int res; 66 | ipv6 = ipv6->data; 67 | 68 | ipv6_hdr_t *ipv6_hdr =(ipv6_hdr_t *)ipv6; 69 | 70 | /* get the first IPv6 interface and prints its address */ 71 | gnrc_netif_t *netif = gnrc_netif_iter(NULL); 72 | res = gnrc_netif_ipv6_addrs_get(netif, addrs, sizeof(addrs)); 73 | if (res < 0) { 74 | /* an error occurred, just continue */ 75 | continue; 76 | } 77 | for (unsigned i = 0; i < (res / sizeof(ipv6_addr_t)); i++) { 78 | if ((!ipv6_addr_is_link_local(&addrs[i])) && 79 | (!ipv6_addr_is_link_local(&ipv6_hdr->src)) && 80 | (!ipv6_addr_is_link_local(&ipv6_hdr->dst)) && 81 | (!ipv6_addr_equal(&addrs[i], &(ipv6_hdr->src)))) { 82 | char addr_str[IPV6_ADDR_MAX_STR_LEN]; 83 | printf("IPv6 ROUTER: forward from src = %s ", 84 | ipv6_addr_to_str(addr_str, &(ipv6_hdr->src), 85 | sizeof(addr_str)) ); 86 | printf("to dst = %s\n", 87 | ipv6_addr_to_str(addr_str, &(ipv6_hdr->dst), 88 | sizeof(addr_str))); 89 | } 90 | } 91 | } 92 | gnrc_pktbuf_release(pkt); 93 | } 94 | /* never reached */ 95 | return NULL; 96 | } 97 | #endif 98 | 99 | int main(void) 100 | { 101 | /* we need a message queue for the thread running the shell in order to 102 | * receive potentially fast incoming networking packets */ 103 | msg_init_queue(_main_msg_queue, MAIN_QUEUE_SIZE); 104 | puts("RIOT network stack example application"); 105 | 106 | #ifdef MODULE_GNRC_SIXLOWPAN 107 | thread_create(_stack, sizeof(_stack), (THREAD_PRIORITY_MAIN - 4), 108 | THREAD_CREATE_STACKTEST, _ipv6_fwd_eventloop, NULL, "ipv6_fwd"); 109 | #endif 110 | /* start shell */ 111 | puts("All up, running the shell now"); 112 | char line_buf[SHELL_DEFAULT_BUFSIZE]; 113 | shell_run(shell_commands, line_buf, SHELL_DEFAULT_BUFSIZE); 114 | 115 | /* should be never reached */ 116 | return 0; 117 | } 118 | -------------------------------------------------------------------------------- /task-09/udp.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015-17 Freie Universität Berlin 3 | * 4 | * This file is subject to the terms and conditions of the GNU Lesser 5 | * General Public License v2.1. See the file LICENSE in the top level 6 | * directory for more details. 7 | */ 8 | 9 | /** 10 | * @ingroup examples 11 | * @{ 12 | * 13 | * @file 14 | * @brief Demonstrating the sending and receiving of UDP data 15 | * 16 | * @author Hauke Petersen 17 | * @author Martine Lenders 18 | * 19 | * @} 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | #include "net/gnrc.h" 26 | #include "net/gnrc/ipv6.h" 27 | #include "net/gnrc/netif.h" 28 | #include "net/gnrc/netif/hdr.h" 29 | #include "net/gnrc/udp.h" 30 | #include "net/gnrc/pktdump.h" 31 | #include "timex.h" 32 | #include "utlist.h" 33 | #include "xtimer.h" 34 | 35 | static gnrc_netreg_entry_t server = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL, 36 | KERNEL_PID_UNDEF); 37 | 38 | 39 | static void send(char *addr_str, char *port_str, char *data, unsigned int num, 40 | unsigned int delay) 41 | { 42 | char *iface; 43 | gnrc_netif_t *netif = NULL; 44 | uint16_t port; 45 | ipv6_addr_t addr; 46 | 47 | /* get interface, if available */ 48 | iface = ipv6_addr_split_iface(addr_str); 49 | if ((!iface) && (gnrc_netif_numof() == 1)) { 50 | netif = gnrc_netif_iter(NULL); 51 | } 52 | else if (iface) { 53 | netif = gnrc_netif_get_by_pid(atoi(iface)); 54 | } 55 | /* parse destination address */ 56 | if (ipv6_addr_from_str(&addr, addr_str) == NULL) { 57 | puts("Error: unable to parse destination address"); 58 | return; 59 | } 60 | /* parse port */ 61 | port = atoi(port_str); 62 | if (port == 0) { 63 | puts("Error: unable to parse destination port"); 64 | return; 65 | } 66 | 67 | for (unsigned int i = 0; i < num; i++) { 68 | gnrc_pktsnip_t *payload, *udp, *ip; 69 | unsigned payload_size; 70 | /* allocate payload */ 71 | payload = gnrc_pktbuf_add(NULL, data, strlen(data), GNRC_NETTYPE_UNDEF); 72 | if (payload == NULL) { 73 | puts("Error: unable to copy data to packet buffer"); 74 | return; 75 | } 76 | /* store size for output */ 77 | payload_size = (unsigned)payload->size; 78 | /* allocate UDP header, set source port := destination port */ 79 | udp = gnrc_udp_hdr_build(payload, port, port); 80 | if (udp == NULL) { 81 | puts("Error: unable to allocate UDP header"); 82 | gnrc_pktbuf_release(payload); 83 | return; 84 | } 85 | /* allocate IPv6 header */ 86 | ip = gnrc_ipv6_hdr_build(udp, NULL, &addr); 87 | if (ip == NULL) { 88 | puts("Error: unable to allocate IPv6 header"); 89 | gnrc_pktbuf_release(udp); 90 | return; 91 | } 92 | /* add netif header, if interface was given */ 93 | if (netif) { 94 | gnrc_pktsnip_t *netif_hdr = gnrc_netif_hdr_build(NULL, 0, NULL, 0); 95 | 96 | ((gnrc_netif_hdr_t *)netif_hdr->data)->if_pid = netif->pid; 97 | LL_PREPEND(ip, netif_hdr); 98 | } 99 | /* send packet */ 100 | if (!gnrc_netapi_dispatch_send(GNRC_NETTYPE_UDP, GNRC_NETREG_DEMUX_CTX_ALL, ip)) { 101 | puts("Error: unable to locate UDP thread"); 102 | gnrc_pktbuf_release(ip); 103 | return; 104 | } 105 | /* access to `payload` was implicitly given up with the send operation above 106 | * => use temporary variable for output */ 107 | printf("Success: sent %u byte(s) to [%s]:%u\n", payload_size, addr_str, 108 | port); 109 | xtimer_usleep(delay); 110 | } 111 | } 112 | 113 | static void start_server(char *port_str) 114 | { 115 | uint16_t port; 116 | 117 | /* check if server is already running */ 118 | if (server.target.pid != KERNEL_PID_UNDEF) { 119 | printf("Error: server already running on port %" PRIu32 "\n", 120 | server.demux_ctx); 121 | return; 122 | } 123 | /* parse port */ 124 | port = atoi(port_str); 125 | if (port == 0) { 126 | puts("Error: invalid port specified"); 127 | return; 128 | } 129 | /* start server (which means registering pktdump for the chosen port) */ 130 | server.target.pid = gnrc_pktdump_pid; 131 | server.demux_ctx = (uint32_t)port; 132 | gnrc_netreg_register(GNRC_NETTYPE_UDP, &server); 133 | printf("Success: started UDP server on port %" PRIu16 "\n", port); 134 | } 135 | 136 | static void stop_server(void) 137 | { 138 | /* check if server is running at all */ 139 | if (server.target.pid == KERNEL_PID_UNDEF) { 140 | printf("Error: server was not running\n"); 141 | return; 142 | } 143 | /* stop server */ 144 | gnrc_netreg_unregister(GNRC_NETTYPE_UDP, &server); 145 | server.target.pid = KERNEL_PID_UNDEF; 146 | puts("Success: stopped UDP server"); 147 | } 148 | 149 | int udp_cmd(int argc, char **argv) 150 | { 151 | if (argc < 2) { 152 | printf("usage: %s [send|server]\n", argv[0]); 153 | return 1; 154 | } 155 | 156 | if (strcmp(argv[1], "send") == 0) { 157 | uint32_t num = 1; 158 | uint32_t delay = 1000000; 159 | if (argc < 5) { 160 | printf("usage: %s send [ []]\n", 161 | argv[0]); 162 | return 1; 163 | } 164 | if (argc > 5) { 165 | num = atoi(argv[5]); 166 | } 167 | if (argc > 6) { 168 | delay = atoi(argv[6]); 169 | } 170 | send(argv[2], argv[3], argv[4], num, delay); 171 | } 172 | else if (strcmp(argv[1], "server") == 0) { 173 | if (argc < 3) { 174 | printf("usage: %s server [start|stop]\n", argv[0]); 175 | return 1; 176 | } 177 | if (strcmp(argv[2], "start") == 0) { 178 | if (argc < 4) { 179 | printf("usage %s server start \n", argv[0]); 180 | return 1; 181 | } 182 | start_server(argv[3]); 183 | } 184 | else if (strcmp(argv[2], "stop") == 0) { 185 | stop_server(); 186 | } 187 | else { 188 | puts("error: invalid command"); 189 | } 190 | } 191 | else { 192 | puts("error: invalid command"); 193 | } 194 | return 0; 195 | } 196 | -------------------------------------------------------------------------------- /slides/pictures/overview-net.svg: -------------------------------------------------------------------------------- 1 | 2 | 8 | RIOT's Networking Architecture 9 | 10 | 11 | 12 | image/svg+xml 13 | 14 | RIOT's Networking Architecture 15 | 16 | 17 | 18 | Martine Lenders 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 132 | 133 | 134 | 136 | 137 | 138 | 139 | 140 | 142 | Application / Library 144 | 145 | 146 | 147 | sock 149 | 150 | 151 | 153 | Network stack 155 | 156 | 157 | 159 | Hardware 161 | 162 | 163 | netdev 165 | 167 | Driver 169 | 170 | 171 | 172 | netdev 174 | 176 | Driver 178 | 179 | 180 | 181 | netdev 183 | 185 | Driver 187 | 188 | 189 | 190 | 191 | -------------------------------------------------------------------------------- /slides/pictures/overview-net-sock.svg: -------------------------------------------------------------------------------- 1 | 2 | 8 | RIOT's Networking Architecture 9 | 10 | 11 | 12 | image/svg+xml 13 | 14 | RIOT's Networking Architecture 15 | 16 | 17 | 18 | Martine Lenders 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 139 | 140 | 141 | 143 | 144 | 145 | 146 | 147 | 149 | Application / Library 151 | 152 | 153 | 154 | sock 156 | 157 | 158 | 160 | Network stack 162 | 163 | 164 | 166 | Hardware 168 | 169 | 170 | netdev 172 | 174 | Driver 176 | 177 | 178 | 179 | netdev 181 | 183 | Driver 185 | 186 | 187 | 188 | netdev 190 | 192 | Driver 194 | 195 | 196 | 197 | 198 | -------------------------------------------------------------------------------- /slides/pictures/overview-net-netdev.svg: -------------------------------------------------------------------------------- 1 | 2 | 8 | RIOT's Networking Architecture 9 | 10 | 11 | 12 | image/svg+xml 13 | 14 | RIOT's Networking Architecture 15 | 16 | 17 | 18 | Martine Lenders 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 139 | 140 | 141 | 143 | 144 | 145 | 146 | 147 | 149 | Application / Library 151 | 152 | 153 | 154 | sock 156 | 157 | 158 | 160 | Network stack 162 | 163 | 164 | 166 | Hardware 168 | 169 | 170 | netdev 172 | 174 | Driver 176 | 177 | 178 | 179 | netdev 181 | 183 | Driver 185 | 186 | 187 | 188 | netdev 190 | 192 | Driver 194 | 195 | 196 | 197 | 198 | -------------------------------------------------------------------------------- /slides/pictures/gnrc_minimal_eth_dep.svg: -------------------------------------------------------------------------------- 1 | 2 | 9 | gnrc_minimal on native 10 | 11 | 12 | 13 | image/svg+xml 14 | 15 | gnrc_minimal on native 16 | 17 | 18 | 19 | Martine Lenders 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 211 | 212 | 213 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 230 | 232 | 234 | 236 | 237 | 239 | 240 | gnrc_ipv6 242 | 243 | NDP[host] 245 | 246 | 247 | 248 | Hardware 250 | 251 | 252 | 253 | netapi 255 | 256 | 257 | 259 | gnrc_netif 261 | 262 | gnrc_netif_ethernet 264 | 265 | 266 | netdev 268 | 270 | netdev_tap 272 | 273 | 274 | 275 | USEMODULE += gnrc_ipv6_default 276 | USEMODULE += auto_init_gnrc_netif 277 | USEMODULE += gnrc_netdev_default 278 | 279 | 280 | 281 | -------------------------------------------------------------------------------- /slides/pictures/gnrc_ccn_lite_relay.svg: -------------------------------------------------------------------------------- 1 | 2 | 9 | ccn-lite on samr21-xpro 10 | 11 | 12 | 13 | image/svg+xml 14 | 15 | ccn-lite on samr21-xpro 16 | 17 | 18 | 19 | Martine Lenders 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 205 | 206 | 207 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 222 | Application / Library 224 | 225 | 226 | 228 | 230 | 232 | 234 | 235 | 236 | netapi 238 | 239 | 240 | 242 | ccn_lite 244 | 245 | 246 | 247 | Hardware 249 | 250 | 251 | 252 | netapi 254 | 255 | 256 | 258 | gnrc_netif 260 | 261 | gnrc_netif_ieee802154 263 | 264 | 265 | netdev 267 | 269 | at86rf2xx 271 | 272 | 273 | 274 | USEPKG += ccn-lite 275 | USEMODULE += auto_init_gnrc_netif 276 | USEMODULE += gnrc_netdev_default 277 | 278 | 279 | 280 | -------------------------------------------------------------------------------- /slides/pictures/gnrc_minimal_eth.svg: -------------------------------------------------------------------------------- 1 | 2 | 9 | gnrc_minimal on native 10 | 11 | 12 | 13 | image/svg+xml 14 | 15 | gnrc_minimal on native 16 | 17 | 18 | 19 | Martine Lenders 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 211 | 212 | 213 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 230 | 232 | 234 | 236 | 237 | 239 | 240 | gnrc_ipv6 242 | 243 | NDP[host] 245 | 246 | 247 | 248 | Hardware 250 | 251 | 252 | 253 | netapi 255 | 256 | 257 | 259 | gnrc_netif 261 | 262 | gnrc_netif_ethernet 264 | 265 | 266 | netdev 268 | 270 | netdev_tap 272 | 273 | 274 | 275 | USEMODULE += gnrc_ipv6 276 | USEMODULE += gnrc_ipv6_nib 277 | USEMODULE += auto_init_gnrc_netif 278 | USEMODULE += gnrc_netdev_default 279 | 280 | 281 | 282 | -------------------------------------------------------------------------------- /slides/pictures/lwip_sock.svg: -------------------------------------------------------------------------------- 1 | 2 | 9 | lwip_networking on samr21-xpro 10 | 11 | 12 | 13 | image/svg+xml 14 | 15 | lwip_networking on samr21-xpro 16 | 17 | 18 | 19 | Martine Lenders 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 211 | 212 | 213 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 228 | Application / Library 230 | 231 | 232 | 234 | 236 | 237 | 239 | lwip_sock 241 | 242 | 243 | 244 | sock 246 | 247 | 248 | 250 | lwIP 252 | 253 | 254 | Hardware 256 | 257 | 258 | 260 | lwip_netdev 262 | 263 | netdev 265 | 267 | at86rf2xx 269 | 270 | 271 | 272 | USEMODULE += lwip_sock_tcp 273 | USEMODULE += lwip_sock_udp 274 | USEMODULE += lwip_sock_ip 275 | USEMODULE += lwip_tcp 276 | USEMODULE += lwip_udp 277 | USEMODULE += lwip_ipv6 278 | USEMODULE += lwip_ipv6_autoconfig 279 | USEMODULE += lwip_ipv6_mld 280 | USEMODULE += lwip_sixlowpan 281 | USEMODULE += lwip_netdev 282 | USEMODULE += at86rf233* 283 | 284 | 285 | 286 | -------------------------------------------------------------------------------- /slides/pictures/gnrc_minimal_ieee802154_dep.svg: -------------------------------------------------------------------------------- 1 | 2 | 9 | RIOT's GNRC Network Stack with UDP and sock 10 | 11 | 12 | 13 | image/svg+xml 14 | 15 | RIOT's GNRC Network Stack with UDP and sock 16 | 17 | 18 | 19 | Martine Lenders 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 211 | 212 | 213 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 230 | 232 | 234 | 236 | 238 | 239 | 241 | 242 | gnrc_ipv6 244 | 245 | 6Lo-ND[6LN] 247 | 248 | 249 | 250 | Hardware 252 | 253 | 254 | 255 | netapi 257 | 258 | 259 | 261 | gnrc_sixlowpan 263 | 264 | 265 | 266 | 267 | netapi 269 | 270 | 271 | 273 | gnrc_netif 275 | 276 | gnrc_netif_ieee802154 278 | 279 | 280 | netdev 282 | 284 | at86rf2xx 286 | 287 | 288 | 289 | USEMODULE += gnrc_ipv6_default 290 | USEMODULE += auto_init_gnrc_netif 291 | USEMODULE += gnrc_netdev_default 292 | 293 | 294 | 295 | -------------------------------------------------------------------------------- /slides/pictures/netapi-lego.svg: -------------------------------------------------------------------------------- 1 | 2 | 9 | netapi as LEGO bricks 10 | 11 | 12 | 13 | image/svg+xml 14 | 15 | netapi as LEGO bricks 16 | 17 | 18 | 19 | Martine Lenders 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | netapi 223 | 224 | UDP 225 | 226 | IPv6 227 | 228 | 6LoWPAN 229 | 230 | MAC + driver 231 | 232 | 233 | 234 | -------------------------------------------------------------------------------- /slides/pictures/gnrc_minimal_ieee802154.svg: -------------------------------------------------------------------------------- 1 | 2 | 9 | RIOT's GNRC Network Stack with UDP and sock 10 | 11 | 12 | 13 | image/svg+xml 14 | 15 | RIOT's GNRC Network Stack with UDP and sock 16 | 17 | 18 | 19 | Martine Lenders 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 211 | 212 | 213 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 230 | 232 | 234 | 236 | 238 | 239 | 241 | 242 | gnrc_ipv6 244 | 245 | 6Lo-ND[6LN] 247 | 248 | 249 | 250 | Hardware 252 | 253 | 254 | 255 | netapi 257 | 258 | 259 | 261 | gnrc_sixlowpan 263 | 264 | 265 | 266 | 267 | netapi 269 | 270 | 271 | 273 | gnrc_netif 275 | 276 | gnrc_netif_ieee802154 278 | 279 | 280 | netdev 282 | 284 | at86rf2xx 286 | 287 | 288 | 289 | USEMODULE += gnrc_ipv6 290 | USEMODULE += gnrc_ipv6_nib_6ln 291 | USEMODULE += gnrc_sixlowpan 292 | USEMODULE += gnrc_sixlowpan_frag 293 | USEMODULE += gnrc_sixlowpan_iphc 294 | USEMODULE += auto_init_gnrc_netif 295 | USEMODULE += gnrc_netdev_default 296 | 297 | 298 | 299 | -------------------------------------------------------------------------------- /slides/pictures/gnrc_networking_eth_dep.svg: -------------------------------------------------------------------------------- 1 | 2 | 9 | gnrc_networking on native 10 | 11 | 12 | 13 | image/svg+xml 14 | 15 | gnrc_networking on native 16 | 17 | 18 | 19 | Martine Lenders 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 211 | 212 | 213 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 230 | Application / Library 232 | 233 | 234 | 236 | 238 | 240 | 242 | 244 | 245 | 246 | netapi 248 | 249 | 250 | 251 | netapi 253 | 254 | 255 | 257 | gnrc_udp 259 | 260 | 261 | 262 | 263 | netapi 265 | 266 | 267 | 269 | 270 | gnrc_ipv6 272 | 273 | NDP[router] 275 | 276 | 277 | 278 | Hardware 280 | 281 | 282 | 283 | netapi 285 | 286 | 287 | 289 | gnrc_netdev 291 | 292 | gnrc_netdev_eth 294 | 295 | 296 | netdev 298 | 300 | netdev_tap 302 | 303 | 304 | 305 | USEMODULE += shell_commands 306 | USEMODULE += gnrc_udp 307 | USEMODULE += gnrc_ipv6_router_default 308 | USEMODULE += auto_init_gnrc_netif 309 | USEMODULE += gnrc_netdev_default 310 | 311 | 312 | 313 | -------------------------------------------------------------------------------- /slides/pictures/gnrc_networking_eth.svg: -------------------------------------------------------------------------------- 1 | 2 | 9 | gnrc_networking on native 10 | 11 | 12 | 13 | image/svg+xml 14 | 15 | gnrc_networking on native 16 | 17 | 18 | 19 | Martine Lenders 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 211 | 212 | 213 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 230 | Application / Library 232 | 233 | 234 | 236 | 238 | 240 | 242 | 244 | 245 | 246 | netapi 248 | 249 | 250 | 251 | netapi 253 | 254 | 255 | 257 | gnrc_udp 259 | 260 | 261 | 262 | 263 | netapi 265 | 266 | 267 | 269 | 270 | gnrc_ipv6 272 | 273 | NDP[router] 275 | 276 | 277 | 278 | Hardware 280 | 281 | 282 | 283 | netapi 285 | 286 | 287 | 289 | gnrc_netif 291 | 292 | gnrc_netif_ethernet 294 | 295 | 296 | netdev 298 | 300 | netdev_tap 302 | 303 | 304 | 305 | USEMODULE += shell_commands 306 | USEMODULE += gnrc_udp 307 | USEMODULE += gnrc_ipv6_router 308 | USEMODULE += gnrc_ipv6_nib_router 309 | USEMODULE += auto_init_gnrc_netif 310 | USEMODULE += gnrc_netdev_default 311 | 312 | 313 | 314 | -------------------------------------------------------------------------------- /slides/pictures/gnrc_minimal_app.svg: -------------------------------------------------------------------------------- 1 | 2 | 9 | gnrc_minimal example with main registering for raw IPv6 packets 10 | 11 | 12 | 13 | image/svg+xml 14 | 15 | gnrc_minimal example with main registering for raw IPv6 packets 16 | 17 | 18 | 19 | Martine Lenders 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 210 | 211 | 212 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 229 | Application / Library 231 | 232 | 233 | 235 | 237 | 239 | 241 | 242 | 243 | netapi 245 | 246 | 247 | 249 | 250 | gnrc_ipv6 252 | 253 | 6Lo-ND[6LN] 255 | 256 | 257 | 258 | Hardware 260 | 261 | 262 | 263 | netapi 265 | 266 | 267 | 269 | gnrc_sixlowpan 271 | 272 | 273 | 274 | 275 | netapi 277 | 278 | 279 | 281 | gnrc_netif 283 | 284 | gnrc_netif_ieee802154 286 | 287 | 288 | netdev 290 | 292 | at86rf2xx 294 | 295 | 296 | 297 | gnrc_netreg_t 298 | app = 299 | GNRC_NETREG_ENTRY_INIT_PID( 300 | PROTNUM_NONXT, 301 | sched_active_pid); 302 | gnrc_netreg_register(GNRC_NETTYPE_IPV6,&app); 303 | USEMODULE += gnrc_ipv6_default 304 | USEMODULE += auto_init_gnrc_netif 305 | USEMODULE += gnrc_netdev_default 306 | 307 | 308 | 309 | -------------------------------------------------------------------------------- /slides/pictures/gnrc-pkt-dup.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | pktbuf — duplication mechanism 13 | 14 | 15 | 16 | image/svg+xml 17 | 18 | pktbuf — duplication mechanism 19 | 20 | 21 | 22 | Martine Lenders 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 115 | 121 | 122 | 123 | 124 | 125 | Packet in transmission 126 | 127 | 128 | netif header 129 | 130 | users = 1 131 | 132 | next 133 | 134 | 135 | 136 | netif header 137 | 138 | users = 1 139 | 140 | next 141 | 142 | 143 | 144 | 6Lo header 145 | 146 | users = 1 147 | 148 | next 149 | 150 | 151 | 152 | IPv6 header 153 | 154 | users = 1 155 | 156 | next 157 | 158 | 159 | 160 | ICMPv6 header 161 | 162 | users = 2 163 | 164 | next 165 | 166 | 167 | 168 | ICMPv6 payload 169 | 170 | users = 2 171 | 172 | 173 | 174 | Packet in reception 175 | 176 | 177 | UDP payload 178 | 179 | users = 1 180 | 181 | next 182 | 183 | 184 | 185 | UDP payload 186 | 187 | users = 1 188 | 189 | next 190 | 191 | 192 | 193 | UDP header 194 | 195 | users = 2 196 | 197 | next 198 | 199 | 200 | 201 | IPv6 header 202 | 203 | users = 2 204 | 205 | next 206 | 207 | 208 | 209 | netif header 210 | 211 | users = 2 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | data 271 | data 272 | data 273 | data 274 | data 275 | data 276 | data 277 | data 278 | data 279 | data 280 | data 281 | 282 | 283 | --------------------------------------------------------------------------------