cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way to use bootloader functions in application code?

SSone.1
Associate III

Hi all. I am working on a project that consist of 3 separate codes. One is bootloader, another is static code and the last one is updatable code. They all share one flash. Static code only fulfills basic tasks and updatable code is more sophisticated but it is more open to bugs.

Normally updatable code runs on MCU and I update it according to feedbacks. But sometimes bugs are occurring in updatable code, than I command MCU to branch static code until I solve bugs in updatable code.

This 3 separate codes are using same protocol to communicate and the communication functions occupies a lot of flash space. What I want to ask is, is there a way to place communication functions in flash not for every code and just for one time? Is there any example, application note or a source about that subject?

3 REPLIES 3

Typically you could buil​d a jump table of function/API entry points, or provide the downstream linker with a definition file.

T​he code being call needs to use pointers or registers, be self contained, you can't use global variables or allocate memory, as these would be different.

So things like AES, SHA256, SECPxxx which are hogs would be good candidates.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
SSone.1
Associate III

Thanks for answer. If I use global variables in that functions with same names in sperate codes, does it work?

No​

The linker puts things in different places. if you're using a lot of global variables you likely don't have the rigor to cleanly separate and reuse things.

You could define some common area and have those be the same, but that's a lot more work than​ just being more object oriented and use structures and pointers.

For floating point libraries you'd want to reference all functions so the linker would pull a complete set rather than do dead code elimination.​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..