Protecting bootloader

Hi there,
Sounds like a memory bounds issue that something is writing over the bootloaders ram area or SD ram,
can you show a list of your variables and do you have any defined as volatile?
You just say Xiao and don’t provide enough information. can you give more?
HTH
GL :slight_smile: PJ
:v:

1 Like

Hello. Xiao SAMD21

I will try and collate a list of variables.
I want to:

  1. protect the bootloader memory
  2. keep the Xiao in reset until there is stable flow of power to the Xiao. I am wondering if a spike at startup is causing the bootloader to be partially run and then failing, thus causing bricking.

G:\TISFINAL.E30 MAIN\TPMS\TPMS V12 NEW\UKUS_Toyota_TPMS_Monitor_V12_X\backlight.h (1 hit)
Line 10: volatile bool ButtonPressed = false;
G:\TISFINAL.E30 MAIN\TPMS\TPMS V12 NEW\UKUS_Toyota_TPMS_Monitor_V12_X\globals.h (8 hits)
Line 181: volatile static uint32_t LastEdgeTime_us = 0;
Line 183: volatile static bool ValidBlock = false;
Line 184: volatile static bool WaitingFirstEdge = true;
Line 185: volatile uint16_t Timings[MAXTIMINGS+1];
Line 186: volatile bool FirstEdgeIsHighToLow;
Line 187: volatile uint16_t BaseBitCount = 0;
Line 188: volatile bool TimingsAreValid = false;
Line 192: volatile uint16_t TimingsIndex = 0;

Hi there,
So it’s a samd21 which is the smallest EVERYTHING as far as the specs go. not a lot of ram, flash etc.
Can you provide the compiler output without an upload, just build it and share the last few lines you get.
HTH
GL :slight_smile: PJ

BTW, you can use the code tags above “</>” paste it in there. :v:

Is this what you need
Apologies if not

Hi Sam_Calver,

If this is a problem with XIAO_SAMD21, the following link may help. How to protect the bootloader.

How to unbrick a dead XIAO using a XIAO(DAPLink) and OpenOCD

Do you think there is possible cause for an issue at starting voltage to cause partial running then failing of bootloader hence corruption and even protecting the bootloader will not fix? I saw your post. Very helpful thank you

Hi there,

it’s the whole output which s fine to.
So why on line 82 :v:
" 1. open C:\Users\scalv\AppData\Local\Arduino15\packages\Seeeduino\hardware\samd\1.8.5\bootloaders\XIAOM0\bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.hex: The system cannot find the file specified."

hmmm. What bootloader ? :face_with_peeking_eye:
may try and roll back the BSP to the earlier one. your using older SPI LIB too AFAIK.

HTH
GL :slight_smile: PJ
:+1:

I rolled back to various versions all the way back to 1.7.9 of Seeed SAMD Boards and have the same error you found

Do I need a Xiao currently connected to compile this code? I do not have one currently as they are all at home. Sam

Hi there,
No, not physically required to test compile of code., Which IDE ver ?
GL :slight_smile: PJ
:v:

Interestingly, the file is there:

IDE Ver is 2.2.1
CLI version 0.34.0

What is the path to file, is it in the environment path?
that is a Hex it wants , you have a bin?
GL :slight_smile: PJ

Sorry can you explain in laymans terms I am not an expert. But I see what you mean the extension is .bin
Interesting. I have not modified the bootloader files so unsure why this is occurring and is it related to the bricking problem?

Thank you for your help PJ.

Hi there,
Sure,
It appears to me that it’s not putting a bootloader on it…
from my understanding it combines all the hex files together to create the bin file it sends to the chip.
There is four files it combines to make a BIN file to FLASH. Check the Building a production BIN file Thread on here,
Or “try this”
Use the option on the Sketch menu, “Export Compiled Binary” and look into the newly created "Build folder "
If you can post the code , I can try a compile also, unless of course it’s some proprietary stuff.

HTH
GL :slight_smile: PJ
:v:

I have sent you this over PM.

Or if you require the entire folder just let me know and I can send over

Hi there,
Ok, just the ino file to start, but check this out. here is an external bin compile from my system , see how many files and the bootloader is present in the ZIp you sent there isn’t one.

I’m not convinced its being sent.to the flash.
I show it so , others can see what is present it’s good info. :+1:

zip the ino file and I can try to compile it and let you know results.
HTH
GL :slight_smile: PJ

if this is a TPM library I vaguely remember another user having and issue, with CAN bus and TPM or something. turned out to be a LIB version. :v:

Interesting. Does this mean all previous times I wrote code to the Xiao it was using the bootloader that was already on it? How could this cause the bricking problem - outdated bootloader?

After protecting the boot loader, did you experience any more bricking issues?