This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

detailed example to create a custom bootloader?

Hello ,

following are my requirements :

  1. to create a secure bootloader which checks app validity at every boot .
  2. the boot loader should also accept UART communication .

following things i have tried :

  1. Stripping the secure DFU bootloader exanple just to boot into my own application : a. compiling the strippred code(removed every aspect of appcheck and DFU via Bluetooth) b. added a blinky funtionality before jumping to the new address ( this is also not sure what address to jump to) c. flashed the bootloader as per given directions using nrfprog and IAR d. flashed the original blinky code (example with a different delay) using IAR

the expectation from this code is to first show the blinky with 100msec delay and then jump to my apop with the blinky with 500 msec delay ,

the result i get is that the blinky from my main application runs directly bypassing the bootloader , i have driven the APP_START_ADRESS as 0x1000

PLease help with a tutorial or a way to achieve my requirements.

board used : nrf52840 dk SDK : 13.00 alpha

  • Hi Abhishek,

    we're going to release a experimental secure serial bootloader in the production release of SDK v13.0.0, which is scheduled in mid-March. Furthermore, the secure serial bootloader will have the same application validity check as the current secure BLE bootloader, i.e. it will check if the NRF_DFU_BANK_VALID_APP flag is written to the bootloader settings flash page.

    I suggest that you wait for the production release of SDK v13.0.0, rather than implementing this on your own.

    Best regards

    Bjørn

  • Hi Bjon ,

    thanks for the answer , rather can you please let me know only how to flash a new application to a different address , (i get a stack pointer misaligned error , when i try to change the itterupt vec. table address )

    can you please suggest a linker configuration for both 5840 and 5832, so that i can flash a application to the suggested address and then jump to the same address from bootloader.

    your help will be much appreciated

  • @Abhishek: How did you test ? If you only test your application with softdevice and no bootloader, then it not possible to start the application at other address unless you write a kind of bootloader at the normal application address (end of softdevice address).

    If you have our bootloader, then it's possible to change address of your application. First you have to update your application setting to set the start address of your application. Second you need to modify the bootloader to update the "MAIN_APPLICATION_START_ADDR" to point to where you application start. Then you should be fine.

  • Hi Abhishek,

    Are you using the DFU states for downloading your application?

    If you are using please maintain the proper states like first set the state as DFU_IDLE and send the DFU_DNLOAD and than start downloading your application. before jump to the start address make sure that your state should be mainfest state.

    if you are in that state than only jump to the start address.

    In the mainfest state you can provide the delay of 100ms for blinking or better use UART logs.

    If you will follows the DFU state machine properly, defiantly you will get the required results.

    Regards,

    Abhishek

  • @abhishek: I don't really get what you posted above. Is it your answer to your own question or else ?

Related