Add delay after reset request.

Hopefully this fixes problems observed with failing vFlashWrite.
This commit is contained in:
Gareth McMullin 2012-07-01 22:40:43 +12:00
parent d64cec686a
commit 5dff263078
7 changed files with 23 additions and 0 deletions

View File

@ -526,6 +526,8 @@ cortexm_reset(struct target_s *target)
while(adiv5_ap_mem_read(ap, CORTEXM_AIRCR) &
(CORTEXM_AIRCR_VECTRESET | CORTEXM_AIRCR_SYSRESETREQ));
platform_delay(2);
/* Reset DFSR flags */
adiv5_ap_mem_write(ap, CORTEXM_DFSR, CORTEXM_DFSR_RESETALL);
}

View File

@ -24,6 +24,7 @@
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <unistd.h>
struct ftdi_context *ftdic;
@ -126,3 +127,8 @@ const char *platform_target_voltage(void)
return "not supported";
}
void platform_delay(uint32_t delay)
{
usleep(delay * 10000000);
}

View File

@ -47,6 +47,7 @@ extern struct ftdi_context *ftdic;
int platform_init(void);
const char *platform_target_voltage(void);
void platform_delay(uint32_t delay);
void platform_buffer_flush(void);
int platform_buffer_write(const uint8_t *data, int size);

View File

@ -125,6 +125,12 @@ int platform_init(void)
return 0;
}
void platform_delay(uint32_t delay)
{
timeout_counter = delay;
while(timeout_counter);
}
void sys_tick_handler(void)
{
if(running_status)

View File

@ -135,6 +135,7 @@ int platform_init(void);
void morse(const char *msg, char repeat);
const char *platform_target_voltage(void);
int platform_hwversion(void);
void platform_delay(uint32_t delay);
/* <cdcacm.c> */
void cdcacm_init(void);

View File

@ -73,6 +73,12 @@ int platform_init(void)
return 0;
}
void platform_delay(uint32_t delay)
{
timeout_counter = delay;
while(timeout_counter);
}
void sys_tick_handler(void)
{
if(running_status)

View File

@ -105,6 +105,7 @@ extern const char *morse_msg;
int platform_init(void);
void morse(const char *msg, char repeat);
const char *platform_target_voltage(void);
void platform_delay(uint32_t delay);
/* <cdcacm.c> */
void cdcacm_init(void);