Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vfs: Force boot interface FW using start_if.act #1079

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/daplink/bootloader/main_bootloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ int main(void)

// check for invalid app image or rst button press. Should be checksum or CRC but NVIC validation is better than nothing.
// If the interface has set the hold in bootloader setting don't jump to app
if (!reset_button_pressed()
if ((config_ram_get_force_enter_if() || !reset_button_pressed())
&& g_board_info.target_cfg
&& validate_bin_nvic((uint8_t *)g_board_info.target_cfg->flash_regions[0].start)
&& !config_ram_get_initial_hold_in_bl()) {
Expand Down
3 changes: 2 additions & 1 deletion source/daplink/drag-n-drop/vfs_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ void vfs_user_file_change_handler(const vfs_filename_t filename, vfs_file_change
if (daplink_is_interface()) {
config_ram_set_hold_in_bl(true);
} else {
// Do nothing - bootloader will go to interface by default
// Force enter the interface mode regardless of the state of the RESET pin
config_ram_set_force_enter_if(true);
}
break;
case kTestAssertActionFile:
Expand Down
18 changes: 17 additions & 1 deletion source/daplink/settings/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@ typedef struct __attribute__((__packed__)) cfg_ram {
// Disable msd support
uint8_t disable_msd;

//Add new entries from here
// Enable page erase
uint8_t page_erase_enable;

// Force enter interface firmware (no checks for RESETn)
uint8_t force_enter_if;

//Add new entries from here
} cfg_ram_t;

// Ensure hexdump field is word aligned.
Expand Down Expand Up @@ -104,6 +109,7 @@ void config_init()
memcpy(config_ram.hexdump, config_ram_copy.hexdump, sizeof(config_ram_copy.hexdump[0]) * config_ram_copy.valid_dumps);
config_ram.disable_msd = config_ram_copy.disable_msd;
config_ram.page_erase_enable = config_ram_copy.page_erase_enable;
config_ram.force_enter_if = config_ram_copy.force_enter_if;
config_rom_init();
}

Expand Down Expand Up @@ -253,3 +259,13 @@ bool config_ram_get_page_erase(void)
{
return config_ram.page_erase_enable;
}

void config_ram_set_force_enter_if(bool force_enter)
{
config_ram.force_enter_if = force_enter;
}

bool config_ram_get_force_enter_if(void)
{
return config_ram.force_enter_if;
}
2 changes: 2 additions & 0 deletions source/daplink/settings/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ void config_ram_set_disable_msd(bool disable_msd);
uint8_t config_ram_get_disable_msd(void);
void config_ram_set_page_erase(bool page_erase_enable);
bool config_ram_get_page_erase(void);
void config_ram_set_force_enter_if(bool force_enter);
bool config_ram_get_force_enter_if(void);

// Private - should only be called from settings.c
void config_rom_init(void);
Expand Down