STM32
直播中

俞舟群

7年用户 1025经验值
擅长:可编程逻辑 电源/新能源
私信 关注
[问答]

在STM32F103C8T6上怎样去移植mpu9250例程呢

STM32F103C8T6上怎样去移植mpu9250例程呢?过程中会碰到哪些问题呢?

回帖(1)

王琰

2021-10-26 10:54:35
  1. 需求和来源
  回归技术的第二天,需要对机器人下层执行器做优化
  外设不算多,用STM32F103C8T6刚刚好留一个测试引脚
  但是在网上找不到比较好的mpu9250在STM32F103的应用例程
  那就只能自己来了
  直接移植正点原子阿波罗F429的mpu9250例程
  简单的移植,修改相关文件和添加头文件包含之类,的就不多说
  就是说说过程中会碰到的一些问题
  1.1. 基本配置
  
  按F429例程添加预定义宏:
  USE_HAL_DRIVER,STM32F429xx,MPL_LOG_NDEBUG=1,EMPL,MPU9250,EMPL_TARGET_STM32F4
  修改编译优化等级
  MPL 代码,要求在 MDK Options for Target 的 C/C++选项卡里面要勾选 C99 模式,否则编译出错
  1.2. 遗留问题
  之后就会遇到网上或者一些教程上比较少提到的问题
  出现下列错误:
  。ObjProject.axf: Error: L6366E: compass_vec_cal.o attributes are not compatible with the provided attributes 。
  Object compass_vec_cal.o contains Build Attributes that are incompatible with the provided attributes.
  Tag_CPU_arch = ARM v7E-M (=13)
  。..
  。ObjProject.axf: Error: L6366E: accel_auto_cal.o attributes are not compatible with the provided attributes 。
  Object accel_auto_cal.o contains Build Attributes that are incompatible with the provided attributes.
  Tag_CPU_arch = ARM v7E-M (=13)
  Not enough information to list image symbols.
  Not enough information to list the image map.
  F4例程里面的libmpllib.lib这个库文件是不是针对F4生成的,F1不能直接使用
  
  出现下列错误:
  。ObjProject.axf: Error: L6406E: No space in execution regions with .ANY selector matching empl_outputs.o(i.inv_enable_eMPL_outputs)。
  。ObjProject.axf: Error: L6406E: No space in execution regions with .ANY selector matching data_builder.o(i.inv_get_gyro_bias)。
  。..
  。ObjProject.axf: Error: L6406E: No space in execution regions with .ANY selector matching usenofp.o(x$fpl$usenofp)。
  。ObjProject.axf: Error: L6407E: Sections of aggregate size 0xaa4 bytes could not fit into .ANY selector(s)。
  编译通过、在链接时会提示以下错误信息提示空间不够
  2. 解决办法
  2.1. libmpllib.lib
  在正点原子的资料包里找到适用于F1的libmpllib.lib
  硬件资料-》MPU9250资料-》motion_driver_6.12.zip-》mpl libraries-》arm-》keil-》libmpllib_Keil_M3.zip
  使用这个lib替换掉原来
  2.2. 空间不够
  一般使用微库就能解决
  将以更精简短小的C库替代标准C库,减小代码大小,使用微库的方法如下:
  打开Project-》Options-》Target,将Use MicroLIB前面的复选框勾上
  
  其他什么特别的,基本在网上能轻松找到。
  还是可以移植成功的,利用串口发送一下姿态角
  
  因为受到文件监控,这个软件工程就不能直接分享了。
举报

更多回帖

发帖
×
20
完善资料,
赚取积分