Sysprogs forums › Forums › VisualGDB › undefined reference to `_….'
This topic contains 3 replies, has 2 voices, and was last updated by support 3 years ago.
-
AuthorPosts
-
November 16, 2020 at 22:10 #29520
I am making an embedded STM32CubeMX project with the STM32CubeMX wizard. Since moving my project to a directory with no spaces my previous issue has been resolved. However I have a problem when building the project. There were a few build errors with the code which I have resolved, but I am stuck on the below build errors. Each one throws a undefined reference to
_….’ error. The missing references are _sbrk, _write, _close, _fstat, _isatty, _lseek, _read. I ran the VisualGDB ‘resolve build errors’ tool and it suggested to add a reference to the ‘nosys’ library. This was done, but when I try to build the program now I still get the errors shown in the image attached
cmd.exe /C “cd . && C:\PROGRA~2\GNUTOO~1\72018-~1\bin\AR19DD~1.EXE -g3 -O0 CMakeFiles/BSP.dir/Src/usb_otg.c.obj CMakeFiles/BSP.dir/Src/usart.c.obj CMakeFiles/BSP.dir/Src/tim.c.obj CMakeFiles/BSP.dir/Src/spi.c.obj CMakeFiles/BSP.dir/Src/fsmc.c.obj CMakeFiles/BSP.dir/Src/dma.c.obj CMakeFiles/BSP.dir/Src/adc.c.obj CMakeFiles/BSP.dir/Src/gpio.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hcd.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_spi.c.obj CMakeFiles/BSP.dir/startup_stm32f407xx.s.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_sram.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_fsmc.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc_ex.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_adc.c.obj CMakeFiles/BSP.dir/Src/system_stm32f4xx.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_exti.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c.obj CMakeFiles/BSP.dir/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c.obj CMakeFiles/BSP.dir/Src/stm32f4xx_hal_msp.c.obj CMakeFiles/BSP.dir/Src/stm32f4xx_it.c.obj CMakeFiles/BSP.dir/Src/main.c.obj CMakeFiles/EmbeddedProject1.dir/dwt_delay.c.obj CMakeFiles/EmbeddedProject1.dir/LcdCust.c.obj CMakeFiles/EmbeddedProject1.dir/ultrasonic.c.obj CMakeFiles/EmbeddedProject1.dir/ili9325.c.obj CMakeFiles/EmbeddedProject1.dir/openx07v_c_lcd.c.obj CMakeFiles/EmbeddedProject1.dir/touch_panel.c.obj CMakeFiles/EmbeddedProject1.dir/font8.c.obj CMakeFiles/EmbeddedProject1.dir/font12.c.obj CMakeFiles/EmbeddedProject1.dir/font16.c.obj CMakeFiles/EmbeddedProject1.dir/font20.c.obj CMakeFiles/EmbeddedProject1.dir/font24.c.obj -o EmbeddedProject1 -“TC:/Users/jpollard_2/Documents/VS2015/Projects/EmbeddedProject1/EmbeddedProject1/STM32F407VGTx_FLASH.ld” -Wl,-Map=EmbeddedProject1.map -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -Wl,-gc-sections && cd .”
c:/progra~2/gnutoo~1/72018-~1/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m/fpv4-sp/hard\libg.a(lib_a-sbrkr.o): In function _sbrk_r’:
sbrkr.c:(.text._sbrk_r+0xc): undefined reference to_sbrk’
_write_r’:
c:/progra~2/gnutoo~1/72018-~1/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m/fpv4-sp/hard\libg.a(lib_a-writer.o): In function
writer.c:(.text._write_r+0x12): undefined reference to_write’
_close_r’:
c:/progra~2/gnutoo~1/72018-~1/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m/fpv4-sp/hard\libg.a(lib_a-closer.o): In function
closer.c:(.text._close_r+0xc): undefined reference to_close’
_fstat_r’:
c:/progra~2/gnutoo~1/72018-~1/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m/fpv4-sp/hard\libg.a(lib_a-fstatr.o): In function
fstatr.c:(.text._fstat_r+0x10): undefined reference to_fstat’
_isatty_r’:
c:/progra~2/gnutoo~1/72018-~1/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m/fpv4-sp/hard\libg.a(lib_a-isattyr.o): In function
isattyr.c:(.text._isatty_r+0xc): undefined reference to_isatty’
_lseek_r’:
c:/progra~2/gnutoo~1/72018-~1/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m/fpv4-sp/hard\libg.a(lib_a-lseekr.o): In function
lseekr.c:(.text._lseek_r+0x12): undefined reference to_lseek’
_read_r’:
c:/progra~2/gnutoo~1/72018-~1/bin/../lib/gcc/arm-none-eabi/7.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m/fpv4-sp/hard\libg.a(lib_a-readr.o): In function
readr.c:(.text._read_r+0x12): undefined reference to `_read’
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.Attachments:
You must be logged in to view attached files.November 17, 2020 at 08:32 #29526Hi,
Looks like you are missing the semihosting syscalls. Please see the following tutorial for details: https://visualgdb.com/tutorials/arm/semihosting/
November 17, 2020 at 14:42 #29527Thanks that fixed some of the missing files, but I am still getting errors regarding the files in the attached image. The ‘Resolve Build Errors’ wizard suggests including a reference to ‘gloss-linux’ but this has no effect on the errors
Attachments:
You must be logged in to view attached files.November 17, 2020 at 14:52 #29529Sorry, VisualGDB cannot automatically fix every possible error in every project. It does its best in suggesting solutions to common errors, but it does not work 100%. Our best advice would be to read more about the role of system calls in embedded projects, understand what component requires them and what implementation suits your requirements the best, and then select the matching implementation as shown in our semihosting tutorial.
-
AuthorPosts
You must be logged in to reply to this topic.