How to get access to firmware flashing functions?


#21

Hi @ScruffR. Thanks for responding and I’ll try to be more clear. I moved this to its own topic to avoid bloating this one!

Thanks,
Brian


#22

@rickkas7 Hi!

I made a version of the tinker flashing code that you shared above with some new logs. I added the following Serial.print to look at the file.file_length.

Serial.printlnf("chunk_address=0x%x chunk_size=%d (%d < %d == %s)", file.chunk_address, file.chunk_size, offset, file.file_length, (offset < file.file_length) ? "continue" : "break");

This is the output I got:

starting flash size=3952
chunk_size=512 file_address=0x80c0000
chunk_address=0x80c0000 chunk_size=512 (0 < 262144 == continue)
chunk_address=0x80c0200 chunk_size=512 (512 < 262144 == continue)
...
chunk_address=0x80ffc00 chunk_size=512 (261120 < 262144 == continue)
chunk_address=0x80ffe00 chunk_size=512 (261632 < 262144 == continue)
upload complete

Why is file.file_size equal to 262144 instead of 3952? 262144=512^2. How is this related to the chunk size?

Related question here: Read Firmware from SD card and flash to P1 or Photon

Thanks in advance :slight_smile: