PX4编译总结以及底层驱动流程

师父给的。

Px4编译总结

1.ld文件配置MCU  /Firmware/nuttx-configs/typhoon/scripts

2.配置NUTTX系统:修改defconfig    /Firmware/nuttx-configs/typhoon/nsh

由defconfig生成.config文件在目录/build_typhoon_default/typhoon/NuttX/nuttx/中。Makefile通过include .config文件将相应的文件编译进系统。

3.上层PX4代码使用cmake编译。

 

 

底层驱动流程

1.在defconfig中打开配置,如需要使用I2C1驱动则CONFIG_STM32_I2C1 = y

2.I2C底层驱动程序流程,以batt_smbus驱动为例介绍

BATT_SMBUS::init()

——>I2C::init()                         ---i2c_nuttx.cpp

     ——>px4_i2cbus_initialize(_bus)     

          ——>up_i2cinitialize(_bus)     ----stm32_i2c.c

               注:已经初始化过的总线不在初始化,使用ref是否等于一来进行判断

 

posted @ 2017-07-23 15:12  cumtchw  阅读(1385)  评论(0编辑  收藏  举报