Skip to main content
alain cordat
Associate
July 12, 2018
Question

stm32f030 aeabi_uidiv undefined reference

  • July 12, 2018
  • 5 replies
  • 3979 views
Posted on July 13, 2018 at 00:12

hi,

I try to compile a minimum program using stm driver libs. but I can't compile without error about '__aeabi_uidiv' from line 1083 of stm32f0xx_rcc.c : pllclk = (HSE_VALUE / prediv1factor) * pllmull;

I think the problem come from the linker and I have added path of the libgcc.a in ld flags in my makefile

LIBGCCARM = ${GCCARMPATH}/lib/gcc/arm-none-eabi/${GCCARMVERSION}/${GCCARMARCH}

LFLAGS = -L${LIBGCCARM} \

-lgcc \

-nostartfiles -T$(LKR_SCRIPT)

the linker find correctly the lib, but the error occurs always...

thanks for your help

    This topic has been closed for replies.

    5 replies

    AvaTar
    Senior III
    July 13, 2018
    Posted on July 13, 2018 at 10:12

    AFAIK, the library should be the right one.

    Perhaps you can check it with objdump or similar, to see if the symbol (function) is really there.

    alain cordat
    Associate
    July 13, 2018
    Posted on July 14, 2018 at 00:20

    Hi,

    I've found in libgcc several lines about __aeabi_uidiv:

    line 68

         00000000 g     F .text    00000000 .hidden __aeabi_uidiv

    lines 2918, 2933, 2989...

         00000000         *UND*    00000000 __aeabi_uidiv

    an idea?

    thanks

    AvaTar
    Senior III
    July 14, 2018
    Posted on July 14, 2018 at 10:56

    Looks like it's there.

    Can you post the actual error message from the linker ?

    alain cordat
    Associate
    July 14, 2018
    Posted on July 14, 2018 at 23:12

    Hi,

    see here after the result of make,

    alain@debian9-fuj:~/03_dev/10_wks_stm32f030/11_BootMinimalStCmsisLib $ make

    /home/alain/02_bin/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc -I/home/alain/03_dev/10_wks_stm32f030/00_LIB/CMSIS/INC/ -I/home/alain/03_dev/10_wks_stm32f030/00_LIB/stm32f0-stdperiph/INC/ -c -L/home/alain/02_bin/gcc-arm-none-eabi-7-2018-q2-update/lib/gcc/arm-none-eabi/7.3.1 -lgcc -DSTM32F030X4 -fno-common -O0 -g -march=armv6-m -mcpu=cortex-m0 -mthumb -DUSE_STDPERIPH_DRIVER=1 -fno-builtin -ffreestanding -nostdlib -std=gnu11   main.c -o main.o

    /home/alain/02_bin/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc -I/home/alain/03_dev/10_wks_stm32f030/00_LIB/CMSIS/INC/ -I/home/alain/03_dev/10_wks_stm32f030/00_LIB/stm32f0-stdperiph/INC/ -c -L/home/alain/02_bin/gcc-arm-none-eabi-7-2018-q2-update/lib/gcc/arm-none-eabi/7.3.1 -lgcc -DSTM32F030X4 -fno-common -O0 -g -march=armv6-m -mcpu=cortex-m0 -mthumb -DUSE_STDPERIPH_DRIVER=1 -fno-builtin -ffreestanding -nostdlib -std=gnu11  /home/alain/03_dev/10_wks_stm32f030/00_LIB/stm32f0-stdperiph/SRC/stm32f0xx_rcc.c  -o stm32f0xx_rcc.o

    /home/alain/02_bin/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc -I/home/alain/03_dev/10_wks_stm32f030/00_LIB/CMSIS/INC/ -I/home/alain/03_dev/10_wks_stm32f030/00_LIB/stm32f0-stdperiph/INC/ -c -L/home/alain/02_bin/gcc-arm-none-eabi-7-2018-q2-update/lib/gcc/arm-none-eabi/7.3.1 -lgcc -DSTM32F030X4 -fno-common -O0 -g -march=armv6-m -mcpu=cortex-m0 -mthumb -DUSE_STDPERIPH_DRIVER=1 -fno-builtin -ffreestanding -nostdlib -std=gnu11  /home/alain/03_dev/10_wks_stm32f030/00_LIB/stm32f0-stdperiph/SRC/stm32f0xx_gpio.c -o stm32f0xx_gpio.o

    /home/alain/02_bin/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-ld -L/home/alain/02_bin/gcc-arm-none-eabi-7-2018-q2-update/lib/gcc/arm-none-eabi/7.3.1 -lgcc -nostartfiles -Tstm32_minimal.ld  -o main.elf -I/home/alain/03_dev/10_wks_stm32f030/00_LIB/CMSIS/INC/ -I/home/alain/03_dev/10_wks_stm32f030/00_LIB/stm32f0-stdperiph/INC/ main.o  stm32f0xx_rcc.o stm32f0xx_gpio.o  

    stm32f0xx_rcc.o: In function `RCC_GetClocksFreq':

    /home/alain/03_dev/10_wks_stm32f030/00_LIB/stm32f0-stdperiph/SRC/stm32f0xx_rcc.c:1083: undefined reference to `__aeabi_uidiv'

    makefile:66 : la recette pour la cible « main.elf » a échouée

    make: *** [main.elf] Erreur 1

    I have try with other gcc version, install witdebian package with same error.

    thanks

    AvaTar
    Senior III
    July 16, 2018
    Posted on July 16, 2018 at 07:36

    Does it work if you drop the '

    -fno-builtin -ffreestanding -nostdlib

    ' flags ?
    alain cordat
    Associate
    July 16, 2018
    Posted on July 16, 2018 at 14:07

    No change, same error...

    Tesla DeLorean
    Guru
    July 16, 2018
    Posted on July 16, 2018 at 14:50

    Ignore for a second that this is a different processor, I don't have time to stand-up a CM0 example, look at the other options

    This is how I compile for the H7

    Compiling file: main.c

    arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -Os -ffunction-sections -fdata-sections -Wall -Wstrict-prototypes -Wextra -std=gnu89 -g -ggdb3 -fverbose-asm -Wa,-ahlms=out/main.lst  -DUSE_HAL_DRIVER  -DSTM32H743xx  -DUSE_STM32H743I_EVAL  -MD -MP -MF out/main.d -I.  -Iinc main.c -o out/main.o

    This is how I link for the H7

    arm-none-eabi-g++ -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -TSTM32H743XIHx_FLASH.ld -g -Wl,-Map=out/demo.map,--cref,--no-warn-mismatch -Wl,--gc-sections -nostartfiles  out/startup_stm32h743xx.o out/main.o out/stm32h743i_eval.o out/stm32h7xx_hal.o out/stm32h7xx_hal_cortex.o out/stm32h7xx_hal_gpio.o out/stm32h7xx_hal_msp.o out/stm32h7xx_hal_rcc.o out/stm32h7xx_hal_rcc_ex.o out/stm32h7xx_hal_uart.o out/stm32h7xx_it.o out/syscalls.o out/system_stm32h7xx.o    -o out/demo.elf

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    alain cordat
    Associate
    July 26, 2018

    Hi I (re)install arm-none-eabi toolchain -> same result

    I try the same type of compil for stm32F103 (minimal boot projet, same toolchain), it's ok, no error. so the toolchain is correct for f103...

    I install eclipse +arm mcu pluggin, using the same toolchain. I try a minimal projet, blinky led, it's ok.

    ...