SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world.
And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download two short videos (registration required) highlighting:

System Workbench for STM32

Adding a custom Library to SW4STM32 project

Hello everyone,

I try to add a library that I have made to an existing project, but I have some problems during the compilation. The errors come from the debug part. The console says to me that I have multiple definition of variable, but I’m sure these variables are definite once.

Here’s the console report :

11:03:59 **** Incremental Build of configuration Debug for project BlueMox_shield ****
make all
Building target: BlueMox_shield.elf
Invoking: MCU GCC Linker
arm-none-eabi-gcc -mcpu=cortex-m0plus -mthumb -mfloat-abi=soft -specs=nosys.specs -specs=nano.specs -u _printf_float -T”../STM32L073RZTx_FLASH.ld” -Wl,-Map=output.map -Wl,--gc-sections -o “BlueMox_shield.elf” @”objects.list” -lm
Src/main.o:(.bss+0x14): multiple definition of `Iload’
Src/BlueMox_Library.o:(.bss+0x4): first defined here
Src/main.o:(.bss+0x18): multiple definition of `buffer’
Src/BlueMox_Library.o:(.bss+0x8): first defined here
collect2.exe: error: ld returned 1 exit status
make: *** BlueMox_shield.elf Error 1
makefile:35: recipe for target ‘BlueMox_shield.elf’ failed

11:03:59 Build Finished (took 511ms)

Has anyone ever had this kind of problem?



Hi Sylvain,

Is it possible that these variables are defined in a header file included by both BlueMox_Library.c and main.c?

Bernard (Ac6)

Hello Bernard;

Thanks for your answer. Unfortunately, the variables is only define in the BlueMox_Library.h ... I still no find a solution

Best regards,


Hi Sylvain,

I presume that BlueMox_Library.h is #included in both main.c and BlueMox_Library.c, isn’t it?

Then how are lload and buffer declared in BlueMox_Library.h? Obviously they are not simply declared but defined in BlueMox_Library.h and that should be the cause of your problem.

Could you just post the declaration for these two variables?

Bernard (Ac6)

Hello Bernard,

Sorry for the answer delay ...

Yes, the BlueMox_Library.h is posted in both main.c and BlueMox_Library.c.

Here’s the declaration of my two variables :

volatile float Iload = 0.0;
char buffer 30 = {0};

EDIT : If I use static for the declaration the compilation works, but I don’t really understand why a static declaration is so important in this case.

Best regards


Hi Sylvain,

That exactly what I thought: in BlueMox_Library.h you should declare these variables; however here you define them. Instead, in BlueMox_Library.h you should have the variables declarations:
extern volatile float Iload; 
extern char buffer 30;
and in BlueMox_Library.c you must add the definitions (that were incorrectly placed in the header file):
volatile float Iload = 0.0; 
char buffer 30 = {0};

Then your project should compile and link without any problem.

Remember: you should only declare things in header file, never define them (except for static inline functions).

Hope this clarifies things,

Bernard (Ac6)