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

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 

Recently uploaded (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

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