I am trying to implement I2C communication between Notecard and an existing host application for the STM23U0 (specifically NUCLEO-STM32U083RC). I’m trying to follow the Note-C documentation, in particular the details on the note-stm32l4 port. I’m also constrained by the fact that the existing host application is maintained using STM32CubeMX (with which I am not familiar) so I need to figure out which “USER CODE” block the declarations should go in. So far, the project builds apart from three build errors related to the noteI2CReset, noteI2CTransmit, and noteI2CReceive functions. The build errors all indicate “multiple definitions of … first defined here” and noting ./Blues/n_hooks.o. I have placed the function prototypes for these three functions in the USER CODE BEGIN PFP section of main.c, and the function implementations in USER CODE BEGIN 4. It all look superficially like the main.c from the note-stm32l4 port. I’m going round in circles with this, so any help would be very welcome…
Hi @darkerenergy ,
I’d be happy to help.
I think the answer may be as simple as reworking some names, but let me try and reproduce your issue and offer a suggestion.
Cheers,
Zak
Hey @zfields,
That’s wonderful, thank you so much. I have a “minimum reproducible” version of the problem and I’m happy to post the source if it helps…
Very Best Regards,
Chris
Hi @zfields -
This looks very similar to something you were helping @natea26 with back in August? In anticipation that you might ask me the same things you did them …
- I’m using STM32CubeIDE 1.16.1 (GNU 11)
- The build log looks like this
make -j12 all
arm-none-eabi-gcc -o “FreeRTOS_Semaphore_LowPower.elf” @“objects.list” -mcpu=cortex-m0plus -T"C:\Users\chris\STM32Cube\Example\FreeRTOS_Semaphore_LowPower\STM32CubeIDE\STM32U083RCTX_FLASH.ld" --specs=nosys.specs -Wl,-Map=“FreeRTOS_Semaphore_LowPower.map” -Wl,–gc-sections -static --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,–start-group -lc -lm -Wl,–end-group
C:/ST/STM32CubeIDE_1.15.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.200.202406191623/tools/bin/…/lib/gcc/arm-none-eabi/12.3.1/…/…/…/…/arm-none-eabi/bin/ld.exe: ./Blues/n_hooks.o: in functionnoteI2CReset': n_hooks.c:(.text.noteI2CReset+0x0): multiple definition of
noteI2CReset’; ./Application/User/main.o:main.c:(.text.noteI2CReset+0x0): first defined here
C:/ST/STM32CubeIDE_1.15.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.200.202406191623/tools/bin/…/lib/gcc/arm-none-eabi/12.3.1/…/…/…/…/arm-none-eabi/bin/ld.exe: ./Blues/n_hooks.o: in functionnoteI2CTransmit': n_hooks.c:(.text.noteI2CTransmit+0x0): multiple definition of
noteI2CTransmit’; ./Application/User/main.o:main.c:(.text.noteI2CTransmit+0x0): first defined here
C:/ST/STM32CubeIDE_1.15.0/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.200.202406191623/tools/bin/…/lib/gcc/arm-none-eabi/12.3.1/…/…/…/…/arm-none-eabi/bin/ld.exe: ./Blues/n_hooks.o: in functionnoteI2CReceive': n_hooks.c:(.text.noteI2CReceive+0x0): multiple definition of
noteI2CReceive’; ./Application/User/main.o:main.c:(.text.noteI2CReceive+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
Cheers,
Chris
Hi Chris,
I hit a bit of a snafoo yesterday.
Apparently the latest STMCube tools aren’t compatible with Ubuntu 24.04.
Regardless, I think I know the solution to the problem, but I’ll need you to test an experimental branch for me.
However, before we try that, can you can you try and clone note-c
at the commit referenced by the note-stm32l4
sub-module? It should be compatible, but I’d like to have you double check.
Thanks,
Zak
Hi Zak -
No worries, I really appreciate your help. In fact … I feel bad because I can’t actually do this until Monday, as I’m on the road at the moment. I’m happy to do any experimentation needed, it is just so annoying that I can’t jump right on it!
I’ll get back to you Monday…
Cheers,
Chris
Looking forward to it!
Hey Zak -
Happy Monday! I think we’re in different time zones (I’m in London, England) but we’ll work it out.
Just wanted to let you know I took your suggestion and cloned the exact commit from the link you provided, and copied the source/header files into my project. And … of course now it builds without any errors. That’s great, but weird and a bit worrying - I wonder what was going on with the other repo I’d copied for the stm32l4 port?? Anyway… now I can go figure out the changes needed to get this working with the STM32U0. I really, really appreciate your help and patience. I guess we should close out this topic now, but thanks again.
Cheers,
Chris
Hello Chris,
That’s great news!
Don’t be concerned about the build failure, you didn’t do anything wrong (it was us).
It failed, because we lowercased the public APIs that we don’t want you to using in note-c
. Unfortunately, the new names clashed with the names from the samples.
I will be putting out a fix this week to rename the names in a way that won’t clash with the sample code. Then you will be able to perform the same operations as you originally did, without encountering any errors.
Happy hacking,
Zak
Hey Zak -
No problem - just happy that you were able to figure out what was going on – it was driving me nuts! When you say you’re “putting out a fix this week” … where would I be able to access that fix?
I’ll mark your earlier post as the solution
Incidentally, I can confirm that I’m now able to establish I2C communications between a Notecard and our STM32U0 (Nucleo) MCU.
Cheers,
Chris