際際滷

際際滷Share a Scribd company logo
Copyright @ 2018 JFrog, PlatformIO - All rights reserved
Over-The-Air (OTA)
firmware upgrades for
Internet of Things devices
with JFrog Bintray
Dr. Ivan Kravets, CEO at PlatformIO
Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP
IoT Devices
30 billion devices by 2020 (wiki)
¢ Smart homes
¢ Smart cities
¢ Smart grids
¢ Virtual power plants
¢ Intelligent transportation
¢ ...
Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP
What¨s Inside?
Copyright ? 2018 JFrog, PlatformIO. All Rights Reserved
Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP
¢ Limited CPU ( ~100MHz )
¢ Limited RAM ( ~256KB )
¢ Limited Flash ( ~1MB)
¢ Limited communication bandwidth
¢ Limited TLS support
¢ Limited power supply resources
Average constrained device
Limited processing and storage capabilities
Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP
Flash Map
Fixed User Application (No OTA)
Boot (optional) Application EEPROM SPIFFS
To upgrade the application, you reprogram it
Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP
¢ Open source, Apache 2.0 license
¢ Zero dependency, written in pure Python
¢ Rich command line interface (CLI)
¢ Use your favorite IDE or OS
¢ Multi-platform build system
¢ Automatic toolchain and library management
¢ Built-in support for CI / CD
¢ ^1-click ̄ debugging
¢ Run unit test on a remote IoT device
How to program IoT device?
PlatformIO: an open source ecosystem for IoT development
Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP
Flash Map
Fixed User Application (No OTA)
Boot (optional) Application EEPROM SPIFFS
Upgradable User Application (OTA)
Boot OTA State Application Application* EEPROM SPIFFS
OTA needs 2 partitions to upgrade safely
Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP
¢ Free For Open Source
¢ 100% Automated via REST API
¢ Custom attributes per release
¢ Super fast CDN, don¨t worry about continents!
¢ Full Control and Security
¢ Unlimited number of IoT devices
¢ Bulk upgrades
¢ Release provisioning and analytics
How to manage IoT updates?
JFrog Bintray: Universal Distribution Platform
Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP
Flash Map
Fixed User Application (No OTA)
Boot (optional) Application EEPROM SPIFFS
Upgradable User Application (OTA)
Boot OTA State Application Application* EEPROM SPIFFS
Bintray API
Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP
Build
(compile firmware)
Local Test
(native, host OS)
Remote Test
(on a physical remote device)
Delivery
(publish firmware)
CI / CD
Over-The-Air Firmware Upgrades Workflow
Smart homes Smart cities Smart grids Virtual power plants Intelligent transportation
Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP
Demo
Copyright ? 2018 JFrog, PlatformIO. All Rights Reserved
https://github.com/platformio/bintray-secure-ota.git
Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP
Secure Bintray Client
C++ open source library by PlatformIO
#include <BintrayClient.h>
const BintrayClient bintray(
BINTRAY_USER,
BINTRAY_REPO,
BINTRAY_PACKAGE
);
const String version = bintray.getLatestVersion();
const String firmwarePath = bintray.getBinaryPath(version);
// download & flash image...
Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP
Initial configuration
platformio.ini
; Please navigate to https://bintray.com/, create an account,
; repository, and add a package where PlatformIO will deploy firmwares
; api_token = Bintray.com > Edit Profile > API Key
[bintray]
user = ivankravets
repository = platformio-ota
package = bintray-secure-ota
api_token = ${env.BINTRAY_API_TOKEN}
; Wi-Fi network settings
[wifi]
ssid = ${env.PIO_WIFI_SSID}
password = ${env.PIO_WIFI_PASSWORD}
[common]
; firmware version, please modify it between releases; positive integer value
release_version = 1
Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP
Unit Testing
Local & Remote
#include <unity.h>
void test_bintray_binary_path_is_valid(void) {
const String binaryPath = bintray.getBinaryPath(bintray.getLatestVersion());
TEST_ASSERT_TRUE(binaryPath.length() > 0);
TEST_ASSERT_TRUE(binaryPath.endsWith(".bin"));
TEST_ASSERT_TRUE(binaryPath.indexOf(BINTRAY_USER) > 0);
}
// ...
void setup() {
UNITY_BEGIN();
RUN_TEST(test_bintray_client_credentials);
RUN_TEST(test_wifi_connection);
RUN_TEST(test_bintray_binary_path_is_valid);
// ...
UNITY_END();
}
Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP
CI/CD Pipeline
Automated firmware delivery: any OS, any CI service
install:
- pip install -U platformio
- platformio upgrade --dev
- platformio update
script:
# Check compiler errors
- platformio run
# List remote devices
- platformio remote device list
# Run embedded test on a remote device
- platformio remote test -r
deploy:
provider: script
script: platformio run -e release -t upload
Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP
THANK YOU!

More Related Content

swampUP: Over-The-Air (OTA) firmware upgrades for Internet of Things devices with PlatformIO and JFrog Bintray

  • 1. Copyright @ 2018 JFrog, PlatformIO - All rights reserved Over-The-Air (OTA) firmware upgrades for Internet of Things devices with JFrog Bintray Dr. Ivan Kravets, CEO at PlatformIO
  • 2. Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP IoT Devices 30 billion devices by 2020 (wiki) ¢ Smart homes ¢ Smart cities ¢ Smart grids ¢ Virtual power plants ¢ Intelligent transportation ¢ ...
  • 3. Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP What¨s Inside? Copyright ? 2018 JFrog, PlatformIO. All Rights Reserved
  • 4. Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP ¢ Limited CPU ( ~100MHz ) ¢ Limited RAM ( ~256KB ) ¢ Limited Flash ( ~1MB) ¢ Limited communication bandwidth ¢ Limited TLS support ¢ Limited power supply resources Average constrained device Limited processing and storage capabilities
  • 5. Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP Flash Map Fixed User Application (No OTA) Boot (optional) Application EEPROM SPIFFS To upgrade the application, you reprogram it
  • 6. Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP ¢ Open source, Apache 2.0 license ¢ Zero dependency, written in pure Python ¢ Rich command line interface (CLI) ¢ Use your favorite IDE or OS ¢ Multi-platform build system ¢ Automatic toolchain and library management ¢ Built-in support for CI / CD ¢ ^1-click ̄ debugging ¢ Run unit test on a remote IoT device How to program IoT device? PlatformIO: an open source ecosystem for IoT development
  • 7. Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP Flash Map Fixed User Application (No OTA) Boot (optional) Application EEPROM SPIFFS Upgradable User Application (OTA) Boot OTA State Application Application* EEPROM SPIFFS OTA needs 2 partitions to upgrade safely
  • 8. Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP ¢ Free For Open Source ¢ 100% Automated via REST API ¢ Custom attributes per release ¢ Super fast CDN, don¨t worry about continents! ¢ Full Control and Security ¢ Unlimited number of IoT devices ¢ Bulk upgrades ¢ Release provisioning and analytics How to manage IoT updates? JFrog Bintray: Universal Distribution Platform
  • 9. Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP Flash Map Fixed User Application (No OTA) Boot (optional) Application EEPROM SPIFFS Upgradable User Application (OTA) Boot OTA State Application Application* EEPROM SPIFFS Bintray API
  • 10. Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP Build (compile firmware) Local Test (native, host OS) Remote Test (on a physical remote device) Delivery (publish firmware) CI / CD Over-The-Air Firmware Upgrades Workflow Smart homes Smart cities Smart grids Virtual power plants Intelligent transportation
  • 11. Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP Demo Copyright ? 2018 JFrog, PlatformIO. All Rights Reserved https://github.com/platformio/bintray-secure-ota.git
  • 12. Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP Secure Bintray Client C++ open source library by PlatformIO #include <BintrayClient.h> const BintrayClient bintray( BINTRAY_USER, BINTRAY_REPO, BINTRAY_PACKAGE ); const String version = bintray.getLatestVersion(); const String firmwarePath = bintray.getBinaryPath(version); // download & flash image...
  • 13. Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP Initial configuration platformio.ini ; Please navigate to https://bintray.com/, create an account, ; repository, and add a package where PlatformIO will deploy firmwares ; api_token = Bintray.com > Edit Profile > API Key [bintray] user = ivankravets repository = platformio-ota package = bintray-secure-ota api_token = ${env.BINTRAY_API_TOKEN} ; Wi-Fi network settings [wifi] ssid = ${env.PIO_WIFI_SSID} password = ${env.PIO_WIFI_PASSWORD} [common] ; firmware version, please modify it between releases; positive integer value release_version = 1
  • 14. Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP Unit Testing Local & Remote #include <unity.h> void test_bintray_binary_path_is_valid(void) { const String binaryPath = bintray.getBinaryPath(bintray.getLatestVersion()); TEST_ASSERT_TRUE(binaryPath.length() > 0); TEST_ASSERT_TRUE(binaryPath.endsWith(".bin")); TEST_ASSERT_TRUE(binaryPath.indexOf(BINTRAY_USER) > 0); } // ... void setup() { UNITY_BEGIN(); RUN_TEST(test_bintray_client_credentials); RUN_TEST(test_wifi_connection); RUN_TEST(test_bintray_binary_path_is_valid); // ... UNITY_END(); }
  • 15. Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP CI/CD Pipeline Automated firmware delivery: any OS, any CI service install: - pip install -U platformio - platformio upgrade --dev - platformio update script: # Check compiler errors - platformio run # List remote devices - platformio remote device list # Run embedded test on a remote device - platformio remote test -r deploy: provider: script script: platformio run -e release -t upload
  • 16. Copyright @ 2018 JFrog, PlatformIO - All rights reserved. Ribbit with us: #swampUP THANK YOU!