Skip to content

Commit

Permalink
esp32c3: Removed the custom mass-erase implementation in preference f…
Browse files Browse the repository at this point in the history
…or the one in spi.c
  • Loading branch information
dragonmux committed Nov 17, 2023
1 parent d94d008 commit 7feec2b
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions src/target/esp32c3.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ static void esp32c3_spi_write(
target_s *target, uint16_t command, target_addr_t address, const void *buffer, size_t length);
static void esp32c3_spi_run_command(target_s *target, uint16_t command, target_addr_t address);

static bool esp32c3_mass_erase(target_s *target);
static bool esp32c3_enter_flash_mode(target_s *target);
static bool esp32c3_exit_flash_mode(target_s *target);
static bool esp32c3_spi_flash_erase(target_flash_s *flash, target_addr_t addr, size_t length);
Expand Down Expand Up @@ -182,7 +181,7 @@ bool esp32c3_probe(target_s *const target)
target->halt_resume = esp32c3_halt_resume;
target->halt_poll = esp32c3_halt_poll;
/* Provide an implementation of the mass erase command */
target->mass_erase = esp32c3_mass_erase;
target->mass_erase = bmp_spi_mass_erase;
/* Special care must be taken during Flash programming */
target->enter_flash_mode = esp32c3_enter_flash_mode;
target->exit_flash_mode = esp32c3_exit_flash_mode;
Expand Down Expand Up @@ -404,21 +403,6 @@ static void esp32c3_spi_run_command(target_s *const target, const uint16_t comma
esp32c3_spi_wait_complete(target);
}

static bool esp32c3_mass_erase(target_s *const target)
{
platform_timeout_s timeout;
platform_timeout_set(&timeout, 500U);
esp32c3_spi_run_command(target, SPI_FLASH_CMD_WRITE_ENABLE, 0U);
if (!(esp32c3_spi_read_status(target) & SPI_FLASH_STATUS_WRITE_ENABLED))
return false;

esp32c3_spi_run_command(target, SPI_FLASH_CMD_CHIP_ERASE, 0U);
while (esp32c3_spi_read_status(target) & SPI_FLASH_STATUS_BUSY)
target_print_progress(&timeout);

return true;
}

static bool esp32c3_enter_flash_mode(target_s *const target)
{
esp32c3_disable_wdts(target);
Expand Down

0 comments on commit 7feec2b

Please sign in to comment.