Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Solved: Invalid partition table of otadata size can corrupt ota_0 partition

    Scheduled Pinned Locked Moved Issues & Bugs
    otabugpartition table
    2 Posts 1 Posters 822 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T Offline
      this.wiederkehr
      last edited by this.wiederkehr

      @xykon said in New beta firmware updater 1.13.1.b1:

      'otadata' : ["0x190000", "0x1000"]
      'ota_0' : ["0x1a0000", "0x180000"]

      According to the esp-idf docs otadata should be 0x2000 in size.

      Reading the source code in https://github.com/pycom/pycom-esp-idf/blob/master/components/app_update/esp_ota_ops.c I think making this partition only 4k is a serius bug. and will lead to having the first block (4k) of ota_0 data erased when updating the boot partition.

      static esp_err_t rewrite_ota_seq(uint32_t seq, uint8_t sec_id, const esp_partition_t *ota_data_partition)
      {
          esp_err_t ret;
      
          if (sec_id == 0 || sec_id == 1) {
              s_ota_select[sec_id].ota_seq = seq;
              s_ota_select[sec_id].crc = ota_select_crc(&s_ota_select[sec_id]);
              ret = esp_partition_erase_range(ota_data_partition, sec_id * SPI_FLASH_SEC_SIZE, SPI_FLASH_SEC_SIZE);
              if (ret != ESP_OK) {
                  return ret;
              } else {
                  return esp_partition_write(ota_data_partition, SPI_FLASH_SEC_SIZE * sec_id, &s_ota_select[sec_id].ota_seq, sizeof(ota_select));
              }
          } else {
              return ESP_ERR_INVALID_ARG;
          }
      }
      
      1 Reply Last reply Reply Quote 0
      • T Offline
        this.wiederkehr
        last edited by

        Checking pycom micropython source I see, that you are not useing the esp-idf functions for performing the update .... so no danger of corrupting the ota_0 slot. Still I wonder why you are doing "your one thing" instead of using the esp-idf functions ...

        (https://github.com/pycom/pycom-micropython-sigfox/blob/83e2f7f59e28d726a5a1d79377a5ec37f9e0065b/esp32/ftp/updater.c)

        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • 1 / 1
        • First post
          Last post

        Pycom on Twitter

        Pycom