Skip to content

Add instructions for using stlink utility in Linux for flashing MCUs#78

Open
gregoster wants to merge 4 commits intoRappetor:mainfrom
gregoster:main
Open

Add instructions for using stlink utility in Linux for flashing MCUs#78
gregoster wants to merge 4 commits intoRappetor:mainfrom
gregoster:main

Conversation

@gregoster
Copy link
Copy Markdown
Contributor

Some (initial?) wording on how to use the stlink utilities (st-info, st-flash, etc.) to read/erase/write firmware to the MCUs. Feel free to use as little or much of this as you prefer.

@Rappetor
Copy link
Copy Markdown
Owner

Thanks, I will give it a try somewhere this week and see what's possible (especially flashing the mcu's from the printer itself). Think we will have to add some more clear instructions on how to install (what package to get, how to install this via the command line etc) since we have to assume probably most users have limited to no experience with this. Hopefully it will just install and work without too many dependencies or issues.

If it works (also with the single digit clones), and I can make an automated script for it, I might just exchange the whole section with this solution. So worth checking out for sure! 😄

@janderholm
Copy link
Copy Markdown

For what it's worth, I've used the stlink from the printer itself when debugging the MCUs and it worked. I did a bunch of flashing. The package is called stlink-tools.

Just make sure not to connect the 3V. I don't think GND is needed either but I didn't check for continuity.

Actually, if there are two GPIOs available from the SoC no stlink is needed at all. Only two wires. Flashing can be done with OpenOCD and linuxgpiod similar to this:
https://www.klipper3d.org/Bootloaders.html#running-openocd-on-the-raspberry-pi

That guide uses bcm2835gpio where we would want to use linuxgpiod instead.

I haven't found any schematics for the mainboard though so don't know if any gpios are available directly from the SoC.

@spamwax
Copy link
Copy Markdown

spamwax commented Jan 14, 2025

there is problematic issue with this instruction at st-flash read _mainboard_original_firmware.bin 0x8000000 128k
The amount of read needs to match the size of mcu memory otherwise the file produced by this method is very different than the one created by STM32CubeProgrammer

In my case, for the mainboard I notice STM32Cube reporting 512k memory so I used that and the resulting file was identical to that of STM32Cube

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants