Flashing and debugging ardupilot bootloader

Hi,
I am trying to flash bootloader and debug it. For that i am using print statement on uart(with cout function of bootloader).
Right now i am not sure if the bootloader is upgrading or not. How can i debug bootloader to see if its my version or not.

Thanks

hello,

You will find here the command to flash the bootlader from the vehicle code : http://ardupilot.org/dev/docs/bootloader.html
it should report report or failure. Unfortunately, I don’t think we got version number on bootloader

I Tried the mav command “long MAV_CMD_FLASH_BOOTLOADER 0 0 0 0 290876” but what is replies is “Bootloader up-to-date”.
Is there any way to force update the bootloader ?

1 Like

did you compile and update the firmware with your new bootloader ?

I Tried the mav command “long MAV_CMD_FLASH_BOOTLOADER 0 0 0 0 290876” but what is replies is “Bootloader up-to-date”.

That’s doing a byte-wise comparison of your new bootloader and the one on
the device - so I’ve screwed up the check or you’re not actually packing
your new bootloader into the image :slight_smile:

Is there any way to force update the bootloader ?

Shouldn’t be required.

You can bump the bootloader protocol as something trivially externally
visible to see if your bootloader is on the device:

Nvm, I was trying to upload it using waf script.
Using the dfu mode instead, worked for me. Although I have to look at the datasheet to figure out where the boot0 pin actually was for the FMU.
Anyway, Thanks.

Hi peter,
BL_PROTOCOL_VERSION is the first thing i changed to 10 in bl_protocol.cpp and also BL_REV_MAX in uploader.py just for the purpose of debug to know if bootloader is upgrading.
What i am doing currently is:

  1. changing bootloader version
  2. building ardupilot firmware (firmware builds the bootloader also with it as far as know).
  3. used mavproxy to upgrade bootloader using cmd long MAV_CMD_FLASH_BOOTLOADER 0 0 0 0 290876.
  4. reply is bootloader up to date
    I also tried waf command for building and uploading bootloader separately:
    ./waf configure --board Pixhawk1 --bootloader
    ./waf bootloader
    ./waf bootloader --upload
    But by both these methods when i am upgrading the ardupilot firmware next time using uploader.py bootloader revision is shown 5 only. So no upgrading i guess.
    The DFU method is working for me also but i was looking for more convenient method.

BL_PROTOCOL_VERSION is the first thing i changed to 10 in bl_protocol.cpp and also BL_REV_MAX in uploader.py just for the purpose of debug to know if
bootloader is upgrading.

Great!

  1. changing bootloader version
  2. building ardupilot firmware (firmware builds the bootloader also with it as far as know).

Ah. Check your assumption there. Did you spot the “–bootloader” option
to waf?

So some time ago it used to be that you had to copy the bootloader from
whereever it gets built into the place that we incorporate the bootloader
binary into the ArduPilot binary. I’m not sure that’s still the case -
but it is another thing that could go wrong…

Hi Peter,
Sorry for the late reply. I was travelling and didnt have laptop.
Ok, so I built the bootloader and copied it to the bootloader folder inside Tools folder and upgraded the bootloader using mavproxy.It worked and bootloader shows show the new bootloader revision which i entered.
But i have got into another problem. I needed some more space for the bootloader. Can you tell me how i can increase bootloader memory size from 16kb to 20kb.

I am not sure if you need to increase the bootloader size. You can do that in hwdef.dat for the specific board. There was a definition for FLASH_BOOTLOADER_SIZE, if i remember correctly. you will figure out once you open the file

I used the --bootloader option. I changed the BL_PROTOCOL_VERSION and BL_REV_MAX. But when I use ./waf bootloader update, the bootloader protocol that prints during upload is not updated. Do we have to use dfu to update bootloader? Or is there a simpler way? Please help