tmk / tmk_keyboard

Keyboard firmwares for Atmel AVR and Cortex-M
3.98k stars 1.7k forks source link

Linking errors during compiling of stm32_f103_onekey #349

Closed KaneTree closed 8 years ago

KaneTree commented 8 years ago

I encountered some linking errors during the compiling of stm32_f103_onekey.

The arm tool chain I used was gcc-arm-none-eabi-4_9-2015q3-20150921-win32 I tired to put both ChibiOS-kinetis and ChibiOS 16.1.4 into tmk_core/tool/chibios/chibios/ and got the same errors. After some search work, I found that the definition of some functions such as the 'usbStartTransmitI' were located in 'usb.c'. Therefore I tried to add the line "include usb.h" into the protocol/chibios/usb_main.c, however it did not work. I am new with the chibios and have no idea how to fix it. Need some help!

The error is as follows: Linking build/ch.elf build/obj/chsys.o: In function chSysInit': C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/tool/chibios/chibios/os/rt/src/chsys.c:105: undefined reference to_core_init' C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/tool/chibios/chibios/os/rt/src/chsys.c:108: undefined reference to _heap_init' C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/tool/chibios/chibios/os/rt/src/chsys.c:152: undefined reference toch_debug' build/obj/hal.o: In function halInit': C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/tool/chibios/chibios/os/hal/src/hal.c:65: undefined reference to_pal_lld_init' C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/tool/chibios/chibios/os/hal/src/hal.c:110: undefined reference to usbInit' build/obj/usb_main.o: In functionkeyboard_idle_timer_cb': C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/protocol/chibios/usb_main.c:1112: undefined reference tousbStartTransmitI' build/obj/usb_main.o: In functionusb_event_cb': C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/protocol/chibios/usb_main.c:799: undefined reference to usbInitEndpointI' C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/protocol/chibios/usb_main.c:801: undefined reference tousbInitEndpointI' C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/protocol/chibios/usb_main.c:808: undefined reference to usbInitEndpointI' C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/protocol/chibios/usb_main.c:811: undefined reference tousbInitEndpointI' build/obj/usb_main.o: In function init_usb_driver': C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/protocol/chibios/usb_main.c:1030: undefined reference to_pal_lld_setgroupmode' C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/protocol/chibios/usb_main.c:1032: undefined reference tousbStart' C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/protocol/chibios/usb_main.c:1033: undefined reference to_pal_lld_setgroupmode' build/obj/usb_main.o: In function send_keyboard': C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/protocol/chibios/usb_main.c:1168: undefined reference tousbStartTransmitI' C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/protocol/chibios/usb_main.c:1153: undefined reference tousbStartTransmitI' build/obj/usb_main.o: In functionosalThreadSuspendS': C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/tool/chibios/chibios/os/hal/osal/rt/osal.h:688: undefined reference to USBD1' build/obj/usb_main.o: In functionsend_mouse': C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/protocol/chibios/usb_main.c:1201: undefined reference tousbStartTransmitI' build/obj/usb_main.o: In function__set_BASEPRI': C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/tool/chibios/chibios/os/ext/CMSIS/include/core_cmFunc.h:5 48: undefined reference to USBD1' build/obj/usb_main.o: In functionsend_extra_report': C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/protocol/chibios/usb_main.c:1237: undefined reference tousbStartTransmitI' build/obj/usb_main.o: In functionsend_system': C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/protocol/chibios/usb_main.c:1243: undefined reference toUSBD1' build/obj/usb_main.o: In functionsend_extra_report': C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/protocol/chibios/usb_main.c:1237: undefined reference tousbStartTransmitI' build/obj/usb_main.o: In functionsend_consumer': C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/protocol/chibios/usb_main.c:1247: undefined reference toUSBD1' build/obj/main.o: In functionhook_usb_suspend_loop': C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/protocol/chibios/main.c:75: undefined reference to USBD1' build/obj/main.o: In functionmain': C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/../../tmk_core/protocol/chibios/main.c:156: undefined reference to USBD1' build/obj/matrix.o: In functioninit_cols': C:\work\new_git_res\tmk_keyboard\keyboard\stm32_f103_onekey/matrix.c:149: undefined reference to `_pal_lld_setgroupmode' collect2.exe: error: ld returned 1 exit status make: *\ [build/ch.elf] Error 1

tmk commented 8 years ago

I think this was fixed, at least I can compile stm32_f103_onekey with the latest source. Check mk_core/protocol/chibios/README.md again.