You are here

Make bootloader wait for command when pushing a button | Cypress Semiconductor

Make bootloader wait for command when pushing a button

Summary: 4 Replies, Latest post by eleci on 15 Jan 2017 10:04 PM PST
Verified Answers: 1
Last post
Log in to post new comments.
Svinaldo's picture
5 posts


I want to be able to hold a button down when powering up the board to tell the Bootloader to wait forever for a command. If the button is not pressed while power-on, it should directly launch the application. 

Is there a simple way to do this?  

This is for emergencies, if for some reason the downloaded image messes up the communication with the host. Then there is no way to get back to the bootloader to download a new image. Is there another way (apart from entering a timeout of a few seconds)?


Svinaldo's picture
5 posts

Before you reply.... yes an alternative is to have a dual bootloader. I am still interested in the answer to whether we can hold a button to stay in the bootloader.


ANKS's picture
Cypress Employee
119 posts

void Bootloadable_Load (void )---
Schedules the Bootloader/Launcher to be launched and then performs a software reset to launch it.
This method will never return. It will load a new application and reset the device.

You can call this API on a switch press,thus this API will immediately call the bootloader and the bootloader will wait for a new application forever.

Alwyn's picture
6 posts

I have the same need, and he answer above doesn't solve it. There should be a way in the Bootloader to cause it to "Wait for Command" if it senses a button pressed on powerup. I finally got it with

if(SW1_Read()==0u) Bootloader_HostLink(Bootloader_WAIT_FOR_COMMAND_FOREVER);

But but you have to bodge the Bootloader.c and Bootloader.h files to make it non-static and exposed in the header. I remember the 4200 sticks working this way out of the box.

eleci's picture
1 post

You can call Bootloader_SET_RUN_TYPE(Bootloader_START_BTLDR)

    if(Pin_bl_Read() == 0){
        //BLFLAG_FOREVER = 1;

    /* This API does the entire bootload operation. After a succesful bootload operation, this API transfers
       program control to the new application via a software reset */

Log in to post new comments.