Menu

#132 undefined reference to Function

Version 1.x
closed-fixed
None
5
2015-04-02
2015-04-02
No

Hi
I've created a simple STM32F10x empty project. I've included need header (stm32f10x.h, stm32f10x_rcc.h, stm32f10x_gpio.h, stm32f10x_tim.h) in the main.c.
I can call the functions in rcc and gpio header files, but while calling functions in tim header the following error will be produced:
make all
Building file: ../src/main.c
Invoking: Cross ARM C Compiler
arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Werror -Wunused -Wuninitialized -Wall -Wextra -Wmissing-declarations -Wconversion -Wpointer-arith -Wpadded -Wshadow -Wlogical-op -Waggregate-return -Wfloat-equal -g3 -DDEBUG -DUSE_FULL_ASSERT -DTRACE -DOS_USE_TRACE_SEMIHOSTING_DEBUG -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -DHSE_VALUE=60000000 -I"../include" -I"../system/include" -I"../system/include/cmsis" -I"../system/include/stm32f1-stdperiph" -std=gnu11 -Wmissing-prototypes -Wstrict-prototypes -Wbad-function-cast -MMD -MP -MF"src/main.d" -MT"src/main.o" -c -o "src/main.o" "../src/main.c"
Finished building: ../src/main.c

Building target: TimerNew.elf
Invoking: Cross ARM C++ Linker
arm-none-eabi-g++ -mcpu=cortex-m3 -mthumb -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -Werror -Wunused -Wuninitialized -Wall -Wextra -Wmissing-declarations -Wconversion -Wpointer-arith -Wpadded -Wshadow -Wlogical-op -Waggregate-return -Wfloat-equal -g3 -T mem.ld -T libs.ld -T sections.ld -nostartfiles -Xlinker --gc-sections -L"../ldscripts" -Wl,-Map,"TimerNew.map" --specs=nano.specs -o "TimerNew.elf" ./system/src/stm32f1-stdperiph/misc.o ./system/src/stm32f1-stdperiph/stm32f10x_gpio.o ./system/src/stm32f1-stdperiph/stm32f10x_rcc.o ./system/src/newlib/_cxx.o ./system/src/newlib/_exit.o ./system/src/newlib/_sbrk.o ./system/src/newlib/_startup.o ./system/src/newlib/_syscalls.o ./system/src/newlib/assert.o ./system/src/diag/Trace.o ./system/src/diag/trace_impl.o ./system/src/cortexm/_initialize_hardware.o ./system/src/cortexm/_reset_hardware.o ./system/src/cortexm/exception_handlers.o ./system/src/cmsis/system_stm32f10x.o ./system/src/cmsis/vectors_stm32f10x.o ./src/_write.o ./src/main.o
./src/main.o: In function initTimer': /home/javad/workspace/STM32-Template/TimerNew/Debug/../src/main.c:82: undefined reference toTIM_TimeBaseInit'
/home/javad/workspace/STM32-Template/TimerNew/Debug/../src/main.c:83: undefined reference to TIM_Cmd' ./src/main.o: In functionmain':
/home/javad/workspace/STM32-Template/TimerNew/Debug/../src/main.c:50: undefined reference to TIM_DeInit' /home/javad/workspace/STM32-Template/TimerNew/Debug/../src/main.c:54: undefined reference toTIM_GetCounter'
collect2: error: ld returned 1 exit status
make: *** [TimerNew.elf] Error 1

Discussion

  • Liviu Ionescu (ilg)

    • status: open --> accepted
    • assigned_to: Liviu Ionescu (ilg)
     
  • Javad Rahimi

    Javad Rahimi - 2015-04-02

    It solved. Thanks !

     
  • Liviu Ionescu (ilg)

    • status: accepted --> closed-fixed