target: Refactored out the progress printer to reduce Flash usage
This commit is contained in:
parent
b8ca831cfb
commit
9d46d0c5c6
|
@ -42,7 +42,6 @@
|
|||
#include "target_internal.h"
|
||||
#include "cortexm.h"
|
||||
#include "adiv5.h"
|
||||
#include "gdb_packet.h"
|
||||
|
||||
#define SRAM_BASE 0x20000000
|
||||
#define STUB_BUFFER_BASE ALIGN(SRAM_BASE + sizeof(efm32_flash_write_stub), 4)
|
||||
|
@ -764,11 +763,7 @@ static bool efm32_mass_erase(target *t)
|
|||
while ((target_mem_read32(t, EFM32_MSC_STATUS(msc)) & EFM32_MSC_STATUS_BUSY)) {
|
||||
if (target_check_error(t))
|
||||
return false;
|
||||
|
||||
if (platform_timeout_is_expired(&timeout)) {
|
||||
gdb_out(".");
|
||||
platform_timeout_set(&timeout, 500);
|
||||
}
|
||||
target_print_progress(&timeout);
|
||||
}
|
||||
|
||||
/* Relock mass erase */
|
||||
|
@ -1037,10 +1032,7 @@ static bool efm32_aap_mass_erase(target *t)
|
|||
/* Read until 0, probably should have a timeout here... */
|
||||
do {
|
||||
status = adiv5_ap_read(ap, AAP_STATUS);
|
||||
if (platform_timeout_is_expired(&timeout)) {
|
||||
gdb_out(".");
|
||||
platform_timeout_set(&timeout, 500);
|
||||
}
|
||||
target_print_progress(&timeout);
|
||||
} while (status & AAP_STATUS_ERASEBUSY);
|
||||
|
||||
/* Read status */
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include "general.h"
|
||||
#include "target.h"
|
||||
#include "target_internal.h"
|
||||
#include "gdb_packet.h"
|
||||
|
||||
/* KE04 registers and constants */
|
||||
|
||||
|
@ -317,10 +316,8 @@ static bool ke04_command(target *t, uint8_t cmd, uint32_t addr, const uint8_t da
|
|||
if (fstat & (FTMRE_FSTAT_ACCERR | FTMRE_FSTAT_FPVIOL))
|
||||
return false;
|
||||
|
||||
if (cmd == CMD_ERASE_ALL_BLOCKS && platform_timeout_is_expired(&timeout)) {
|
||||
gdb_out(".");
|
||||
platform_timeout_set(&timeout, 500);
|
||||
}
|
||||
if (cmd == CMD_ERASE_ALL_BLOCKS)
|
||||
target_print_progress(&timeout);
|
||||
} while (!(fstat & FTMRE_FSTAT_CCIF));
|
||||
|
||||
return true;
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "target.h"
|
||||
#include "target_internal.h"
|
||||
#include "cortexm.h"
|
||||
#include "gdb_packet.h"
|
||||
|
||||
static bool stm32f1_cmd_option(target *t, int argc, const char **argv);
|
||||
|
||||
|
@ -404,11 +403,7 @@ static bool stm32f1_mass_erase(target *t)
|
|||
while (target_mem_read32(t, FLASH_SR) & FLASH_SR_BSY) {
|
||||
if (target_check_error(t))
|
||||
return false;
|
||||
|
||||
if (platform_timeout_is_expired(&timeout)) {
|
||||
gdb_out(".");
|
||||
platform_timeout_set(&timeout, 500);
|
||||
}
|
||||
target_print_progress(&timeout);
|
||||
}
|
||||
|
||||
/* Check for error */
|
||||
|
|
|
@ -366,6 +366,14 @@ int target_flash_done_buffered(struct target_flash *f)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void target_print_progress(platform_timeout *const timeout)
|
||||
{
|
||||
if (platform_timeout_is_expired(timeout)) {
|
||||
gdb_out(".");
|
||||
platform_timeout_set(timeout, 500);
|
||||
}
|
||||
}
|
||||
|
||||
/* Wrapper functions */
|
||||
void target_detach(target *t)
|
||||
{
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#ifndef __TARGET_INTERNAL_H
|
||||
#define __TARGET_INTERNAL_H
|
||||
|
||||
#include "platform_support.h"
|
||||
|
||||
extern target *target_list;
|
||||
target *target_new(void);
|
||||
|
||||
|
@ -142,6 +144,7 @@ struct target_s {
|
|||
void (*priv_free)(void *);
|
||||
};
|
||||
|
||||
void target_print_progress(platform_timeout *timeout);
|
||||
void target_ram_map_free(target *t);
|
||||
void target_flash_map_free(target *t);
|
||||
void target_mem_map_free(target *t);
|
||||
|
|
Loading…
Reference in New Issue