forked from auracaster/openocd
Compare commits
60 Commits
v0.6.0-rc1
...
v0.6.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9c4700b4d | ||
|
|
e69b94295e | ||
|
|
6d1ea5a7a9 | ||
|
|
8f944fc226 | ||
|
|
6544018321 | ||
|
|
80a9e44ac7 | ||
|
|
f5793f9a4a | ||
|
|
6145b016c2 | ||
|
|
2d0750d708 | ||
|
|
00581ae591 | ||
|
|
f8a537aa92 | ||
|
|
feb926a770 | ||
|
|
0c0c1b81e2 | ||
|
|
a384596034 | ||
|
|
027f8c9fb3 | ||
|
|
612cad7f7c | ||
|
|
07a73c01d1 | ||
|
|
6cb0c3ff14 | ||
|
|
f254667a13 | ||
|
|
370d02b857 | ||
|
|
552e027f68 | ||
|
|
e26ddb627b | ||
|
|
8a197f0bbc | ||
|
|
37f8f0bf9a | ||
|
|
39f3501afb | ||
|
|
9fbfb6103a | ||
|
|
6d9803ef1d | ||
|
|
4288886c83 | ||
|
|
210ff60284 | ||
|
|
9a8aa4ec63 | ||
|
|
897817b331 | ||
|
|
6055d952c3 | ||
|
|
d9a02fda07 | ||
|
|
d7f5a00cdc | ||
|
|
0288ea0920 | ||
|
|
9a9f745eba | ||
|
|
38e547b9c7 | ||
|
|
07158a7f8a | ||
|
|
73d87c6210 | ||
|
|
4c3972c1df | ||
|
|
09f9596ae0 | ||
|
|
a25e61ecd3 | ||
|
|
2ce4e31bbc | ||
|
|
4be685c616 | ||
|
|
0989cd4d5d | ||
|
|
47728f9215 | ||
|
|
63a23e6fc8 | ||
|
|
349b459e98 | ||
|
|
f97a159411 | ||
|
|
78f4f95648 | ||
|
|
640141eea3 | ||
|
|
2d57e80801 | ||
|
|
60a932b368 | ||
|
|
fb525cdd76 | ||
|
|
0e4dee1164 | ||
|
|
939f923927 | ||
|
|
c58c24c42f | ||
|
|
aec561c7c6 | ||
|
|
66b9bff3b3 | ||
|
|
8b344453ed |
3
NEWS
3
NEWS
@@ -9,6 +9,8 @@ JTAG Layer:
|
||||
New Tincantools Flyswatter2 support.
|
||||
Improved ULINK driver.
|
||||
Improved RLINK driver.
|
||||
Support for adapters based on FT232H chips.
|
||||
New experimental driver for FTDI based adapters, using libusb-1.0 in asynchronous mode.
|
||||
|
||||
Boundary Scan:
|
||||
|
||||
@@ -17,6 +19,7 @@ Target Layer:
|
||||
New Cortex-M4 support.
|
||||
Improved Working area algorithm.
|
||||
New RTOS support. Currently linux, FreeRTOS, ThreadX and eCos.
|
||||
Connecting under reset to Cortex-Mx and MIPS chips.
|
||||
|
||||
Flash Layer:
|
||||
New SST39WF1601 support.
|
||||
|
||||
10
configure.ac
10
configure.ac
@@ -1,5 +1,5 @@
|
||||
AC_PREREQ(2.60)
|
||||
AC_INIT([openocd], [0.6.0-rc1],
|
||||
AC_INIT([openocd], [0.6.1],
|
||||
[OpenOCD Mailing List <openocd-devel@lists.sourceforge.net>])
|
||||
AC_CONFIG_SRCDIR([src/openocd.c])
|
||||
|
||||
@@ -224,7 +224,7 @@ __EOF__
|
||||
# In case (1) and (2) we need to know where the package was unpacked.
|
||||
|
||||
AC_ARG_WITH(ftd2xx-win32-zipdir,
|
||||
AS_HELP_STRING([--with-ftd2xx-win32-zipdir],[Where (CYGWIN/MINGW) the zip file from ftdichip.com was unpacked <default=search>]),
|
||||
AS_HELP_STRING([--with-ftd2xx-win32-zipdir],[Where (CYGWIN/MINGW) the zip file from ftdichip.com was unpacked (default=search)]),
|
||||
[
|
||||
# option present
|
||||
if test -d $with_ftd2xx_win32_zipdir
|
||||
@@ -237,7 +237,7 @@ AC_ARG_WITH(ftd2xx-win32-zipdir,
|
||||
], [true])
|
||||
|
||||
AC_ARG_WITH(ftd2xx-linux-tardir,
|
||||
AS_HELP_STRING([--with-ftd2xx-linux-tardir], [Where (Linux/Unix) the tar file from ftdichip.com was unpacked <default=search>]),
|
||||
AS_HELP_STRING([--with-ftd2xx-linux-tardir], [Where (Linux/Unix) the tar file from ftdichip.com was unpacked (default=search)]),
|
||||
[
|
||||
# Option present
|
||||
if test $is_win32 = yes ; then
|
||||
@@ -254,7 +254,7 @@ AC_ARG_WITH(ftd2xx-linux-tardir,
|
||||
|
||||
AC_ARG_WITH(ftd2xx-lib,
|
||||
AS_HELP_STRING([--with-ftd2xx-lib],
|
||||
[Use static or shared ftd2xx libs on default static]),
|
||||
[Use static or shared ftd2xx libs (default=static)]),
|
||||
[
|
||||
case "$withval" in
|
||||
static)
|
||||
@@ -816,7 +816,7 @@ if test $build_remote_bitbang = yes; then
|
||||
build_bitbang=yes
|
||||
AC_DEFINE([BUILD_REMOTE_BITBANG], [1], [1 if you want the Remote Bitbang JTAG driver.])
|
||||
else
|
||||
AC_DEFINE([BUILD_REMOTE_BITBNAG], [0], [0 if you don't want the Remote Bitbang JTAG driver.])
|
||||
AC_DEFINE([BUILD_REMOTE_BITBANG], [0], [0 if you don't want the Remote Bitbang JTAG driver.])
|
||||
fi
|
||||
|
||||
#-- Deal with MingW/Cygwin FTD2XX issues
|
||||
|
||||
@@ -174,7 +174,7 @@ The OpenOCD web site provides the latest public news from the community:
|
||||
|
||||
The user's guide you are now reading may not be the latest one
|
||||
available. A version for more recent code may be available.
|
||||
Its HTML form is published irregularly at:
|
||||
Its HTML form is published regularly at:
|
||||
|
||||
@uref{http://openocd.sourceforge.net/doc/html/index.html}
|
||||
|
||||
@@ -192,6 +192,17 @@ instead of this forum.
|
||||
|
||||
@uref{http://forum.sparkfun.com/viewforum.php?f=18}
|
||||
|
||||
@section OpenOCD User's Mailing List
|
||||
|
||||
The OpenOCD User Mailing List provides the primary means of
|
||||
communication between users:
|
||||
|
||||
@uref{https://lists.sourceforge.net/mailman/listinfo/openocd-user}
|
||||
|
||||
@section OpenOCD IRC
|
||||
|
||||
Support can also be found on irc:
|
||||
@uref{irc://irc.freenode.net/openocd}
|
||||
|
||||
@node Developers
|
||||
@chapter OpenOCD Developer Resources
|
||||
|
||||
@@ -510,7 +510,7 @@ static int mg_mflash_read_sects(void *buff, uint32_t sect_num, uint32_t sect_cnt
|
||||
}
|
||||
|
||||
static int mg_mflash_do_write_sects(void *buff, uint32_t sect_num, uint32_t sect_cnt,
|
||||
mg_io_type_cmd cmd)
|
||||
uint8_t cmd)
|
||||
{
|
||||
uint32_t i, address;
|
||||
int ret;
|
||||
@@ -770,6 +770,7 @@ COMMAND_HANDLER(mg_write_cmd)
|
||||
int retval = fileio_size(&fileio, &filesize);
|
||||
if (retval != ERROR_OK) {
|
||||
fileio_close(&fileio);
|
||||
free(buffer);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
@@ -524,8 +524,9 @@ static int lpc3180_write_page(struct nand_device *nand,
|
||||
target_write_u32(target, 0x200b8010, 0x0);
|
||||
|
||||
if (!lpc3180_controller_ready(nand, 1000)) {
|
||||
LOG_ERROR(
|
||||
"timeout while waiting for completion of auto encode cycle");
|
||||
LOG_ERROR("timeout while waiting for completion of auto encode cycle");
|
||||
free(page_buffer);
|
||||
free(oob_buffer);
|
||||
return ERROR_NAND_OPERATION_FAILED;
|
||||
}
|
||||
}
|
||||
@@ -536,11 +537,15 @@ static int lpc3180_write_page(struct nand_device *nand,
|
||||
retval = nand_read_status(nand, &status);
|
||||
if (retval != ERROR_OK) {
|
||||
LOG_ERROR("couldn't read status");
|
||||
free(page_buffer);
|
||||
free(oob_buffer);
|
||||
return ERROR_NAND_OPERATION_FAILED;
|
||||
}
|
||||
|
||||
if (status & NAND_STATUS_FAIL) {
|
||||
LOG_ERROR("write operation didn't pass, status: 0x%2.2x", status);
|
||||
free(page_buffer);
|
||||
free(oob_buffer);
|
||||
return ERROR_NAND_OPERATION_FAILED;
|
||||
}
|
||||
|
||||
@@ -888,8 +893,9 @@ static int lpc3180_read_page(struct nand_device *nand,
|
||||
target_write_u32(target, 0x200b8014, 0xaa55aa55);
|
||||
|
||||
if (!lpc3180_controller_ready(nand, 1000)) {
|
||||
LOG_ERROR(
|
||||
"timeout while waiting for completion of auto decode cycle");
|
||||
LOG_ERROR("timeout while waiting for completion of auto decode cycle");
|
||||
free(page_buffer);
|
||||
free(oob_buffer);
|
||||
return ERROR_NAND_OPERATION_FAILED;
|
||||
}
|
||||
|
||||
@@ -899,6 +905,8 @@ static int lpc3180_read_page(struct nand_device *nand,
|
||||
if (mlc_isr & 0x40) {
|
||||
LOG_ERROR("uncorrectable error detected: 0x%2.2x",
|
||||
(unsigned)mlc_isr);
|
||||
free(page_buffer);
|
||||
free(oob_buffer);
|
||||
return ERROR_NAND_OPERATION_FAILED;
|
||||
}
|
||||
|
||||
|
||||
@@ -3018,7 +3018,7 @@ static int sam3_page_read(struct sam3_bank_private *pPrivate, unsigned pagenum,
|
||||
int r;
|
||||
|
||||
adr = pagenum * pPrivate->page_size;
|
||||
adr += adr + pPrivate->base_address;
|
||||
adr += pPrivate->base_address;
|
||||
|
||||
r = target_read_memory(pPrivate->pChip->target,
|
||||
adr,
|
||||
@@ -3126,7 +3126,7 @@ static int sam3_page_write(struct sam3_bank_private *pPrivate, unsigned pagenum,
|
||||
int r;
|
||||
|
||||
adr = pagenum * pPrivate->page_size;
|
||||
adr += (adr + pPrivate->base_address);
|
||||
adr += pPrivate->base_address;
|
||||
|
||||
/* Get flash mode register value */
|
||||
r = target_read_u32(pPrivate->pChip->target, pPrivate->controller_address, &fmr);
|
||||
|
||||
@@ -722,10 +722,17 @@ static int FLASHD_ErasePages(struct sam4_bank_private *pPrivate,
|
||||
break;
|
||||
}
|
||||
|
||||
/* AT91C_EFC_FCMD_EPA
|
||||
* According to the datasheet FARG[15:2] defines the page from which
|
||||
* the erase will start.This page must be modulo 4, 8, 16 or 32
|
||||
* according to the number of pages to erase. FARG[1:0] defines the
|
||||
* number of pages to be erased. Previously (firstpage << 2) was used
|
||||
* to conform to this, seems it should not be shifted...
|
||||
*/
|
||||
return EFC_PerformCommand(pPrivate,
|
||||
/* send Erase Page */
|
||||
AT91C_EFC_FCMD_EPA,
|
||||
(firstPage << 2) | erasePages,
|
||||
(firstPage) | erasePages,
|
||||
status);
|
||||
}
|
||||
|
||||
|
||||
@@ -897,8 +897,10 @@ static int at91sam7_erase(struct flash_bank *bank, int first, int last)
|
||||
for (pos = 0; pos < nbytes; pos++)
|
||||
buffer[pos] = 0xFF;
|
||||
|
||||
if (at91sam7_write(bank, buffer, bank->sectors[first].offset, nbytes) != ERROR_OK)
|
||||
if (at91sam7_write(bank, buffer, bank->sectors[first].offset, nbytes) != ERROR_OK) {
|
||||
free(buffer);
|
||||
return ERROR_FLASH_OPERATION_FAILED;
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
@@ -1634,7 +1634,7 @@ static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer,
|
||||
struct cfi_spansion_pri_ext *pri_ext = cfi_info->pri_ext;
|
||||
struct target *target = bank->target;
|
||||
struct reg_param reg_params[10];
|
||||
struct arm_algorithm *arm_algo;
|
||||
void *arm_algo;
|
||||
struct arm_algorithm armv4_5_algo;
|
||||
struct armv7m_algorithm armv7m_algo;
|
||||
struct working_area *source;
|
||||
@@ -1818,7 +1818,7 @@ static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer,
|
||||
if (is_armv7m(target_to_armv7m(target))) { /* Cortex-M3 target */
|
||||
armv7m_algo.common_magic = ARMV7M_COMMON_MAGIC;
|
||||
armv7m_algo.core_mode = ARMV7M_MODE_HANDLER;
|
||||
arm_algo = (struct arm_algorithm *)&armv7m_algo;
|
||||
arm_algo = &armv7m_algo;
|
||||
} else if (is_arm(target_to_arm(target))) {
|
||||
/* All other ARM CPUs have 32 bit instructions */
|
||||
armv4_5_algo.common_magic = ARM_COMMON_MAGIC;
|
||||
@@ -1835,7 +1835,7 @@ static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer,
|
||||
|
||||
switch (bank->bus_width) {
|
||||
case 1:
|
||||
if (arm_algo->common_magic != ARM_COMMON_MAGIC) {
|
||||
if (is_armv7m(target_to_armv7m(target))) {
|
||||
LOG_ERROR("Unknown ARM architecture");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
@@ -1845,19 +1845,19 @@ static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer,
|
||||
case 2:
|
||||
/* Check for DQ5 support */
|
||||
if (cfi_info->status_poll_mask & (1 << 5)) {
|
||||
if (arm_algo->common_magic == ARM_COMMON_MAGIC) {/* armv4_5 target */
|
||||
target_code_src = armv4_5_word_16_code;
|
||||
target_code_size = sizeof(armv4_5_word_16_code);
|
||||
} else if (arm_algo->common_magic == ARMV7M_COMMON_MAGIC) { /*
|
||||
if (is_armv7m(target_to_armv7m(target))) { /*
|
||||
*cortex-m3
|
||||
*target
|
||||
**/
|
||||
target_code_src = armv7m_word_16_code;
|
||||
target_code_size = sizeof(armv7m_word_16_code);
|
||||
} else { /* armv4_5 target */
|
||||
target_code_src = armv4_5_word_16_code;
|
||||
target_code_size = sizeof(armv4_5_word_16_code);
|
||||
}
|
||||
} else {
|
||||
/* No DQ5 support. Use DQ7 DATA# polling only. */
|
||||
if (arm_algo->common_magic != ARM_COMMON_MAGIC) {
|
||||
if (is_armv7m(target_to_armv7m(target))) {
|
||||
LOG_ERROR("Unknown ARM architecture");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
@@ -1866,7 +1866,7 @@ static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer,
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (arm_algo->common_magic != ARM_COMMON_MAGIC) {
|
||||
if (is_armv7m(target_to_armv7m(target))) {
|
||||
LOG_ERROR("Unknown ARM architecture");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
@@ -351,32 +351,75 @@ static int kinetis_write(struct flash_bank *bank, uint8_t *buffer,
|
||||
if (fallback == 0) {
|
||||
unsigned prog_section_bytes = kinfo->sector_size >> 8;
|
||||
for (i = 0; i < count; i += kinfo->sector_size) {
|
||||
/*
|
||||
* The largest possible Kinetis "section" is
|
||||
* 16 bytes. A full Kinetis sector is always
|
||||
* 256 "section"s.
|
||||
*/
|
||||
uint8_t residual_buffer[16];
|
||||
uint8_t ftfx_fstat;
|
||||
uint32_t section_count = 256;
|
||||
uint32_t residual_wc = 0;
|
||||
|
||||
/*
|
||||
* Assume the word count covers an entire
|
||||
* sector.
|
||||
*/
|
||||
wc = kinfo->sector_size / 4;
|
||||
|
||||
/*
|
||||
* If bytes to be programmed are less than the
|
||||
* full sector, then determine the number of
|
||||
* full-words to program, and put together the
|
||||
* residual buffer so that a full "section"
|
||||
* may always be programmed.
|
||||
*/
|
||||
if ((count - i) < kinfo->sector_size) {
|
||||
wc = count - i;
|
||||
wc /= 4;
|
||||
/* number of bytes to program beyond full section */
|
||||
unsigned residual_bc = (count-i) % prog_section_bytes;
|
||||
|
||||
/* number of complete words to copy directly from buffer */
|
||||
wc = (count - i) / 4;
|
||||
|
||||
/* number of total sections to write, including residual */
|
||||
section_count = DIV_ROUND_UP((count-i), prog_section_bytes);
|
||||
|
||||
/* any residual bytes delivers a whole residual section */
|
||||
residual_wc = (residual_bc ? prog_section_bytes : 0)/4;
|
||||
|
||||
/* clear residual buffer then populate residual bytes */
|
||||
(void) memset(residual_buffer, 0xff, prog_section_bytes);
|
||||
(void) memcpy(residual_buffer, &buffer[i+4*wc], residual_bc);
|
||||
}
|
||||
|
||||
LOG_DEBUG("write section @ %08X with length %d",
|
||||
offset + i, wc * 4);
|
||||
LOG_DEBUG("write section @ %08X with length %d bytes",
|
||||
offset + i, (count - i));
|
||||
|
||||
/* write data to flexram */
|
||||
result =
|
||||
target_write_memory(bank->target, 0x14000000, 4, wc,
|
||||
buffer + i);
|
||||
/* write data to flexram as whole-words */
|
||||
result = target_write_memory(bank->target, 0x14000000, 4, wc,
|
||||
buffer + i);
|
||||
|
||||
if (result != ERROR_OK) {
|
||||
LOG_ERROR("target_write_memory failed");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* execute section command */
|
||||
/* write the residual words to the flexram */
|
||||
if (residual_wc) {
|
||||
result = target_write_memory(bank->target,
|
||||
0x14000000+4*wc,
|
||||
4, residual_wc,
|
||||
residual_buffer);
|
||||
|
||||
if (result != ERROR_OK) {
|
||||
LOG_ERROR("target_write_memory failed");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/* execute section-write command */
|
||||
w0 = (0x0b << 24) | (bank->base + offset + i);
|
||||
w1 = ((wc * 4 / prog_section_bytes) << 16);
|
||||
w1 = section_count << 16;
|
||||
|
||||
result = kinetis_ftfx_command(bank, w0, w1, w2, &ftfx_fstat);
|
||||
|
||||
@@ -392,7 +435,13 @@ static int kinetis_write(struct flash_bank *bank, uint8_t *buffer,
|
||||
LOG_DEBUG("write longword @ %08X", offset + i);
|
||||
|
||||
w0 = (0x06 << 24) | (bank->base + offset + i);
|
||||
w1 = buf_get_u32(buffer + offset + i, 0, 32);
|
||||
if (count - i < 4) {
|
||||
uint32_t padding = 0xffffffff;
|
||||
memcpy(&padding, buffer + i, count - i);
|
||||
w1 = buf_get_u32(&padding, 0, 32);
|
||||
} else {
|
||||
w1 = buf_get_u32(buffer + i, 0, 32);
|
||||
}
|
||||
|
||||
result = kinetis_ftfx_command(bank, w0, w1, w2, &ftfx_fstat);
|
||||
|
||||
@@ -587,6 +636,8 @@ static int kinetis_read_part_info(struct flash_bank *bank)
|
||||
LOG_DEBUG("FlexRAM bank %d already configured okay",
|
||||
kinfo->bank_ordinal);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG_WARNING("Unknown or inconsistent flash class");
|
||||
reassign = 1;
|
||||
|
||||
@@ -422,7 +422,7 @@ static int lpc2000_iap_call(struct flash_bank *bank,
|
||||
|
||||
static int lpc2000_iap_blank_check(struct flash_bank *bank, int first, int last)
|
||||
{
|
||||
uint32_t param_table[5];
|
||||
uint32_t param_table[5] = {0};
|
||||
uint32_t result_table[4];
|
||||
int status_code;
|
||||
int i;
|
||||
@@ -512,7 +512,7 @@ FLASH_BANK_COMMAND_HANDLER(lpc2000_flash_bank_command)
|
||||
static int lpc2000_erase(struct flash_bank *bank, int first, int last)
|
||||
{
|
||||
struct lpc2000_flash_bank *lpc2000_info = bank->driver_priv;
|
||||
uint32_t param_table[5];
|
||||
uint32_t param_table[5] = {0};
|
||||
uint32_t result_table[4];
|
||||
int status_code;
|
||||
|
||||
@@ -573,7 +573,7 @@ static int lpc2000_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offs
|
||||
uint32_t bytes_written = 0;
|
||||
int first_sector = 0;
|
||||
int last_sector = 0;
|
||||
uint32_t param_table[5];
|
||||
uint32_t param_table[5] = {0};
|
||||
uint32_t result_table[4];
|
||||
int status_code;
|
||||
int i;
|
||||
@@ -772,7 +772,7 @@ static int get_lpc2000_info(struct flash_bank *bank, char *buf, int buf_size)
|
||||
|
||||
COMMAND_HANDLER(lpc2000_handle_part_id_command)
|
||||
{
|
||||
uint32_t param_table[5];
|
||||
uint32_t param_table[5] = {0};
|
||||
uint32_t result_table[4];
|
||||
int status_code;
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <jtag/jtag.h>
|
||||
#include "imp.h"
|
||||
#include <target/algorithm.h>
|
||||
#include <target/mips32.h>
|
||||
@@ -419,6 +420,7 @@ static int pic32mx_write_block(struct flash_bank *bank, uint8_t *buffer,
|
||||
struct working_area *source;
|
||||
uint32_t address = bank->base + offset;
|
||||
struct reg_param reg_params[3];
|
||||
uint32_t row_size;
|
||||
int retval = ERROR_OK;
|
||||
|
||||
struct pic32mx_flash_bank *pic32mx_info = bank->driver_priv;
|
||||
@@ -438,12 +440,14 @@ static int pic32mx_write_block(struct flash_bank *bank, uint8_t *buffer,
|
||||
pic32mx_flash_write_code[14] = 0x24840080;
|
||||
pic32mx_flash_write_code[15] = 0x24A50080;
|
||||
pic32mx_flash_write_code[17] = 0x24C6FFE0;
|
||||
row_size = 128;
|
||||
} else {
|
||||
/* 512 byte row */
|
||||
pic32mx_flash_write_code[8] = 0x2CD30080;
|
||||
pic32mx_flash_write_code[14] = 0x24840200;
|
||||
pic32mx_flash_write_code[15] = 0x24A50200;
|
||||
pic32mx_flash_write_code[17] = 0x24C6FF80;
|
||||
row_size = 512;
|
||||
}
|
||||
|
||||
retval = target_write_buffer(target, pic32mx_info->write_algorithm->address,
|
||||
@@ -463,7 +467,7 @@ static int pic32mx_write_block(struct flash_bank *bank, uint8_t *buffer,
|
||||
LOG_WARNING("no large enough working area available, can't do block memory writes");
|
||||
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
mips32_info.common_magic = MIPS32_COMMON_MAGIC;
|
||||
mips32_info.isa_mode = MIPS32_ISA_MIPS32;
|
||||
@@ -472,19 +476,46 @@ static int pic32mx_write_block(struct flash_bank *bank, uint8_t *buffer,
|
||||
init_reg_param(®_params[1], "a1", 32, PARAM_OUT);
|
||||
init_reg_param(®_params[2], "a2", 32, PARAM_OUT);
|
||||
|
||||
int row_offset = offset % row_size;
|
||||
uint8_t *new_buffer = NULL;
|
||||
if (row_offset && (count >= (row_size / 4))) {
|
||||
new_buffer = malloc(buffer_size);
|
||||
if (new_buffer == NULL) {
|
||||
LOG_ERROR("Out of memory");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
memset(new_buffer, 0xff, row_offset);
|
||||
address -= row_offset;
|
||||
} else
|
||||
row_offset = 0;
|
||||
|
||||
while (count > 0) {
|
||||
uint32_t status;
|
||||
uint32_t thisrun_count = (count > (buffer_size / 4)) ?
|
||||
(buffer_size / 4) : count;
|
||||
uint32_t thisrun_count;
|
||||
|
||||
retval = target_write_buffer(target, source->address,
|
||||
thisrun_count * 4, buffer);
|
||||
if (retval != ERROR_OK)
|
||||
break;
|
||||
if (row_offset) {
|
||||
thisrun_count = (count > ((buffer_size - row_offset) / 4)) ?
|
||||
((buffer_size - row_offset) / 4) : count;
|
||||
|
||||
memcpy(new_buffer + row_offset, buffer, thisrun_count * 4);
|
||||
|
||||
retval = target_write_buffer(target, source->address,
|
||||
row_offset + thisrun_count * 4, new_buffer);
|
||||
if (retval != ERROR_OK)
|
||||
break;
|
||||
} else {
|
||||
thisrun_count = (count > (buffer_size / 4)) ?
|
||||
(buffer_size / 4) : count;
|
||||
|
||||
retval = target_write_buffer(target, source->address,
|
||||
thisrun_count * 4, buffer);
|
||||
if (retval != ERROR_OK)
|
||||
break;
|
||||
}
|
||||
|
||||
buf_set_u32(reg_params[0].value, 0, 32, Virt2Phys(source->address));
|
||||
buf_set_u32(reg_params[1].value, 0, 32, Virt2Phys(address));
|
||||
buf_set_u32(reg_params[2].value, 0, 32, thisrun_count);
|
||||
buf_set_u32(reg_params[2].value, 0, 32, thisrun_count + row_offset / 4);
|
||||
|
||||
retval = target_run_algorithm(target, 0, NULL, 3, reg_params,
|
||||
pic32mx_info->write_algorithm->address,
|
||||
@@ -512,6 +543,10 @@ static int pic32mx_write_block(struct flash_bank *bank, uint8_t *buffer,
|
||||
buffer += thisrun_count * 4;
|
||||
address += thisrun_count * 4;
|
||||
count -= thisrun_count;
|
||||
if (row_offset) {
|
||||
address += row_offset;
|
||||
row_offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
target_free_working_area(target, source);
|
||||
@@ -521,6 +556,8 @@ static int pic32mx_write_block(struct flash_bank *bank, uint8_t *buffer,
|
||||
destroy_reg_param(®_params[1]);
|
||||
destroy_reg_param(®_params[2]);
|
||||
|
||||
if (new_buffer != NULL)
|
||||
free(new_buffer);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -828,6 +865,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command)
|
||||
|
||||
/* unlock/erase device */
|
||||
mips_ejtag_drscan_8_out(ejtag_info, MCHP_ASERT_RST);
|
||||
jtag_add_sleep(200);
|
||||
|
||||
mips_ejtag_drscan_8_out(ejtag_info, MCHP_ERASE);
|
||||
|
||||
|
||||
@@ -249,6 +249,14 @@ static int stm32x_erase_options(struct flash_bank *bank)
|
||||
|
||||
stm32x_info = bank->driver_priv;
|
||||
|
||||
/* stlink is currently does not support 16bit
|
||||
* read/writes. so we cannot write option bytes */
|
||||
struct armv7m_common *armv7m = target_to_armv7m(target);
|
||||
if (armv7m && armv7m->stlink) {
|
||||
LOG_ERROR("Option bytes currently unsupported for stlink");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
/* read current options */
|
||||
stm32x_read_options(bank);
|
||||
|
||||
@@ -1134,6 +1142,10 @@ static int get_stm32x_info(struct flash_bank *bank, char *buf, int buf_size)
|
||||
snprintf(buf, buf_size, "1.0");
|
||||
break;
|
||||
|
||||
case 0x2000:
|
||||
snprintf(buf, buf_size, "2.0");
|
||||
break;
|
||||
|
||||
default:
|
||||
snprintf(buf, buf_size, "unknown");
|
||||
break;
|
||||
@@ -1180,6 +1192,10 @@ static int get_stm32x_info(struct flash_bank *bank, char *buf, int buf_size)
|
||||
snprintf(buf, buf_size, "1.0");
|
||||
break;
|
||||
|
||||
case 0x2000:
|
||||
snprintf(buf, buf_size, "2.0");
|
||||
break;
|
||||
|
||||
default:
|
||||
snprintf(buf, buf_size, "unknown");
|
||||
break;
|
||||
|
||||
@@ -427,16 +427,7 @@ COMMAND_HANDLER(handle_flash_fill_command)
|
||||
int retval = ERROR_OK;
|
||||
|
||||
static size_t const chunksize = 1024;
|
||||
uint8_t *chunk = malloc(chunksize);
|
||||
if (chunk == NULL)
|
||||
return ERROR_FAIL;
|
||||
|
||||
uint8_t *readback = malloc(chunksize);
|
||||
if (readback == NULL) {
|
||||
free(chunk);
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
uint8_t *chunk = NULL, *readback = NULL;
|
||||
|
||||
if (CMD_ARGC != 3) {
|
||||
retval = ERROR_COMMAND_SYNTAX_ERROR;
|
||||
@@ -447,6 +438,16 @@ COMMAND_HANDLER(handle_flash_fill_command)
|
||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], pattern);
|
||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], count);
|
||||
|
||||
chunk = malloc(chunksize);
|
||||
if (chunk == NULL)
|
||||
return ERROR_FAIL;
|
||||
|
||||
readback = malloc(chunksize);
|
||||
if (readback == NULL) {
|
||||
free(chunk);
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
goto done;
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
/* see Embedder-HOWTO.txt in Jim Tcl project hosted on BerliOS*/
|
||||
/* see Embedded-HOWTO.txt in Jim Tcl project hosted on BerliOS*/
|
||||
#define JIM_EMBEDDED
|
||||
|
||||
/* @todo the inclusion of target.h here is a layering violation */
|
||||
@@ -152,6 +152,7 @@ static void script_command_args_free(const char **words, unsigned nwords)
|
||||
free((void *)words[i]);
|
||||
free(words);
|
||||
}
|
||||
|
||||
static const char **script_command_args_alloc(
|
||||
unsigned argc, Jim_Obj * const *argv, unsigned *nwords)
|
||||
{
|
||||
@@ -244,6 +245,7 @@ static struct command *command_find(struct command *head, const char *name)
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct command *command_find_in_context(struct command_context *cmd_ctx,
|
||||
const char *name)
|
||||
{
|
||||
@@ -570,6 +572,7 @@ static char *__command_name(struct command *c, char delim, unsigned extra)
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
char *command_name(struct command *c, char delim)
|
||||
{
|
||||
return __command_name(c, delim, 0);
|
||||
@@ -777,7 +780,7 @@ static int jim_capture(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
|
||||
/* disable polling during capture. This avoids capturing output
|
||||
* from polling.
|
||||
*
|
||||
* This is necessary in order to avoid accidentially getting a non-empty
|
||||
* This is necessary in order to avoid accidentally getting a non-empty
|
||||
* string for tcl fn's.
|
||||
*/
|
||||
bool save_poll = jtag_poll_get_enabled();
|
||||
@@ -847,6 +850,7 @@ static void command_help_show_wrap(const char *str, unsigned n, unsigned n2)
|
||||
n = n2;
|
||||
}
|
||||
}
|
||||
|
||||
static COMMAND_HELPER(command_help_show, struct command *c, unsigned n,
|
||||
bool show_help, const char *match)
|
||||
{
|
||||
@@ -911,6 +915,7 @@ static COMMAND_HELPER(command_help_show, struct command *c, unsigned n,
|
||||
return CALL_COMMAND_HANDLER(command_help_show_list,
|
||||
c->children, n, show_help, match);
|
||||
}
|
||||
|
||||
COMMAND_HANDLER(handle_help_command)
|
||||
{
|
||||
bool full = strcmp(CMD_NAME, "help") == 0;
|
||||
@@ -927,19 +932,16 @@ COMMAND_HANDLER(handle_help_command)
|
||||
if (NULL != match) {
|
||||
char *prev = match;
|
||||
|
||||
match = alloc_printf("%s %s", match,
|
||||
CMD_ARGV[i]);
|
||||
match = alloc_printf("%s %s", match, CMD_ARGV[i]);
|
||||
free(prev);
|
||||
if (NULL == match) {
|
||||
LOG_ERROR("unable to build "
|
||||
"search string");
|
||||
LOG_ERROR("unable to build search string");
|
||||
return -ENOMEM;
|
||||
}
|
||||
} else {
|
||||
match = alloc_printf("%s", CMD_ARGV[i]);
|
||||
if (NULL == match) {
|
||||
LOG_ERROR("unable to build "
|
||||
"search string");
|
||||
LOG_ERROR("unable to build search string");
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,43 +55,52 @@ int configuration_output_handler(struct command_context *context, const char *li
|
||||
static void add_default_dirs(void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
char strExePath[MAX_PATH];
|
||||
char *path;
|
||||
GetModuleFileName(NULL, strExePath, MAX_PATH);
|
||||
|
||||
/* Strip executable file name, leaving path */
|
||||
*strrchr(strExePath, '\\') = '\0';
|
||||
|
||||
/* Convert path separators to UNIX style, should work on Windows also. */
|
||||
for (char *p = strExePath; *p; p++) {
|
||||
if (*p == '\\')
|
||||
*p = '/';
|
||||
}
|
||||
|
||||
/* Add the parent of the directory where openocd.exe resides to the
|
||||
* config script search path.
|
||||
* Directory layout:
|
||||
* bin\openocd.exe
|
||||
* lib\openocd
|
||||
*
|
||||
* bin/openocd.exe
|
||||
* interface/dummy.cfg
|
||||
* target/at91eb40a.cfg
|
||||
*/
|
||||
{
|
||||
char strExePath[MAX_PATH];
|
||||
GetModuleFileName(NULL, strExePath, MAX_PATH);
|
||||
/* Either this code will *always* work or it will SEGFAULT giving
|
||||
* excellent information on the culprit.
|
||||
*/
|
||||
*strrchr(strExePath, '\\') = 0;
|
||||
strcat(strExePath, "\\..");
|
||||
add_script_search_dir(strExePath);
|
||||
path = alloc_printf("%s%s", strExePath, "/..");
|
||||
if (path) {
|
||||
add_script_search_dir(path);
|
||||
free(path);
|
||||
}
|
||||
/*
|
||||
* Add support for the default (as of 20091118) layout when
|
||||
* using autotools and cygwin/MinGW to build native binary.
|
||||
* Path separator is converted to UNIX style so that MinGW is
|
||||
* pleased.
|
||||
/* Add support for the directory layout resulting from a 'make install'.
|
||||
*
|
||||
* bin/openocd.exe
|
||||
* share/openocd/scripts/interface/dummy.cfg
|
||||
* share/openocd/scripts/target/at91eb40a.cfg
|
||||
*/
|
||||
{
|
||||
char strExePath[MAX_PATH];
|
||||
char *p;
|
||||
GetModuleFileName(NULL, strExePath, MAX_PATH);
|
||||
*strrchr(strExePath, '\\') = 0;
|
||||
strcat(strExePath, "/../share/"PACKAGE "/scripts");
|
||||
for (p = strExePath; *p; p++) {
|
||||
if (*p == '\\')
|
||||
*p = '/';
|
||||
}
|
||||
add_script_search_dir(strExePath);
|
||||
path = alloc_printf("%s%s", strExePath, "/../share/" PACKAGE "/scripts");
|
||||
if (path) {
|
||||
add_script_search_dir(path);
|
||||
free(path);
|
||||
}
|
||||
/* Add single "scripts" folder to search path for Windows OpenOCD builds that don't use cygwin
|
||||
*
|
||||
* bin/openocd.exe
|
||||
* scripts/interface/dummy.cfg
|
||||
* scripts/target/at91eb40a.cfg
|
||||
*/
|
||||
path = alloc_printf("%s%s", strExePath, "/../scripts");
|
||||
if (path) {
|
||||
add_script_search_dir(path);
|
||||
free(path);
|
||||
}
|
||||
#else
|
||||
/*
|
||||
|
||||
@@ -311,7 +311,6 @@ next:
|
||||
} else
|
||||
new_cfg = jtag_get_reset_config();
|
||||
|
||||
|
||||
/*
|
||||
* Display the (now-)current reset mode
|
||||
*/
|
||||
@@ -409,8 +408,6 @@ COMMAND_HANDLER(handle_adapter_nsrst_assert_width_command)
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
COMMAND_HANDLER(handle_adapter_khz_command)
|
||||
{
|
||||
if (CMD_ARGC > 1)
|
||||
@@ -432,9 +429,9 @@ COMMAND_HANDLER(handle_adapter_khz_command)
|
||||
return retval;
|
||||
|
||||
if (cur_speed)
|
||||
command_print(CMD_CTX, "%d kHz", cur_speed);
|
||||
command_print(CMD_CTX, "adapter speed: %d kHz", cur_speed);
|
||||
else
|
||||
command_print(CMD_CTX, "RCLK - adaptive");
|
||||
command_print(CMD_CTX, "adapter speed: RCLK - adaptive");
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ static int ftdi_set_signal(const struct signal *s, char value)
|
||||
|
||||
output = data ? output | s->data_mask : output & ~s->data_mask;
|
||||
if (s->oe_mask == s->data_mask)
|
||||
direction = oe ? output | s->oe_mask : output & ~s->oe_mask;
|
||||
direction = oe ? direction | s->oe_mask : direction & ~s->oe_mask;
|
||||
else
|
||||
output = oe ? output | s->oe_mask : output & ~s->oe_mask;
|
||||
|
||||
@@ -247,6 +247,11 @@ static int ftdi_speed_div(int speed, int *khz)
|
||||
|
||||
static int ftdi_khz(int khz, int *jtag_speed)
|
||||
{
|
||||
if (khz == 0 && !mpsse_is_high_speed(mpsse_ctx)) {
|
||||
LOG_DEBUG("RCLK not supported");
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
*jtag_speed = khz * 1000;
|
||||
return ERROR_OK;
|
||||
}
|
||||
@@ -389,6 +394,18 @@ static int ftdi_execute_scan(struct jtag_command *cmd)
|
||||
DEBUG_JTAG_IO("%s type:%d", cmd->cmd.scan->ir_scan ? "IRSCAN" : "DRSCAN",
|
||||
jtag_scan_type(cmd->cmd.scan));
|
||||
|
||||
/* Make sure there are no trailing fields with num_bits == 0, or the logic below will fail. */
|
||||
while (cmd->cmd.scan->num_fields > 0
|
||||
&& cmd->cmd.scan->fields[cmd->cmd.scan->num_fields - 1].num_bits == 0) {
|
||||
cmd->cmd.scan->num_fields--;
|
||||
LOG_DEBUG("discarding trailing empty field");
|
||||
}
|
||||
|
||||
if (cmd->cmd.scan->num_fields == 0) {
|
||||
LOG_DEBUG("empty scan, doing nothing");
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (cmd->cmd.scan->ir_scan) {
|
||||
if (tap_get_state() != TAP_IRSHIFT)
|
||||
move_to_state(TAP_IRSHIFT);
|
||||
@@ -413,7 +430,7 @@ static int ftdi_execute_scan(struct jtag_command *cmd)
|
||||
|
||||
if (i == cmd->cmd.scan->num_fields - 1 && tap_get_state() != tap_get_end_state()) {
|
||||
/* Last field, and we're leaving IRSHIFT/DRSHIFT. Clock last bit during tap
|
||||
*movement */
|
||||
* movement. This last field can't have length zero, it was checked above. */
|
||||
mpsse_clock_data(mpsse_ctx,
|
||||
field->out_value,
|
||||
0,
|
||||
@@ -626,7 +643,7 @@ static int ftdi_initialize(void)
|
||||
if (retval == ERROR_OK)
|
||||
retval = mpsse_set_data_bits_high_byte(mpsse_ctx, output >> 8, direction >> 8);
|
||||
if (retval != ERROR_OK) {
|
||||
LOG_ERROR("couldn't initialize FTDI with 'JTAGkey' layout");
|
||||
LOG_ERROR("couldn't initialize FTDI with configured layout");
|
||||
return ERROR_JTAG_INIT_FAILED;
|
||||
}
|
||||
|
||||
|
||||
@@ -443,8 +443,8 @@ int mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_off
|
||||
|
||||
while (length > 0) {
|
||||
/* Guarantee buffer space enough for a minimum size transfer */
|
||||
if (buffer_write_space(ctx) + (length < 8) < (out ? 4 : 3)
|
||||
|| (in && buffer_read_space(ctx) < 1))
|
||||
if (buffer_write_space(ctx) + (length < 8) < (out || (!out && !in) ? 4 : 3)
|
||||
|| (in && buffer_read_space(ctx) < 1))
|
||||
retval = mpsse_flush(ctx);
|
||||
|
||||
if (length < 8) {
|
||||
@@ -465,8 +465,8 @@ int mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_off
|
||||
if (this_bytes > 65536)
|
||||
this_bytes = 65536;
|
||||
/* Buffer space limit. We already made sure there's space for the minimum
|
||||
*transfer. */
|
||||
if (out && this_bytes + 3 > buffer_write_space(ctx))
|
||||
* transfer. */
|
||||
if ((out || (!out && !in)) && this_bytes + 3 > buffer_write_space(ctx))
|
||||
this_bytes = buffer_write_space(ctx) - 3;
|
||||
if (in && this_bytes > buffer_read_space(ctx))
|
||||
this_bytes = buffer_read_space(ctx);
|
||||
|
||||
@@ -94,7 +94,10 @@ struct stlink_usb_handle_s {
|
||||
};
|
||||
|
||||
#define STLINK_DEBUG_ERR_OK 0x80
|
||||
#define STLINK_DEBUG_ERR_FAULT 0x81
|
||||
#define STLINK_DEBUG_ERR_FAULT 0x81
|
||||
#define STLINK_SWD_AP_WAIT 0x10
|
||||
#define STLINK_SWD_DP_WAIT 0x14
|
||||
|
||||
#define STLINK_CORE_RUNNING 0x80
|
||||
#define STLINK_CORE_HALTED 0x81
|
||||
#define STLINK_CORE_STAT_UNKNOWN -1
|
||||
@@ -784,6 +787,10 @@ static int stlink_usb_reset(void *handle)
|
||||
|
||||
LOG_DEBUG("RESET: 0x%08X", h->databuf[0]);
|
||||
|
||||
/* the following is not a error under swd (using hardware srst), so return success */
|
||||
if (h->databuf[0] == STLINK_SWD_AP_WAIT || h->databuf[0] == STLINK_SWD_DP_WAIT)
|
||||
return ERROR_OK;
|
||||
|
||||
return h->databuf[0] == STLINK_DEBUG_ERR_OK ? ERROR_OK : ERROR_FAIL;
|
||||
}
|
||||
|
||||
|
||||
@@ -532,6 +532,7 @@ int ulink_allocate_payload(struct ulink_cmd *ulink_cmd, int size,
|
||||
case PAYLOAD_DIRECTION_OUT:
|
||||
if (ulink_cmd->payload_out != NULL) {
|
||||
LOG_ERROR("BUG: Duplicate payload allocation for OpenULINK command");
|
||||
free(payload);
|
||||
return ERROR_FAIL;
|
||||
} else {
|
||||
ulink_cmd->payload_out = payload;
|
||||
@@ -541,6 +542,7 @@ int ulink_allocate_payload(struct ulink_cmd *ulink_cmd, int size,
|
||||
case PAYLOAD_DIRECTION_IN:
|
||||
if (ulink_cmd->payload_in_start != NULL) {
|
||||
LOG_ERROR("BUG: Duplicate payload allocation for OpenULINK command");
|
||||
free(payload);
|
||||
return ERROR_FAIL;
|
||||
} else {
|
||||
ulink_cmd->payload_in_start = payload;
|
||||
@@ -896,6 +898,7 @@ int ulink_append_scan_cmd(struct ulink *device, enum scan_type scan_type,
|
||||
if (scan_size_bits > (58 * 8)) {
|
||||
LOG_ERROR("BUG: Tried to create CMD_SCAN_IO OpenULINK command with too"
|
||||
" large payload");
|
||||
free(cmd);
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
@@ -934,8 +937,10 @@ int ulink_append_scan_cmd(struct ulink *device, enum scan_type scan_type,
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret != ERROR_OK)
|
||||
if (ret != ERROR_OK) {
|
||||
free(cmd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Build payload_out that is common to all scan types */
|
||||
cmd->payload_out[0] = scan_size_bytes & 0xFF;
|
||||
@@ -993,8 +998,10 @@ int ulink_append_clock_tms_cmd(struct ulink *device, uint8_t count,
|
||||
|
||||
/* CMD_CLOCK_TMS has two OUT payload bytes and zero IN payload bytes */
|
||||
ret = ulink_allocate_payload(cmd, 2, PAYLOAD_DIRECTION_OUT);
|
||||
if (ret != ERROR_OK)
|
||||
if (ret != ERROR_OK) {
|
||||
free(cmd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
cmd->payload_out[0] = count;
|
||||
cmd->payload_out[1] = sequence;
|
||||
@@ -1027,8 +1034,10 @@ int ulink_append_clock_tck_cmd(struct ulink *device, uint16_t count)
|
||||
|
||||
/* CMD_CLOCK_TCK has two OUT payload bytes and zero IN payload bytes */
|
||||
ret = ulink_allocate_payload(cmd, 2, PAYLOAD_DIRECTION_OUT);
|
||||
if (ret != ERROR_OK)
|
||||
if (ret != ERROR_OK) {
|
||||
free(cmd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
cmd->payload_out[0] = count & 0xff;
|
||||
cmd->payload_out[1] = (count >> 8) & 0xff;
|
||||
@@ -1057,8 +1066,10 @@ int ulink_append_get_signals_cmd(struct ulink *device)
|
||||
/* CMD_GET_SIGNALS has two IN payload bytes */
|
||||
ret = ulink_allocate_payload(cmd, 2, PAYLOAD_DIRECTION_IN);
|
||||
|
||||
if (ret != ERROR_OK)
|
||||
if (ret != ERROR_OK) {
|
||||
free(cmd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ulink_append_queue(device, cmd);
|
||||
}
|
||||
@@ -1094,8 +1105,10 @@ int ulink_append_set_signals_cmd(struct ulink *device, uint8_t low,
|
||||
/* CMD_SET_SIGNALS has two OUT payload bytes and zero IN payload bytes */
|
||||
ret = ulink_allocate_payload(cmd, 2, PAYLOAD_DIRECTION_OUT);
|
||||
|
||||
if (ret != ERROR_OK)
|
||||
if (ret != ERROR_OK) {
|
||||
free(cmd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
cmd->payload_out[0] = low;
|
||||
cmd->payload_out[1] = high;
|
||||
@@ -1124,8 +1137,10 @@ int ulink_append_sleep_cmd(struct ulink *device, uint32_t us)
|
||||
/* CMD_SLEEP_US has two OUT payload bytes and zero IN payload bytes */
|
||||
ret = ulink_allocate_payload(cmd, 2, PAYLOAD_DIRECTION_OUT);
|
||||
|
||||
if (ret != ERROR_OK)
|
||||
if (ret != ERROR_OK) {
|
||||
free(cmd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
cmd->payload_out[0] = us & 0x00ff;
|
||||
cmd->payload_out[1] = (us >> 8) & 0x00ff;
|
||||
@@ -1159,8 +1174,10 @@ int ulink_append_configure_tck_cmd(struct ulink *device, int delay_scan_in,
|
||||
/* CMD_CONFIGURE_TCK_FREQ has five OUT payload bytes and zero
|
||||
* IN payload bytes */
|
||||
ret = ulink_allocate_payload(cmd, 5, PAYLOAD_DIRECTION_OUT);
|
||||
if (ret != ERROR_OK)
|
||||
if (ret != ERROR_OK) {
|
||||
free(cmd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (delay_scan_in < 0)
|
||||
cmd->payload_out[0] = 0;
|
||||
@@ -1217,8 +1234,10 @@ int ulink_append_led_cmd(struct ulink *device, uint8_t led_state)
|
||||
|
||||
/* CMD_SET_LEDS has one OUT payload byte and zero IN payload bytes */
|
||||
ret = ulink_allocate_payload(cmd, 1, PAYLOAD_DIRECTION_OUT);
|
||||
if (ret != ERROR_OK)
|
||||
if (ret != ERROR_OK) {
|
||||
free(cmd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
cmd->payload_out[0] = led_state;
|
||||
|
||||
@@ -1245,8 +1264,10 @@ int ulink_append_test_cmd(struct ulink *device)
|
||||
|
||||
/* CMD_TEST has one OUT payload byte and zero IN payload bytes */
|
||||
ret = ulink_allocate_payload(cmd, 1, PAYLOAD_DIRECTION_OUT);
|
||||
if (ret != ERROR_OK)
|
||||
if (ret != ERROR_OK) {
|
||||
free(cmd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
cmd->payload_out[0] = 0xAA;
|
||||
|
||||
@@ -2136,6 +2157,8 @@ static int ulink_init(void)
|
||||
ret = ulink_usb_open(&ulink_handle);
|
||||
if (ret != ERROR_OK) {
|
||||
LOG_ERROR("Could not open ULINK device");
|
||||
free(ulink_handle);
|
||||
ulink_handle = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2157,6 +2180,8 @@ static int ulink_init(void)
|
||||
ULINK_FIRMWARE_FILE, ULINK_RENUMERATION_DELAY);
|
||||
if (ret != ERROR_OK) {
|
||||
LOG_ERROR("Could not download firmware and re-numerate ULINK");
|
||||
free(ulink_handle);
|
||||
ulink_handle = NULL;
|
||||
return ret;
|
||||
}
|
||||
} else
|
||||
@@ -2186,6 +2211,8 @@ static int ulink_init(void)
|
||||
/* Bulk IN transfer failed -> unrecoverable error condition */
|
||||
LOG_ERROR("Cannot communicate with ULINK device. Disconnect ULINK from "
|
||||
"the USB port and re-connect, then re-run OpenOCD");
|
||||
free(ulink_handle);
|
||||
ulink_handle = NULL;
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
#ifdef _DEBUG_USB_COMMS_
|
||||
|
||||
@@ -75,9 +75,8 @@ int stlink_interface_init_target(struct target *t)
|
||||
}
|
||||
|
||||
if (found == 0) {
|
||||
LOG_ERROR
|
||||
("stlink_interface_init_target: target not found: idcode: %x ",
|
||||
t->tap->idcode);
|
||||
LOG_ERROR("stlink_interface_init_target: target not found: idcode: 0x%08x",
|
||||
t->tap->idcode);
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
|
||||
@@ -259,6 +259,7 @@ static int FreeRTOS_update_threads(struct rtos *rtos)
|
||||
(uint8_t *)&list_thread_count);
|
||||
if (retval != ERROR_OK) {
|
||||
LOG_OUTPUT("Error reading number of threads in FreeRTOS thread list\r\n");
|
||||
free(list_of_lists);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -273,8 +274,8 @@ static int FreeRTOS_update_threads(struct rtos *rtos)
|
||||
param->pointer_width,
|
||||
(uint8_t *)&list_elem_ptr);
|
||||
if (retval != ERROR_OK) {
|
||||
LOG_OUTPUT(
|
||||
"Error reading first thread item location in FreeRTOS thread list\r\n");
|
||||
LOG_OUTPUT("Error reading first thread item location in FreeRTOS thread list\r\n");
|
||||
free(list_of_lists);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -288,8 +289,8 @@ static int FreeRTOS_update_threads(struct rtos *rtos)
|
||||
param->pointer_width,
|
||||
(uint8_t *)&(rtos->thread_details[tasks_found].threadid));
|
||||
if (retval != ERROR_OK) {
|
||||
LOG_OUTPUT(
|
||||
"Error reading thread list item object in FreeRTOS thread list\r\n");
|
||||
LOG_OUTPUT("Error reading thread list item object in FreeRTOS thread list\r\n");
|
||||
free(list_of_lists);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -304,8 +305,8 @@ static int FreeRTOS_update_threads(struct rtos *rtos)
|
||||
FREERTOS_THREAD_NAME_STR_SIZE,
|
||||
(uint8_t *)&tmp_str);
|
||||
if (retval != ERROR_OK) {
|
||||
LOG_OUTPUT(
|
||||
"Error reading first thread item location in FreeRTOS thread list\r\n");
|
||||
LOG_OUTPUT("Error reading first thread item location in FreeRTOS thread list\r\n");
|
||||
free(list_of_lists);
|
||||
return retval;
|
||||
}
|
||||
tmp_str[FREERTOS_THREAD_NAME_STR_SIZE-1] = '\x00';
|
||||
@@ -338,12 +339,13 @@ static int FreeRTOS_update_threads(struct rtos *rtos)
|
||||
param->pointer_width,
|
||||
(uint8_t *)&list_elem_ptr);
|
||||
if (retval != ERROR_OK) {
|
||||
LOG_OUTPUT(
|
||||
"Error reading next thread item location in FreeRTOS thread list\r\n");
|
||||
LOG_OUTPUT("Error reading next thread item location in FreeRTOS thread list\r\n");
|
||||
free(list_of_lists);
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(list_of_lists);
|
||||
rtos->thread_count = tasks_found;
|
||||
return 0;
|
||||
|
||||
@@ -420,6 +420,8 @@ int fill_task(struct target *target, struct threads *t)
|
||||
} else
|
||||
LOG_ERROR("fill task: unable to read memory");
|
||||
|
||||
free(buffer);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -494,8 +496,10 @@ int get_current(struct target *target, int create)
|
||||
int retval;
|
||||
|
||||
if (target_get_gdb_reg_list(head->target, ®_list,
|
||||
®_list_size) != ERROR_OK)
|
||||
®_list_size) != ERROR_OK) {
|
||||
free(buffer);
|
||||
return ERROR_TARGET_FAILURE;
|
||||
}
|
||||
|
||||
if (!reg_list[13]->valid)
|
||||
reg_list[13]->type->get(reg_list[13]);
|
||||
@@ -550,6 +554,8 @@ int get_current(struct target *target, int create)
|
||||
head = head->next;
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
@@ -615,6 +621,7 @@ retry:
|
||||
(uint8_t *) registers);
|
||||
|
||||
if (retval != ERROR_OK) {
|
||||
free(buffer);
|
||||
LOG_ERROR("cpu_context: unable to read memory\n");
|
||||
return context;
|
||||
}
|
||||
@@ -643,6 +650,8 @@ retry:
|
||||
if (*thread_info_addr_old == 0xdeadbeef)
|
||||
*thread_info_addr_old = thread_info_addr_update;
|
||||
|
||||
free(buffer);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
@@ -655,11 +664,13 @@ uint32_t next_task(struct target *target, struct threads *t)
|
||||
if (retval == ERROR_OK) {
|
||||
uint32_t val = get_buffer(target, buffer);
|
||||
val = val - NEXT;
|
||||
return val;
|
||||
free(buffer);
|
||||
return val;
|
||||
} else
|
||||
LOG_ERROR("next task: unable to read memory");
|
||||
|
||||
free(buffer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -778,6 +789,7 @@ int linux_get_tasks(struct target *target, int context)
|
||||
retval = get_name(target, t);
|
||||
|
||||
if (loop > MAX_THREADS) {
|
||||
free(t);
|
||||
LOG_INFO("more than %d threads !!", MAX_THREADS);
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
@@ -829,6 +841,7 @@ int linux_get_tasks(struct target *target, int context)
|
||||
(timeval_ms() - start) / linux_os->threadid_count);
|
||||
|
||||
LOG_INFO("threadid count %d", linux_os->threadid_count);
|
||||
free(t);
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
@@ -973,7 +986,7 @@ error_handling:
|
||||
#ifndef PID_CHECK
|
||||
error_handling:
|
||||
free(t);
|
||||
LOG_ERROR("unable toread pid");
|
||||
LOG_ERROR("unable to read pid");
|
||||
return;
|
||||
|
||||
#endif
|
||||
@@ -1454,7 +1467,7 @@ static int linux_thread_packet(struct connection *connection, char *packet,
|
||||
}
|
||||
}
|
||||
|
||||
/* if a packet handler returned an error, exit input loop */
|
||||
/* if a packet handler returned an error, exit input loop */
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -169,6 +169,8 @@ int rtos_qsymbol(struct connection *connection, char *packet, int packet_size)
|
||||
if (target->rtos->symbols[symbol_num].symbol_name == NULL) {
|
||||
LOG_OUTPUT("ERROR: unknown symbol\r\n");
|
||||
gdb_put_packet(connection, "OK", 2);
|
||||
free(hex_name_str);
|
||||
free(name_str);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -1138,6 +1138,7 @@ static int gdb_set_register_packet(struct connection *connection,
|
||||
|
||||
if ((unsigned int)chars != strlen(separator + 1)) {
|
||||
LOG_ERROR("gdb sent a packet with wrong register size");
|
||||
free(bin_buf);
|
||||
return ERROR_SERVER_REMOTE_CLOSED;
|
||||
}
|
||||
|
||||
|
||||
@@ -635,6 +635,10 @@ SERVER_PIPE_COMMAND()
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if (CMD_CTX->mode == COMMAND_EXEC) {
|
||||
LOG_WARNING("unable to change server port after init");
|
||||
return ERROR_COMMAND_ARGUMENT_INVALID;
|
||||
}
|
||||
const char *t = strdup(CMD_ARGV[0]);
|
||||
free((void *)*out);
|
||||
*out = t;
|
||||
|
||||
@@ -237,8 +237,6 @@ int arm_blank_check_memory(struct target *target,
|
||||
void arm_set_cpsr(struct arm *arm, uint32_t cpsr);
|
||||
struct reg *arm_reg_current(struct arm *arm, unsigned regnum);
|
||||
|
||||
void arm_endianness(uint8_t *tmp, void *in, int size, int be, int flip);
|
||||
|
||||
extern struct reg arm_gdb_dummy_fp_reg;
|
||||
extern struct reg arm_gdb_dummy_fps_reg;
|
||||
|
||||
|
||||
@@ -2659,6 +2659,46 @@ int arm7_9_check_reset(struct target *target)
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
int arm7_9_endianness_callback(jtag_callback_data_t pu8_in,
|
||||
jtag_callback_data_t i_size, jtag_callback_data_t i_be,
|
||||
jtag_callback_data_t i_flip)
|
||||
{
|
||||
uint8_t *in = (uint8_t *)pu8_in;
|
||||
int size = (int)i_size;
|
||||
int be = (int)i_be;
|
||||
int flip = (int)i_flip;
|
||||
uint32_t readback;
|
||||
|
||||
switch (size) {
|
||||
case 4:
|
||||
readback = le_to_h_u32(in);
|
||||
if (flip)
|
||||
readback = flip_u32(readback, 32);
|
||||
if (be)
|
||||
h_u32_to_be(in, readback);
|
||||
else
|
||||
h_u32_to_le(in, readback);
|
||||
break;
|
||||
case 2:
|
||||
readback = le_to_h_u16(in);
|
||||
if (flip)
|
||||
readback = flip_u32(readback, 16);
|
||||
if (be)
|
||||
h_u16_to_be(in, readback & 0xffff);
|
||||
else
|
||||
h_u16_to_le(in, readback & 0xffff);
|
||||
break;
|
||||
case 1:
|
||||
readback = *in;
|
||||
if (flip)
|
||||
readback = flip_u32(readback, 8);
|
||||
*in = readback & 0xff;
|
||||
break;
|
||||
}
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
COMMAND_HANDLER(handle_arm7_9_dbgrq_command)
|
||||
{
|
||||
struct target *target = get_current_target(CMD_CTX);
|
||||
|
||||
@@ -172,4 +172,8 @@ int arm7_9_init_arch_info(struct target *target, struct arm7_9_common *arm7_9);
|
||||
int arm7_9_examine(struct target *target);
|
||||
int arm7_9_check_reset(struct target *target);
|
||||
|
||||
int arm7_9_endianness_callback(jtag_callback_data_t pu8_in,
|
||||
jtag_callback_data_t i_size, jtag_callback_data_t i_be,
|
||||
jtag_callback_data_t i_flip);
|
||||
|
||||
#endif /* ARM7_9_COMMON_H */
|
||||
|
||||
@@ -168,40 +168,6 @@ static int arm7tdmi_clock_data_in(struct arm_jtag *jtag_info, uint32_t *in)
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
void arm_endianness(uint8_t *tmp, void *in, int size, int be, int flip)
|
||||
{
|
||||
uint32_t readback = le_to_h_u32(tmp);
|
||||
if (flip)
|
||||
readback = flip_u32(readback, 32);
|
||||
switch (size) {
|
||||
case 4:
|
||||
if (be)
|
||||
h_u32_to_be(((uint8_t *)in), readback);
|
||||
else
|
||||
h_u32_to_le(((uint8_t *)in), readback);
|
||||
break;
|
||||
case 2:
|
||||
if (be)
|
||||
h_u16_to_be(((uint8_t *)in), readback & 0xffff);
|
||||
else
|
||||
h_u16_to_le(((uint8_t *)in), readback & 0xffff);
|
||||
break;
|
||||
case 1:
|
||||
*((uint8_t *)in) = readback & 0xff;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int arm7endianness(jtag_callback_data_t arg,
|
||||
jtag_callback_data_t size, jtag_callback_data_t be,
|
||||
jtag_callback_data_t captured)
|
||||
{
|
||||
uint8_t *in = (uint8_t *)arg;
|
||||
|
||||
arm_endianness((uint8_t *)captured, in, (int)size, (int)be, 1);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
/* clock the target, and read the databus
|
||||
* the *in pointer points to a buffer where elements of 'size' bytes
|
||||
* are stored in big (be == 1) or little (be == 0) endianness
|
||||
@@ -210,7 +176,7 @@ static int arm7tdmi_clock_data_in_endianness(struct arm_jtag *jtag_info,
|
||||
void *in, int size, int be)
|
||||
{
|
||||
int retval = ERROR_OK;
|
||||
struct scan_field fields[2];
|
||||
struct scan_field fields[3];
|
||||
|
||||
retval = arm_jtag_scann(jtag_info, 0x1, TAP_DRPAUSE);
|
||||
if (retval != ERROR_OK)
|
||||
@@ -223,17 +189,29 @@ static int arm7tdmi_clock_data_in_endianness(struct arm_jtag *jtag_info,
|
||||
fields[0].out_value = NULL;
|
||||
fields[0].in_value = NULL;
|
||||
|
||||
fields[1].num_bits = size * 8;
|
||||
fields[1].out_value = NULL;
|
||||
fields[1].in_value = in;
|
||||
if (size == 4) {
|
||||
fields[1].num_bits = 32;
|
||||
fields[1].out_value = NULL;
|
||||
fields[1].in_value = in;
|
||||
} else {
|
||||
/* Discard irrelevant bits of the scan, making sure we don't write more
|
||||
* than size bytes to in */
|
||||
fields[1].num_bits = 32 - size * 8;
|
||||
fields[1].out_value = NULL;
|
||||
fields[1].in_value = NULL;
|
||||
|
||||
jtag_add_dr_scan(jtag_info->tap, 2, fields, TAP_DRPAUSE);
|
||||
fields[2].num_bits = size * 8;
|
||||
fields[2].out_value = NULL;
|
||||
fields[2].in_value = in;
|
||||
}
|
||||
|
||||
jtag_add_callback4(arm7endianness,
|
||||
jtag_add_dr_scan(jtag_info->tap, size == 4 ? 2 : 3, fields, TAP_DRPAUSE);
|
||||
|
||||
jtag_add_callback4(arm7_9_endianness_callback,
|
||||
(jtag_callback_data_t)in,
|
||||
(jtag_callback_data_t)size,
|
||||
(jtag_callback_data_t)be,
|
||||
(jtag_callback_data_t)in);
|
||||
(jtag_callback_data_t)1);
|
||||
|
||||
jtag_add_runtest(0, TAP_DRPAUSE);
|
||||
|
||||
|
||||
@@ -244,16 +244,6 @@ int arm9tdmi_clock_data_in(struct arm_jtag *jtag_info, uint32_t *in)
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static int arm9endianness(jtag_callback_data_t arg,
|
||||
jtag_callback_data_t size, jtag_callback_data_t be,
|
||||
jtag_callback_data_t captured)
|
||||
{
|
||||
uint8_t *in = (uint8_t *)arg;
|
||||
|
||||
arm_endianness((uint8_t *)captured, in, (int)size, (int)be, 0);
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
/* clock the target, and read the databus
|
||||
* the *in pointer points to a buffer where elements of 'size' bytes
|
||||
* are stored in big (be == 1) or little (be == 0) endianness
|
||||
@@ -262,7 +252,7 @@ int arm9tdmi_clock_data_in_endianness(struct arm_jtag *jtag_info,
|
||||
void *in, int size, int be)
|
||||
{
|
||||
int retval = ERROR_OK;
|
||||
struct scan_field fields[3];
|
||||
struct scan_field fields[2];
|
||||
|
||||
retval = arm_jtag_scann(jtag_info, 0x1, TAP_DRPAUSE);
|
||||
if (retval != ERROR_OK)
|
||||
@@ -272,25 +262,33 @@ int arm9tdmi_clock_data_in_endianness(struct arm_jtag *jtag_info,
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
fields[0].num_bits = size * 8;
|
||||
fields[0].out_value = NULL;
|
||||
fields[0].in_value = in;
|
||||
if (size == 4) {
|
||||
fields[0].num_bits = 32;
|
||||
fields[0].out_value = NULL;
|
||||
fields[0].in_value = in;
|
||||
|
||||
fields[1].num_bits = 3;
|
||||
fields[1].out_value = NULL;
|
||||
fields[1].in_value = NULL;
|
||||
fields[1].num_bits = 3 + 32;
|
||||
fields[1].out_value = NULL;
|
||||
fields[1].in_value = NULL;
|
||||
} else {
|
||||
/* Discard irrelevant bits of the scan, making sure we don't write more
|
||||
* than size bytes to in */
|
||||
fields[0].num_bits = size * 8;
|
||||
fields[0].out_value = NULL;
|
||||
fields[0].in_value = in;
|
||||
|
||||
fields[2].num_bits = 32;
|
||||
fields[2].out_value = NULL;
|
||||
fields[2].in_value = NULL;
|
||||
fields[1].num_bits = 3 + 32 + 32 - size * 8;
|
||||
fields[1].out_value = NULL;
|
||||
fields[1].in_value = NULL;
|
||||
}
|
||||
|
||||
jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_DRPAUSE);
|
||||
jtag_add_dr_scan(jtag_info->tap, 2, fields, TAP_DRPAUSE);
|
||||
|
||||
jtag_add_callback4(arm9endianness,
|
||||
jtag_add_callback4(arm7_9_endianness_callback,
|
||||
(jtag_callback_data_t)in,
|
||||
(jtag_callback_data_t)size,
|
||||
(jtag_callback_data_t)be,
|
||||
(jtag_callback_data_t)in);
|
||||
(jtag_callback_data_t)0);
|
||||
|
||||
jtag_add_runtest(0, TAP_DRPAUSE);
|
||||
|
||||
|
||||
@@ -1265,6 +1265,8 @@ int dap_lookup_cs_component(struct adiv5_dap *dap, int ap,
|
||||
retval = mem_ap_read_atomic_u32(dap,
|
||||
(component_base & 0xfffff000) | 0xfcc,
|
||||
&devtype);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
if ((devtype & 0xff) == type) {
|
||||
*addr = component_base;
|
||||
retval = ERROR_OK;
|
||||
|
||||
@@ -2890,7 +2890,7 @@ static int t2ev_cond_b(uint32_t opcode, uint32_t address,
|
||||
offset = opcode & 0x7ff;
|
||||
offset |= (opcode & 0x003f0000) >> 5;
|
||||
if (opcode & (1 << 26)) {
|
||||
offset |= 0xffff << 19;
|
||||
offset |= 0x1fff << 19;
|
||||
if ((opcode & (1 << 11)) == 0)
|
||||
b17 = 0;
|
||||
if ((opcode & (1 << 13)) == 0)
|
||||
|
||||
@@ -524,7 +524,7 @@ static int arm_simulate_step_core(struct target *target,
|
||||
|
||||
switch (instruction.info.load_store_multiple.addressing_mode) {
|
||||
case 0: /* Increment after */
|
||||
Rn = Rn;
|
||||
/* Rn = Rn; */
|
||||
break;
|
||||
case 1: /* Increment before */
|
||||
Rn = Rn + 4;
|
||||
@@ -604,7 +604,7 @@ static int arm_simulate_step_core(struct target *target,
|
||||
|
||||
switch (instruction.info.load_store_multiple.addressing_mode) {
|
||||
case 0: /* Increment after */
|
||||
Rn = Rn;
|
||||
/* Rn = Rn; */
|
||||
break;
|
||||
case 1: /* Increment before */
|
||||
Rn = Rn + 4;
|
||||
|
||||
@@ -387,7 +387,7 @@ static int armv7a_flush_all_data(struct target *target)
|
||||
head = target->head;
|
||||
while (head != (struct target_list *)NULL) {
|
||||
curr = head->target;
|
||||
if ((curr->state == TARGET_HALTED)) {
|
||||
if (curr->state == TARGET_HALTED) {
|
||||
LOG_INFO("Wait flushing data l1 on core %d", curr->coreid);
|
||||
retval = _armv7a_flush_all_data(curr);
|
||||
}
|
||||
|
||||
@@ -1025,7 +1025,7 @@ static int cortex_m3_assert_reset(struct target *target)
|
||||
|
||||
if (reset_config == CORTEX_M3_RESET_VECTRESET) {
|
||||
LOG_WARNING("Only resetting the Cortex-M3 core, use a reset-init event "
|
||||
"handler to reset any peripherals");
|
||||
"handler to reset any peripherals or configure hardware srst support.");
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -125,9 +125,9 @@ static int wait_for_pracc_rw(struct mips_ejtag *ejtag_info, uint32_t *ctrl)
|
||||
|
||||
/* wait for the PrAcc to become "1" */
|
||||
mips_ejtag_set_instr(ejtag_info, EJTAG_INST_CONTROL);
|
||||
ejtag_ctrl = ejtag_info->ejtag_ctrl;
|
||||
|
||||
while (1) {
|
||||
ejtag_ctrl = ejtag_info->ejtag_ctrl;
|
||||
retval = mips_ejtag_drscan_32(ejtag_info, &ejtag_ctrl);
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
@@ -443,7 +443,7 @@ static int stm32_stlink_assert_reset(struct target *target)
|
||||
}
|
||||
|
||||
if (use_srst_fallback) {
|
||||
/* stlink v1 api does support hardware srst, so we use a software reset fallback */
|
||||
/* stlink v1 api does not support hardware srst, so we use a software reset fallback */
|
||||
stlink_if->layout->api->write_debug_reg(stlink_if->fd, NVIC_AIRCR, AIRCR_VECTKEY | AIRCR_SYSRESETREQ);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#
|
||||
# TI/Luminary Stellaris LM3S1968 Evaluation Kits
|
||||
#
|
||||
# http://www.luminarymicro.com/products/lm3s1968_evaluation_kits.html
|
||||
# http://www.ti.com/tool/ek-lm3s1968
|
||||
#
|
||||
|
||||
# NOTE: to use J-Link instead of the on-board interface,
|
||||
# you may also need to reduce adapter_khz to be about 1200.
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
# Stellaris lm3s3748 Evaluation Kit
|
||||
# http://www.luminarymicro.com/products/lm3s3748_usb_h_d_evaluation_kits.html
|
||||
#
|
||||
# TI/Luminary Stellaris lm3s3748 Evaluation Kits
|
||||
#
|
||||
# http://www.ti.com/tool/ek-lm3s3748
|
||||
#
|
||||
|
||||
# NOTE: using the on-board FT2232 JTAG/SWD/SWO interface is optional!
|
||||
# so is using it in JTAG mode, as done here.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#
|
||||
# TI/Luminary Stellaris LM3S6965 Evaluation Kits
|
||||
#
|
||||
# http://www.luminarymicro.com/products/lm3s6965_ethernet_evaluation_kit.html
|
||||
# http://www.ti.com/tool/ek-lm3s6965
|
||||
#
|
||||
|
||||
# NOTE: using the on-board FT2232 JTAG/SWD/SWO interface is optional!
|
||||
# so is using it in JTAG mode, as done here.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#
|
||||
# TI/Luminary Stellaris LM3S811 Evaluation Kits (rev B and earlier)
|
||||
#
|
||||
# http://www.luminarymicro.com/products/stellaris_811_evaluation_kits.html
|
||||
# http://www.ti.com/tool/ek-lm3s811
|
||||
#
|
||||
|
||||
# NOTE: newer 811-EK boards (rev C and above) shouldn't use this.
|
||||
# use board/ek-lm3s811.cfg
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#
|
||||
# TI/Luminary Stellaris LM3S811 Evaluation Kits
|
||||
#
|
||||
# http://www.luminarymicro.com/products/stellaris_811_evaluation_kits.html
|
||||
# http://www.ti.com/tool/ek-lm3s811
|
||||
#
|
||||
|
||||
# NOTE: using the on-board FT2232 JTAG/SWD/SWO interface is optional!
|
||||
# so is using it in JTAG mode, as done here.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#
|
||||
# Luminary Micro Stellaris LM3S9B9x Evaluation Kits
|
||||
# TI/Luminary Stellaris LM3S9B9x Evaluation Kits
|
||||
#
|
||||
# http://www.luminarymicro.com/products/ek-lm3s9b90.html
|
||||
# http://www.luminarymicro.com/products/ek-lm3s9b92.html
|
||||
# http://www.ti.com/tool/ek-lm3s9b90
|
||||
# http://www.ti.com/tool/ek-lm3s9b92
|
||||
#
|
||||
|
||||
# NOTE: using the bundled FT2232 JTAG/SWD/SWO interface is optional!
|
||||
|
||||
9
tcl/board/stm32f3discovery.cfg
Normal file
9
tcl/board/stm32f3discovery.cfg
Normal file
@@ -0,0 +1,9 @@
|
||||
# This is an STM32F3 discovery board with a single STM32F303VCT6 chip.
|
||||
# http://www.st.com/internet/evalboard/product/254044.jsp
|
||||
|
||||
source [find interface/stlink-v2.cfg]
|
||||
|
||||
source [find target/stm32f3x_stlink.cfg]
|
||||
|
||||
# use hardware reset, connect under reset
|
||||
reset_config srst_only srst_nogate
|
||||
@@ -1,11 +0,0 @@
|
||||
#
|
||||
# Olimex ARM-USB-OCD
|
||||
#
|
||||
# http://www.olimex.com/dev/arm-usb-ocd.html
|
||||
#
|
||||
|
||||
interface ft2232
|
||||
ft2232_device_desc "Olimex OpenOCD JTAG"
|
||||
ft2232_layout "olimex-jtag"
|
||||
ft2232_vid_pid 0x15BA 0x0003
|
||||
|
||||
@@ -4,15 +4,10 @@
|
||||
# http://www.hitex.com/index.php?id=cortino
|
||||
#
|
||||
|
||||
echo "WARNING!"
|
||||
echo "This file was not tested with real interface, it is based on code in ft2232.c."
|
||||
echo "Please report your experience with this file to openocd-devel mailing list,"
|
||||
echo "so it could be marked as working or fixed."
|
||||
|
||||
interface ftdi
|
||||
ftdi_device_desc "Cortino"
|
||||
ftdi_vid_pid 0x0640 0x0032
|
||||
|
||||
ftdi_layout_init 0x0308 0x031b
|
||||
ftdi_layout_init 0x0108 0x010b
|
||||
ftdi_layout_signal nTRST -data 0x0100
|
||||
ftdi_layout_signal nSRST -data 0x0200
|
||||
ftdi_layout_signal nSRST -data 0x0200 -oe 0x0200
|
||||
|
||||
@@ -9,7 +9,7 @@ interface ftdi
|
||||
ftdi_device_desc "LPC1768-Stick"
|
||||
ftdi_vid_pid 0x0640 0x0026
|
||||
|
||||
ftdi_layout_init 0x0188 0x038b
|
||||
ftdi_layout_init 0x0388 0x038b
|
||||
ftdi_layout_signal nTRST -data 0x0100
|
||||
ftdi_layout_signal nSRST -data 0x0080 -noe 0x200
|
||||
|
||||
|
||||
@@ -4,15 +4,10 @@
|
||||
# http://www.hitex.com/index.php?id=383
|
||||
#
|
||||
|
||||
echo "WARNING!"
|
||||
echo "This file was not tested with real interface, it is based on code in ft2232.c."
|
||||
echo "Please report your experience with this file to openocd-devel mailing list,"
|
||||
echo "so it could be marked as working or fixed."
|
||||
|
||||
interface ftdi
|
||||
ftdi_device_desc "STR9-comStick"
|
||||
ftdi_vid_pid 0x0640 0x002c
|
||||
|
||||
ftdi_layout_init 0x0308 0x030b
|
||||
ftdi_layout_init 0x0108 0x010b
|
||||
ftdi_layout_signal nTRST -data 0x0100
|
||||
ftdi_layout_signal nSRST -data 0x0200
|
||||
ftdi_layout_signal nSRST -data 0x0200 -oe 0x0200
|
||||
|
||||
14
tcl/interface/ftdi/jtag-lock-pick_tiny_2.cfg
Normal file
14
tcl/interface/ftdi/jtag-lock-pick_tiny_2.cfg
Normal file
@@ -0,0 +1,14 @@
|
||||
#
|
||||
# DISTORTEC JTAG-lock-pick Tiny 2
|
||||
#
|
||||
# http://www.distortec.com
|
||||
#
|
||||
|
||||
interface ftdi
|
||||
ftdi_device_desc "JTAG-lock-pick Tiny 2"
|
||||
ftdi_vid_pid 0x0403 0x8220
|
||||
|
||||
ftdi_layout_init 0x8c28 0xff3b
|
||||
ftdi_layout_signal nTRST -data 0x0100 -noe 0x0400
|
||||
ftdi_layout_signal nSRST -data 0x0200 -noe 0x0800
|
||||
ftdi_layout_signal LED -ndata 0x8000
|
||||
@@ -11,11 +11,6 @@
|
||||
# need to use the "luminary_icdi" layout to work correctly.
|
||||
#
|
||||
|
||||
echo "WARNING!"
|
||||
echo "This file was not tested with real interface, it is based on code in ft2232.c."
|
||||
echo "Please report your experience with this file to openocd-devel mailing list,"
|
||||
echo "so it could be marked as working or fixed."
|
||||
|
||||
interface ftdi
|
||||
ftdi_device_desc "LM3S811 Evaluation Board"
|
||||
ftdi_vid_pid 0x0403 0xbcd9
|
||||
|
||||
@@ -29,4 +29,4 @@ ftdi_device_desc "Stellaris Evaluation Board"
|
||||
ftdi_vid_pid 0x0403 0xbcd9
|
||||
|
||||
ftdi_layout_init 0x00a8 0x00eb
|
||||
ftdi_layout_signal nSRST -data 0x0020
|
||||
ftdi_layout_signal nSRST -noe 0x0020
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
# http://www.olimex.com/dev/arm-usb-tiny.html
|
||||
#
|
||||
|
||||
echo "WARNING!"
|
||||
echo "This file was not tested with real interface, but is assumed to work as this"
|
||||
echo "interface uses the same layout as configs that were verified. Please report your"
|
||||
echo "experience with this file to openocd-devel mailing list, so it could be marked"
|
||||
echo "as working or fixed."
|
||||
|
||||
interface ftdi
|
||||
ftdi_device_desc "Olimex OpenOCD JTAG TINY"
|
||||
ftdi_vid_pid 0x15ba 0x0004
|
||||
|
||||
13
tcl/interface/ftdi/openocd-usb-hs.cfg
Normal file
13
tcl/interface/ftdi/openocd-usb-hs.cfg
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# embedded projects openocd usb adapter v3
|
||||
#
|
||||
# http://shop.embedded-projects.net/index.php?module=artikel&action=artikel&id=14
|
||||
#
|
||||
|
||||
interface ftdi
|
||||
ftdi_device_desc "Dual RS232-HS"
|
||||
ftdi_vid_pid 0x0403 0x6010
|
||||
|
||||
ftdi_layout_init 0x0508 0x0f1b
|
||||
ftdi_layout_signal nTRST -data 0x0200 -noe 0x0100
|
||||
ftdi_layout_signal nSRST -data 0x0800 -noe 0x0400
|
||||
@@ -4,15 +4,10 @@
|
||||
# http://www.hitex.com/index.php?id=340
|
||||
#
|
||||
|
||||
echo "WARNING!"
|
||||
echo "This file was not tested with real interface, it is based on code in ft2232.c."
|
||||
echo "Please report your experience with this file to openocd-devel mailing list,"
|
||||
echo "so it could be marked as working or fixed."
|
||||
|
||||
interface ftdi
|
||||
ftdi_device_desc "STM32-PerformanceStick"
|
||||
ftdi_vid_pid 0x0640 0x002d
|
||||
|
||||
ftdi_layout_init 0x0188 0x038b
|
||||
ftdi_layout_init 0x0388 0x038b
|
||||
ftdi_layout_signal nTRST -data 0x0100
|
||||
ftdi_layout_signal nSRST -data 0x0080
|
||||
ftdi_layout_signal nSRST -data 0x0080 -noe 0x200
|
||||
|
||||
10
tcl/interface/jtag-lock-pick_tiny_2.cfg
Normal file
10
tcl/interface/jtag-lock-pick_tiny_2.cfg
Normal file
@@ -0,0 +1,10 @@
|
||||
#
|
||||
# DISTORTEC JTAG-lock-pick Tiny 2
|
||||
#
|
||||
# http://www.distortec.com
|
||||
#
|
||||
|
||||
interface ft2232
|
||||
ft2232_device_desc "JTAG-lock-pick Tiny 2"
|
||||
ft2232_layout ktlink
|
||||
ft2232_vid_pid 0x0403 0x8220
|
||||
11
tcl/interface/openocd-usb-hs.cfg
Normal file
11
tcl/interface/openocd-usb-hs.cfg
Normal file
@@ -0,0 +1,11 @@
|
||||
#
|
||||
# embedded projects openocd usb adapter v3
|
||||
#
|
||||
# http://shop.embedded-projects.net/index.php?module=artikel&action=artikel&id=14
|
||||
#
|
||||
|
||||
interface ft2232
|
||||
ft2232_vid_pid 0x0403 0x6010
|
||||
ft2232_device_desc "Dual RS232-HS"
|
||||
ft2232_layout "oocdlink"
|
||||
ft2232_latency 2
|
||||
@@ -66,3 +66,7 @@ $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 16384 -work-ar
|
||||
$_TARGETNAME configure -event gdb-flash-erase-start {
|
||||
halt
|
||||
}
|
||||
|
||||
# if srst is not fitted use SYSRESETREQ to
|
||||
# perform a soft reset
|
||||
cortex_m3 reset_config sysresetreq
|
||||
|
||||
@@ -22,3 +22,8 @@ target create $_TARGETNAME cortex_m3 -endian little -chain-position $_TARGETNAME
|
||||
|
||||
set _FLASHNAME $_CHIPNAME.flash
|
||||
flash bank flash0 at91sam3 0x00400000 0 0 0 $_TARGETNAME
|
||||
|
||||
# if srst is not fitted use SYSRESETREQ to
|
||||
# perform a soft reset
|
||||
cortex_m3 reset_config sysresetreq
|
||||
|
||||
|
||||
@@ -43,3 +43,7 @@ $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 16384 -work-ar
|
||||
$_TARGETNAME configure -event gdb-flash-erase-start {
|
||||
halt
|
||||
}
|
||||
|
||||
# if srst is not fitted use SYSRESETREQ to
|
||||
# perform a soft reset
|
||||
cortex_m3 reset_config sysresetreq
|
||||
|
||||
@@ -33,3 +33,7 @@ target create $_TARGETNAME cortex_m3 -chain-position $_CHIPNAME.cpu
|
||||
|
||||
$_CHIPNAME.cpu configure -event examine-start { puts "START..." ; }
|
||||
$_CHIPNAME.cpu configure -event examine-end { puts "END..." ; }
|
||||
|
||||
# if srst is not fitted use SYSRESETREQ to
|
||||
# perform a soft reset
|
||||
cortex_m3 reset_config sysresetreq
|
||||
|
||||
@@ -33,3 +33,7 @@ target create $_TARGETNAME cortex_m3 -chain-position $_CHIPNAME.cpu
|
||||
|
||||
$_CHIPNAME.cpu configure -event examine-start { puts "START..." ; }
|
||||
$_CHIPNAME.cpu configure -event examine-end { puts "END..." ; }
|
||||
|
||||
# if srst is not fitted use SYSRESETREQ to
|
||||
# perform a soft reset
|
||||
cortex_m3 reset_config sysresetreq
|
||||
|
||||
@@ -91,3 +91,7 @@ $_TARGETNAME configure -event reset-init {
|
||||
|
||||
mww 0x400FC040 0x01
|
||||
}
|
||||
|
||||
# if srst is not fitted use VECTRESET to
|
||||
# perform a soft reset - SYSRESETREQ is not supported
|
||||
cortex_m3 reset_config vectreset
|
||||
|
||||
@@ -42,3 +42,7 @@ jtag newtap $_CHIPNAME m0 -irlen 4 -ircapture 0x1 -irmask 0xf \
|
||||
|
||||
target create $_CHIPNAME.m4 cortex_m3 -chain-position $_CHIPNAME.m4
|
||||
target create $_CHIPNAME.m0 cortex_m3 -chain-position $_CHIPNAME.m0
|
||||
|
||||
# if srst is not fitted use SYSRESETREQ to
|
||||
# perform a soft reset
|
||||
cortex_m3 reset_config sysresetreq
|
||||
|
||||
@@ -7,7 +7,7 @@ if { [info exists CHIPNAME] == 0 } {
|
||||
}
|
||||
|
||||
if { [info exists CPUTAPID] == 0 } {
|
||||
set CPUTAPID 0x1ba01477
|
||||
set CPUTAPID 0x2ba01477
|
||||
}
|
||||
|
||||
if { [info exists WORKAREASIZE] == 0 } {
|
||||
|
||||
Reference in New Issue
Block a user