Stm32 development Template

Source: Internet
Author: User

I have been working for more than three years. During this process, many projects have been developed due to the nature of my work, because software engineers not only knock on the code, this includes preliminary design, development history, document sorting, and so on. Therefore, we gradually made modifications during development, and made a set of templates based on stm32f103c8t6, mainly completed the Framework Design of some documents, boootloader integration, and communication protocol integration in APP software.

  

For example, Yu is also responsible for the development of Windows desktop programs. To handle the corresponding relationship, a version.xlsx file is responsible for the relationship between the underlying code version of stm32 and the WPF desktop software version.

  

For example, in the underlying code development, you must have a corresponding development record manual, which records your development history and each version in the code folder.

  

This is the final design of relevant information for each version. First, let's take a look at the way the files are organized. youdao cloud has always been very important to sort out the program.

  

Examples contains instructions, code usage and precautions. The most important thing is the user folder, which contains all the code files you have written.

  

For example, include the interrupt function file, configuration file, main file, and all the underlying driver functions you write.

  

For example, it is a folder in the underlying driver function. Each folder contains the relevant source file and header file. It adopts a modular Development Method to integrate the basic module into the relevant template, the coupling between application modules is minimized, which plays a very good role in later maintenance and module transplantation.

Previously, stlink was used for program download and debugging. Due to work reasons, some programs need to be upgraded, or the circuit board is already sealed and cannot provide the download interface, therefore, the templates are developed in the bootloader + app mode, and the bootloader program is downloaded to the MCU through stlink. Later code upgrades and debugging are completed through the communication interface provided by bootloader, this communication interface can be usart, SPI, I2C, and so on. The bootloader has been designed in two ways. One is a very coupled design, and the app has a bootloader switch, this design will increase the connection between the app and the bootloader, and cause the app failure to cause the bootloader fault. It is generally not recommended unless it is highly Real-time. Another design, you can refer to the PC design. After power-on, you can give feedback for a period of time (entering the BIOS). If there is feedback, you can enter the related upgrade process. This method makes the Bootloader and app irrelevant, in addition to power-on ( Of course, this period of time can be designed very short), you need to consider whether this period of waiting will cause problems that are not within the scope of the design of other hardware (generally, hardware design will take this extreme situation into account ), we also need to consider the verification and fault issues during the upgrade.

Therefore, the first two files are Bootloader and App. Because usart is common, the interface used in the template is usart. In addition to some normal configuration files, the app, it also includes necessary watchdog, tick clock, timer, framework code, and framework code which can be developed by program according to modules. Similar to the object-oriented interface idea, there is also the Code of communication protocol, related upgrade processes and later control protocols have been integrated, mainly to quickly get started with the stability of projects and projects.

The next two files are the flowchart Design of APP and bootloader. The design is simple and common, mainly to understand the idea of the designer.

There is also the flash file. This file is generally used to consider the configuration instructions of external storage. The meaning of each byte. Of course, if there is no external storage, this will include the built-in flash description, because the existing templates do not consider external memory, however, during the bootloader upgrade process, a power loss data is required, therefore, the last sector of the flash built into stm32 is used as the memory. This flash details the configuration of this sector.

The most important thing to connect to the hardware is the connection to the relevant Io. The IO configuration file includes the connection relationship between Io, the default Io situation, and the IO action relationship.

There is also the function test file, which includes relevant testing methods to ensure code preparation and product integrity.

The most important thing is the communication protocol document. When designing the communication protocol, we considered the garbled and mistaken communication factors. A communication protocol was designed with a time wheel scheme, similar to the protocol frame judgment in 485 or can, this scheme was not used due to previous experience. Another solution was to make some articles on the content, by increasing the complexity of the Protocol content, prevents protocol errors, including packet header, packet tail, data type, data object, data content, verification, and so on.

Finally, an upgrade file is installed into the flash of stm32 through the combination of the host computer.

 

Thought determines the height, three stinks, and the top Zhuge Liang. Thank you for your correction.

Contact: https://www.cnblogs.com/xhqinglin/p/9876333.html

 

Stm32 development Template

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.