Getting Started with Project Development

[中文]

Note

This document is automatically translated using AI. Please excuse any detailed errors. The official English version is still in progress.

When developing an ESP project, the typical process begins with understanding the relevant ESP examples and SDK based on the project’s requirements. The next step is to select the most suitable example as a template for the target project, and then modify it to create your own project.

This article will summarize essential knowledge required for developing general embedded projects within the Espressif environment:

General Knowledge

Before developing an ESP project, some key general knowledge and skills are needed to ensure smooth development:

  • Git:

    Git is an open-source distributed version control system used to track code changes and collaborative development. Using Git in your project can help you manage your code effectively, control versions, and work collaboratively with team members. Learning how to use Git for code submission, branch management, merging, etc., is a basic requirement for developing ESP projects. Here, developers are recommended to master some common Git commands

  • FreeRTOS:

    FreeRTOS is an open-source real-time operating system widely used in embedded systems and microcontroller projects. ESP series chips all support FreeRTOS, and often use it to implement multitasking and real-time scheduling. Understanding the concepts of FreeRTOS task scheduling, message queues, semaphores, etc., is essential knowledge for developing ESP projects.

  • Linux (optional):

    ESP project development often takes place on the Linux operating system, as Linux provides a wealth of tools and command-line environments suitable for embedded development. Developers should understand the basic commands and usage of Linux, such as file operations, directory management, process management, etc., in order to debug and configure during development. Developers are recommended to master some common Linux file and directory management commands

    - ls: Lists files and folders in the current directory.
    - cd <directory>: Switches to the specified directory.
    - pwd: Displays the path of the current working directory.
    - cp <source> <destination>: Copies files or directories.
    - rm <file_name>: Deletes a file.
    - mkdir <directory>: Creates a new directory.
    - rmdir <directory>: Deletes an empty directory.
    - cat <file_name>: Displays the contents of a file.
    

Understanding ESP Series Chips and ESP-IDF Framework

Summary of Project Development Knowledge Points

C Language

  1. Data Types

    • Basic Data Types
      • Integer, Character, Floating Point

    • Standard Library Data Types
      • Boolean (bool), String (string)

    • Pointer Types

    • Composite Data Types
      • Array, Structure (struct), Enumeration (enum)

    • Custom Data Types

    • Data Type Qualifiers
      • const, volatile

  2. Functions, Pointers, and Memory Management

  3. Compilation, Linking, and Execution Process of Engineering Projects

  4. Algorithms

    • Data Structures
      • Linked List

      • Stack and Queue

      • Tree and Graph

    • Sorting Algorithms
      • Bubble Sort

      • Selection Sort

      • Insertion Sort

      • Quick Sort

      • Merge Sort

    • Search Algorithms
      • Linear Search

      • Binary Search

      • Hashing

    • Recursive Algorithms
      • Divide and Conquer

      • Backtracking

    • Dynamic Programming

    • Encoding and Decoding Algorithms
      • Handling Data Compression, Encryption, Encoding, and Decoding

    • Signal Processing Algorithms
      • Processing of audio and images

    • Algorithm optimization
      • Time complexity

      • Space complexity

Communication Protocols

  1. Master various communication protocols, such as UART, SPI, I2C, CAN, etc., for communication with external devices

  2. Learn network protocol stacks, such as TCP/UDP, as well as higher-layer application protocols, such as HTTP, MQTT, etc.

Project Building and Management

  1. Build System

  2. Partition Table

  3. Component Management and Usage

Application Programming

  1. GPIO (General Purpose Input/Output), General Input/Output

    • GPIO initialization, mode, reading, writing

    • GPIO configuration options
      • Determine the function of each pin according to the datasheet and pin diagram

    • GPIO interrupts

    • Strapping pins

  2. JTAG (Joint Test Action Group) Debugging

  3. Memory Management

    • Dynamic memory allocation and release, such as malloc and free

    • Memory layout and stack management

  4. Interrupt Handling

    • Understand and handle hardware interrupts

    • Implement Interrupt Service Routines (ISR) to respond to external events

  5. Clocks and Timers

    • Use timers and clock sources to implement time control and timed tasks

    • Handle delay and timing operations

  6. Exception Handling

    • Handle hardware and software exceptions

  7. Low Power Mode Design

    • Implement power optimization strategies to extend battery life or reduce energy consumption

  8. Processes

    • Creation and termination of processes

    • Management and scheduling of processes

    • Resource allocation and usage of processes

    • Methods of inter-process communication
      • Pipes, Named Pipe (FIFO), Message Queue, Signal, Shared Memory, Semaphore, Socket

  9. Threads

    • Creation and destruction of threads

    • Scheduling and synchronization of threads

    • Concurrency control in multithreaded programming

    • Methods of inter-thread communication
      • Mutex, Condition Variable, Semaphore, Barrier, Message Queue, Shared Memory, Spin Lock

  10. Driver Development

  • Drivers can be written for various hardware devices, including but not limited to sensor, actuator, storage devices (such as flash memory and SD cards), communication interfaces (such as UART, SPI, I2C), display, network interface card (NIC), etc.

Learning Methods

  • Online resources and documents:

    • Utilize the ESP-IDF official documentation, tutorials, and example codes to gain a deep understanding of the framework and API usage.

    • Find ESP-IDF based solutions, application examples, components, and drivers in the ESP IoT Solution library. Most documents provide both Chinese and English versions.

  • Online courses and video tutorials:

  • Experiments and projects:

  • Community and forums:

    • Join the ESP32 official forum, CSDN forum, or other developer communities. Exchange experiences with other developers, seek help, and share projects and solutions.

    • Submit bugs or feature requests through the Issues section on GitHub. Please check the existing Issues before submitting new ones.

  • Reference books:

    • Read books related to embedded systems, C language, and ESP chip development to expand your knowledge breadth and depth. Reference: ESP32 book list.

Continuous practice and project development are the most important parts of the learning process. Developers can gradually master the skills of embedded project development with ESP chips through continuous practice and practical application.