stm32-hal-development

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

STM32 HAL Development

STM32 HAL开发

Treat this skill as the working playbook for CubeMX-based STM32 projects.
将此技能视为基于CubeMX的STM32项目的实用操作手册。

Workflow

工作流程

  1. Read references/core-guidelines.md first.
  2. Keep all custom code inside
    USER CODE
    regions unless the project has an explicit non-CubeMX extension point.
  3. Configure peripherals in CubeMX, regenerate code, then add application or BSP logic.
  4. Read additional references only as needed:
    • references/peripheral-driver-guide.md for sensor and bus drivers
    • references/hal-quick-reference.md for API lookups
    • references/troubleshooting-guide.md for failure analysis
    • references/usage-examples.md for implementation patterns
  5. Reuse assets/bsp-template.c and assets/bsp-template.h when starting a new BSP module.
  1. 首先阅读references/core-guidelines.md
  2. 除非项目有明确的非CubeMX扩展点,否则所有自定义代码都需放在
    USER CODE
    区域内。
  3. 在CubeMX中配置外设,重新生成代码,然后添加应用程序或BSP逻辑。
  4. 仅在需要时阅读额外参考文档:
    • references/peripheral-driver-guide.md:用于传感器和总线驱动开发
    • references/hal-quick-reference.md:用于API查询
    • references/troubleshooting-guide.md:用于故障分析
    • references/usage-examples.md:用于实现模式参考
  5. 启动新的BSP模块时,复用assets/bsp-template.cassets/bsp-template.h

Notes

注意事项

  • Prioritize hardware constraints, interrupt safety, and regeneration safety over local code convenience.
  • Do not modify CubeMX-generated initialization files directly when the same change belongs in the
    .ioc
    configuration.
  • 优先考虑硬件约束、中断安全性和代码再生安全性,而非本地代码便利性。
  • 当相同修改可通过
    .ioc
    配置实现时,请勿直接修改CubeMX生成的初始化文件。