Files
STM32F103/AGENTS.md
2026-07-13 15:38:57 +08:00

1.8 KiB
Raw Blame History

STM32F103C8T6 Project

Project Type

STM32CubeMX-generated project using Keil MDK-ARM V5.32 toolchain.

Key Files

  • STM32F103C8T6/STM32F103C8T6.ioc — CubeMX configuration (pinout, clock, peripherals)
  • STM32F103C8T6/Core/Src/main.c — Application entry point
  • STM32F103C8T6/MDK-ARM/STM32F103C8T6.uvprojx — Keil project file

Hardware Configuration

  • MCU: STM32F103C8T6 (LQFP48, 72MHz, 64KB Flash, 20KB RAM)
  • Clock: HSE 8MHz → PLL ×9 = 72MHz SYSCLK
  • Peripherals:
    • USART1: PA9 (TX), PA10 (RX) — Async mode
    • LED: PC13 (active low, pull-up)
    • Keys: PB3 (KEY1), PB4 (KEY2), PB5 (KEY3), PC14 (KEY4), PC15 (KEY5) — Pull-down
    • LCD: PB12 (RST), PB13 (SCL), PB15 (SDA) — GPIO output, pull-up

Code Conventions

  • Custom code must be placed within /* USER CODE BEGIN */ and /* USER CODE END */ markers
  • Code outside these markers will be overwritten by CubeMX code generation
  • HAL library is used (defined USE_HAL_DRIVER and STM32F103xB)

代码规范

  • 遵循: 嵌入式C语言代码规范V1.0.md
  • 缩进: 4个空格禁止Tab
  • 命名:
    • 变量/函数: 小写+下划线,全局变量g_前缀,静态变量s_前缀,指针p_前缀
    • 宏/常量: 大写+下划线,模块名前缀
    • 类型: 小写+下划线+_t后缀
  • 注释: 关键逻辑每行注释,函数必须完整注释(功能/参数/返回值/说明)
  • 大括号: 所有if/for/while必须加大括号左大括号同行右大括号单独行
  • 禁止: goto、递归、可变参数函数、注释掉的代码提交

Important Notes

  • Drivers/ directory contains HAL driver source — do not edit directly
  • Regenerate code via CubeMX .ioc file, not manually editing HAL files
  • Keil build output goes to MDK-ARM/STM32F103C8T6/ (already gitignored)