Skip to content

Project Structure

1. Overview

This page explains the project structure conventions of the servo demo examples and the purpose of each library file.

2. Project Structure

Using the servo Communication Check example as a reference, this section explains the STM32 project structure.

Extract openmv-stm32.zip and open the folder Source Code/FashionStarUartServo.

The directory structure is as follows:

  • Project

Keil5 project files. Click FashionStarUartServo.uvprojx to open this project in Keil5.

  • User

Main program and user-defined libraries.

  • main.c User main program
  • User-defined library files, such as the serial port servo driver library
  • Libraries
  • CMSIS: Stores the core interface files customized by ARM for the cm3 core
  • FWLIB: Stores the STM32 peripheral library
  • Listings: This directory is the MDK output directory for generated information, including code distribution files such as .map and .lst
  • Output: This directory is the MDK output directory for generated information, including object files (.o), Configuration files (.axf), download files (.hex), dependency files (.d), and related files.

3. User-Defined Library Files

Introduction to the project structure in the User folder.

  • sys_tick

Manages system time. By configuring the system timer interrupt, it implements delay and countdown logic.

  • ring_buffer

Implements a ring buffer queue in C. It is used to store and manage byte streams for serial port communication. It can also read and write values of specific data types from and to the buffer queue.

  • usart

Library for serial port communication. Through macro configuration, you can conveniently enable or disable the three USART resources on the STM32F103C8 development board.

  • fashion_star_uart_servo

Encapsulates the communication protocol of the servo. It is the STM32F103 SDK for the servo.

  • main.c

Main program and program entry point.

User directory tree

├── fashion_star_uart_servo 舵机驱动库
│   ├── fashion_star_uart_servo.c
│   └── fashion_star_uart_servo.h
├── main.c 主程序
├── ring_buffer 环形缓冲队列驱动库
│   ├── README.md
│   ├── ring_buffer.c
│   └── ring_buffer.h
├── stm32f10x_conf.h
├── sys_tick 系统时钟
│   ├── sys_tick.c
│   └── sys_tick.h
└── usart 串口通信
    ├── README.md
    ├── usart.c
    └── usart.h

4. Reference

  1. STM32 Library Development Practical Guide
  2. Creating an STM32F103 Development Template with MDK