From fb8fe671d695c5239a6f8f5e549d55ab1776d55f Mon Sep 17 00:00:00 2001 From: Me No Dev Date: Fri, 10 Feb 2017 14:11:24 +0200 Subject: [PATCH] New partitions (#192) * Add new partition scheme * Init NVS early, so it can be used without BT or WiFi --- cores/esp32/esp32-hal-misc.c | 2 +- libraries/WiFi/src/WiFiAP.cpp | 4 ++-- platform.txt | 2 +- tools/partitions/boot_app0.bin | Bin 0 -> 8192 bytes tools/partitions/default.bin | Bin 0 -> 3072 bytes tools/partitions/default.csv | 10 ++++++---- tools/platformio-build.py | 7 +++---- 7 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 tools/partitions/boot_app0.bin create mode 100644 tools/partitions/default.bin diff --git a/cores/esp32/esp32-hal-misc.c b/cores/esp32/esp32-hal-misc.c index 1fd1d743..0d72e752 100644 --- a/cores/esp32/esp32-hal-misc.c +++ b/cores/esp32/esp32-hal-misc.c @@ -28,7 +28,6 @@ void arduino_phy_init() if(initialized){ return; } - nvs_flash_init(); esp_phy_calibration_mode_t calibration_mode = PHY_RF_CAL_PARTIAL; if (rtc_get_reset_reason(0) == DEEPSLEEP_RESET) { calibration_mode = PHY_RF_CAL_NONE; @@ -106,6 +105,7 @@ void initWiFi() __attribute__((weak)); void initWiFi() {} void initArduino(){ + nvs_flash_init(); init(); initVariant(); initWiFi(); diff --git a/libraries/WiFi/src/WiFiAP.cpp b/libraries/WiFi/src/WiFiAP.cpp index 9db49196..0ce76ab2 100644 --- a/libraries/WiFi/src/WiFiAP.cpp +++ b/libraries/WiFi/src/WiFiAP.cpp @@ -253,7 +253,7 @@ const char * WiFiAPClass::softAPgetHostname() */ bool WiFiAPClass::softAPsetHostname(const char * hostname) { - return tcpip_adapter_set_hostname(TCPIP_ADAPTER_IF_AP, hostname) == 0; + return tcpip_adapter_set_hostname(TCPIP_ADAPTER_IF_AP, hostname) == ESP_OK; } /** @@ -262,7 +262,7 @@ bool WiFiAPClass::softAPsetHostname(const char * hostname) */ bool WiFiAPClass::softAPenableIpV6() { - return tcpip_adapter_create_ip6_linklocal(TCPIP_ADAPTER_IF_AP) == 0; + return tcpip_adapter_create_ip6_linklocal(TCPIP_ADAPTER_IF_AP) == ESP_OK; } /** diff --git a/platform.txt b/platform.txt index 81045758..1ae01d2a 100644 --- a/platform.txt +++ b/platform.txt @@ -87,4 +87,4 @@ recipe.size.regex.data=^(?:\.dram0\.data|\.dram0\.bss)\s+([0-9]+).* tools.esptool.upload.protocol=esp32 tools.esptool.upload.params.verbose= tools.esptool.upload.params.quiet= -tools.esptool.upload.pattern={cmd} --chip esp32 --port "{serial.port}" --baud {upload.speed} --before default_reset --after hard_reset write_flash -z --flash_freq {build.flash_freq} --flash_mode {build.flash_mode} --flash_size {build.flash_size} 0x1000 "{runtime.platform.path}/tools/sdk/bin/bootloader.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin" 0x10000 "{build.path}/{build.project_name}.bin" +tools.esptool.upload.pattern={cmd} --chip esp32 --port "{serial.port}" --baud {upload.speed} --before default_reset --after hard_reset write_flash -z --flash_freq {build.flash_freq} --flash_mode {build.flash_mode} --flash_size {build.flash_size} 0x1000 "{runtime.platform.path}/tools/sdk/bin/bootloader.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin" 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0x10000 "{build.path}/{build.project_name}.bin" diff --git a/tools/partitions/boot_app0.bin b/tools/partitions/boot_app0.bin new file mode 100644 index 0000000000000000000000000000000000000000..13562cabb9648287fdf70d2a22789fdf1e4156b4 GIT binary patch literal 8192 zcmeI#u?+wq2n0Z!&B7Ip%ZdwNPjZydJlFk*h+E9ra}_6R0t5&UAV7cs0RjXF5FkLH gk-)3}W&dyVhNuJx5FkK+009C72oNAZfWSu}0Te{nn*aa+ literal 0 HcmV?d00001 diff --git a/tools/partitions/default.bin b/tools/partitions/default.bin new file mode 100644 index 0000000000000000000000000000000000000000..283b2ebbeebae41abfdb03e025c5d3792cb3168a GIT binary patch literal 3072 zcmZ1#z{tcffq{V`fPo>etQg2Z1*-xW85kY_#S|DA@=Fp^5=#cssU1o z1qB8ul0XhnUXTHVAo7No@{COk42nQud4}SG%(OH#C;T4;qaiRF0;3@?8UmvsFd71* QAut*OqaiRF0#pkD0Mt%q#Q*>R literal 0 HcmV?d00001 diff --git a/tools/partitions/default.csv b/tools/partitions/default.csv index 5c6cd8d1..92b29eeb 100644 --- a/tools/partitions/default.csv +++ b/tools/partitions/default.csv @@ -1,4 +1,6 @@ -# Name, Type, SubType, Offset, Size, Flags -nvs, data, nvs, 0x9000, 0x6000, -phy_init, data, phy, 0xf000, 0x1000, -factory, app, factory, 0x10000, 1M, +# Name, Type, SubType, Offset, Size, Flags +nvs, data, nvs, 0x9000, 0x5000 +otadata, data, ota, 0xe000, 0x2000 +app0, app, ota_0, 0x10000, 1M, +app1, app, ota_1, , 1M, +spiffs, data, spiffs, , 0x1F0000, diff --git a/tools/platformio-build.py b/tools/platformio-build.py index 250d095f..ab998f3b 100644 --- a/tools/platformio-build.py +++ b/tools/platformio-build.py @@ -102,10 +102,9 @@ env.Append( ], UPLOADERFLAGS=[ - "0x1000", '"%s"' % join(FRAMEWORK_DIR, "tools", - "sdk", "bin", "bootloader.bin"), - "0x8000", '"%s"' % join(FRAMEWORK_DIR, "tools", - "sdk", "bin", "partitions_singleapp.bin"), + "0x1000", '"%s"' % join(FRAMEWORK_DIR, "tools", "sdk", "bin", "bootloader.bin"), + "0x8000", '"%s"' % join(FRAMEWORK_DIR, "tools", "partitions", "default.bin"), + "0xe000", '"%s"' % join(FRAMEWORK_DIR, "tools", "partitions", "boot_app0.bin"), "0x10000" ] )