glenn20 / mp-image-tool-esp32

Tool for manipulating MicroPython esp32 image files.
MIT License
19 stars 2 forks source link

`No partition table found.` #1

Closed MRIIOT closed 3 months ago

MRIIOT commented 6 months ago

I am trying to inspect my image, but am receiving a PartitionError.

% ./mp-image-tool-esp32 ../micropython/ports/esp32/build/micropython.bin
Opening image file: ../micropython/ports/esp32/build/micropython.bin... 
Chip type: esp32 
Flash size: 16MB 
PartitionError: No partition table found. 
Traceback (most recent call last):
  File "mp-image-tool-esp32/./mp-image-tool-esp32", line 15, in <module>
    sys.exit(main())
             ^^^^^^
  File "mp-image-tool-esp32/./mp-image-tool-esp32", line 11, in main
    return src.mp_image_tool_esp32.main.main()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "mp-image-tool-esp32/src/mp_image_tool_esp32/main.py", line 285, in main
    raise err
  File "mp-image-tool-esp32/src/mp_image_tool_esp32/main.py", line 279, in main
    process_arguments()
  File "mp-image-tool-esp32/src/mp_image_tool_esp32/main.py", line 150, in process_arguments
    table: PartitionTable = copy.copy(image.table)
                                      ^^^^^^^^^^^
  File "/usr/local/Cellar/python@3.11/3.11.6_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/functools.py", line 1001, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "mp-image-tool-esp32/src/mp_image_tool_esp32/image_file.py", line 200, in table
    table.from_bytes(data)
  File "mp-image-tool-esp32/src/mp_image_tool_esp32/partition_table.py", line 169, in from_bytes
    raise PartitionError("No partition table found.", self)
src.mp_image_tool_esp32.partition_table.PartitionError: No partition table found.

My typical build artifacts include:

Partition table is:

#   Name,      Type,     SubType,    Offset,         Size,     Flags
     nvs,      data,         nvs,          ,     0x004000,
 otadata,      data,         ota,          ,     0x002000,
phy_init,      data,         phy,          ,     0x001000,
   ota_0,       app,       ota_0,          ,     0x270000,
   ota_1,       app,       ota_1,          ,     0x270000,
     vfs,      data,         fat,          ,     0xb00000,
glenn20 commented 6 months ago

The micropython.bin file in the build directories are what espressif calls an "app image" file. They include only the micropython firmware and do not include the bootloader or partition table.

The firmware.bin files combine the bootloader, partition table and micropython.bin file into a full firnware foir writing to a new device.

Try ./mp-image-tool-esp32 ../micropython/ports/esp32/build/firmware.bin instead.

MRIIOT commented 6 months ago

Makes sense. Interesting, my build does not produce a firmware.bin.

idf.py -D MICROPY_BOARD=$BOARD_NAME -D MICROPY_BOARD_VARIANT=$VARIANT_NAME -B $BUILD_FOLDER_NAME build

MRIIOT commented 6 months ago

Ok, I used make instead of idf.py, which did produce a firmware.bin but same No partition table found error.

glenn20 commented 6 months ago

Ooh. That's odd. You should use the make command rather than idf.py to build micropython. You may need to rebuild from scratch (eg. "make clean"). See the instructions in ports/esp32/README.md.

MRIIOT commented 6 months ago

I did, but let me try flashing the built firmware.bin to make sure it actually works.

glenn20 commented 3 months ago

I am closing this issue as I have been unable to replicate and there is nho new information on the bug.

If you are still getting "No partition table found." errors, please re-open and provide additional information.