Skip to content

Commit

Permalink
skip call to boot loader (already started)
Browse files Browse the repository at this point in the history
  • Loading branch information
pwittich committed Jul 7, 2020
1 parent 67587af commit f158f18
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

# GIT
GIT_VERSION="$(shell git describe --abbrev=4 --dirty --always --tags)"
#
CFLAGS+= -DFIRMWARE_VERSION=\"$(GIT_VERSION)\"
#
#


DIRS=sflash
Expand Down
30 changes: 23 additions & 7 deletions sflash/sflash.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ uint32_t g_pui32BaudRate;
uint32_t g_ui32DataSize;
int32_t g_i32DisableAutoBaud;

bool g_SkipCallToBL = false;

//*****************************************************************************
//
//! This string will be printed if any errors are present in the command line
Expand Down Expand Up @@ -370,6 +372,8 @@ static char const pcUsageString[] =
" before downloading the application specified by the filename parameter.\n"
"-b [baud rate]:\n"
" Specifies the baud rate in decimal.\n"
"-x :\n"
" Disable call to boot loader\n"
"-d Disable Auto-Baud support\n"
"-s [data size]:\n"
" Specifies the number of data bytes to be sent in each data packet. Must\n"
Expand Down Expand Up @@ -643,6 +647,12 @@ parseArgs(int32_t argc, char **argv)
return(-2);
break;
}
case 'x':
{
g_SkipCallToBL = true;
printf("\tSkipping bootloader invocation\n");
break;
}
case 'd':
{
g_i32DisableAutoBaud = 1;
Expand Down Expand Up @@ -768,14 +778,20 @@ main(int32_t argc, char **argv)
printf("Starting programming in 5 seconds ....\n");
sleep(5);

// start the boot loader on the MCU
int ret;
if ( ret = start_bootloader() ) {
printf("start_bootloader returned error %d\n", ret);
return ret;
}
// skip call to BL if needed
if ( ! g_SkipCallToBL ) {
// start the boot loader on the MCU
int ret;
if ( ret = start_bootloader() ) {
printf("start_bootloader returned error %d\n", ret);
return ret;
}
else {
printf("bootloader started successfully\n");
}
}
else {
printf("bootloader started successfully\n");
printf("Skipping invocation of bootloader\n");
}


Expand Down

0 comments on commit f158f18

Please sign in to comment.