A demonstration of a simple bootloader with SD card. Binary folder already contains precompiled two Firmware files for Nucleo-F767ZI under MbedOS 6.15.1. These files may be placed to a SD card (It will working with https://os.mbed.com/users/JohnnyK/code/SimpleBootloader/)

main.cpp

Committer:
JohnnyK
Date:
2021-12-08
Revision:
0:b8b091db9767

File content as of revision 0:b8b091db9767:

/* 
 * Tested with Nudleo-F767Zi and Nudleo-F429ZI
 * Builded with Mbed Studio 1.4.3
 */

#include "mbed.h" //MbedOS 6.15.5

#define DELAY 200ms

DigitalOut myled1(LED1);
DigitalOut myled2(LED2);
DigitalOut myled3(LED3);*/
InterruptIn iin(BUTTON1);
bool flag = false;

void fall(){
    flag = true;
}

int main()
{
    printf("AppStart_Firm1\n");
    iin.fall(callback(fall));

    while (true) {
        myled1 = 1; myled2 = 0; myled3 = 0; ThisThread::sleep_for(DELAY);
        myled1 = 0; myled2 = 1; myled3 = 0; ThisThread::sleep_for(DELAY);
        myled1 = 0; myled2 = 0; myled3 = 1; ThisThread::sleep_for(DELAY);
        myled1 = 0; myled2 = 1; myled3 = 0; ThisThread::sleep_for(DELAY);
        ThisThread::sleep_for(DELAY);
        if(flag){printf("Restarting...\n"); ThisThread::sleep_for(1s); NVIC_SystemReset();}
    }
}