我在Sourcery CodeBench IDE中使用C,在STM32F10X中编程,以及编译此代码时
int main(void){
RCC_Configuration();
/* NVIC configuration */
NVIC_Configuration();
/* GPIO configuration */
GPIO_Configuration();
SysTick_Configuration();
Timer_Configuration();
dxl_initialize( 0, 1 );
USART_Configuration(USART_PC, Baudrate_PC);
GoalPos1[0]= 333;
GoalPos1[1]= 333;
GoalPos2[0]=690;
GoalPos2[1]=690;
GoalPos5[0]=412;
GoalPos5[1]=412;
GoalPos6[0]=611;
GoalPos6[1]=611;
GoalPos7[0]=355;
GoalPos7[1]=355;
GoalPos8[0]=664;
GoalPos8[1]=664;
double t = 1.0;
while(1)
{
bMoving = dxl_read_byte( id, P_MOVING );
CommStatus = dxl_get_result();
if( CommStatus == COMM_RXSUCCESS )
{
if( bMoving == 0 )
{
if(t<=2){GoalPos3[0]=(int)(-1.5*t+300.7);GoalPos3[1]=(int)(-1.5*t+300.7);}else{GoalPos3[0]=298;GoalPos3[1]=298;}if(t<=2){GoalPos4[0]=(int)(1.5*t+721.0);GoalPos4[1]=(int)(1.5*t+721.0);}else{GoalPos4[0]=724;GoalPos4[1]=724;}GoalPos9[0]=(int)(0.0001661*t*t*t*t*t*t+0.0006153*t*t*t*t*t-0.1318*t*t*t*t+1.254*t*t*t+2.925*t*t-43.64*t+527.9);GoalPos9[1]=GoalPos9[0];GoalPos10[0]=(int)(0.0003296*t*t*t*t*t*t-0.01189*t*t*t*t*t+0.2032*t*t*t*t-2.895*t*t*t+27.86*t*t-109.9*t+613.8);GoalPos10[1]=GoalPos10[0];GoalPos11[0]=(int)(-0.006659*t*t*t*t*t*t+0.2862*t*t*t*t*t-4.584*t*t*t*t+33.35*t*t*t-105.1*t*t+102.1*t+379.3);GoalPos11[1]=GoalPos11[0];GoalPos12[0]=(int)(0.000823*t*t*t*t*t*t-0.01887*t*t*t*t*t-0.09102*t*t*t*t+5.247*t*t*t-44.36*t*t+130.7*t+528.9);GoalPos12[1]=GoalPos12[0];GoalPos13[0]=(int)(-0.003788*t*t*t*t*t*t+0.1389*t*t*t*t*t-1.64*t*t*t*t+5.74*t*t*t+7.459*t*t-24.55*t+297.2);GoalPos13[1]=GoalPos13[0];GoalPos14[0]=(int)(0.002975*t*t*t*t*t*t-0.1283*t*t*t*t*t+2.114*t*t*t*t-16.1*t*t*t+50.88*t*t-38.08*t+744.6);GoalPos14[1]=GoalPos14[0];GoalPos15[0]=(int)(-0.007288*t*t*t*t*t*t+0.3476*t*t*t*t*t-6.384*t*t*t*t+55.4*t*t*t-219.1*t*t+301.6*t+492.8);GoalPos15[1]=GoalPos15[0];GoalPos16[0]=(int)(0.001997*t*t*t*t*t*t-0.07483*t*t*t*t*t+0.881*t*t*t*t-2.857*t*t*t-5.658*t*t+27.76*t+378.4);GoalPos16[1]=GoalPos16[0];GoalPos17[0]=(int)(-0.0002364 *t*t*t*t*t*t+0.02187*t*t*t*t*t-0.5432 *t*t*t*t+4.617*t*t*t-6.029*t*t-49.48*t+537.6);GoalPos17[1]=GoalPos17[0];GoalPos18[0]=(int)(0.000729*t*t*t*t*t*t-0.03161*t*t*t*t*t+0.5943 *t*t*t*t-7.041*t*t*t+52.96*t*t-183.3*t+664.7); GoalPos18[1]=GoalPos18[0];
Posicao();
}
PrintErrorCode();
// Read present position
wPresentPos = dxl_read_word( id, P_PRESENT_POSITION_L );
TxDWord16(GoalPos[INDEX]);
TxDString(" ");
TxDWord16(wPresentPos);
TxDByte_PC('\r');
TxDByte_PC('\n');
}
else
PrintCommStatus(CommStatus);
t = t + 0.01;
}
return 0;}
当我运行它时,请提供以下信息:
C:\ Users \ Gilmar \ Dropbox \ L008 - Bloco Delta \ Trabalho \ pdpd \ PDPD LIBS \ CM530 \ 09 DXL READ_WRITE / APP / src / main.c:179:未定义引用__aeabi_dcmple'
C:\Users\Gilmar\Dropbox\L008 - Bloco Delta\Trabalho\pdpd\PDPD LIBS\CM530\09 DXL READ_WRITE/APP/src/main.c:179: undefined reference to
__ aeabi_dmul&# 39;
C:\ Users \ Gilmar \ Dropbox \ L008 - Bloco Delta \ Trabalho \ pdpd \ PDPD LIBS \ CM530 \ 09 DXL READ_WRITE / APP / src / main.c:179:未定义引用__aeabi_dadd'
C:\Users\Gilmar\Dropbox\L008 - Bloco Delta\Trabalho\pdpd\PDPD LIBS\CM530\09 DXL READ_WRITE/APP/src/main.c:179: undefined reference to
__ aeabi_d2iz&#39;
C:\ Users \ Gilmar \ Dropbox \ L008 - Bloco Delta \ Trabalho \ pdpd \ PDPD LIBS \ CM530 \ 09 DXL READ_WRITE / APP / src / main.c:179:未定义引用__aeabi_dmul'
C:\Users\Gilmar\Dropbox\L008 - Bloco Delta\Trabalho\pdpd\PDPD LIBS\CM530\09 DXL READ_WRITE/APP/src/main.c:179: undefined reference to
__ aeabi_dadd&#39;
C:\ Users \ Gilmar \ Dropbox \ L008 - Bloco Delta \ Trabalho \ pdpd \ PDPD LIBS \ CM530 \ 09 DXL READ_WRITE / APP / src / main.c:179:未定义引用__aeabi_d2iz'
C:\Users\Gilmar\Dropbox\L008 - Bloco Delta\Trabalho\pdpd\PDPD LIBS\CM530\09 DXL READ_WRITE/APP/src/main.c:179: undefined reference to
__ aeabi_dmul&#39;
C:\ Users \ Gilmar \ Dropbox \ L008 - Bloco Delta \ Trabalho \ pdpd \ PDPD LIBS \ CM530 \ 09 DXL READ_WRITE / APP / src / main.c:179:未定义引用__aeabi_dmul'
C:\Users\Gilmar\Dropbox\L008 - Bloco Delta\Trabalho\pdpd\PDPD LIBS\CM530\09 DXL READ_WRITE/APP/src/main.c:179: undefined reference to
__ aeabi_dmul&#39;
C:\ Users \ Gilmar \ Dropbox \ L008 - Bloco Delta \ Trabalho \ pdpd \ PDPD LIBS \ CM530 \ 09 DXL READ_WRITE / APP / src / main.c:179:未定义引用__aeabi_dmul'
C:\Users\Gilmar\Dropbox\L008 - Bloco Delta\Trabalho\pdpd\PDPD LIBS\CM530\09 DXL READ_WRITE/APP/src/main.c:179: undefined reference to
__ aeabi_dmul&#39;
APP / src / main.o:C: \ Users \ Gilmar \ Dropbox \ L008 - Bloco Delta \ Trabalho \ pdpd \ PDPD LIBS \ CM530 \ 09 DXL READ_WRITE / APP / src / main.c:179:更多未定义的引用` __aeabi_dmul&#39;遵循
我该如何解决这个问题?当我评论行t = t + 0.01时,代码Works,但我需要添加0.01。我已经尝试过float,double和int,任何数字,当我把孤独,工作,我的问题只是在总和。
答案 0 :(得分:1)
您的编译器需要一个软浮点库的实现来处理浮点运算。未定义的符号表示编译器没有链接到软浮点实现。
我不知道你是否需要双精度,但如果可能的话,我建议不要使用它 - 单精度浮动对于架构来说不那么痛苦。您需要确保将编译器设置为使用合适的浮点ABI,并且它具有适当的软浮点实现。您的Cortex M3没有硬件浮点单元。