Programmatically Changing Bootloader Communications Component

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

cross mob
PrMa_264311
Level 3
Level 3
First like received

Hello,

   

I would like to programmatically change the communications component utilized by the bootloader on a PSoC5. Here's why. Normally I would bootload a bit of firmware over USBFS. However, there could be an alternative way of bootloading through a serial port that would be advantageous under certain circumstances. Is there a way to programmatically select which component is used before the bootloader component is initialized? 

   

This statement in the data sheet is a little ominous: "Select one, and only one, communications component", but hey, I'm willing to try! I suppose one way to do this would be to create a custom component that would select the communications component functions of choice at that time. Any other ways?

   

Thanks.

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

You cold use a self-written custom bootloader. The communication is in your hand, so you may select from different sources when you discover that they are present.

   

 

   

Bob

0 Likes

True, there is that option. I was looking for something a little more out-of-the box. I am looking through the "custom" interface information now.

   

Edit: In the end, I simply created a new file with the custom communications interface function prototypes that allowed the correct function references to be called depending upon which configuration I wanted. For example:

   
    
#define USBFS   1u  void CyBtldrCommStart(void) { #ifdef USBFS         USBFS_Bootloader_CyBtldrCommStart(); #else     PM_UART_CyBtldrCommStart(); #endif }  void CyBtldrCommStop (void) { #ifdef USBFS     USBFS_Bootloader_CyBtldrCommStop(); #else     PM_UART_CyBtldrCommStop(); #endif     }  void CyBtldrCommReset(void) { #ifdef USBFS    USBFS_Bootloader_CyBtldrCommReset();  #else     PM_UART_CyBtldrCommReset(); #endif }  cystatus CyBtldrCommWrite(uint8* buffer, uint16 size, uint16* count, uint8 timeOut) { #ifdef USBFS     return USBFS_Bootloader_CyBtldrCommWrite(buffer, size, count, timeOut); #else     return PM_UART_CyBtldrCommWrite(buffer, size, count, timeOut); #endif     }  cystatus CyBtldrCommRead (uint8* buffer, uint16 size, uint16* count, uint8 timeOut) { #ifdef USBFS         return USBFS_Bootloader_CyBtldrCommRead(buffer, size, count, timeOut); #else     return PM_UART_CyBtldrCommRead(buffer, size, count, timeOut); #endif     }
   
   

Thanks for responding. 

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

You are always welcome.

   

 

   

Bob

0 Likes