完整的问题提示如下:
23:51:30 **** 构建 of configuration Debug for project 2_UART2 ****
make -j8 all
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/Legacy/stm32f1xx_hal_can.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_adc_ex.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_can.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cec.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_cortex.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_crc.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dac.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dac_ex.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_dma.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_eth.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_exti.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_flash_ex.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_gpio_ex.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_hcd.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2c.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_i2s.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_irda.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_iwdg.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_mmc.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_nand.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_nor.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pccard.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pcd_ex.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_pwr.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rcc_ex.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_rtc_ex.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_sd.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_smartcard.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_spi.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_sram.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_tim_ex.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_uart.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_usart.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_hal_wwdg.c"
arm-none-eabi-gcc "../libraries/STM32F1xx_HAL_Driver/Src/stm32f1xx_ll_usb.c"
arm-none-eabi-gcc "../libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/gcc/startup_stm32f103xe.S"
arm-none-eabi-gcc "../libraries/CMSIS/Device/ST/STM32F1xx/Source/Templates/system_stm32f1xx.c"
arm-none-eabi-gcc "../drivers/led.c"
arm-none-eabi-gcc "../drivers/stm32f1xx_it.c"
arm-none-eabi-gcc "../drivers/sysclk.c"
arm-none-eabi-gcc "../drivers/uart.c"
arm-none-eabi-gcc "../applications/main.c"
linking...
d:/rt-threadstudio/repo/extract/toolchain_support_packages/arm/gnu_tools_for_arm_embedded_processors/5.4.1/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/armv7-m\libg.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text._sbrk_r+0xc): undefined reference to `_sbrk'
d:/rt-threadstudio/repo/extract/toolchain_support_packages/arm/gnu_tools_for_arm_embedded_processors/5.4.1/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/armv7-m\libg.a(lib_a-writer.o): In function `_write_r':
writer.c:(.text._write_r+0x12): undefined reference to `_write'
d:/rt-threadstudio/repo/extract/toolchain_support_packages/arm/gnu_tools_for_arm_embedded_processors/5.4.1/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/armv7-m\libg.a(lib_a-closer.o): In function `_close_r':
closer.c:(.text._close_r+0xc): undefined reference to `_close'
d:/rt-threadstudio/repo/extract/toolchain_support_packages/arm/gnu_tools_for_arm_embedded_processors/5.4.1/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/armv7-m\libg.a(lib_a-fstatr.o): In function `_fstat_r':
fstatr.c:(.text._fstat_r+0x10): undefined reference to `_fstat'
d:/rt-threadstudio/repo/extract/toolchain_support_packages/arm/gnu_tools_for_arm_embedded_processors/5.4.1/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/armv7-m\libg.a(lib_a-isattyr.o): In function `_isatty_r':
isattyr.c:(.text._isatty_r+0xc): undefined reference to `_isatty'
d:/rt-threadstudio/repo/extract/toolchain_support_packages/arm/gnu_tools_for_arm_embedded_processors/5.4.1/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/armv7-m\libg.a(lib_a-lseekr.o): In function `_lseek_r':
lseekr.c:(.text._lseek_r+0x12): undefined reference to `_lseek'
d:/rt-threadstudio/repo/extract/toolchain_support_packages/arm/gnu_tools_for_arm_embedded_processors/5.4.1/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/armv7-m\libg.a(lib_a-readr.o): In function `_read_r':
readr.c:(.text._read_r+0x12): undefined reference to `_read'
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:50: rtthread.elf] Error 1
"make -j8 all" terminated with exit code 2. Build might be incomplete.
23:51:33 Build Failed. 1 errors, 0 warnings. (took 3s.15ms)
谢谢您的回答,我的项目没有RT-Thread Settings这个设定项,因为我是裸机程序,没有用到RTT,所以不知道如何使能libc
那可能需要你来实现 c 库的一些接口 比如 lseek,在studio 创建的裸机中 是通过一个文件syscalls.c 做了一些简单的接口,可以参考