SlideShare a Scribd company logo
1 of 54
Advanced IoT Firmware Engineering
With Thingsquare and Contiki
Overview
•
•
•
•

This is the advanced course
Hard core firmware source code drill-down
We will look deep into the system
We will look into network debugging and
simulation
Quick recap
Thingsquare
• Build connected systems – leverage the
Internet of Things
• Founded in 2012
• Creators of the open source Contiki OS
• Launching in 2014
– Thingsquare cloud backend
– Online development environment
zolertia.com

streetlinenetworks.com
What is the common
denominator?
IPv6 / 6lowpan
• Much more low power than WiFi
• Automatic meshing
• Very long range
– Sub-GHz communication

• Drawbacks
– Lack of infrastructure in homes
IPv6 / 6lowpan contd.
• IPv6 addresses are large
– 6lowpan compresses headers

• Automatic meshing: RPL
– Automatically form large (1000+) node
networks
– Self-suppression of control trafic
Putting it together
2.

3.

1.

1. Bluetooth (Smart) / WiFi
2. WiFi / 6lowpan or through a smart hub
3. RESTful API
Big Red Internet Button
+

= IoT!
The Thingsquare cloud
What we just did
• Did an HTTP POST directly from the chip
• Posted data via a webhook to a cloud
service
api.example.com?
198.51.100.28
198.51.100.28

64:ff9b::c633:641c
ws://api.example.com/
What we will do today and tomorrow
• Drill down into the firmware
– Network protocols
– Radio drivers
– Duty cycling
– Timers
– Boot-up code
– Debugging
– Cooja
You should already know
•
•
•
•
•

What Contiki is
What IPv6 is
What RPL is
What CSMA means
What an interrupt is
What you will know
• How Contiki works, under the hood
• How to write a radio device driver
– And make it interrupt-safe

• How the serial stack works
• How Contiki boots
– How a firmware upgrade on the CC2538 works

•
•
•
•

How to port Contiki to new platforms
What knobs to turn in the Contiki netstack
How to make full use of the Contiki RPL stack
How to sniff and debug the network
Brand new: Contiki 3.x
• We will use some of the APIs and
mechanisms that will go into Contiki 3.x
– But aren’t in there yet

• We’ll use Thingsquare’s Contiki internal
version
IoT software challenges
• Severe limitations in every dimension
– Memory
– Processing power
– Communication bandwidth
– Energy, power consumption

• The number of different platforms is large
– Different microcontrollers, different radios,
different compilers
IoT system challenges
• Communication-bound, distributed
systems
– Exceptionally low visibility
• Hard to understand what is going on

– Application development difficult
– Debugging difficult

• Large-scale
• Wireless communication
Toolchains
A toolchain
•
•
•
•
•
•

Editor
Compiler
Standard libraries
Linker
Debugger
Flash programmer
Contiki tool chains
• IAR, TI CCS, Atmel Studio, or other embedded IDEs
– Doable, but not ideal

• Cygwin under Windows
– Installation can be a hassle
– Compilation is (somewhat) slow

• Native under Mac OS
– Installation may be hassle
– Lack of flash programmer tools may be prohibitive

• Native under Linux
– Drivers for flash programmers may be problematic

• Instant Contiki
The Contiki build system
• A set of Makefiles
• Makefiles set C #defines
– These will have to be replicated if compiling
via an IDE
– Using make is usually best (and easiest)
Install Instant Contiki
•
•
•
•

VMWare player (Windows, Linux)
Virtualbox (Mac OS X)
InstantContiki2.7.zip (from USB stick)
Unzip InstantContiki2.7.zip in separate
directory
• Copy thingsquare-firmware-course-201402-05-73c67ea.zip into Instant Contiki and
unzip it
Update contiki
• cd contiki
• git pull
Code walkthrough
(In another window)
Contiki programming principles
Software development
•
•
•
•

Write your program in a separate C file
Cross-compile the full system binary
Upload to target
Debug via serial printouts, LEDs
– On occasion: gdb / IAR debugger

• Use Cooja to simulate
The project directory
•
•
•
•

Create a new directory
Copy Makefile from examples/hello-world
Modify Makefile
Create new C code file
Contiki firmware images
• In a terminal, go to the project directory

make TARGET=platform file
• This will build the full source code tree for
your project. Eg,
make TARGET=openmote hello-world
Uploading the firmware
• Some platforms have a convenient way to
upload the firmware
make TARGET=sky hello-world.upload

• Some platforms are significantly trickier
Save target
• If you are using the same target a lot,
make TARGET=cc2538dk savetarget

• Then, simply
make blink.upload
Running as the native target
• Sometimes using the native target is
useful
make TARGET=native hello-world

• Run the program
./hello-world.native
Other commands
• Connect to serial port
make TARGET=exp5438 login
make TARGET=exp5438 COMPORT=COM12 login

• Clean out previous compilation
make TARGET=exp5438 clean

• List available commands
make TARGET=exp5438 help
Hands on 1: blink
Blink
• Create project directory, copy Makefile and
project-conf.h from examples/hello-world
• Open blink.c with text editor of choice
(emacs, vi, gedit, …)
• Log in to demo.thsq.io, click on the Develop
button
• Copy the contents of blink.c from the browser
into blink.c
• Compile, in the terminal:
– make TARGET=thsq-cc2538dk blink.bin
Upload
• Copy blink.bin to shared folder
• Use TI SmartRF Flash Programmer 2 to
burn to flash
• Watch the LEDs blink
Hands on 2: UDP broadcast
udp-broadcast.c
• Copy udp-broadcast.c from demo.thsq.io
into udp-broadcast.c
• make TARGET=thsq-cc2538dk udp-broadcast.bin
More Contiki principles
Naming
• Function names prefixed by their module
name
• Example: memb_alloc()

• Configuration parameters:
MODULE_CONF_NAME
– Example: QUEUEBUF_CONF_NUM
Caller allocation
• In general, the caller always allocates
memory
– Pass pointer to struct

• Example:
– HTTP socket
– See big-red-button.c

• Exception: low-level uIP TCP connections
Editing core files
• Sometimes you need edit core files
• Don’t edit core files in the Contiki tree
– Makes it difficult to update to new versions

• Instead, copy the core file to your project
directory and edit there
• Run make clean before compiling next
time
Contiki’s complexity
• Contiki may be complex
• Sometimes this is due to the problems
being complex
• Sometimes this is just because of random
historical reasons
More

http://thingsquare.com

More Related Content

What's hot

Innovation is back in the transport and network layers
Innovation is back in the transport and network layersInnovation is back in the transport and network layers
Innovation is back in the transport and network layersOlivier Bonaventure
 
Network Automation (Bay Area Juniper Networks Meetup)
Network Automation (Bay Area Juniper Networks Meetup)Network Automation (Bay Area Juniper Networks Meetup)
Network Automation (Bay Area Juniper Networks Meetup)Alejandro Salinas
 
[Draft] Fast Prototyping with DPDK and eBPF in Containernet
[Draft] Fast Prototyping with DPDK and eBPF in Containernet[Draft] Fast Prototyping with DPDK and eBPF in Containernet
[Draft] Fast Prototyping with DPDK and eBPF in ContainernetAndrew Wang
 
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)Thomas Graf
 
Hands on with CoAP and Californium
Hands on with CoAP and CaliforniumHands on with CoAP and Californium
Hands on with CoAP and CaliforniumJulien Vermillard
 
DPDK Integration: A Product's Journey - Roger B. Melton
DPDK Integration: A Product's Journey - Roger B. MeltonDPDK Integration: A Product's Journey - Roger B. Melton
DPDK Integration: A Product's Journey - Roger B. Meltonharryvanhaaren
 
Presentation 2 Spring 2016 FINAL fat cut (1)
Presentation 2 Spring 2016 FINAL fat cut (1)Presentation 2 Spring 2016 FINAL fat cut (1)
Presentation 2 Spring 2016 FINAL fat cut (1)Michael Vistine
 
Introduction to the Cluster Infrastructure and the Systems Provisioning Engin...
Introduction to the Cluster Infrastructure and the Systems Provisioning Engin...Introduction to the Cluster Infrastructure and the Systems Provisioning Engin...
Introduction to the Cluster Infrastructure and the Systems Provisioning Engin...Angelo Failla
 
Senior Design: Raspberry Pi Cluster Computing
Senior Design: Raspberry Pi Cluster ComputingSenior Design: Raspberry Pi Cluster Computing
Senior Design: Raspberry Pi Cluster ComputingRalph Walker II
 
OSMC 2021 | Robotmk: You don’t run IT – you deliver services!
OSMC 2021 | Robotmk: You don’t run IT – you deliver services!OSMC 2021 | Robotmk: You don’t run IT – you deliver services!
OSMC 2021 | Robotmk: You don’t run IT – you deliver services!NETWAYS
 
Wireshark
WiresharkWireshark
Wiresharkbtohara
 
Network testing course
Network testing courseNetwork testing course
Network testing coursetcpipguru
 
Unleashing the Power of Fabric Orchestrating New Performance Features for SR-...
Unleashing the Power of Fabric Orchestrating New Performance Features for SR-...Unleashing the Power of Fabric Orchestrating New Performance Features for SR-...
Unleashing the Power of Fabric Orchestrating New Performance Features for SR-...Liz Warner
 
IP routing in linux
IP routing in linuxIP routing in linux
IP routing in linuxgamer007
 
Netty Notes Part 3 - Channel Pipeline and EventLoops
Netty Notes Part 3 - Channel Pipeline and EventLoopsNetty Notes Part 3 - Channel Pipeline and EventLoops
Netty Notes Part 3 - Channel Pipeline and EventLoopsRick Hightower
 
Netty Notes Part 2 - Transports and Buffers
Netty Notes Part 2 - Transports and BuffersNetty Notes Part 2 - Transports and Buffers
Netty Notes Part 2 - Transports and BuffersRick Hightower
 

What's hot (20)

Contiki Presentation
Contiki PresentationContiki Presentation
Contiki Presentation
 
Innovation is back in the transport and network layers
Innovation is back in the transport and network layersInnovation is back in the transport and network layers
Innovation is back in the transport and network layers
 
Network Automation (Bay Area Juniper Networks Meetup)
Network Automation (Bay Area Juniper Networks Meetup)Network Automation (Bay Area Juniper Networks Meetup)
Network Automation (Bay Area Juniper Networks Meetup)
 
[Draft] Fast Prototyping with DPDK and eBPF in Containernet
[Draft] Fast Prototyping with DPDK and eBPF in Containernet[Draft] Fast Prototyping with DPDK and eBPF in Containernet
[Draft] Fast Prototyping with DPDK and eBPF in Containernet
 
Ipx protocol slide share
Ipx protocol slide shareIpx protocol slide share
Ipx protocol slide share
 
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
Taking Security Groups to Ludicrous Speed with OVS (OpenStack Summit 2015)
 
Hands on with CoAP and Californium
Hands on with CoAP and CaliforniumHands on with CoAP and Californium
Hands on with CoAP and Californium
 
DPDK Integration: A Product's Journey - Roger B. Melton
DPDK Integration: A Product's Journey - Roger B. MeltonDPDK Integration: A Product's Journey - Roger B. Melton
DPDK Integration: A Product's Journey - Roger B. Melton
 
Presentation 2 Spring 2016 FINAL fat cut (1)
Presentation 2 Spring 2016 FINAL fat cut (1)Presentation 2 Spring 2016 FINAL fat cut (1)
Presentation 2 Spring 2016 FINAL fat cut (1)
 
FD.io - The Universal Dataplane
FD.io - The Universal DataplaneFD.io - The Universal Dataplane
FD.io - The Universal Dataplane
 
Introduction to the Cluster Infrastructure and the Systems Provisioning Engin...
Introduction to the Cluster Infrastructure and the Systems Provisioning Engin...Introduction to the Cluster Infrastructure and the Systems Provisioning Engin...
Introduction to the Cluster Infrastructure and the Systems Provisioning Engin...
 
Senior Design: Raspberry Pi Cluster Computing
Senior Design: Raspberry Pi Cluster ComputingSenior Design: Raspberry Pi Cluster Computing
Senior Design: Raspberry Pi Cluster Computing
 
OSMC 2021 | Robotmk: You don’t run IT – you deliver services!
OSMC 2021 | Robotmk: You don’t run IT – you deliver services!OSMC 2021 | Robotmk: You don’t run IT – you deliver services!
OSMC 2021 | Robotmk: You don’t run IT – you deliver services!
 
Wireshark
WiresharkWireshark
Wireshark
 
Network testing course
Network testing courseNetwork testing course
Network testing course
 
Unleashing the Power of Fabric Orchestrating New Performance Features for SR-...
Unleashing the Power of Fabric Orchestrating New Performance Features for SR-...Unleashing the Power of Fabric Orchestrating New Performance Features for SR-...
Unleashing the Power of Fabric Orchestrating New Performance Features for SR-...
 
IP routing in linux
IP routing in linuxIP routing in linux
IP routing in linux
 
Netty Notes Part 3 - Channel Pipeline and EventLoops
Netty Notes Part 3 - Channel Pipeline and EventLoopsNetty Notes Part 3 - Channel Pipeline and EventLoops
Netty Notes Part 3 - Channel Pipeline and EventLoops
 
Netty Notes Part 2 - Transports and Buffers
Netty Notes Part 2 - Transports and BuffersNetty Notes Part 2 - Transports and Buffers
Netty Notes Part 2 - Transports and Buffers
 
Network Layer
Network LayerNetwork Layer
Network Layer
 

Viewers also liked

Advanced Internet of Things firmware engineering with Thingsquare and Contiki...
Advanced Internet of Things firmware engineering with Thingsquare and Contiki...Advanced Internet of Things firmware engineering with Thingsquare and Contiki...
Advanced Internet of Things firmware engineering with Thingsquare and Contiki...Adam Dunkels
 
Building the Internet of Things with Thingsquare and Contiki - day 2 part 1
Building the Internet of Things with Thingsquare and Contiki - day 2 part 1Building the Internet of Things with Thingsquare and Contiki - day 2 part 1
Building the Internet of Things with Thingsquare and Contiki - day 2 part 1Adam Dunkels
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3Adam Dunkels
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1Building the Internet of Things with Thingsquare and Contiki - day 1, part 1
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1Adam Dunkels
 
Contiki os timer tutorial
Contiki os timer tutorialContiki os timer tutorial
Contiki os timer tutorialSalah Amean
 
Contiki introduction I.
Contiki introduction I.Contiki introduction I.
Contiki introduction I.Dingxin Xu
 

Viewers also liked (6)

Advanced Internet of Things firmware engineering with Thingsquare and Contiki...
Advanced Internet of Things firmware engineering with Thingsquare and Contiki...Advanced Internet of Things firmware engineering with Thingsquare and Contiki...
Advanced Internet of Things firmware engineering with Thingsquare and Contiki...
 
Building the Internet of Things with Thingsquare and Contiki - day 2 part 1
Building the Internet of Things with Thingsquare and Contiki - day 2 part 1Building the Internet of Things with Thingsquare and Contiki - day 2 part 1
Building the Internet of Things with Thingsquare and Contiki - day 2 part 1
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
Building the Internet of Things with Thingsquare and Contiki - day 1, part 3
 
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1Building the Internet of Things with Thingsquare and Contiki - day 1, part 1
Building the Internet of Things with Thingsquare and Contiki - day 1, part 1
 
Contiki os timer tutorial
Contiki os timer tutorialContiki os timer tutorial
Contiki os timer tutorial
 
Contiki introduction I.
Contiki introduction I.Contiki introduction I.
Contiki introduction I.
 

Similar to Advanced Internet of Things firmware engineering with Thingsquare and Contiki - day 1, part 1

ch4-Software is Everywhere
ch4-Software is Everywherech4-Software is Everywhere
ch4-Software is Everywheressuser06ea42
 
How to install IBM Connections in a Coffe Break
How to install IBM Connections in a Coffe BreakHow to install IBM Connections in a Coffe Break
How to install IBM Connections in a Coffe BreakAndrea Fontana
 
Latest (storage IO) patterns for cloud-native applications
Latest (storage IO) patterns for cloud-native applications Latest (storage IO) patterns for cloud-native applications
Latest (storage IO) patterns for cloud-native applications OpenEBS
 
Modern Web-site Development Pipeline
Modern Web-site Development PipelineModern Web-site Development Pipeline
Modern Web-site Development PipelineGlobalLogic Ukraine
 
DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2Docker, Inc.
 
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWER
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWERContinuous Integration with Cloud Foundry Concourse and Docker on OpenPOWER
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWERIndrajit Poddar
 
DEF CON 27 - workshop - RICHARD GOLD - mind the gap
DEF CON 27 - workshop - RICHARD GOLD - mind the gapDEF CON 27 - workshop - RICHARD GOLD - mind the gap
DEF CON 27 - workshop - RICHARD GOLD - mind the gapFelipe Prado
 
DevOpsCon 2015 - DevOps in Mobile Games
DevOpsCon 2015 - DevOps in Mobile GamesDevOpsCon 2015 - DevOps in Mobile Games
DevOpsCon 2015 - DevOps in Mobile GamesAndreas Katzig
 
Realtime traffic analyser
Realtime traffic analyserRealtime traffic analyser
Realtime traffic analyserAlex Moskvin
 
321 codeincontainer brewbox
321 codeincontainer brewbox321 codeincontainer brewbox
321 codeincontainer brewboxLino Telera
 
Moving to software-based production workflows and containerisation of media a...
Moving to software-based production workflows and containerisation of media a...Moving to software-based production workflows and containerisation of media a...
Moving to software-based production workflows and containerisation of media a...Kieran Kunhya
 
Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?GetInData
 
Docker in pratice -chenyifei
Docker in pratice -chenyifeiDocker in pratice -chenyifei
Docker in pratice -chenyifeidotCloud
 
Architectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and ConsistentlyArchitectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and ConsistentlyComsysto Reply GmbH
 
Architectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and ConsistentlyArchitectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and ConsistentlyComsysto Reply GmbH
 
Security research over Windows #defcon china
Security research over Windows #defcon chinaSecurity research over Windows #defcon china
Security research over Windows #defcon chinaPeter Hlavaty
 
Managing WorkSpaces at Scale | AWS Public Sector Summit 2016
Managing WorkSpaces at Scale | AWS Public Sector Summit 2016Managing WorkSpaces at Scale | AWS Public Sector Summit 2016
Managing WorkSpaces at Scale | AWS Public Sector Summit 2016Amazon Web Services
 
Software Architecture and Architectors: useless VS valuable
Software Architecture and Architectors: useless VS valuableSoftware Architecture and Architectors: useless VS valuable
Software Architecture and Architectors: useless VS valuableComsysto Reply GmbH
 

Similar to Advanced Internet of Things firmware engineering with Thingsquare and Contiki - day 1, part 1 (20)

ch4-Software is Everywhere
ch4-Software is Everywherech4-Software is Everywhere
ch4-Software is Everywhere
 
How to install IBM Connections in a Coffe Break
How to install IBM Connections in a Coffe BreakHow to install IBM Connections in a Coffe Break
How to install IBM Connections in a Coffe Break
 
Latest (storage IO) patterns for cloud-native applications
Latest (storage IO) patterns for cloud-native applications Latest (storage IO) patterns for cloud-native applications
Latest (storage IO) patterns for cloud-native applications
 
Modern Web-site Development Pipeline
Modern Web-site Development PipelineModern Web-site Development Pipeline
Modern Web-site Development Pipeline
 
DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2DockerCon 15 Keynote - Day 2
DockerCon 15 Keynote - Day 2
 
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWER
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWERContinuous Integration with Cloud Foundry Concourse and Docker on OpenPOWER
Continuous Integration with Cloud Foundry Concourse and Docker on OpenPOWER
 
DEF CON 27 - workshop - RICHARD GOLD - mind the gap
DEF CON 27 - workshop - RICHARD GOLD - mind the gapDEF CON 27 - workshop - RICHARD GOLD - mind the gap
DEF CON 27 - workshop - RICHARD GOLD - mind the gap
 
DevOpsCon 2015 - DevOps in Mobile Games
DevOpsCon 2015 - DevOps in Mobile GamesDevOpsCon 2015 - DevOps in Mobile Games
DevOpsCon 2015 - DevOps in Mobile Games
 
Realtime traffic analyser
Realtime traffic analyserRealtime traffic analyser
Realtime traffic analyser
 
321 codeincontainer brewbox
321 codeincontainer brewbox321 codeincontainer brewbox
321 codeincontainer brewbox
 
Moving to software-based production workflows and containerisation of media a...
Moving to software-based production workflows and containerisation of media a...Moving to software-based production workflows and containerisation of media a...
Moving to software-based production workflows and containerisation of media a...
 
Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?
 
Docker in pratice -chenyifei
Docker in pratice -chenyifeiDocker in pratice -chenyifei
Docker in pratice -chenyifei
 
Android Lollipop
Android LollipopAndroid Lollipop
Android Lollipop
 
Architectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and ConsistentlyArchitectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and Consistently
 
Architectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and ConsistentlyArchitectural Decisions: Smoothly and Consistently
Architectural Decisions: Smoothly and Consistently
 
Security research over Windows #defcon china
Security research over Windows #defcon chinaSecurity research over Windows #defcon china
Security research over Windows #defcon china
 
Managing WorkSpaces at Scale | AWS Public Sector Summit 2016
Managing WorkSpaces at Scale | AWS Public Sector Summit 2016Managing WorkSpaces at Scale | AWS Public Sector Summit 2016
Managing WorkSpaces at Scale | AWS Public Sector Summit 2016
 
Software Architecture and Architectors: useless VS valuable
Software Architecture and Architectors: useless VS valuableSoftware Architecture and Architectors: useless VS valuable
Software Architecture and Architectors: useless VS valuable
 
Lick my Lollipop
Lick my LollipopLick my Lollipop
Lick my Lollipop
 

Recently uploaded

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 

Recently uploaded (20)

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 

Advanced Internet of Things firmware engineering with Thingsquare and Contiki - day 1, part 1

  • 1. Advanced IoT Firmware Engineering With Thingsquare and Contiki
  • 2. Overview • • • • This is the advanced course Hard core firmware source code drill-down We will look deep into the system We will look into network debugging and simulation
  • 4. Thingsquare • Build connected systems – leverage the Internet of Things • Founded in 2012 • Creators of the open source Contiki OS • Launching in 2014 – Thingsquare cloud backend – Online development environment
  • 5.
  • 6.
  • 7.
  • 8.
  • 10. What is the common denominator?
  • 11.
  • 12. IPv6 / 6lowpan • Much more low power than WiFi • Automatic meshing • Very long range – Sub-GHz communication • Drawbacks – Lack of infrastructure in homes
  • 13. IPv6 / 6lowpan contd. • IPv6 addresses are large – 6lowpan compresses headers • Automatic meshing: RPL – Automatically form large (1000+) node networks – Self-suppression of control trafic
  • 14. Putting it together 2. 3. 1. 1. Bluetooth (Smart) / WiFi 2. WiFi / 6lowpan or through a smart hub 3. RESTful API
  • 18. What we just did • Did an HTTP POST directly from the chip • Posted data via a webhook to a cloud service
  • 23. What we will do today and tomorrow • Drill down into the firmware – Network protocols – Radio drivers – Duty cycling – Timers – Boot-up code – Debugging – Cooja
  • 24. You should already know • • • • • What Contiki is What IPv6 is What RPL is What CSMA means What an interrupt is
  • 25. What you will know • How Contiki works, under the hood • How to write a radio device driver – And make it interrupt-safe • How the serial stack works • How Contiki boots – How a firmware upgrade on the CC2538 works • • • • How to port Contiki to new platforms What knobs to turn in the Contiki netstack How to make full use of the Contiki RPL stack How to sniff and debug the network
  • 26. Brand new: Contiki 3.x • We will use some of the APIs and mechanisms that will go into Contiki 3.x – But aren’t in there yet • We’ll use Thingsquare’s Contiki internal version
  • 27. IoT software challenges • Severe limitations in every dimension – Memory – Processing power – Communication bandwidth – Energy, power consumption • The number of different platforms is large – Different microcontrollers, different radios, different compilers
  • 28. IoT system challenges • Communication-bound, distributed systems – Exceptionally low visibility • Hard to understand what is going on – Application development difficult – Debugging difficult • Large-scale • Wireless communication
  • 31. Contiki tool chains • IAR, TI CCS, Atmel Studio, or other embedded IDEs – Doable, but not ideal • Cygwin under Windows – Installation can be a hassle – Compilation is (somewhat) slow • Native under Mac OS – Installation may be hassle – Lack of flash programmer tools may be prohibitive • Native under Linux – Drivers for flash programmers may be problematic • Instant Contiki
  • 32. The Contiki build system • A set of Makefiles • Makefiles set C #defines – These will have to be replicated if compiling via an IDE – Using make is usually best (and easiest)
  • 33. Install Instant Contiki • • • • VMWare player (Windows, Linux) Virtualbox (Mac OS X) InstantContiki2.7.zip (from USB stick) Unzip InstantContiki2.7.zip in separate directory • Copy thingsquare-firmware-course-201402-05-73c67ea.zip into Instant Contiki and unzip it
  • 34. Update contiki • cd contiki • git pull
  • 37. Software development • • • • Write your program in a separate C file Cross-compile the full system binary Upload to target Debug via serial printouts, LEDs – On occasion: gdb / IAR debugger • Use Cooja to simulate
  • 38. The project directory • • • • Create a new directory Copy Makefile from examples/hello-world Modify Makefile Create new C code file
  • 39. Contiki firmware images • In a terminal, go to the project directory make TARGET=platform file • This will build the full source code tree for your project. Eg, make TARGET=openmote hello-world
  • 40. Uploading the firmware • Some platforms have a convenient way to upload the firmware make TARGET=sky hello-world.upload • Some platforms are significantly trickier
  • 41. Save target • If you are using the same target a lot, make TARGET=cc2538dk savetarget • Then, simply make blink.upload
  • 42. Running as the native target • Sometimes using the native target is useful make TARGET=native hello-world • Run the program ./hello-world.native
  • 43. Other commands • Connect to serial port make TARGET=exp5438 login make TARGET=exp5438 COMPORT=COM12 login • Clean out previous compilation make TARGET=exp5438 clean • List available commands make TARGET=exp5438 help
  • 44. Hands on 1: blink
  • 45. Blink • Create project directory, copy Makefile and project-conf.h from examples/hello-world • Open blink.c with text editor of choice (emacs, vi, gedit, …) • Log in to demo.thsq.io, click on the Develop button • Copy the contents of blink.c from the browser into blink.c • Compile, in the terminal: – make TARGET=thsq-cc2538dk blink.bin
  • 46. Upload • Copy blink.bin to shared folder • Use TI SmartRF Flash Programmer 2 to burn to flash • Watch the LEDs blink
  • 47. Hands on 2: UDP broadcast
  • 48. udp-broadcast.c • Copy udp-broadcast.c from demo.thsq.io into udp-broadcast.c • make TARGET=thsq-cc2538dk udp-broadcast.bin
  • 50. Naming • Function names prefixed by their module name • Example: memb_alloc() • Configuration parameters: MODULE_CONF_NAME – Example: QUEUEBUF_CONF_NUM
  • 51. Caller allocation • In general, the caller always allocates memory – Pass pointer to struct • Example: – HTTP socket – See big-red-button.c • Exception: low-level uIP TCP connections
  • 52. Editing core files • Sometimes you need edit core files • Don’t edit core files in the Contiki tree – Makes it difficult to update to new versions • Instead, copy the core file to your project directory and edit there • Run make clean before compiling next time
  • 53. Contiki’s complexity • Contiki may be complex • Sometimes this is due to the problems being complex • Sometimes this is just because of random historical reasons