[Huawei cloud technology sharing] STM32L476 transplanting Huawei LiteOS series tutorials-background knowledge 1

Posted May 26, 20203 min read

  1. This article wants to explain to everyone a question, what is the essence of our development of single chip microcomputer?

In the earliest development, we did not have a series of easy-to-use integrated development environments for Keil, IAR, etc. Note that "integration" here refers to the integration of multiple software

① Editor:Notepad, NotePad ++, vim(in Linux) These are editors, which can provide me with keyword highlighting, code completion, etc.

② Compiler:gcc tool chain, we are using arm-none-eabi-gcc tool chain, note there is a "chain" here, chain ? ? Put a series of tools together in one piece, which can be used separately or separately. We input gcc -o hello hello.c under Linux, and a hello executable file is generated./Hello just prints the hello world! Give us, or put it this way, we have written an output hello world in Keil! Program, click "compile" and then "download", the serial port of the microcontroller will output hello world! .

But have you ever thought about this step, what exactly does the compiler do?

I believe that everyone already knows that the binary files composed of 0 and 1 are eventually run for the machine, but how does our C language transform into binary files?

One of the hello.c files has undergone "pre-processing", "compilation", "assembly", "linking", generating hex/bin and other executable files, where each step is operated by a different software.

These softwares are integrated into the tool chain, so I won't go on with them here. If you are interested, you can leave a message for me and give you detailed science.

③Downloader:The downloader is the driver of our ST-Link/JLink emulator. Through this downloader, the program is burned into our microcontroller.

I believe that students who have used Keil must have encountered "the error that the header file cannot be found". You can find it by adding the path of the header file to the red box in the figure below

When we did not have a very good development environment in the earliest single-chip development, we used a file called Makefile and make software to help us simplify the above operations. This is the most essential operation. The IoTStudio software we use now Control compilation is also done through Makefile.

Second, the development environment comparison


I believe that most microcontroller development enthusiasts use development software such as Keil/IAR, which is particularly easy to use, because he integrates management compilation tool chain, management compilation method, provides code completion, provides ST-Link/JLink simulation integration, When we use it, we only need to care about the logic of the code, and we can completely ignore other problems.

Our development steps:

Use the STM32CubeMX software to create a project-> select the chip model-> configure the clock and various types of peripherals(GPIO, serial port, timer, interrupt controller, etc.)-> select the generated project(IAR/Keil/Makefile)- > Use Keil/IAR directly to open the created project and start programming.


The IoTStudio software uses Makefile to control the compilation, but you do n’t have to worry, Makefile does n’t need to be written by us, as long as it can be understood and modified. Compile, download and other buttons Huawei's engineers and brothers have helped us to do it, just click it.

In this issue, I will introduce a series of knowledge about the development of single chip microcomputer. In the next issue, I will take you directly from STM32CubeMX to create a project, until you can run the Demo program in IoTStudio!

Click to follow and learn the latest Huawei Cloud technology ~