Review feedback
This commit is contained in:
parent
469ecbf0f9
commit
a3c2592e44
@ -96,9 +96,6 @@ int gdb_main_loop(struct target_controller *tc, bool in_syscall)
|
|||||||
int size;
|
int size;
|
||||||
bool single_step = false;
|
bool single_step = false;
|
||||||
|
|
||||||
/*
|
|
||||||
DEBUG("Entering GDB protocol main loop\n");
|
|
||||||
*/
|
|
||||||
/* GDB protocol main loop */
|
/* GDB protocol main loop */
|
||||||
while(1) {
|
while(1) {
|
||||||
SET_IDLE_STATE(1);
|
SET_IDLE_STATE(1);
|
||||||
|
@ -36,7 +36,7 @@ static void swdptap_turnaround(uint8_t dir)
|
|||||||
if(dir == olddir) return;
|
if(dir == olddir) return;
|
||||||
olddir = dir;
|
olddir = dir;
|
||||||
|
|
||||||
#if 0
|
#ifdef DEBUG_SWD_BITS
|
||||||
DEBUG("%s", dir ? "\n-> ":"\n<- ");
|
DEBUG("%s", dir ? "\n-> ":"\n<- ");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ bool swdptap_bit_in(void)
|
|||||||
gpio_set(SWCLK_PORT, SWCLK_PIN);
|
gpio_set(SWCLK_PORT, SWCLK_PIN);
|
||||||
gpio_clear(SWCLK_PORT, SWCLK_PIN);
|
gpio_clear(SWCLK_PORT, SWCLK_PIN);
|
||||||
|
|
||||||
#if 0
|
#ifdef DEBUG_SWD_BITS
|
||||||
DEBUG("%d", ret?1:0);
|
DEBUG("%d", ret?1:0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ bool swdptap_bit_in(void)
|
|||||||
|
|
||||||
void swdptap_bit_out(bool val)
|
void swdptap_bit_out(bool val)
|
||||||
{
|
{
|
||||||
#if 0
|
#ifdef DEBUG_SWD_BITS
|
||||||
DEBUG("%d", val);
|
DEBUG("%d", val);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* vim: set noexpandtab ts=4:
|
|
||||||
*
|
*
|
||||||
* This file is part of the Black Magic Debug project.
|
* This file is part of the Black Magic Debug project.
|
||||||
*
|
*
|
||||||
@ -108,10 +107,6 @@ static int sam4l_flash_erase(struct target_flash *f, target_addr addr, size_t le
|
|||||||
static int sam4l_flash_write_buf(struct target_flash *f, target_addr dest,
|
static int sam4l_flash_write_buf(struct target_flash *f, target_addr dest,
|
||||||
const void *src, size_t len);
|
const void *src, size_t len);
|
||||||
|
|
||||||
const struct command_s sam4l_cmds[] = {
|
|
||||||
{NULL, NULL, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
/* why Atmel couldn't make it sequential ... */
|
/* why Atmel couldn't make it sequential ... */
|
||||||
static const size_t __ram_size[16] = {
|
static const size_t __ram_size[16] = {
|
||||||
48 * 1024, /* 0: 48K */
|
48 * 1024, /* 0: 48K */
|
||||||
@ -152,6 +147,7 @@ static const size_t __nvp_size[16] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* All variants of 4L have a 512 byte page */
|
||||||
#define SAM4L_PAGE_SIZE 512
|
#define SAM4L_PAGE_SIZE 512
|
||||||
#define SAM4L_ARCH 0xb0
|
#define SAM4L_ARCH 0xb0
|
||||||
#define SAM4L_CHIPID_CIDR 0x400E0740
|
#define SAM4L_CHIPID_CIDR 0x400E0740
|
||||||
@ -162,8 +158,6 @@ static const size_t __nvp_size[16] = {
|
|||||||
#define CHIPID_CIDR_NVPSIZ_MASK 0xf
|
#define CHIPID_CIDR_NVPSIZ_MASK 0xf
|
||||||
#define CHIPID_CIDR_NVPSIZ_SHIFT 8
|
#define CHIPID_CIDR_NVPSIZ_SHIFT 8
|
||||||
|
|
||||||
/* All variants of 4L have a 512 byte page */
|
|
||||||
#define SAM4_PAGE_SIZE 512
|
|
||||||
|
|
||||||
/* Arbitrary time to wait for FLASH controller to be ready */
|
/* Arbitrary time to wait for FLASH controller to be ready */
|
||||||
#define FLASH_TIMEOUT 10000
|
#define FLASH_TIMEOUT 10000
|
||||||
@ -177,12 +171,12 @@ static void sam4l_add_flash(target *t, uint32_t addr, size_t length)
|
|||||||
struct target_flash *f = calloc(1, sizeof(struct target_flash));
|
struct target_flash *f = calloc(1, sizeof(struct target_flash));
|
||||||
f->start = addr;
|
f->start = addr;
|
||||||
f->length = length;
|
f->length = length;
|
||||||
f->blocksize = 512;
|
f->blocksize = SAM4L_PAGE_SIZE;
|
||||||
f->erase = sam4l_flash_erase;
|
f->erase = sam4l_flash_erase;
|
||||||
f->write = target_flash_write_buffered;
|
f->write = target_flash_write_buffered;
|
||||||
f->done = target_flash_done_buffered;
|
f->done = target_flash_done_buffered;
|
||||||
f->write_buf = sam4l_flash_write_buf;
|
f->write_buf = sam4l_flash_write_buf;
|
||||||
f->buf_size = 512;;
|
f->buf_size = SAM4L_PAGE_SIZE;
|
||||||
f->erased = 0xff;
|
f->erased = 0xff;
|
||||||
/* add it into the target structures flash chain */
|
/* add it into the target structures flash chain */
|
||||||
target_add_flash(t, f);
|
target_add_flash(t, f);
|
||||||
@ -264,7 +258,7 @@ bool sam4l_probe(target *t)
|
|||||||
/*
|
/*
|
||||||
* We've been reset, make sure we take the core out of reset
|
* We've been reset, make sure we take the core out of reset
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
sam4l_extended_reset(target *t)
|
sam4l_extended_reset(target *t)
|
||||||
{
|
{
|
||||||
uint32_t reg;
|
uint32_t reg;
|
||||||
@ -345,9 +339,12 @@ sam4l_flash_write_buf(struct target_flash *f, target_addr addr, const void *src,
|
|||||||
|
|
||||||
DEBUG("\nSAM4L: sam4l_flash_write_buf: addr = 0x%08lx, len %d\n", (long unsigned int) addr, (int) len);
|
DEBUG("\nSAM4L: sam4l_flash_write_buf: addr = 0x%08lx, len %d\n", (long unsigned int) addr, (int) len);
|
||||||
/* This will fail with unaligned writes, the write_buf version */
|
/* This will fail with unaligned writes, the write_buf version */
|
||||||
while (len) {
|
|
||||||
page = addr / SAM4L_PAGE_SIZE;
|
page = addr / SAM4L_PAGE_SIZE;
|
||||||
|
|
||||||
|
if (len != SAM4L_PAGE_SIZE) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* clear the page buffer */
|
/* clear the page buffer */
|
||||||
if (sam4l_flash_command(t, 0, FLASH_CMD_CPB)) {
|
if (sam4l_flash_command(t, 0, FLASH_CMD_CPB)) {
|
||||||
return -1;
|
return -1;
|
||||||
@ -374,10 +371,6 @@ sam4l_flash_write_buf(struct target_flash *f, target_addr addr, const void *src,
|
|||||||
if (sam4l_flash_command(t, page, FLASH_CMD_WP)) {
|
if (sam4l_flash_command(t, page, FLASH_CMD_WP)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* it should be done after one page, but in case it isn't */
|
|
||||||
len -= SAM4L_PAGE_SIZE;
|
|
||||||
addr += SAM4L_PAGE_SIZE;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,12 +392,12 @@ sam4l_flash_erase(struct target_flash *f, target_addr addr, size_t len)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
while (len) {
|
while (len) {
|
||||||
page = addr / SAM4_PAGE_SIZE;
|
page = addr / SAM4L_PAGE_SIZE;
|
||||||
if (sam4l_flash_command(t, page, FLASH_CMD_EP)) {
|
if (sam4l_flash_command(t, page, FLASH_CMD_EP)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
len -= SAM4_PAGE_SIZE;
|
len -= SAM4L_PAGE_SIZE;
|
||||||
addr += SAM4_PAGE_SIZE;
|
addr += SAM4L_PAGE_SIZE;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user