Linux+Zephyr:IoTmadeeasy
IoTExplodesEverywhere
❑ “Sensorsandactuatorsembeddedinphysicalobjectsandlinkedthroughwiredandwirelessnetworks,oftenusingthesameInternetProtocol(IP)thatconnectstheInternet”-DefinitionbyMcKinsey.
❑ Soundsjustlikeembeddedstuffwe’vebeendoingfordecades!Sowhatchanged?
❑ Nowthere’sabigmarketandtheworldisjust‘ready’.
❑ Unfortunatelythere’snostandard(andprobablywillnotbeoneformanydecades),fragmentationisrunningamok.
LinuxIoT
❑ AroundformanyyearsandbeendoingIoTthingswithitbeforeithadacoolname.
❑ AllprotocolshavetheirreferenceimplementationonLinux(AllJoyn,MQTT,Weave,XMPP,etc)
❑ UnfortunatelyLinuxhasgottenquitelarge
❑ Minimumkernelforembeddedtarget>4MBcompressed
❑ RequiresafewhundredsofGBofflashforageneralpurposeinstall.
❑ Notsuitableforverysmalldevices
Priceiseverything
❑ IfwecouldrunLinuxoneverythingyouwouldn’tbeinthispresentation!
❑ Linuxissecure(hasyearsofscrutinyandprofessionalsecuritypeoplegoaftereverycommitwithafinetoothcomb).
❑ Linuxhasthefullnetworkingstackrequired.
❑ LinuxhastheI/Ocapabilities(everysensor/actuatordriver)
❑ Unfortunatelyyoucan’trunLinuxon$0.5part.
Priceiseverything(cont)
❑ RunIoTona$0.5part(ideally,wecoulddowith$1)
❑ Thisisthesweet-spotformanyapplications
❑ Puta$50deviceoffpremisesandgetlostorstollen,youmightgetabitupset->endupnotbuyingit.
❑ Puta$1deviceoffpremisesandgetlostorstollen->meh.
❑ TurnsoutthatweneedanOSforourcheapdevicesthatisleanerthanLinux.
❑ Manyoptions!
RTOSselection
❑ Abigselectionofchoices,thebigcontenders
❑ FreeRTOS
❑ mbedOS
❑ NuttX
❑ magenta(LK)
❑ None
❑ Zephyr
FreeRTOS
❑ DualLicense-GPLv2withlinkingexceptionorcommercial
❑ SparseAPI-themostRTOSofoldofthemost
❑ Nocommunitydevelopmentforthecore(separate)
❑ Preemptivethreadmodel,optionalMPUprotection
❑ Networkingisanadd-on-nohighlevelframeworks
❑ Suitedforpeoplemovingonfrombaremetal
mbedOS
❑ Apache2,6LoWPanunderpermissivebinarylicense(etc).
❑ Newmbed5RTOS(CMSIS-RTOS-RTX)
❑ Communityinvolvementminimal(ARMfocused).
❑ MINAReventbasedAPI
❑ Completestandardsupport(twodifferentIPstacks)
❑ TiedtothembedOScloudAPI
❑ Mosteasytogetstarted,butnotveryopensourceIMO.
NuttX
❑ BSD3clause
❑ MostLinuxAPIofthemall.
❑ Hasalargecommunitybut80%isMr.Nutthimself
❑ QuitePOSIXcompatible-easiertoportLinuxstuff
❑ IPstackbutnotmuchelseIoTrelated
❑ Largerthantheotheroptions,mostLinuxlike.
magenta(partoffuchsia)
❑ MITlicense
❑ Littlekernel-UsedonAndroidbootloaders.
❑ Justintroduced,communityisdubious
❑ Limitedprioritynumber,standardprimitives.
❑ Networkingstack-couldn’tfigurethisout:)
❑ Googleproject-significantinfantmortality
None(isalwaysanoption)
❑ N/A
❑ N/A
❑ N/A
❑ N/A
❑ N/A
❑ Onlyforthehardcore
Zephyr
❑ Apache2(networkstackApache2)
❑ AdequateRTOSAPI(andnano/microoption)
❑ UnderLinuxFoundation-trueopensource
❑ Networkingstack-IPstack+IoToptions(CoAP)+BLE
❑ Linuxkconfigbuildsystem,feelsrightathome.
❑ Ourselection.
IoTonZephyr.
❑ CoAP,BLE,contiki+tinydtls
❑ Canbeverysmall(smallestnanokernelexampleat8K)
❑ PortingofIoTlibrariespossible
❑ Youcanaccomplishquitealot.
❑ WhataboutLinux?Wheredoesitfitin?
IoTonZephyr(problems)
❑ Security-yourIoTdevicehaskeysandpasswords,howdoyouhandleitbeingstolenbyamaliciousparty?
❑ Convenience-Howeasycanyouupdatethesoftwareonthedevices?Youmighthavedozenonyourpremises.
❑ FutureProofing-Notenoughroominnon-volatilestorageforeveryIoTprotocol.Whathappensifthecompanygoesoutofbusiness?Youhavetochangeallthelightbulbs/securitysystem/etcinsuchacase?
❑ Warringtribes-iPhonevsAndroid-itshouldworkwithmyotherdevicestoo.
Solution:LinuxGateway
❑ LinuxgatewayandslaveZephyrIoTdevices.
❑ LinuxcanrunallIoTprotocols(andwithenoughRAMatthesametime)
❑ Futureproof-Linuxiseasilyupdated,sincepointtodoso.
❑ SoftwareontheIoTdevices?ShoulditbeanIoTstack?Dowestillneedtoupdates/wontheIoTdevices?
Intermission:CheapIoT(1)
❑ CheapMCUwithonchipperipherals
❑ ARMMcore/PIC/ARM/x86/AVR
❑ GPIOs
❑ PWM
❑ Serial
❑ I2C
❑ SPI
❑ Networking(IEEE802.15orZigBeeorWiFi)…
Intermission:CheapIoT(2)
❑ Analogglue
❑ SensorsonI2C/SPIbus
❑ Verypricesensitive
❑ Speedsareusuallylow
❑ Powerbudgetissmall
❑ Lessismore
WhatiftherewasnoIoT(1)
❑ LinuxhasfullI/OcapabilitiesforIoT
❑ Problemisthatthesensorsareremote
❑ WhatifwegotridoftheheavyweightIoTprotocols?
❑ Zephyrdevicesaresimplyperipherals
❑ S/WloadonZephyrdevicesisthesameforthesameSoCnomatterwhatdifferentkindofsensor/IoTdeviceitis
❑ LinuxkernelinterfacesmeanalltheIoTapplicationareinsulatedfromtheunderlyingdevicedetails.
WhatiftherewasnoIoT(2)
❑ Significantlessattacksurfacewithsecurityproblems:
❑ Thedevicesonlycontainenoughkeystoconnectwiththegatewayandhavenovaluableinformation
❑ Thereismuchlesssoftwareonthedevice
❑ Bothendscanbesecuredeitherwithpre-programmedkeysorusingasmart-phoneapplicationoninstalltime.
❑ Thedevicesarebasicallydisposable.
Implementation(bare)
❑ DirectlyaccesstheSoCresources
❑ Registers
❑ Busses
❑ +Nosoftwarebesidesnetworkingandconfiguration
❑ -Performancemightbeimpacted
❑ -Morepowerrequired(tradeoff)
Implementation(classdrivers)
❑ Thinclasslayer
❑ GPIOclassforinstance
❑ Classesforeverykindofperipheral
❑ -MoreS/Wcomparedtobarebones
❑ +Betterperformance
❑ +Lesspowerrequired
Status
❑ Unfortunatelynodemoyet!
❑ TestbedisabeagleboneandanIntelGalileo
❑ KerneldriverprovidesremoteGPIOsnow,I2C,SPItocome
❑ Kerneldriversusesauser-spacehelpertobridgetothedeviceoverBLE.
❑ Pre-configuredkeyswithDTLS
❑ WIP,hopetohaveademoatELC.
Thankyou!
Questions?