Skip to content

Commit

Permalink
Implement faster flash (921600 baud)
Browse files Browse the repository at this point in the history
Update esp-serial-flasher lib as submodule, which includes write
block retries to enable higher baud rates
  • Loading branch information
0xchocolate committed Nov 26, 2023
1 parent d621268 commit 9bcf086
Show file tree
Hide file tree
Showing 127 changed files with 32 additions and 21,746 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/esp-serial-flasher"]
path = lib/esp-serial-flasher
url = [email protected]:0xchocolate/esp-serial-flasher.git
4 changes: 2 additions & 2 deletions application.fam
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
App(
appid="esp_flasher",
name="ESP Flasher",
fap_version=(1,3),
fap_version=(1,4),
apptype=FlipperAppType.EXTERNAL,
entry_point="esp_flasher_app",
requires=["gui"],
Expand All @@ -22,7 +22,7 @@ App(
"src/slip.c"
],
cincludes=["lib/esp-serial-flasher/private_include"],
cdefines=["SERIAL_FLASHER_INTERFACE_UART=1", "MD5_ENABLED=1"],
cdefines=["SERIAL_FLASHER_INTERFACE_UART=1", "MD5_ENABLED=1", "SERIAL_FLASHER_WRITE_BLOCK_RETRIES=10"],
),
],
cdefines=["SERIAL_FLASHER_INTERFACE_UART=1"],
Expand Down
2 changes: 2 additions & 0 deletions esp_flasher_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ EspFlasherApp* esp_flasher_app_alloc() {
app->reset = false;
app->boot = false;

app->turbospeed = false;

scene_manager_next_scene(app->scene_manager, EspFlasherSceneStart);

return app;
Expand Down
2 changes: 1 addition & 1 deletion esp_flasher_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
extern "C" {
#endif

#define ESP_FLASHER_APP_VERSION "v1.3"
#define ESP_FLASHER_APP_VERSION "v1.4"

typedef struct EspFlasherApp EspFlasherApp;

Expand Down
1 change: 1 addition & 0 deletions esp_flasher_app_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ struct EspFlasherApp {
Submenu* submenu;

EspFlasherUart* uart;
bool turbospeed;

bool reset;
bool boot;
Expand Down
18 changes: 9 additions & 9 deletions esp_flasher_worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,10 @@ static int32_t esp_flasher_flash_bin(void* context) {
loader_port_debug_print(err_msg);
}

#if 0 // still getting packet drops with this
// higher BR
if(!err) {
if(!err && app->turbospeed) {
loader_port_debug_print("Increasing speed for faster flash\n");
err = esp_loader_change_transmission_rate(230400);
err = esp_loader_change_transmission_rate(921600);
if (err != ESP_LOADER_SUCCESS) {
char err_msg[256];
snprintf(
Expand All @@ -241,20 +240,21 @@ static int32_t esp_flasher_flash_bin(void* context) {
err);
loader_port_debug_print(err_msg);
}
furi_hal_uart_set_br(FuriHalUartIdUSART1, 230400);
furi_hal_uart_set_br(FuriHalUartIdUSART1, 921600);
}
#endif

if(!err) {
loader_port_debug_print("Connected\n");
if(!_switch_fw(app)) {
_flash_all_files(app);
}
app->switch_fw = SwitchNotSet;
#if 0
loader_port_debug_print("Restoring transmission rate\n");
furi_hal_uart_set_br(FuriHalUartIdUSART1, 115200);
#endif

if (app->turbospeed) {
loader_port_debug_print("Restoring transmission rate\n");
furi_hal_uart_set_br(FuriHalUartIdUSART1, 115200);
}

loader_port_debug_print(
"Done flashing. Please reset the board manually if it doesn't auto-reset.\n");

Expand Down
1 change: 1 addition & 0 deletions lib/esp-serial-flasher
Submodule esp-serial-flasher added at 81805a
Loading

0 comments on commit 9bcf086

Please sign in to comment.