mirror of
https://github.com/m5stack/M5Stack_MicroPython.git
synced 2026-05-20 10:14:44 -07:00
Updated BUILD.sh
do not permit 'flash' command if the firmware was not built fix wrong partition sizes in some cases Updated OTA module allow setting boot partition also for ota types
This commit is contained in:
@@ -179,6 +179,15 @@ do
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${arg}" == "flash" ]; then
|
||||
if [ ! -f "build/MicroPython.bin" ]; then
|
||||
echo "'build/MicroPython.bin' not found"
|
||||
echo "The firmware must be built before flashing!"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
executeCommand
|
||||
result=$?
|
||||
|
||||
|
||||
@@ -124,11 +124,10 @@ set_partitions() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ${size} -le 0 ]; then size=1024; fi
|
||||
if [ ${size} -le 64 ]; then size=1024; fi
|
||||
if [ ${fbin_size} -gt ${size} ]; then
|
||||
size=$(( (($fbin_size / 64) + 1) * 64 ));
|
||||
fi
|
||||
|
||||
if [ ${part_lay3} == "yes" ]; then
|
||||
fs_size=$(( $flash_sz - $size - $size - $size - 64))
|
||||
fs_start=$(( (64 + $size + $size + $size) * 1024 ))
|
||||
@@ -172,7 +171,7 @@ set_partitions() {
|
||||
echo "internalfs, data, ${PART_SUB_TYPE} , ${fs_size}K," >> partitions_mpy.csv
|
||||
else
|
||||
# --- Single partition layout is used ---
|
||||
if [ ${size} -le 0 ]; then size=1024; fi
|
||||
if [ ${size} -le 64 ]; then size=1024; fi
|
||||
if [ ${fbin_size} -gt ${size} ]; then
|
||||
size=$(( (($fbin_size / 64) + 1) * 64 ));
|
||||
fi
|
||||
|
||||
@@ -620,19 +620,39 @@ STATIC mp_obj_t mod_ota_set_boot(mp_uint_t n_args, const mp_obj_t *pos_args, mp_
|
||||
|
||||
part_name = (char *)mp_obj_str_get_str(args[0].u_obj);
|
||||
|
||||
const esp_partition_t *boot_part = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_FACTORY, part_name);
|
||||
if (boot_part == NULL) {
|
||||
ESP_LOGE(TAG, "Partition not found !");
|
||||
return mp_const_false;
|
||||
const esp_partition_t *boot_part1 = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_FACTORY, part_name);
|
||||
const esp_partition_t *boot_part2 = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_OTA_0, part_name);
|
||||
const esp_partition_t *boot_part3 = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_OTA_1, part_name);
|
||||
if ((boot_part1 == NULL) && (boot_part2 == NULL) && (boot_part3 == NULL)) {
|
||||
ESP_LOGE(TAG, "Partition not found !");
|
||||
return mp_const_false;
|
||||
}
|
||||
|
||||
// === Set boot partition ===
|
||||
esp_err_t err = esp_ota_set_boot_partition(boot_part);
|
||||
char sptype[16] = {'\0'};
|
||||
char splabel[16] = {'\0'};
|
||||
esp_err_t err = ESP_FAIL;
|
||||
|
||||
if (boot_part1 != NULL) {
|
||||
sprintf(sptype,"Factory");
|
||||
sprintf(splabel, boot_part1->label);
|
||||
err = esp_ota_set_boot_partition(boot_part1);
|
||||
}
|
||||
else if (boot_part2 != NULL) {
|
||||
sprintf(sptype,"OTA_1");
|
||||
sprintf(splabel, boot_part2->label);
|
||||
err = esp_ota_set_boot_partition(boot_part2);
|
||||
}
|
||||
else if (boot_part3 != NULL) {
|
||||
sprintf(sptype,"OTA_2");
|
||||
sprintf(splabel, boot_part3->label);
|
||||
err = esp_ota_set_boot_partition(boot_part3);
|
||||
}
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "OTA set_boot_partition failed! err=0x%x", err);
|
||||
return mp_const_false;
|
||||
}
|
||||
ESP_LOGW(TAG, "On next reboot the system will be started from '%s' partition", boot_part->label);
|
||||
ESP_LOGW(TAG, "On next reboot the system will be started from '%s' partition (%s)", splabel, sptype);
|
||||
|
||||
return mp_const_true;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// MicroPython version info
|
||||
#define MICROPY_GIT_TAG "ESP32_LoBo_v3.1.7"
|
||||
#define MICROPY_GIT_TAG "ESP32_LoBo_v3.1.8"
|
||||
#define MICROPY_GIT_HASH "g2ddee729"
|
||||
#define MICROPY_BUILD_DATE "2017-01-18"
|
||||
#define MICROPY_BUILD_DATE "2017-01-19"
|
||||
#define MICROPY_VERSION_MAJOR (3)
|
||||
#define MICROPY_VERSION_MINOR (1)
|
||||
#define MICROPY_VERSION_MICRO (7)
|
||||
#define MICROPY_VERSION_STRING "3.1.7"
|
||||
#define MICROPY_VERSION_MICRO (8)
|
||||
#define MICROPY_VERSION_STRING "3.1.8"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user