Giter VIP home page Giter VIP logo

nabto-edge-freertos-simulator's Introduction

Nabto Edge FreeRTOS + LwIP simulator

The purpose of this repository/example is:

  1. A FreeRTOS Nabto Edge integration.
  2. Show how a typical embedded target with FreeRTOS and the LwIP IP stack works with Nabto Edge.

The example consists of the FreeRTOS linux simulator, the LwIP stack running simulated on linux using a tap interface and the Nabto Edge embedded SDK.

FreeRTOS linux simulator, the example is based around the simulator. The simulator is running the LwIP thread and a thread running the nabto edge example.

LwIP, the example uses the LwIP IP stack integrated on linux using a TAP interface. The tap interface is a layer 2 integration between the LwIP stack and the linux system where the demo is running on.

Nabto Edge Embedded SDK, the Nabto Edge example uses the Embedded SDK to create a Nabto Edge device. The example mimics the simple_coap example from the embedded sdk. It is a Nabto Edge device with a CoAP server responding to the /hello-word path.

Project State

Implemented:

  • FreeRTOS integrated with Nabto SDK
  • LwIP TCP, DNS and UDP integrated with Nabto SDK
  • LwIP via TAP interfaces.
  • Simple CoAP demo

TODO:

  • libpcap integration for LwIP such that LwIP can be used directly with ethernet interfaces.

Building

git clone --recurse-submodules https://github.com/nabto/nabto-edge-freertos-simulator

It is a plain CMake build.

mdkir build
cd build
cmake ..
make -j

Integration test

The integration tests tests the nabto implementation against lwip and FreeRTOS.

./build/integration_test

Example output

vscode@2b86f239ccb5:/workspaces/nabto-edge-freertos-simulator/build$ ./integration_test
Starting lwIP, local interface IP is 192.168.100.200
ip6 linklocal address: FE80::12:34FF:FE56:78AB
status_callback==UP, local interface IP is 192.168.100.200
Create device test passed
Future resolve test has passed
Event queue test has passed
DNS test has passed
UDP test has passed
TCP test has passed

Running

Linux

dependencies: nftables

./setup-tapif.sh ./build/nabto_demo

setup-tapif.sh creates a new tapif and setup NAT rules in the firewall using

Docker

To not contaminate your system with custom tap interfaces and firewall rules the example can be run inside a docker container.

docker build . -t edge-freertos docker run --rm -it --privileged edge-freertos

Make a new git clone and build the software inside the container.

Vscode

Open the project in vscode and start hacking using a remote-container workflow.

Notes

PCAP Inject to Wifi networks.

This is most likely not going to work for an explanation read the VirtualBox notes. TLDR: Multiple macs sending on a single wifi interface in client mode is not a good idea.

mDNS inside docker container

If the demo app is running inside a docker container mdns discovery is not working outside the container.

mDNS

mDNS only works on the local machine if the simulator is not running inside a container and the mDNS client is also running on the local machine, due to multicast on the tap interface not being routed to the primary network interface.

nabto-edge-freertos-simulator's People

Contributors

mkm85 avatar quarken avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.