Open alvarolb opened 2 years ago
Hi @alvarolb ! It seems that this library is optimized during the build process. Does it work if you link the dependencies as object files using the following configuration:
[env:mkrnb1500]
platform = atmelsam
framework = arduino
board = mkrnb1500
lib_archive = no
Hi, It does not work, as the SBU does not run at startup. I can confirm it because:
LED_BUILTIN
does not blink after reboot as in the normal OTA processUPDATE.BIN
and UPDATE.OK
, are present in the Ublox Filesystem after rebootMoreover, if I flash the following sketch in Arduino, it flash the OTA file present in the device. So, the firmware is well placed and it is valid:
#include <SBU.h>
void setup()
{
Serial.begin(9600);
while (!Serial) { }
// wait a bit
delay(1000);
String message;
message += "Sketch compile date and time: ";
message += __DATE__;
message += " ";
message += __TIME__;
// print out the sketch compile date and time on the serial port
Serial.println(message);
}
void loop()
{
// add you own code here
}
The strange thing is that the firmware size increases a lot with this flag, but it seems that the SBU code is never executed.
I have also tried to directly include the contents of SBU.cpp in the sketch, but it does not work. It seems that the __attribute__
code is not working properly?
__attribute__ ((section(".sketch_boot")))
unsigned char SBU_BOOT[0x8000] = {
#if defined(ARDUINO_SAMD_MKRNB1500)
#include "boot/mkrnb1500.h"
#else
#error "Unsupported board!"
#endif
};
After testing with more devices, other implementations with SDU, SFU, SNU, etc., seems to work adding lib_archive = no
.
Not sure why SBU (which is the first I tested) does not work properly.
I cannot make SBU working (and I assume other SAMD libraries like SDU, SFU, SNU...).
With this basic Sketch on Arduino, it compiles fine and includes the code required in SBU (basically detect firmware files from external storage on Ublox chip, and flash before boot):
When compiling this sketch, it is clear that the SBU library is compiled and linked:
If I comment out the
#include <SBU.h>
, then the code size is reduced from 17% to 5%:By the way, the sketch compiled in Platformio IDE has always the same size, independently of the
SBU.h
includeThis is the
platformio.ini
used:I suspect that this is cased by the SBU.h header definition, that literally does nothing:
However, the .cpp contains code that it is not being included. Whats the reason? How can we solve it?
Here is the link for SBU source code:
https://github.com/arduino/ArduinoCore-samd/tree/master/libraries/SBU/src