Closed mhetrick closed 1 year ago
What's the file size of the .uimg file you're uploading? That address (0x74d714bf) is indeed out of range. The chip is 16MB, with the starting address at 0x70000000. Also, have you tried the dfu-util command line utility?
My bad! I was trying to copy the .elf file, not the .uimg file. Apologies for the noise on that one.
Reopening this as I'm hitting a similar issue.
Right now, I'm trying to uploading main.uimg, which is 4,018 KB in size. On the DFU upload website, it's telling me that NOR Flash available is 3.90234375 MiB
Name: STM Device in DFU Mode
MFG: STMicroelectronics
Serial: 384B36723139
DFU: [0483:df11] cfg=1, intf=0, alt=0, name="STM Device in DFU Mode" serial="384B36723139"
Selected memory region: NOR Flash (3.90234375MiB)
0x70080000-0x70466fff (readable, erasable, writable)
When attempting to write the firmware to the device, I get the outside of memory map error again.
OK I got to the bottom of this. With a lack of foresight, I set the USB DFU bootloader's max size to 999 * blocks of 4kB each, so just shy of 4MB.
On my unit here, I just tried changing it to the actual maximum application size (7.5MB), and it will load larger firmware files.
We actually could increase this a bit more, because there is a 16MB Flash chip and only 512kB needed for the bootloaders. The rest is split between "Internal" patch storage (including extra for wear-leveling) and firmware. Probably 8MB for storage of yml files is excessive, we could drop it down to 2MB and give ourselves more space for firmware.
In any case, this is easy to fix an existing unit with access to a JTAG programmer, but without that I'll have to write a custom firmware that loads a new DFU USB bootloader.
Great, I thankfully have a mini-JTAG adapter here! How do I go about changing the bootloader size on my unit?
Is it a JLink? Actually I went ahead and wrote the flash loader, and it works. It's probably the easiest solution.
Pull the flash-loader-usbdfu
branch and then in the firmware dir, run make flash_loader.elf
. It should build flash_loader.uimg
in the build/src/flash_loader
dir.
Load the uimg file using the same USB DFU process that you've already been using. The file is only 90kB or so, so you won't hit the 4MB limit error. Alternatively you could load it onto an SD card as if it were the regular application, if you prefer. When it's done, power cycle the unit. You should see the light toggle green/blue after a couple seconds. Success!
Now, power cycle holding down the rotary to enter USB DFU mode like normal. Connect to the computer and you should see the limit is now 7.5MB. Go ahead and flash the normal application. Done!
Excellent, that worked! Thank you.
On Windows 11, Chrome 116, I'm consistently receiving an error when attempting to use the recommended tool (https://devanlai.github.io/webdfu/dfu-util/) to upload firmware to the device.
Here's the log at the top of the screen: