From abbbf7e5db818d700c4a16f1661d17e869bf908b Mon Sep 17 00:00:00 2001 From: dragonmux Date: Fri, 17 Nov 2023 02:45:00 +0000 Subject: [PATCH] esp32c3: Removed the custom mass-erase implementation in preference for the one in spi.c --- src/target/esp32c3.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/target/esp32c3.c b/src/target/esp32c3.c index cad777fd837..7da731fe8eb 100644 --- a/src/target/esp32c3.c +++ b/src/target/esp32c3.c @@ -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); @@ -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; @@ -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);