对 STM32 的“__aeabi_d2iz”ARM 程序的未定义引用
undefined reference to `__aeabi_d2iz' ARM program for STM32
我正在做一个大学项目,其中包括使用 6 位 7 段显示器。我写了一个代码,应该在显示上写双精度数,但我不能将双精度数发送给函数,也不能将双精度数转换为整数再发送。
我在 Eclipse 和 Proteus 工作。
代码如下:
void ispisbroja(int broj){
int c4 = (broj%1000000)/100000;
int c3 = (broj%100000)/10000;
int c2=(broj%10000)/1000;
int c1=(broj%1000)/100;
int c0=(broj%100)/10;
int cm1=(broj%10);
while(1){
GPIOC->BSRR |= (GPIO_BSRR_BS0); // setujemo pin PC0
switch(c4){
case 9:
devetka();
break;
case 8:
osmica();
break;
case 7:
sedmica();
break;
case 6:
sestica();
break;
case 5:
petica();
break;
case 4:
cetvorka();
break;
case 3:
trojka();
break;
case 2:
dvojka();
break;
case 1:
jedinica();
break;
default:
nula();
}
delay(100);
GPIOC->BSRR &= ~(GPIO_BSRR_BS0); // resetujemo pin PC0
GPIOC->BSRR |= (GPIO_BSRR_BR0); // resetujemo pin PC0
GPIOC->BSRR |= (GPIO_BSRR_BS1); // setujemo pin PC1
switch(c3){
case 9:
devetka();
break;
case 8:
osmica();
break;
case 7:
sedmica();
break;
case 6:
sestica();
break;
case 5:
petica();
break;
case 4:
cetvorka();
break;
case 3:
trojka();
break;
case 2:
dvojka();
break;
case 1:
jedinica();
break;
default:
nula();
}
delay(100);
GPIOC->BSRR &= ~(GPIO_BSRR_BS1); // resetujemo pin PC1
GPIOC->BSRR |= (GPIO_BSRR_BR1); // resetujemo pin PC1
GPIOC->BSRR |= (GPIO_BSRR_BS2); // setujemo pin PC2
switch (c2){
case 9:
devetka();
break;
case 8:
osmica();
break;
case 7:
sedmica();
break;
case 6:
sestica();
break;
case 5:
petica();
break;
case 4:
cetvorka();
break;
case 3:
trojka();
break;
case 2:
dvojka();
break;
case 1:
jedinica();
break;
default:
nula();
}
delay(100);
GPIOC->BSRR &= ~(GPIO_BSRR_BS2); // resetujemo pin PC2
GPIOC->BSRR |= (GPIO_BSRR_BR2); // resetujemo pin PC2
GPIOC->BSRR |= (GPIO_BSRR_BS3); // setujemo pin PC3
switch(c1){
case 9:
devetka(1);
break;
case 8:
osmica(1);
break;
case 7:
sedmica(1);
break;
case 6:
sestica(1);
break;
case 5:
petica(1);
break;
case 4:
cetvorka(1);
break;
case 3:
trojka(1);
break;
case 2:
dvojka(1);
break;
case 1:
jedinica(1);
break;
default:
nula(1);
}
delay(100);
GPIOC->BSRR &= ~(GPIO_BSRR_BS3); // resetujemo pin PC3
GPIOC->BSRR |= (GPIO_BSRR_BR3); // resetujemo pin PC3
GPIOC->BSRR |= (GPIO_BSRR_BS4); // setujemo pin PC4
switch(c0){
case 9:
devetka();
break;
case 8:
osmica();
break;
case 7:
sedmica();
break;
case 6:
sestica();
break;
case 5:
petica();
break;
case 4:
cetvorka();
break;
case 3:
trojka();
break;
case 2:
dvojka();
break;
case 1:
jedinica();
break;
default:
nula();
}
delay(100);
GPIOC->BSRR &= ~(GPIO_BSRR_BS4); // resetujemo pin PC4
GPIOC->BSRR |= (GPIO_BSRR_BR4); // resetujemo pin PC4
GPIOC->BSRR |= (GPIO_BSRR_BS5); // setujemo pin PC5
switch(cm1){
case 9:
devetka();
break;
case 8:
osmica();
break;
case 7:
sedmica();
break;
case 6:
sestica();
break;
case 5:
petica();
break;
case 4:
cetvorka();
break;
case 3:
trojka();
break;
case 2:
dvojka();
break;
case 1:
jedinica();
break;
default:
nula();
}
delay(100);
GPIOC->BSRR &= ~(GPIO_BSRR_BS5); // resetujemo pin PC5
GPIOC->BSRR |= (GPIO_BSRR_BR5); // resetujemo pin PC5
}
}
int main(void){
GPIO_Init();
double broj = 1234.66;
int broj2=broj;
broj2 = broj2 * 100;
ispisbroja(broj2);
}
我得到的错误:
D:\toolchain\GNU MCU Eclipse\ARM Embedded GCC.3.1-1.1\bin/arm-none-eabi-ld.exe -T linker_script.ld -o build/domzad2_program.elf build/startup_code.o build/main.o build/util.o build/timer_pwm.o build/adc.o build/usart.o
D:\toolchain\GNU MCU Eclipse\ARM Embedded GCC.3.1-1.1\bin/arm-none-eabi-ld.exe: build/main.o: in function `main':
main.c:(.text+0xdd4): undefined reference to `__aeabi_d2iz'
make: *** [makefile:92: build/domzad2_program.elf] Error 1
"make all" terminated with exit code 2. Build might be incomplete.
谢谢!
您还需要 link 图书馆。很难用简单的 post 来解释如何配置工具链。
我建议安装 stmCubeIde,它将为您进行配置。
我正在做一个大学项目,其中包括使用 6 位 7 段显示器。我写了一个代码,应该在显示上写双精度数,但我不能将双精度数发送给函数,也不能将双精度数转换为整数再发送。
我在 Eclipse 和 Proteus 工作。
代码如下:
void ispisbroja(int broj){
int c4 = (broj%1000000)/100000;
int c3 = (broj%100000)/10000;
int c2=(broj%10000)/1000;
int c1=(broj%1000)/100;
int c0=(broj%100)/10;
int cm1=(broj%10);
while(1){
GPIOC->BSRR |= (GPIO_BSRR_BS0); // setujemo pin PC0
switch(c4){
case 9:
devetka();
break;
case 8:
osmica();
break;
case 7:
sedmica();
break;
case 6:
sestica();
break;
case 5:
petica();
break;
case 4:
cetvorka();
break;
case 3:
trojka();
break;
case 2:
dvojka();
break;
case 1:
jedinica();
break;
default:
nula();
}
delay(100);
GPIOC->BSRR &= ~(GPIO_BSRR_BS0); // resetujemo pin PC0
GPIOC->BSRR |= (GPIO_BSRR_BR0); // resetujemo pin PC0
GPIOC->BSRR |= (GPIO_BSRR_BS1); // setujemo pin PC1
switch(c3){
case 9:
devetka();
break;
case 8:
osmica();
break;
case 7:
sedmica();
break;
case 6:
sestica();
break;
case 5:
petica();
break;
case 4:
cetvorka();
break;
case 3:
trojka();
break;
case 2:
dvojka();
break;
case 1:
jedinica();
break;
default:
nula();
}
delay(100);
GPIOC->BSRR &= ~(GPIO_BSRR_BS1); // resetujemo pin PC1
GPIOC->BSRR |= (GPIO_BSRR_BR1); // resetujemo pin PC1
GPIOC->BSRR |= (GPIO_BSRR_BS2); // setujemo pin PC2
switch (c2){
case 9:
devetka();
break;
case 8:
osmica();
break;
case 7:
sedmica();
break;
case 6:
sestica();
break;
case 5:
petica();
break;
case 4:
cetvorka();
break;
case 3:
trojka();
break;
case 2:
dvojka();
break;
case 1:
jedinica();
break;
default:
nula();
}
delay(100);
GPIOC->BSRR &= ~(GPIO_BSRR_BS2); // resetujemo pin PC2
GPIOC->BSRR |= (GPIO_BSRR_BR2); // resetujemo pin PC2
GPIOC->BSRR |= (GPIO_BSRR_BS3); // setujemo pin PC3
switch(c1){
case 9:
devetka(1);
break;
case 8:
osmica(1);
break;
case 7:
sedmica(1);
break;
case 6:
sestica(1);
break;
case 5:
petica(1);
break;
case 4:
cetvorka(1);
break;
case 3:
trojka(1);
break;
case 2:
dvojka(1);
break;
case 1:
jedinica(1);
break;
default:
nula(1);
}
delay(100);
GPIOC->BSRR &= ~(GPIO_BSRR_BS3); // resetujemo pin PC3
GPIOC->BSRR |= (GPIO_BSRR_BR3); // resetujemo pin PC3
GPIOC->BSRR |= (GPIO_BSRR_BS4); // setujemo pin PC4
switch(c0){
case 9:
devetka();
break;
case 8:
osmica();
break;
case 7:
sedmica();
break;
case 6:
sestica();
break;
case 5:
petica();
break;
case 4:
cetvorka();
break;
case 3:
trojka();
break;
case 2:
dvojka();
break;
case 1:
jedinica();
break;
default:
nula();
}
delay(100);
GPIOC->BSRR &= ~(GPIO_BSRR_BS4); // resetujemo pin PC4
GPIOC->BSRR |= (GPIO_BSRR_BR4); // resetujemo pin PC4
GPIOC->BSRR |= (GPIO_BSRR_BS5); // setujemo pin PC5
switch(cm1){
case 9:
devetka();
break;
case 8:
osmica();
break;
case 7:
sedmica();
break;
case 6:
sestica();
break;
case 5:
petica();
break;
case 4:
cetvorka();
break;
case 3:
trojka();
break;
case 2:
dvojka();
break;
case 1:
jedinica();
break;
default:
nula();
}
delay(100);
GPIOC->BSRR &= ~(GPIO_BSRR_BS5); // resetujemo pin PC5
GPIOC->BSRR |= (GPIO_BSRR_BR5); // resetujemo pin PC5
}
}
int main(void){
GPIO_Init();
double broj = 1234.66;
int broj2=broj;
broj2 = broj2 * 100;
ispisbroja(broj2);
}
我得到的错误:
D:\toolchain\GNU MCU Eclipse\ARM Embedded GCC.3.1-1.1\bin/arm-none-eabi-ld.exe -T linker_script.ld -o build/domzad2_program.elf build/startup_code.o build/main.o build/util.o build/timer_pwm.o build/adc.o build/usart.o
D:\toolchain\GNU MCU Eclipse\ARM Embedded GCC.3.1-1.1\bin/arm-none-eabi-ld.exe: build/main.o: in function `main':
main.c:(.text+0xdd4): undefined reference to `__aeabi_d2iz'
make: *** [makefile:92: build/domzad2_program.elf] Error 1
"make all" terminated with exit code 2. Build might be incomplete.
谢谢!
您还需要 link 图书馆。很难用简单的 post 来解释如何配置工具链。
我建议安装 stmCubeIde,它将为您进行配置。