Couldn’t compile DeviceOS@6.1.1

The DeviceOS works till 5.5.0 but didn't work when I tried to upgrade it
It keeps showing the error below...
I have tried to clean the application etc, but still the same.

The error is here:

/Users/mypc/.particle/toolchains/gcc-arm/10.2.1/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /Users/mypc/.particle/toolchains/gcc-arm/10.2.1/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libg_nano.a(lib_a-vsprintf.o): in function _vsprintf_r': vsprintf.c:(.text._vsprintf_r+0x16): undefined reference to __wrap__svfprintf_r'
collect2: error: ld returned 1 exit status
make[3]: *** [/Users/mypc/firmware/target/6.1.1/bsom/firmware.elf] Error 1
make[2]: *** [modules/boron/user-part] Error 2
make[1]: *** [make-main] Error 2
make: *** [compile-user] Error 2

That function is part of Device OS itself. Which compile command are you using? Are you building for debug or regular? I presume you are doing a local compile, not a cloud compile, and for Boron.

Did you try a clean application and Device OS? Does a cloud compile work?

Also you may want to try 6.2.0; it's currently a preview release but I think it will be relabeled as a GA release this month.

1 Like

Thank you,
Yes, I have tried to clean application and deviceOS.
Yes, I am trying to compile locally using Particle: compile local but still the same.

What works is that while the device is plugged into the computer, I use the "particle update," which actually flashes the 6.1.1 OS and is also reflected in the console online. However, when I tried again to compile the application and deviceOS, it showed the same error as above.

the error again here:

:::: COMPILING APPLICATION & DEVICE OS

/Users/mypc/.particle/toolchains/deviceOS/6.1.1/modules/boron/system-part1/makefile /Users/mypc/.particle/toolchains/deviceOS/6.1.1/modules/boron/user-part/makefile
text data bss dec hex filename
536924 2666 59622 599212 924ac ../../../build/target/system-part1/platform-23-m/system-part1.elf
Creating /Users/mypc/firmware/target/6.1.1/bsom/platform_user_ram.ld ...
/Users/mypc/.particle/toolchains/gcc-arm/10.2.1/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /Users/mypc/.particle/toolchains/gcc-arm/10.2.1/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m+fp/hard/libg_nano.a(lib_a-vsprintf.o): in function _vsprintf_r': vsprintf.c:(.text._vsprintf_r+0x16): undefined reference to __wrap__svfprintf_r'
collect2: error: ld returned 1 exit status
make[3]: *** [/Users/mypc/firmware/target/6.1.1/bsom/New-FW.elf] Error 1
make[2]: *** [/Users/mypc/.particle/toolchains/deviceOS/6.1.1/modules/boron/user-part/makefile] Error 2
make[1]: *** [make-modules] Error 2
make: *** [compile-all] Error 2

  • The terminal process "/bin/bash '-c', 'make -f '/Users/mypc/.particle/toolchains/buildscripts/1.16.0/Makefile' compile-all -s'" terminated with exit code: 2.
  • Press any key to close the terminal.

What happens if you only compile application? There is no reason to compile Device OS if you are not using the source-level debugger (debug build).

It still has the same error.
I tried to compile the application alone but also clean application before trying.

OK, that's really weird. The only thing I have left is go into "Particle: Uninstall Local Compiler Toolchain" and remove 6.1.1. Also delete the target directory in the top level of your project.

Then configure project for device and compile application local again.

1 Like

Thanks for your help...
it's not working, one thing that I tried is just to do a "hello world" which was able to compile for 6.1.1 deviceOS.. code sample below

#include "Particle.h"

SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(SEMI_AUTOMATIC);

void setup() { 
  Serial.begin(9600); // Initialize serial communication at 9600 baud
}

void loop() {
  Serial.println("Hello World"); // Print "Hello World" to the serial monitor
  delay(1000); // Delay for 1 second to avoid flooding the serial output
}

But after I added all my source code, it returned the same error as above... Even if something is wrong with my code, why does it work with 5.5.0 deviceOS and not the upgraded version?

Do you have a call to vsprintf in your code?

If so, you probably should switch to vsnprintf which has a buffer length as the second parameter and can't cause a buffer overflow.

1 Like

Okay that works..
I changed the code for sps30

//vsprintf(prfbuf, pcFmt, pArgs);
        vsnprintf(prfbuf, sizeof(prfbuf), pcFmt, pArgs);

Thank you.

2 Likes