Program download and simulation

1、FlyMCU:Program download

FlyMCU software can download the compiled program code (hex file) to the target MCU chip through the serial port.

1.1、Generate.hex files

Using STM32CubeIDE will not generate.hex files by default,You need to check the appropriate option.

image-20230926152839631

image-20230926152934564

image-20230926152958123

1.2、Downloading the program

Using the data line can be through the development board Type-C interface burning program;

After connecting the computer with Type-C data cable, you can check the serial port number of the corresponding device in the device manager: port.

image-20230926153435306

image-20231201112034829

1.3、Running the program

After downloading the program successfully, press the RESET button of the development board to observe whether the phenomenon of the development board is normal.

2、ST-Link:Program download and simulation

To download a program using ST-Link, you need to check and set the debugger to ST-Link.

2.1、Debug configuration

image-20230926154953513

image-20230926155111521

Before using ST-Link to download programs, you need to use four mother-to-mother dupont wires to connect the ST-Link to the development board, and the ST-Link is connected to the computer through a USB interface.

ST-LinkThe SWD interface of the board
3.3V3V3
SWCLKSWCLK
SWDIOSWDIO
GNDGND

2.2、Program download

Click the Debug icon

image-20230926155129482

2.3、Program simulation

image-20231010144324096

image-20230926160106843

image-20230926162749897

In debug mode, select the Num variable you want to view (here's how to view the Num variable)

image-20231010160345505

image-20231010160420216

When the Num variable is added to the Express window, the value can be viewed in the Expression window, and the actual value of the variable is displayed only when the program is stopped

image-20231010160830547

Breakpoint:Double-click on the leftmost part of the current statement to show a blue breakpoint, where the program stops running

Keep running:When the program runs to the breakpoint position, you can use this button to continue running down

Terminate debugging:Exit program debugging