{"id":381,"date":"2019-07-15T23:01:09","date_gmt":"2019-07-15T14:01:09","guid":{"rendered":"https:\/\/idis.dev\/outdoorlife\/?p=381"},"modified":"2020-03-29T11:34:12","modified_gmt":"2020-03-29T02:34:12","slug":"https-ota","status":"publish","type":"post","link":"https:\/\/idis.dev\/blog\/https-ota\/","title":{"rendered":"esp32\u3067https\u7d4c\u7531\u3067\u30bd\u30d5\u30c8\u3092\u81ea\u52d5\u66f4\u65b0(OTA)\u3059\u308b"},"content":{"rendered":"\n<h2>\u306f\u3058\u3081\u306b<\/h2>\n\n\n\n<p> IoT\u3092\u958b\u767a\u3059\u308b\u306b\u5f53\u305f\u308a\u3001\u307e\u305a\u307f\u3093\u306a\u304c\u6b32\u3057\u3044\u3068\u601d\u3046\u6a5f\u80fd\u304c\u30bd\u30d5\u30c8\u306e\u81ea\u52d5\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u6a5f\u80fd(OTA)\u3067\u3059\u3002 <br><br>ESP32\u3092\u4f7f\u3063\u305fOTA\u306f\u69d8\u3005\u306a\u3068\u3053\u308d\u3067\u7d39\u4ecb\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u305d\u306e\u307b\u3068\u3093\u3069\u304cwifi\u30ed\u30fc\u30ab\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u5185\u3067\u306e\u66f4\u65b0\u3067\u3001\u30ea\u30e2\u30fc\u30c8\u30b5\u30fc\u30d0\u304b\u3089\u9060\u9694\u7d4c\u7531\u3067\u306e\u30bd\u30d5\u30c8\u66f8\u304d\u8fbc\u307f\u4e8b\u4f8b\u306f\u307b\u3068\u3093\u3069\u306a\u3044\u3067\u3059\u3002<br><br> \u5546\u7528\u306e\u3082\u306e\u3067\u3088\u3051\u308c\u3070\u3001Amazon IoT\u3068\u304b\u3092\u5229\u7528\u3059\u308c\u3070\u3044\u3044\u3093\u3067\u3059\u3051\u3069\u3001\u7121\u6599\u3067\u3084\u308b\u65b9\u6cd5\u304c\u4ee5\u4e0b\u306e\u30b5\u30a4\u30c8\u3067\u66f8\u304b\u308c\u3066\u3044\u305f\u306e\u3067\u5b9f\u969b\u306b\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002 <\/p>\n\n\n\n<p><a href=\"http:\/\/www.lucadentella.it\/en\/2018\/10\/27\/esp32-37-ota-via-https\/\">http:\/\/www.lucadentella.it\/en\/2018\/10\/27\/esp32-37-ota-via-https\/<\/a><\/p>\n\n\n\n<p>ESP32\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u5185\u306b\u3042\u3089\u304b\u3058\u3081\u30bd\u30d5\u30c8\u66f4\u65b0\u51e6\u7406\u3092\u4ed5\u8fbc\u3093\u3067\u304a\u3044\u3066\u3001\u7d04\uff11\uff10\u79d2\u304a\u304d\u306b\u30b5\u30fc\u30d0\u30fc\u306ejson\u30d5\u30a1\u30a4\u30eb\u3092\u53c2\u7167\u3059\u308b\u30bf\u30b9\u30af\u3092\u7d44\u307f\u3001\u30d0\u30fc\u30b8\u30e7\u30f3UP\u3092\u691c\u77e5\u3057\u305f\u3089ESP\u30bd\u30d5\u30c8\u66f4\u65b0\u3092\u59cb\u3081\u308b\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002<br> \u4eca\u56de\u3084\u308b\u3053\u3068\u306f\u4ee5\u4e0b\u3068\u306a\u308a\u307e\u3059\u3002 <\/p>\n\n\n\n<div class=\"wp-block-dvaux-frame sc_frame_wrap inline\"><div class=\"sc_frame_title inline\" style=\"background-color:#2ac113\">\u8981\u4ef6<\/div><div class=\"sc_frame\" style=\"background-color:#fff;border-color:#2ac113\">\n<ul><li>\u30e6\u30fc\u30b6\u304c\u4f55\u3082\u3057\u306a\u304f\u3066\u3082\u5e38\u306b\u6700\u65b0\u306e\u30bd\u30d5\u30c8\u3067IoT\u7aef\u672b\u304c\u52d5\u4f5c<\/li><li> https(SSL)\u7d4c\u7531\u3067\u30bb\u30ad\u30e5\u30a2\u306b\u30bd\u30d5\u30c8\u3092\u66f4\u65b0<\/li><li>\u958b\u767a\u74b0\u5883\u306fVisual Studio Code + PlatformIO + ESP-IDF<\/li><\/ul>\n<\/div><\/div>\n\n\n\n<div><span>\u30bd\u30fc\u30b9\u306f\u30b3\u30c1\u30e9\u3002\u4ee5\u4e0b\u8981\u70b9\u3092\u8a18\u8f09\u3002<\/span><\/div>\n<div class=\"button btn  block blue\" style=\"text-align: left;\"><a href=\"https:\/\/github.com\/y1255018\/esp32-https-ota\" class=\"midium\" target=\"_blank\" rel=\"noopener noreferrer\"><i class=\"fa fa-github before\" aria-hidden=\"true\"><span>fa-github<\/span><\/i>GitHub<\/a><\/div>\n\n\n\n<h2 class=\"wp-block-dvaux-headline sc_heading solid\" style=\"background-color:#000;color:#fff;border-color:#000\"><div class=\"sc_title\">WIFI\u306e\u8a2d\u5b9a<\/div><\/h2>\n\n\n\n<div>\n<div>wifi_functions.h \u306b\u81ea\u8eab\u306ewifi\u60c5\u5831\u3092\u66f8\u304f\u3002<\/div>\n<div>\n<pre class=\"line-numbers\"><code class=\"language-markup\">#define WIFI_SSID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\"your-ssid\"\n#define WIFI_PASS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\"your-password\"<\/code><\/pre>\n<\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-dvaux-headline sc_heading solid\" style=\"background-color:#000;color:#fff;border-color:#000\"><div class=\"sc_title\"> OTA\u7528\u306bESP32\u306e\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u9818\u57df\u3092\u78ba\u4fdd\u3059\u308b <\/div><\/h2>\n\n\n\n<p>costom.csv\u306bESP32\u306e\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u9818\u57df\u306e\u8a2d\u5b9a\u3092\u66f8\u304f\u3002\u3056\u3063\u304f\u308a\u8aac\u660e\u3059\u308b\u3068\u3001<\/p>\n<p>nvs\uff1a<span>\u30d6\u30fc\u30c8\u30ed\u30fc\u30c0\u30fc\u9818\u57df\u3001<\/span><span>phy_init\uff1apython\u8d77\u52d5\u9818\u57df\uff1f\u3001<\/span><span>factory\uff1a\u5de5\u5834\u51fa\u8377\u9818\u57df\u3001otadata\uff1aota\u60c5\u5831\u672c\u4f53\u3001ota_0,ota_1\uff1a\u30bd\u30d5\u30c8\u66f8\u304d\u8fbc\u307f\u6642\u306e\u30b9\u30ef\u30c3\u30d7\u9818\u57df\u3067\u4e8c\u3064\u304c\u5fc5\u8981\u3068\u306a\u308b\u3002\u9806\u756a\u304c\u5927\u4e8b\u307f\u305f\u3044\u3067\u4e0b\u624b\u306b\u9806\u756a\u5165\u308c\u66ff\u3048\u308b\u3068\u52d5\u304b\u304f\u306a\u308b\u306e\u3067\u6ce8\u610f\u3002<\/span><\/p>\n<pre class=\"line-numbers\"><code class=\"language-markup\"># Name,   Type, SubType, Offset,   Size, Flags\n# Note: if you change the phy_init or app partition offset, make sure to change the offset in Kconfig.projbuild\nnvs,      data, nvs,     ,        0x6000,\nphy_init, data, phy,     ,        0x1000,\nfactory,  app,  factory, ,        1M,\notadata,  data, ota,     ,        0x2000,\nota_0,    app,  ota_0,   ,        1M,\nota_1,    app,  ota_1,   ,        1M,<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-dvaux-headline sc_heading solid\" style=\"background-color:#000;color:#fff;border-color:#000\"><div class=\"sc_title\">SSL\u8a3c\u660e\u66f8\u306e\u8a2d\u5b9a<\/div><\/h2>\n\n\n\n<p>\u8a3c\u660e\u66f8\u304c\u3000server_certs\/certs.pem\u3000\u306b\u3042\u308b\u3068\u3059\u308b\u3068\u3001\u8a3c\u660e\u66f8\u306e\u547c\u3073\u51fa\u3057\u65b9\u306f\u4ee5\u4e0b\u3068\u306a\u308b\u3002<\/p>\n<div>\n<div>\n<pre class=\"line-numbers\"><code class=\"language-markup\">\/\/ server certificates\nextern const char server_cert_pem_start[] asm(\"_binary_server_certs_certs_pem_start\");\nextern const char server_cert_pem_end[] asm(\"_binary_server_certs_certs_pem_end\");<\/code><\/pre>\n<\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-dvaux-headline sc_heading solid\" style=\"background-color:#000;color:#fff;border-color:#000\"><div class=\"sc_title\">\u30b3\u30f3\u30d1\u30a4\u30eb\u8a2d\u5b9a\uff08PlatformIO Project  Configuration\uff09<\/div><\/h2>\n\n\n\n<div>platformio.ini\u306b\u74b0\u5883\u8a2d\u5b9a\u3092\u66f8\u304f\u3002<\/div>\n<div>\u30fb\u30b7\u30ea\u30a2\u30eb\u30e2\u30cb\u30bf\u306e\u30dc\u30fc\u30ec\u30fc\u30c8\u3092115200\u306b\u5408\u308f\u305b\u3066\u6587\u5b57\u5316\u3051\u5bfe\u7b56\u3002<\/div>\n<div>\u30fb\u30d1\u30fc\u30c6\u30a3\u30b7\u30e7\u30f3\u9818\u57df\u306e\u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb<code class=\"language-markup\"> custom.csv\u3092\u6307\u5b9a\u3002<\/code><\/div>\n<div>\u30fb\u8a3c\u660e\u66f8\u3092\u5185\u5305\u3057\u3066\u30b3\u30f3\u30d1\u30a4\u30eb\u3055\u305b\u308b\u305f\u3081\u306b\u5834\u5408\u306f\u3001<code class=\"language-markup\">certs.pem\u3092\u6307\u5b9a\u3002<\/code><\/div>\n<div><\/div>\n<div>\n<div>\n<pre class=\"line-numbers\"><code class=\"language-markup\">[env:esp32dev]\nplatform = espressif32\nframework = espidf\nboard = esp32dev\nmonitor_speed = 115200\nboard_build.partitions = custom.csv\nbuild_flags =\n-DCOMPONENT_EMBED_TXTFILES=server_certs\/certs.pem<\/code><\/pre>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u306f\u3058\u3081\u306b IoT\u3092\u958b\u767a\u3059\u308b\u306b\u5f53\u305f\u308a\u3001\u307e\u305a\u307f\u3093\u306a\u304c\u6b32\u3057\u3044\u3068\u601d\u3046\u6a5f\u80fd\u304c\u30bd\u30d5\u30c8\u306e\u81ea\u52d5\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u6a5f\u80fd(OTA)\u3067\u3059\u3002 ESP32\u3092\u4f7f\u3063\u305fOTA\u306f\u69d8\u3005\u306a\u3068\u3053\u308d\u3067\u7d39\u4ecb\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u305d\u306e\u307b\u3068\u3093\u3069\u304cwifi\u30ed\u30fc\u30ab\u30eb\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u5185\u3067\u306e\u66f4\u65b0\u3067\u3001\u30ea\u30e2\u30fc\u30c8\u30b5\u30fc\u2026<\/p>\n","protected":false},"author":1,"featured_media":453,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[22],"tags":[23,25,24,5],"_links":{"self":[{"href":"https:\/\/idis.dev\/blog\/wp-json\/wp\/v2\/posts\/381"}],"collection":[{"href":"https:\/\/idis.dev\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idis.dev\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idis.dev\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idis.dev\/blog\/wp-json\/wp\/v2\/comments?post=381"}],"version-history":[{"count":49,"href":"https:\/\/idis.dev\/blog\/wp-json\/wp\/v2\/posts\/381\/revisions"}],"predecessor-version":[{"id":692,"href":"https:\/\/idis.dev\/blog\/wp-json\/wp\/v2\/posts\/381\/revisions\/692"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/idis.dev\/blog\/wp-json\/wp\/v2\/media\/453"}],"wp:attachment":[{"href":"https:\/\/idis.dev\/blog\/wp-json\/wp\/v2\/media?parent=381"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idis.dev\/blog\/wp-json\/wp\/v2\/categories?post=381"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idis.dev\/blog\/wp-json\/wp\/v2\/tags?post=381"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}