Files
STM32F4-Base/Src
wandering1 a14011380e feat(gpio): sync CubeMX regen: 6 new KO pins + netTask stack 960
Sync CubeMX regen output for the 6 newly assigned output pins:
KO5=PC15, KO4=PF5, KO_LED1=PF2, KO_LED2=PF3, KO_LED3=PE6,
KO_24V=PF4.  All are push-pull, no-pull, low initial level in
MX_GPIO_Init.  The BSP driver does not own these pins yet; the
drivable output count stays 4 (ioboard_do_write 4-bit mask).

netTask stack reduced from 1408 to 960 words, in both .ioc
FREERTOS.Tasks01 and freertos.c generated region.  Rebuilt the
cubemx-survival baseline for the ioc-task-stacks drift (only that
one entry changed); --check now returns 0.

Keil full rebuild verified: 0 errors, 0 warnings.  Refilled the
RAM budget ledger and memory snapshot from the authoritative map
along with the trend row and size attestation; --gate and --scan
both return 0.  Regenerated the managed task tables in README and
AGENTS from freertos.c (netTask 960); task-table --check passes.
Doc sync and the 6-pin question were committed in 795ce970.
2026-11-18 12:32:10 +08:00
..
2026-07-19 13:09:06 +08:00

Src/ — CubeMX 生成的源文件

⚠️ 本目录文件由 STM32CubeMX 生成(.ioc 重生成会覆盖),不是自研代码。 但允许在 USER CODE BEGIN/END 标记区之间写自定义代码。

文件一览

文件 生成 作用
main.c CubeMX 程序入口:HAL_Init → SystemClock_Config → 外设初始化 → app_main_init → osKernelStart
freertos.c CubeMX FreeRTOS 任务创建(MX_FREERTOS_Init)+ 任务栈/优先级定义
gpio.c / dma.c / spi.c / i2c.c / usart.c CubeMX 各外设 MX_xxx_Init
stm32f4xx_hal_msp.c CubeMX HAL 外设底层初始化(时钟使能、NVIC、引脚复用)
stm32f4xx_hal_timebase_tim.c 自研覆盖 HAL 时基改用 TIM7(非 SysTick),tick = 1ms
stm32f4xx_it.c CubeMX 中断服务函数(ISR)
system_stm32f4xx.c CMSIS 系统时钟初始化(SystemInit)

⚠️ 修改约定(铁律)

  • 自定义代码只写 USER CODE BEGIN xxx / USER CODE END xxx 标记区之间—— 标记区外的内容在 CubeMX 重新生成时会被无条件覆盖丢失
  • 本目录被 pre-commit 的 C 代码规范检查排除(因是生成代码,风格不受控)
  • Drivers/BSP/ 才是纯手工代码区;应用逻辑放 App/

关键点

  • HAL 时基 = TIM7,不是 SysTick;FreeRTOS 用 SysTick 之外的方式,tick = 1ms
  • NVIC 4 位优先级分组;外设中断优先级 ≥ 5(0~4 预留给 FreeRTOS)
  • 时钟:HSE 8MHz → PLL M=4/N=168/P=2 → 168MHz

相关文档

  • 架构全景:docs/架构设计/项目架构总览.md
  • 启动顺序:docs/架构设计/项目启动顺序管理.md
  • 任务表(唯一事实源 = freertos.c):根 README.md