This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: TI C/C++ Compiler
Hello everyone. I try to read gyro data. But I always get some link error. My output, as follow;
**** Build of configuration Debug for project mpu6050_v1 ****
"C:\\ti\\ccsv7\\utils\\bin\\gmake" -k -j 4 all -O
'Building file: ../main.c'
'Invoking: ARM Compiler'
"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"
'Finished building: ../main.c'
' '
'Building target: mpu6050_v1.out'
'Invoking: 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"
<Linking>
undefined first referenced
symbol in file
--------- ----------------
MPU6050DataAccelGetFloat ./main.obj
MPU6050DataGyroGetFloat ./main.obj
MPU6050DataRead ./main.obj
MPU6050Init ./main.obj
MPU6050ReadModifyWrite ./main.obj
error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "mpu6050_v1.out" not built
>> Compilation failure
makefile:143: recipe for target 'mpu6050_v1.out' failed
gmake[1]: *** [mpu6050_v1.out] Error 1
makefile:139: recipe for target 'all' failed
gmake: *** [all] Error 2
**** Build Finished ****
My code as follow.
#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) { 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. // } }
Pleasee help me, any advice or help. I have trying for days.
thanks. I resolved this error. :D:D
I added mpu6050.c and i2cm_drv.c as linked file. project->addfile->linked_to_file and ok.