我尝试读取陀螺仪数据。构建时,总是会出现一些链接错误。我的输出,如下;
****为项目mpu6050_v1构建配置调试****
“ C:\ ti \ ccsv7 \ utils \ bin \ gmake” -k -j 4全部-O'构建文件: ../main.c''调用:ARM编译器' “ C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/bin/armcl” -mv7M4 --code_state = 16 --float_support = FPv4SPD16 -me --include_path =“ C:/ Users / yilmaz / workspace_v7 / mpu6050_v1” --include_path =“ C:/ti/TivaWare_C_Series-2.1.4.178” --include_path =“ C :/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/include“ --define = ccs =“ ccs” --define = PART_TM4C123GH6PM -g --gcc --diag_warning = 225 --diag_wrap = off --display_error_number --abi = eabi --preproc_with_compile --preproc_dependency =“ main.d_raw”“ ../main.c“'完成的建筑物:../main.c''''建筑目标:mpu6050_v1.out' “调用:ARM Linker” “ C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/bin/armcl” -mv7M4 --code_state = 16 --float_support = FPv4SPD16 -me --define = ccs =“ ccs” --define = PART_TM4C123GH6PM -g --gcc --diag_warning = 225 --diag_wrap = off --display_error_number --abi = eabi- z -m“ mpu6050_v1.map” --heap_size = 0 --stack_size = 512 -i“ C:/ti/ccsv7/tools/compiler/ti-cgt-arm_16.9.4.LTS/lib” -i“ C:/ ti / ccsv7 / tools / compiler / ti-cgt-arm_16.9.4.LTS / include“ --reread_libs --diag_wrap = off --display_error_number --warn_sections --xml_link_info =” mpu6050_v1_linkInfo.xml“ --rom_model -o” mpu6050_v1 .out“” ./main.obj“” ./tm4c123gh6pm_startup_ccs.obj“ “ ../tm4c123gh6pm.cmd” -llibc.a -l“ C:/ti/TivaWare_C_Series-2.1.4.178/driverlib/ccs/Debug/driverlib.lib”
文件中未定义的第一个引用符号 --------- ---------------- MPU6050DataAccelGetFloat ./main.obj MPU6050DataGyroGetFloat ./main.obj MPU6050DataRead ./main.obj MPU6050Init ./main.obj MPU6050ReadModifyWrite ./main.obj
错误#10234-D:未解决的符号仍然错误#10010:错误 链接过程中遇到的问题;未构建“ mpu6050_v1.out”
编译失败makefile:143:目标'mpu6050_v1.out'的配方失败gmake [1]: * [mpu6050_v1.out]错误1 makefile:139:目标“全部”的配方失败gmake:* [all]错误2
****构建完成****
我的代码如下。
#include <stdbool.h>
#include <stdio.h>
#include <stdint.h>
#include "sensorlib/i2cm_drv.h"
#include "sensorlib/mpu6050.h"
#include "sensorlib/hw_mpu6050.h"
//
// A boolean that is set when a MPU6050 command has completed.
//
volatile bool g_bMPU6050Done;
void MPU6050Callback(void *pvCallbackData, uint_fast8_t ui8Status);
void MPU6050Example(void);
/**
* main.c
*/
int main(void)
{
MPU6050Example();
return 0;
}
//
// The function that is provided by this example as a callback when MPU6050
// transactions have completed.
//
void MPU6050Callback(void *pvCallbackData, uint_fast8_t ui8Status)
{
//
// See if an error occurred.
//
if(ui8Status != I2CM_STATUS_SUCCESS)
{
//
// An error occurred, so handle it here if required.
//
}
//
// Indicate that the MPU6050 transaction has completed.
//
g_bMPU6050Done = true;
}
//
// The MPU6050 example.
//
void MPU6050Example(void)
{
float fAccel[3], fGyro[3];
tI2CMInstance sI2CInst;
tMPU6050 sMPU6050;
//
// Initialize the MPU6050. This code assumes that the I2C master instance
// has already been initialized.
//
g_bMPU6050Done = false;
MPU6050Init(&sMPU6050, &sI2CInst, 0x68, MPU6050Callback, 0);
while(!g_bMPU6050Done);
//
// Configure the MPU6050 for +/- 4 g accelerometer range.
//
g_bMPU6050Done = false;
MPU6050ReadModifyWrite(&sMPU6050, MPU6050_O_ACCEL_CONFIG, ~MPU6050_ACCEL_CONFIG_AFS_SEL_M,
MPU6050_ACCEL_CONFIG_AFS_SEL_4G, MPU6050Callback, 0);
while(!g_bMPU6050Done);
//
// Loop forever reading data from the MPU6050. Typically, this process
// would be done in the background, but for the purposes of this example,
// it is shown in an infinite loop.
//
while(1)
{
//
// Request another reading from the MPU6050.
//
g_bMPU6050Done = false;
MPU6050DataRead(&sMPU6050, MPU6050Callback, 0);
while(!g_bMPU6050Done);
//
// Get the new accelerometer and gyroscope readings.
//
MPU6050DataAccelGetFloat(&sMPU6050, &fAccel[0], &fAccel[1], &fAccel[2]);
MPU6050DataGyroGetFloat(&sMPU6050, &fGyro[0], &fGyro[1], &fGyro[2]);
//
// Do something with the new accelerometer and gyroscope readings.
//
}
}
任何帮助,请帮助我。我已经尝试了好几天。
答案 0 :(得分:0)
我添加了mpu6050.c和i2cm_drv.c作为链接文件。 project-> addfile-> linked_to_file,然后确定。
感谢您的帮助。我已经解决了评论中的问题