microchip-pic-avr-tools / pymcuprog

a Python utility for programming various Microchip MCU devices using Microchip CMSIS-DAP based debuggers
MIT License
96 stars 22 forks source link

utils/pagealign: operate on a clone of the input array #11

Closed KrystianD closed 2 years ago

KrystianD commented 2 years ago

Otherwise, input array was being modified, which had a negative impact on other parts of the app.

I figured it out when added CRC value at the end of the flash without gaps filled with 0xFF (to speed the upload and verification processes up), which resulted in 2-byte segment at the end of the ihex file:

:020000040000FA
:10000000F3C00000F9C00000F7C00000F5C0000018
:10001000F3C00000F1C00000EFC00000EDC0000020
...
:10028000215080409040E1F700C00000E8CF8BE2B1
:0A029000EBCF8BE2F0CFF894FFCF24
:023FFE0012238C <--- here is the CRC
:00000001FF

pymcuprog was returning error while performing verification of this section:

pymcuprog.pymcuprog_main - ERROR - Operation failed with ValueError: 126 bytes of data at offset 16382 is outside the boundaries of 'flash' with size 16384

It turned out data buffer was modified during write (from length of 2 to the length of 64), so verification process wanted to verify starting at 16382 and check 126 bytes, what resulted in the error above.

xedbg commented 2 years ago

Thanks @KrystianD Logged internally as DSG-4230