‎2021-06-01 06:43 AM
Hello everyone,
I bought a tool that uses a STM32F103C8T6 with a program on it to transmit some CAN data. I would like to read the program that is currently on the tool and edit it.
Is it feasible ? Or is the memory protected ?
Thanks in advance for your help ! :grinning_face:
‎2021-06-01 06:47 AM
I would expect most companies selling commercial tools to enable read protection.
If read protection is off, you can read the compiled assembly code, but not the source code. Editing the program to do something useful would require a significant technical ability and time investment.
‎2021-06-01 07:45 AM
Thanks for the quick and detailed answer.
I'll try it out and see if I can get something. Do you know where I can find some info on how to connect to the STM32F103 and check if the read protection is activated ? The PCB I have provides some pins that are connected to VDD_1, PA09, PA10, PA13 and PA14. I also have a "FT232RL FTDI Mini USB to TTL Serial Converter Adapter Module" that I bought for that purpose.
Kind regards
‎2021-06-01 08:22 AM
If you need to ask that question, it suggests that you're not in a position to do much with the code if you do manage to read it.
You would need to connect to the microcontroller's SWD/JTAG Debug port using an ST-Link or similar debug probe.
‎2021-06-01 08:32 AM
Indeed I don't have much experience with micro processors. I do have a bit of experience with coding tho and I'm pretty sure the code is very simple (only a few lines). So I'll give shot, nothing to lose anyway.
‎2021-06-01 08:48 AM
App Note AN2606 would cover modes of connectivity, PA9/PA10 would provide access to the boot loader
STM32 Cube Programmer can use that via UART/COM mode
PA13/PA14 would require a ST-LINK pod, and STM32 Cube Programmer could use that also
‎2021-06-01 08:50 AM
I don't think the code is in the form you're imagining, a few lines becomes a needle in the haystack.
‎2021-06-01 08:55 AM
If what you want to do is read what is written inside the microcontroller so you can change some code.
Short answer no.
Long answer:
What the microcontroller memory contains is the already compiled machine code (unless youre using micropython or some other satanic scripting engine).
This means youre just going to be able to read BIP BUP BIP, maybe some static strings. Reverse engineering that would be VEEERY HARD.
‎2021-06-01 08:59 AM
"I'm pretty sure the code is very simple (only a few lines)"
In that case, probably easier to just write it from scratch to do what you want.
‎2021-06-02 12:27 AM
Thanks a lot for the help !