Hi,
1. Is bootloader file and firmware file, different for projects build on nCS..?
Or a single executable build file consists both bootloader & firmware..?
2. Can you suggest a sample program to build a bootloader project..?
Thanks,
Hi,
1. Is bootloader file and firmware file, different for projects build on nCS..?
Or a single executable build file consists both bootloader & firmware..?
2. Can you suggest a sample program to build a bootloader project..?
Thanks,
Hello,
In NCS, the bootloader is enabled through configurations, mostly.
I suggest that you check out the documentation of FOTA upgrades:
https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.9.1/nrf/ug_nrf52.html#fota-upgrades
And there is also a written guide on how to add DFU to your project, that I can recommend:
https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/ncs-dfu
If you struggle with the implementation, I suggest that you follow the guide first, and add DFU to the smp_svr sample from NCS, so that you know that everything around (uploading via nRF Connect for iOS/Android/mcumgr) is working as it should, before you start looking into potential issues in your custom application.
BR,
Edvin
Hello Edvin,
And there is also a written guide on how to add DFU to your project,
Towards DFU, i see that we make the following configuration to the project:
# Ensure an MCUboot-compatible binary is generated. CONFIG_BOOTLOADER_MCUBOOT=y
So,
1. By enabling MCUBOOT what happens..?
2. Where is the bootloader image file in the device memory..?
3. Is the boot loader image file different than firmware image file or bootloader code is integrated into the firmware image file..?
Thanks,
Hello Edvin,
bootloader is located at address 0x0
1. Can you please suggest who copies bootloader code from hex file onto memory location 0x000 on the target board..?
2. what is the size overhead added by enabling MCU_BOOT on the firmware file, by enabling and disabling CONFIG_MCUBOOT I found that 17kb size difference of .bin file was the difference, is this fine..?
3. Can I compile mcboot separately..?
4. Can you please refer me to a link wherein I can find sample programs on mcuboot..?
Thanks,
Ubaid
Ubaid_M said:Can you please suggest who copies bootloader code from hex file onto memory location 0x000 on the target board..?
You need to program the bootloader using a programmer.
Ubaid_M said:what is the size overhead added by enabling MCU_BOOT on the firmware file, by enabling and disabling CONFIG_MCUBOOT I found that 17kb size difference of .bin file was the difference, is this fine..?
It says when you compile your project. Both the compiler will give some output on each child image (the mcuboot is a child image) and you can see it in the partitions.yml file in your build folder.
Ubaid_M said:Can I compile mcboot separately..?
Yes, but no need to do that. For all practical reasons, you would want to do it with your application.
Ubaid_M said:4. Can you please refer me to a link wherein I can find sample programs on mcuboot..?
Please follow the instructions from FOTA upgrades for the 52 series in our documentation, which points to the smp_svr as an example, or you can check this guide, which is a step by step blog post.
BR,
Edvin
Hello Edvin,
I will try to keep my problem definition brief, my device is a nrf528333dk interfaced with a 512kb serial flash memory.
I have a requirement to update the firmware for my device via BLE. which I can work with the dfu app.
Now the memory breakdown of my device is as:
The DFU app will download the updated firmware file via BLE interface into SLOT-1 which is in my external memory. After successful download, the DFU app will initiate a soft reboot which gives the control over to mcuboot.
mcuboot is now supposed to overwrite SLOT-0 with contents of SLOT-1.
1. Please point me or help me with an example mcuboot project with copies from external memory to internal memory as in my requirement above, I need to get an idea on where mcuboot source code needs to be tweaked and how..?! Along with the details on how dts file would look for this.
You need to program the bootloader using a programmer
Post this, comes my second challenge.
If say the signed key of firmware is compromised or i will need to update the key on new firmware. Here I can built firmware on new key and DFU will copy the new firmware via BLE on SLOT-1.
2. But what about mcuboot..? How will I update mcuboot in this case..? as the firmware update is happening wirelessly and programmer cannot help here..?
3. Crazy idea, if we know where exactly in mcuboot memory the firmware signing key is stored.! can we use DFU app to access the memory and update only the key..? How to know the key address if this is possible..?
Appreciate your help.
Thanks.
Hello,
I have not tested DFU using external flash before, but perhaps you can try using:
Ubaid_M said:1. Please point me or help me with an example mcuboot project with copies from external memory to internal memory as in my requirement above, I need to get an idea on where mcuboot source code needs to be tweaked and how..?! Along with the details on how dts file would look for this.
Sorry, but I am no dts expert. Please open a separate ticket on this matter. I am sorry that I can't help you with that.
Ubaid_M said:2. But what about mcuboot..? How will I update mcuboot in this case..? as the firmware update is happening wirelessly and programmer cannot help here..?
If you need to change the key in the bootloader, then you need to update the bootloader (entirely). In order to do so, please study the section:
Adding an immutable bootloader.
Ubaid_M said:3. Crazy idea, if we know where exactly in mcuboot memory the firmware signing key is stored.! can we use DFU app to access the memory and update only the key..? How to know the key address if this is possible..?
I see where you are going, but unfortunately, this is not possible. You need to use an immutable bootloader (preferably with a different key, if the original key is already compromized. Even if you knew exactly where the key was located, it is not possible to update a section in flash without deleting the entire flash page where this is located., also erasing a lot of your bootloader. I would also be surprised if the bootloader didn't protect it's own flash area before starting the application, so that actually doing this wouldn't typically be possible without updating the bootloader either way (to turn off the protection).
BR,
Edvin
Hello Edvin,
Thanks for the info.
You need to use an immutable
So I am to understand that, to have an updatable mcuboot bootloader,
I need to have a nRF Secure immutable bootloader and then I can have updatable mcuboot bootloader..?
1. How will immutable bootloader occupy memory memory as per my design..?
That is:
Now the memory breakdown of my device is as:
2. Should I consider another 30kb for immutable bootloader..?
3. Can you please suggest a sample program demonstrating nRF Secure immutable bootloader updating upgradable mcuboot bootloader..?
Thanks,
Ubaid
Hello Edvin,
Thanks for the info.
You need to use an immutable
So I am to understand that, to have an updatable mcuboot bootloader,
I need to have a nRF Secure immutable bootloader and then I can have updatable mcuboot bootloader..?
1. How will immutable bootloader occupy memory memory as per my design..?
That is:
Now the memory breakdown of my device is as:
2. Should I consider another 30kb for immutable bootloader..?
3. Can you please suggest a sample program demonstrating nRF Secure immutable bootloader updating upgradable mcuboot bootloader..?
Thanks,
Ubaid
Hello,
I am afraid I don't know the immutable bootloader's in's and out's at this point in time, other than pointing at the documentation. In short, the immutable bootloader is a separate bootloader that will have the possiblilty to update the mcuboot bootloader. It is not possible to update the immutable bootloader itself.
Regarding your image, the network core will also have a small portion belonging to the mcuboot bootloader.
Ubaid_M said:Should I consider another 30kb for immutable bootloader..?
the immutable bootloader should be smaller than the mcuboot botloader.
Did you check out the documentation for the immutable bootloader?