@myval apologies if I was rude. I’m also kind of lost here and making my way through, not an expert either by any means. I’m glad the “hacked bootloader” worked on your board too. With it, SD update didn’t work either for me… then I found out the Marlin4MPMD includes a copy of the stock bootloader, which restores the SD Update functionality! If the “hacked” one worked for you, I guess this one will too: Marlin4MPMD/bootloader binary at master · mcheah/Marlin4MPMD · GitHub
The readme file mentions that the bootloader is “optional if debugging directly on target hardware” so I guess your approach is right and should work, even though I couldn’t make it work. I’m also trying to make it work with Marlin starting at 0x08002000 so then I can update via SD.
Also ended up in you situation a couple of times:
.pioinit:13: Error in sourced command file:
Remote communication error. Target disconnected.: Success.
Would like to better understand why this happens in the first place, but at least (I think) I found a way out when OpenOCD doesn’t wan’t to connect (but the STLink Utility does):
- Connect via STLink Utility
- Erase chip
After that, uploads work again (util I happen to break anything at some point and then have to repeat) ![:man_shrugging: :man_shrugging:](https://community.platformio.org/images/emoji/twitter/man_shrugging.png?v=12)
I think now I’m a flow where I can upload reliably and restore booloaders or whatever I need, check what’s in memory, even potentially following up the disassembly with Binary Ninja… but still can’t reach the actual code.
@maxgerhardt Is it necessary to rename ~/.platformio\packages\framework-arduinoststm32\variants\MALYANM200_F070CB\startup_M200_f070xb.S
? Think that when I do I end up with a very small binary, but if I make it availble by renaming it again and use the debugger, I end up with this weird pc. Checking the memory of the STLink I see there’s a ELF header at 0x08000000, with part of it at 0x08000004 setting the wrong PC for the RESET_VECTOR
.
What I would like to do is compile something with Platformio (Marlin in this case) so the actual code (no ELF headers or anything) ends up at 0x08002000. This way, I can keep my bootloader, which after running will leave me there and start debugging from that point. I’m a bit lost with which files/settings (json files, variant, .S and the likes) would be neccesary to configure or combine so I can get there (leave the bootloader and load the debug firmware at 0x08002000).
Thanks again!