Redefinition of Symbols( defines, functions, etc) if lib_deps are used

Hello everyone,

I just discovered plattformio and currently trying it out. I must say its bit difficult.

I use the STM32F746G-DISCO with the mbed as a framework. To get the touchscreen demo running I want to install the following libraries:

  • BSP_DISCO_F746NG,
  • LCD_DISCO_F746NG,
  • TS_DISCO_F746NG

installing them worked fantastically. building them not so much. I get tons of errors of the following kind:

In file included from C:\Users\johannes\.platformio\lib\cmsis-core_ID1237\source\cmsis_nvic.c:31:0:
C:\Users\johannes\.platformio\lib\cmsis-core_ID1237/cmsis-core/cmsis_nvic.h:37:0: warning: 
"NVIC_USER_IRQ_OFFSET" redefined
#define NVIC_USER_IRQ_OFFSET YOTTA_CFG_CMSIS_NVIC_USER_IRQ_OFFSET

In file included from C:\Users\johannes\.platformio\packages\framework- 
mbed\targets\TARGET_STM\TARGET_STM32F7\TARGET_STM32F746xG\device/stm32f746xx.h:190:0,
from C:\Users\johannes\.platformio\packages\framework- 
mbed\targets\TARGET_STM\TARGET_STM32F7\TARGET_STM32F746xG\device/stm32f7xx.h:140,
from C:\Users\johannes\.platformio\packages\framework- 
mbed\targets\TARGET_STM\TARGET_STM32F7\TARGET_STM32F746xG\device/cmsis.h:35,
from C:\Users\johannes\.platformio\lib\cmsis-core_ID1237/cmsis-core/cmsis_nvic.h:35,
from C:\Users\johannes\.platformio\lib\cmsis-core_ID1237\source\cmsis_nvic.c:31:
C:\Users\johannes\.platformio\packages\framework-mbed\cmsis\TARGET_CORTEX_M/core_cm7.h:1844:0: 
note: this is the location of the previous definition
#define NVIC_USER_IRQ_OFFSET          16

C:\Users\johannes\.platformio\packages\framework- 
mbed\cmsis\TARGET_CORTEX_M/core_cm7.h:1840:39: error: redefinition of '__NVIC_SetVector'
#define NVIC_SetVector              __NVIC_SetVector
^
C:\Users\johannes\.platformio\lib\cmsis-core_ID1237\source\cmsis_nvic.c:40:6: note: in expansion of macro 
'NVIC_SetVector'

my platformio.ini file is as follows:

[env:disco_f746ng]

platform = ststm32

board = disco_f746ng

framework = mbed

lib_archive = true

lib_compat_mode = strict

lib_deps = BSP_DISCO_F746NG, LCD_DISCO_F746NG, TS_DISCO_F746NG

It does not make any sense why building 3 distinct libraries could create such a fuss. the Header definitions should not matter as far as I understood it because plattformio builds each lib separately and links the archives into the elf file. isn’t that correct? did I miss something?

All three dependencies depend on cmsis and because of that I’ve got a ton of redefinitions.

How can I prevent this from happening with the help of the platformIO system?
There must be a switch to prevent this. I just have not yet discovered in the docs yet.

I am happy for any help in this regard

I found a solution to this “redefinition” problem.

I added

  lib_ldf_mode = off

into my platformio.ini and all problems disappeared. I have found this in the docs:
https://docs.platformio.org/en/latest/librarymanager/ldf.html#ldf-mode