Re-using components from Bootloader in application to save flash

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
pacr_284376
Level 5
Level 5
100 replies posted 10 solutions authored 50 sign-ins

 Hi,

   

I studied and tried the I2C Bootloader AN86526 document and it works great. But there is one question.

   

For my application I need a couple of routines such as i2c communication and writing to a display. These basic (library) routines will be used by BOTH Bootloader and application program. Is there a way to use the libraries from both programs ? I am aware that in that case the libraries cannot be overwritten in case of new versions but it could save me memory.

   

I'm testing now with PSOC4 on my pioneer kit but as soon as I get my PCBs I will run my application on a PSOC3. Bootloading via I2C.

   

Thanks

   

Patrick

0 Likes
3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You could save some flash by changing the properties of already debugged files (as the generated files are). Right click on the file and set the optimization level to something better than "none".

   

This you may do with your own modules, too.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Seems like you could build a table of f() pointers and

   

force their storage to a known location in FLASH and use

   

them in the bootloadable program as calls. I am thinking

   

this would have to be done in ASM calls from the bootloadable

   

to effect the code share.

   

 

   

Would be nice if compiler was "boot" aware......

   

 

   

Not being an expert on BL's will be interesting to see if there are any

   

alternative approaches.

   

 

   

Regards, Dana.

0 Likes
pacr_284376
Level 5
Level 5
100 replies posted 10 solutions authored 50 sign-ins

 Thanks for the replies, I will use the optimizing for now and if I run into memory problems later on I can study the second option.

0 Likes