The arduino development board normally embeds the bootloader code in the code, and uses the IAP function of the microcontroller to download the program through the USB port. In fact, it is also possible to download the program by properly setting the hex or bin file of the generated program and then downloading it to the MCU with the downloader. In this way, the arduino development environment and open source materials can be used to develop programs for other common MCU development boards on the market. This article takes MapleIDE to develop ordinary STM32 microcontroller programs as an example to illustrate.
In the arduino development environment, if build.path="storage path" is added to the last line of the lib\preferences.txt file, a hex or bin file will be generated in the corresponding folder after pressing shift to compile. However, since this file contains the startup process of the bootloader, it cannot be directly downloaded into the microcontroller. The following settings need to be done:
1. Add the parameters of the STM32F103RBT6 development board type in hardware\leaflabs\boards.txt as follows, the parameters can be modified according to different microcontrollers
mapleJTAG.name=LeafLabs Maple Rev 3+ to JTAG
2. Note that the key contents of the program storage space in maple\jtag.ld are as follows:
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K
After completing the above settings, program development can be carried out. After the program is developed, the serial port download software can be used to download the program into the STM32 microcontroller. Note that the MCU-ISP serial port download software commonly used by STM32 sometimes does not support .bin files well. The download software of uISP for STM32 is recommended here.