Uart Circular buffer , Error while building using Nucleo 429zi
Just did what is in the video in the link
https://controllerstech.com/ring-buffer-using-head-and-tail-in-stm32/
The error is as shown in the details
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-29 9:48 PM
arm-none-eabi-gcc -o "Uart_Ring_Buffer.elf" @"objects.list" -mcpu=cortex-m4 -T"C:\Users\User\STM32CubeIDE\workspace_1.8.0\Uart_Ring_Buffer\STM32F429ZITX_FLASH.ld" --specs=nosys.specs -Wl,-Map="Uart_Ring_Buffer.map" -Wl,--gc-sections -static --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
c:\st\stm32cubeide_1.8.0\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: ./Core/Src/main.o:C:/Users/User/STM32CubeIDE/workspace_1.8.0/Uart_Ring_Buffer/Debug/../Core/Src/main.c:50: multiple definition of `huart2'; ./Core/Src/UartRingbuffer.o:C:/Users/User/STM32CubeIDE/workspace_1.8.0/Uart_Ring_Buffer/Debug/../Core/Src/UartRingbuffer.c:15: first defined here
collect2.exe: error: ld returned 1 exit status
make: *** [makefile:64: Uart_Ring_Buffer.elf] Error 1
"make -j8 all" terminated with exit code 2. Build might be incomplete.
Solved! Go to Solution.
- Labels:
-
STM32CubeIDE
-
STM32F4 Series
-
UART-USART
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-29 10:14 PM
Error says you defined a variable in two files. Need to not do that​.
Decide where you want it, and use extern elsewhere.​
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-29 10:14 PM
Error says you defined a variable in two files. Need to not do that​.
Decide where you want it, and use extern elsewhere.​
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-30 6:27 AM - edited ‎2023-11-20 8:53 AM
After searching huart2 in my code as shown below , I use extern as you mention
Do you see any error (multiple definition of `huart2';) ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-30 6:39 AM
Is it in an include file?
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-30 7:31 AM
> multiple definition of `huart2';
> ./Core/Src/UartRingbuffer.o:C:/Users/User/STM32CubeIDE/workspace_1.8.0/Uart_Ring_Buffer/Debug/../Core/Src/UartRingbuffer.c:15: first defined here
The error indicates that you've defined huart2 in UartRingbuffer.c on line 15. It shouldn't be defined there. Use extern. Would be easier to spot the error if you attached the relevant files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-30 8:31 AM
Thanks , Tesla & TDK
you are correct it was in UartRingBuffer.c
