Fix missing start on MK3/S

This commit is contained in:
Alex Voinea 2020-05-27 09:44:28 +03:00
parent 67e79af145
commit 4ffa4dd8fd
No known key found for this signature in database
GPG Key ID: F5034E7CFCF2F973
3 changed files with 12 additions and 8 deletions

View File

@ -1016,9 +1016,10 @@ void setup()
#ifdef W25X20CL #ifdef W25X20CL
bool w25x20cl_success = w25x20cl_init(); bool w25x20cl_success = w25x20cl_init();
uint8_t optiboot_status = 1;
if (w25x20cl_success) if (w25x20cl_success)
{ {
optiboot_w25x20cl_enter(); optiboot_status = optiboot_w25x20cl_enter();
#if (LANG_MODE != 0) //secondary language support #if (LANG_MODE != 0) //secondary language support
update_sec_lang_from_external_flash(); update_sec_lang_from_external_flash();
#endif //(LANG_MODE != 0) #endif //(LANG_MODE != 0)
@ -1064,9 +1065,12 @@ void setup()
} }
MYSERIAL.begin(BAUDRATE); MYSERIAL.begin(BAUDRATE);
fdev_setup_stream(uartout, uart_putchar, NULL, _FDEV_SETUP_WRITE); //setup uart out stream fdev_setup_stream(uartout, uart_putchar, NULL, _FDEV_SETUP_WRITE); //setup uart out stream
#ifndef W25X20CL #if !((LANG_MODE == 1) && defined(W25X20CL)) || (LANG_MODE == 0)
SERIAL_PROTOCOLLNPGM("start"); SERIAL_PROTOCOLLNPGM("start");
#endif //W25X20CL #else
if (optiboot_status == 1)
SERIAL_PROTOCOLLNPGM("start");
#endif
stdout = uartout; stdout = uartout;
SERIAL_ECHO_START; SERIAL_ECHO_START;
printf_P(PSTR(" " FW_VERSION_FULL "\n")); printf_P(PSTR(" " FW_VERSION_FULL "\n"));

View File

@ -99,9 +99,9 @@ struct block_t;
extern struct block_t *block_buffer; extern struct block_t *block_buffer;
//! @brief Enter an STK500 compatible Optiboot boot loader waiting for flashing the languages to an external flash memory. //! @brief Enter an STK500 compatible Optiboot boot loader waiting for flashing the languages to an external flash memory.
void optiboot_w25x20cl_enter() uint8_t optiboot_w25x20cl_enter()
{ {
if (boot_app_flags & BOOT_APP_FLG_USER0) return; if (boot_app_flags & BOOT_APP_FLG_USER0) return 1;
uint8_t ch; uint8_t ch;
uint8_t rampz = 0; uint8_t rampz = 0;
register uint16_t address = 0; register uint16_t address = 0;
@ -144,12 +144,12 @@ void optiboot_w25x20cl_enter()
delayMicroseconds(1); delayMicroseconds(1);
if (++ boot_timer > boot_timeout) if (++ boot_timer > boot_timeout)
// Timeout expired, continue with the application. // Timeout expired, continue with the application.
return; return 0;
} }
ch = UDR0; ch = UDR0;
if (pgm_read_byte(ptr ++) != ch) if (pgm_read_byte(ptr ++) != ch)
// Magic was not received correctly, continue with the application // Magic was not received correctly, continue with the application
return; return 0;
watchdogReset(); watchdogReset();
} }
// Send the cfm magic string. // Send the cfm magic string.

View File

@ -1,6 +1,6 @@
#ifndef OPTIBOOT_W25X20CL_H #ifndef OPTIBOOT_W25X20CL_H
#define OPTIBOOT_W25X20CL_H #define OPTIBOOT_W25X20CL_H
extern void optiboot_w25x20cl_enter(); extern uint8_t optiboot_w25x20cl_enter();
#endif /* OPTIBOOT_W25X20CL_H */ #endif /* OPTIBOOT_W25X20CL_H */