STM32 Environment Building/learning viewpoint/self-study method getting started must see

Source: Internet
Author: User

Article from Armfly Development Board V4 Software Development Manual, sharing learning ~

Today is fortunate to see Armfly Development Board Software Development Manual, the beginning of the basic knowledge, really useful, good to see, everything is not late, feeling a lot, excerpt part, learn to share ~

About building the development environment

(Personally, the use of tools, handy development environment, for programming is a good habit, but also a good enjoyment, so, in the environment, I am still more concerned about the combination of software, the construction of standardization and so on, so that can be as little as possible in the late replacement of different environments, softening will be a waste of time, Once in place, Bon Voyage ~)

Personal preferences of the environment to build:

Integrated development Environment (IDE): Keil Company's RealView MDK

Source Editor: Ultraedit/sourceinsight/ide's own editor

Serial Port tool: SECURECRT (a professional super terminal tool, support many interfaces (including serial port) and protocol, recommended to use. )

RealView MDK project configuration:

(It is necessary to familiarize yourself with it here.)

1. "Device" option. Select the correct CPU model. Select Stm32f103ze.

2. The "Target" option. Tick "use MicroLIB". If not selected, the printf function will not be able to output information to the serial port.

3. The "Output" option. You can modify the executable file name. Tick "Create hex file" to generate the hex files that can be burned separately.

Canceling the "Browse information" option can greatly speed up the compilation of each file, but will lose the ability to locate functions and macros in the right mouse button. This option does not affect the final hex.

During the compilation, a large number of obj temporary files are generated, and you can specify obj with the "Select Folder for Objects" button
The directory where the files are stored. This will be the project file directory becomes very concise.

4. "Listing" option. During the compilation process, a large number of LST temporary files are generated, and you can specify the storage directory for the LST file via the "Select Folder for Listings" button. This will be the project file directory becomes very concise.

5. "User" option. You can specify user programs that are executed before and after compilation.

In order to copy the compiled hex file to the specified directory and rename it, we can execute a bat batch file after compiling.
The Copyhex_flash.bat file is a text file that reads as follows:
Copy Flash\obj\output.hex. \output (MDK). Hex

6. "C + +" option. "Use_stdperiph_driver" here means using St's firmware Library, and if there are other precompiled macros, they can be separated by commas.
Include path to specify the path of the header file
Add--diag_suppress=870 control to avoid Chinese string alarms

7. "ASM" option. No changes are required.

8. "Linker" option. No changes are required.

9. "Linker" option. No changes are required.

Click the "Settings" button to set the Hardware emulator, select the corresponding emulator model. Our routines are configured by default to J-link
Simulator.
Tick "Run to Main ()" To pause the main () function when debug is started.

"Utilities" option.

Click the "Settings" button to set the Hardware emulator, select the corresponding emulator model. Our routines are configured by default to J-link
Simulator. Click the "Add" button to add the Flash programming algorithm. Select stm32f10x high-density Flash.

/***** above the setting is the premise of programming, must pay attention to, otherwise when the unknown error will not touch the mind. *****/

Some viewpoints on STM32 learning

(The benevolent see of the beholder)

Firm Belief Select St Firmware Library

Stop thinking about firmware library development or register development. 99% of engineers with actual product development experience will tell
You, using ST's firmware Library to develop STM32 applications is the best choice. This set of firmware library written very standardized, very rigorous, there is no certain C language
The foundation of the language and the design of the program structure is not written out of this code. If you feel that the firmware library is too complex, too messy, can only explain a
Problem: You have not been involved in large-scale software development, your C language has not been studied in place, you have not yet the concept of program architecture design.
All we have to do is learn how to read the firmware library and learn how to use the firmware library. In-depth words can be built using the firmware library to build our
Their own peripheral drivers.
Maybe some people will refute, do not learn register, feel that learning is not in depth. My point is: Register is the least learning value,
The hardware function is complex. You must configure and select hardware features through some bits of the registers. We need a lot of time to remember and comb
Registers the relationship between each bit. I don't think it's worth it. You might as well spend this time learning how to comb and summarize the St firmware Library
These hardware functions, that is, learning C programming methods.
We are not completely letting you not understand the register function, we also use registers to operate directly at very rare times. But we
That is, the function of the St firmware Library is expanded to improve the efficiency of code execution.

Selective learning

(This may be suitable for many self-motivated very strong children's shoes, always want to STM32, even not just monolithic computer, FPGA and so on technology, life is short, seize the essence, try your best! )

STM32 has too many functions, and there are a plethora of software components associated with STM32. And the human energy is limited, you can not learn all things even if you study for a lifetime. One's life, time is the most precious, we must spend time on the blade. Others do good open source third-party code, if you test the application, no problem, then he belongs to you, you just have to learn how to transplant and use it is enough. If someone else has already been transplanted, it is more convenient and can be used directly. There is no need to spend more time digging into code to study the program structure of others. than such as Fatfs, UIP, St firmware Library, UCOS, EmWin. Unless you are doing basic research or finding bugs.

We must spare time to learn and master more software modules. That way, when the project comes in, you'll be able to handle it calmly.

Build your own code base

(according to their own code style, as well as the commonly used modules, to build their own small code base, so later used when, directly to change, their own things in mind clear, with clear, in the mind also practical, also conducive to the rapid start and establishment of the project)

self-validated code, to learn to collect and organize. Become part of your code base. Cumulative. When doing products and projects,more than 80% of the code comes from the code base. Making a product is a lot of time building blocks. The richer your codebase, the quicker it will be to start a product . Some good engineering frameworks also have to learn to collect and organize. Most of the time we do projects that replicate a similar project directly. It is not possible to re-create a new project every time. like building a house, you can take bricks directly instead of taking the time to make a turn.

/***** above views for reference only, Development Board team according to their own development experience and experience of the recommendations, but also I agree with the point of view *****/

It is better to teach fish than to teach it

For more information, please visit St's official website directly:

Http://www.st.com
Another very good Chinese site is:

http://www.stmcu.org

? Reference Manual (Reference Manual) "Content is comprehensive, software engineers must read"

? Data sheet Sheet "Hardware engineers must read"

? Errata sheet (errata Sheet)

The limitations of some functions of the chip are described and the solutions are given. This handbook is also more important, and sometimes we
We feel that there are some places where debugging is always a problem, we need to find out and see if we have a solution.

? Flash programming Manual (Flash programming Manual)

Operation Guide, read/write protection settings, option byte information for on-chip flash memory

Kernel Programming Manual (Cortex-m programming Manual)

Description of the system control block register for the kernel. This manual is sometimes used, for example, we need to understand NVIC and
SysTick related registers are required to use this brochure, which can be downloaded from the ARM's official website or
St Official download, the difference is that the ARM method is universal, ST hair is for their own chip to do, and sometimes in the reference
This manual is required when the information about the register is not found on the manual.

STM32 Environment Building/learning viewpoint/self-study method getting started must see

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.