3

I am in the process of implementing over-the-air updates on a CC2652 microcontroller using the OpenThread stack. As far as I know a bootloader has to be able to operate independently from the application and be as small as possible. But for the bootloader to download the new firmware by itself it will have to implement the OpenThread stack which will add quite a lot to its size.

I was wondering if it is possible to share the OpenThread stack between the two. I have heard it is possible to place the functions of the library in a specific place in memory and to then share the address with the application but I don't know how to do this. How can I assign a specific region in memory to a library and how can I tell two separate applications, the bootloader and the real application, to use this region?

  • It looks like the CC2652 provides some ROM that you can load libraries into and share between the two, however another approach is possible... Use the main application to download the firmware file into some external flash (you can use SPI flash or even I2C flash) and then reboot to the bootloader. The bootloader checks for a valid image in external flash and if there is one, loads it and resets. This keeps the libs in the main application and the bootloader very small. – Ron Beyer Feb 28 '20 at 15:33
  • 4
    there are two basic ways, one is that both parts are created by the same linker at the same time so that all the addresses are known and resolved across the one binary in the linkers view but two in yours. the other way is like most of our computers you define a runtime library solution which means every library function has to have its address patched in to the binary before use, which involves a system design that both sides use, can be as simple as a big array of function pointers in a known order and you point the array to the other side and now you can use them. – old_timer Feb 28 '20 at 16:12
  • or the worst case is function by function you create a solution where each function address has to be handled one at a time through some system level design. but if one side is in the field and does not have this in place already then that is perhaps possible if you know exactly which binary is there and you can take a copy of that binary and reverse engineer the list of addresses, but ideally you want to have planned for this before release. – old_timer Feb 28 '20 at 16:13
  • 1
    You might like to read [my answer](https://stackoverflow.com/questions/59858922/how-to-assign-address-to-external-symbols-from-another-library-without-including/59860202#59860202) to the question "How to assign address to external symbols from another library without including it in the output of ld?" on StackOverflow. There are more questions and answers, if you search for them. – the busybee Feb 28 '20 at 19:35

0 Answers0