How evvgc/firmware works
Project Type & Purpose
• Full-stack embedded system:
• Host-side GUI application (Processing/Java)
• Target-side firmware for STM32F10x microcontroller
• Bootloader for USB/DFU flashing
• Purpose: configure and control a 3-axis brushless gimbal in real time.
Top-Level Components
1. Host PC
– EvvGC_GUI (v0.4) Processing/Java application
– DFU-Util / Bootloader interface
2. Physical Hardware (STM32F10x board)
– Bootloader (maple_boot.bin)
– Firmware v0.4 (compiled ELF/HEX via Eclipse+GCC)
– External peripherals:
• IMU/Gyro (I²C)
• RC Rx (PWM / digital input)
• Motors (PWM outputs)
• EEPROM (internal MCU)
• UART1/UART4 (serial for bootloader and GUI)
• USB-CDC VCP (virtual COM)
3. Software Libraries & BSP
– CMSIS core + DSP libs
– STM32 Standard Peripheral Driver
– USB-FS Device Driver
Internal Firmware Modules (logical layers)
A. Hardware Abstraction Layer
• startup_stm32f10x_hd.S, system_stm32f10x.c
• stm32f10x_conf.h + CMSIS + StdPeriph
B. Peripheral Drivers
• src/VCP (USB CDC)
• src/usb.c/.h (USB stack)
• src/usart.c/.h (UART)
• src/i2c.c/.h (I²C for gyro)
• src/adc.c/.h (ADC, if used)
• src/pwm.c/.h (PWM output)
C. Middleware & Utilities
• sys/printf, sys/itoa (retargeted I/O)
• newlib_stubs.c (malloc, etc.)
• ringbuffer.c (buffering comms)
D. Application Layer
• commhandler.c/.h (parse commands from GUI)
• config.c/.h (store/load parameters in EEPROM)
• engine.c/.h (main control loop, PID)
• gyro.c/.h (sensor read + filtering)
• rc.c/.h (process RC input)
• reboot.c/.h (soft reboot to bootloader)
• fasttrig.c/.h (fast math approximations)
• utils.c/.h (support functions)
Relationships & Data Flows
• Host PC ↔ USB-CDC ↔ VCP driver ↔ commhandler
(bi-directional: configuration & telemetry)
• commhandler → config → EEPROM (store/retrieve settings)
• commhandler → engine → PWM (motor commands)
• engine ↔ gyro over I²C (sensor data feed)
• engine ↔ rc (user stick input)
• engine uses fasttrig & DSP functions (via CMSIS)
• Any reboot command → reboot module → bootloader
Architectural Patterns & Principles
• Layered architecture (HAL → drivers → middleware → app)
• Modular design: each peripheral and function is isolated by C module
• Real-time control loop: deterministic cycle in main.c
• Interrupt-driven comms and timing (SysTick, USB IRQ, USART IRQ)
Final Checklist
• Callouts for build tools (GCC/Eclipse) & config files (Makefile, .ld)