SWIM achieve a similar ST-LINK function by, for STM8 download

Technique relies: SWIM communication, FLASH operation, serial port, DMA.

The main idea becomes, the command-line tool to achieve through the serial port, and then burned by slave swim host. Wherein the serial data transmission received via DMA.

There are introduced before SWIM communication, there is a need to see, this article introduces the idea when the STM8 SWIM for programming.

First, direct programming through WOTF.
This method does work, but the actual observed after the test, due to the failure rate is extremely slow WOTF led programming in the programming process. Not recommended.

Second, make yourself a slave flash programmer
we know, there are block programming when programming flash. And run in RAM block during programming procedures. We can use this feature, the program will write a good flash block of programming (programming address Specifies the address and the address data is programming), download to the RAM specified by the address the slave SWIM. Then the host machine so as to complete the self-control of the programming.
In this process we need is to pass over the serial data transmitted from the specified address of the RAM in the machine, the address will be programmed from the machine reached the specified address in RAM. We control the machine from the CPU to run ahead of time to burn the code into RAM in the completion of "self-programming."

Note:
We need to be written by a block of code can not finished, then we need a pause after programming, when a next reset programming (by controlling the slave CPU) Slave Slave then programmed by FLASH code.

If I need to I will consider FLASH update knowledge and DMA (If someone asks)

Guess you like

Origin blog.csdn.net/qq_43448742/article/details/89642778