mirror of
https://github.com/openocd-org/openocd.git
synced 2025-10-15 04:28:44 +08:00
Compare commits
7 Commits
v0.5.0-rc1
...
v0.5.0-rc2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d4cd6f0320 | ||
![]() |
89fa8ce2d8 | ||
![]() |
bad3ee87ac | ||
![]() |
f6026a8295 | ||
![]() |
d567df02b9 | ||
![]() |
2482244b07 | ||
![]() |
e4c054cada |
2
jimtcl
2
jimtcl
Submodule jimtcl updated: 60dfb023c4...411e92fea9
@@ -30,9 +30,11 @@ NOR_DRIVERS = \
|
|||||||
str9x.c \
|
str9x.c \
|
||||||
str9xpec.c \
|
str9xpec.c \
|
||||||
tms470.c \
|
tms470.c \
|
||||||
dsp5680xx_flash.c \
|
|
||||||
virtual.c
|
virtual.c
|
||||||
|
|
||||||
|
# Disabled for now, it generates warnings
|
||||||
|
# dsp5680xx_flash.c
|
||||||
|
|
||||||
noinst_HEADERS = \
|
noinst_HEADERS = \
|
||||||
core.h \
|
core.h \
|
||||||
cfi.h \
|
cfi.h \
|
||||||
|
@@ -43,7 +43,7 @@ extern struct flash_driver faux_flash;
|
|||||||
extern struct flash_driver virtual_flash;
|
extern struct flash_driver virtual_flash;
|
||||||
extern struct flash_driver stmsmi_flash;
|
extern struct flash_driver stmsmi_flash;
|
||||||
extern struct flash_driver em357_flash;
|
extern struct flash_driver em357_flash;
|
||||||
extern struct flash_driver dsp5680xx_flash;
|
//extern struct flash_driver dsp5680xx_flash;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of built-in flash drivers.
|
* The list of built-in flash drivers.
|
||||||
@@ -72,7 +72,8 @@ static struct flash_driver *flash_drivers[] = {
|
|||||||
&virtual_flash,
|
&virtual_flash,
|
||||||
&stmsmi_flash,
|
&stmsmi_flash,
|
||||||
&em357_flash,
|
&em357_flash,
|
||||||
&dsp5680xx_flash,
|
// Disabled for now, it generates warnings
|
||||||
|
//&dsp5680xx_flash,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -33,8 +33,10 @@ libtarget_la_SOURCES = \
|
|||||||
$(MIPS32_SRC) \
|
$(MIPS32_SRC) \
|
||||||
avrt.c \
|
avrt.c \
|
||||||
dsp563xx.c \
|
dsp563xx.c \
|
||||||
dsp563xx_once.c \
|
dsp563xx_once.c
|
||||||
dsp5680xx.c
|
|
||||||
|
# This file generates warnings, disabled for now, see also target.c
|
||||||
|
# dsp5680xx.c
|
||||||
|
|
||||||
TARGET_CORE_SRC = \
|
TARGET_CORE_SRC = \
|
||||||
algorithm.c \
|
algorithm.c \
|
||||||
|
@@ -28,6 +28,9 @@
|
|||||||
#include "target_type.h"
|
#include "target_type.h"
|
||||||
#include "dsp5680xx.h"
|
#include "dsp5680xx.h"
|
||||||
|
|
||||||
|
struct dsp5680xx_common dsp5680xx_context;
|
||||||
|
|
||||||
|
|
||||||
#define err_check(retval,err_msg) if(retval != ERROR_OK){LOG_ERROR("%s: %d %s.",__FUNCTION__,__LINE__,err_msg);return retval;}
|
#define err_check(retval,err_msg) if(retval != ERROR_OK){LOG_ERROR("%s: %d %s.",__FUNCTION__,__LINE__,err_msg);return retval;}
|
||||||
#define err_check_propagate(retval) if(retval!=ERROR_OK){return retval;}
|
#define err_check_propagate(retval) if(retval!=ERROR_OK){return retval;}
|
||||||
|
|
||||||
@@ -62,7 +65,7 @@ static int dsp5680xx_drscan(struct target * target, uint8_t * data_to_shift_into
|
|||||||
//can i send as many bits as i want?
|
//can i send as many bits as i want?
|
||||||
//is the casting necessary?
|
//is the casting necessary?
|
||||||
jtag_add_plain_dr_scan(len,data_to_shift_into_dr,data_shifted_out_of_dr, TAP_IDLE);
|
jtag_add_plain_dr_scan(len,data_to_shift_into_dr,data_shifted_out_of_dr, TAP_IDLE);
|
||||||
if(context.flush){
|
if(dsp5680xx_context.flush){
|
||||||
retval = dsp5680xx_execute_queue();
|
retval = dsp5680xx_execute_queue();
|
||||||
err_check_propagate(retval);
|
err_check_propagate(retval);
|
||||||
}
|
}
|
||||||
@@ -94,7 +97,7 @@ static int dsp5680xx_irscan(struct target * target, uint32_t * data_to_shift_int
|
|||||||
//can i send as many bits as i want?
|
//can i send as many bits as i want?
|
||||||
//is the casting necessary?
|
//is the casting necessary?
|
||||||
jtag_add_plain_ir_scan(ir_len,(uint8_t *)data_to_shift_into_ir,(uint8_t *)data_shifted_out_of_ir, TAP_IDLE);
|
jtag_add_plain_ir_scan(ir_len,(uint8_t *)data_to_shift_into_ir,(uint8_t *)data_shifted_out_of_ir, TAP_IDLE);
|
||||||
if(context.flush){
|
if(dsp5680xx_context.flush){
|
||||||
retval = dsp5680xx_execute_queue();
|
retval = dsp5680xx_execute_queue();
|
||||||
err_check_propagate(retval);
|
err_check_propagate(retval);
|
||||||
}
|
}
|
||||||
@@ -505,7 +508,7 @@ static int eonce_pc_store(struct target * target){
|
|||||||
retval = eonce_rx_lower_data(target,(uint16_t *)&tmp);
|
retval = eonce_rx_lower_data(target,(uint16_t *)&tmp);
|
||||||
err_check_propagate(retval);
|
err_check_propagate(retval);
|
||||||
LOG_USER("PC value: 0x%06X\n",tmp);
|
LOG_USER("PC value: 0x%06X\n",tmp);
|
||||||
context.stored_pc = (uint32_t)tmp;
|
dsp5680xx_context.stored_pc = (uint32_t)tmp;
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -516,8 +519,8 @@ static int dsp5680xx_target_create(struct target *target, Jim_Interp * interp){
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int dsp5680xx_init_target(struct command_context *cmd_ctx, struct target *target){
|
static int dsp5680xx_init_target(struct command_context *cmd_ctx, struct target *target){
|
||||||
context.stored_pc = 0;
|
dsp5680xx_context.stored_pc = 0;
|
||||||
context.flush = 1;
|
dsp5680xx_context.flush = 1;
|
||||||
LOG_DEBUG("target initiated!");
|
LOG_DEBUG("target initiated!");
|
||||||
//TODO core tap must be enabled before running these commands, currently this is done in the .cfg tcl script.
|
//TODO core tap must be enabled before running these commands, currently this is done in the .cfg tcl script.
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
@@ -739,12 +742,12 @@ static int dsp5680xx_read(struct target * target, uint32_t address, unsigned siz
|
|||||||
retval = dsp5680xx_convert_address(&address, &pmem);
|
retval = dsp5680xx_convert_address(&address, &pmem);
|
||||||
err_check_propagate(retval);
|
err_check_propagate(retval);
|
||||||
|
|
||||||
context.flush = 0;
|
dsp5680xx_context.flush = 0;
|
||||||
int counter = FLUSH_COUNT_READ_WRITE;
|
int counter = FLUSH_COUNT_READ_WRITE;
|
||||||
|
|
||||||
for (unsigned i=0; i<count; i++){
|
for (unsigned i=0; i<count; i++){
|
||||||
if(--counter==0){
|
if(--counter==0){
|
||||||
context.flush = 1;
|
dsp5680xx_context.flush = 1;
|
||||||
counter = FLUSH_COUNT_FLASH;
|
counter = FLUSH_COUNT_FLASH;
|
||||||
}
|
}
|
||||||
switch (size){
|
switch (size){
|
||||||
@@ -766,10 +769,10 @@ static int dsp5680xx_read(struct target * target, uint32_t address, unsigned siz
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
err_check_propagate(retval);
|
err_check_propagate(retval);
|
||||||
context.flush = 0;
|
dsp5680xx_context.flush = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
context.flush = 1;
|
dsp5680xx_context.flush = 1;
|
||||||
retval = dsp5680xx_execute_queue();
|
retval = dsp5680xx_execute_queue();
|
||||||
err_check_propagate(retval);
|
err_check_propagate(retval);
|
||||||
|
|
||||||
@@ -823,18 +826,18 @@ static int dsp5680xx_write_8(struct target * target, uint32_t address, uint32_t
|
|||||||
int counter = FLUSH_COUNT_READ_WRITE;
|
int counter = FLUSH_COUNT_READ_WRITE;
|
||||||
for(iter = 0; iter<count/2; iter++){
|
for(iter = 0; iter<count/2; iter++){
|
||||||
if(--counter==0){
|
if(--counter==0){
|
||||||
context.flush = 1;
|
dsp5680xx_context.flush = 1;
|
||||||
counter = FLUSH_COUNT_READ_WRITE;
|
counter = FLUSH_COUNT_READ_WRITE;
|
||||||
}
|
}
|
||||||
retval = dsp5680xx_write_16_single(target,address+iter,data_w[iter], pmem);
|
retval = dsp5680xx_write_16_single(target,address+iter,data_w[iter], pmem);
|
||||||
if(retval != ERROR_OK){
|
if(retval != ERROR_OK){
|
||||||
LOG_ERROR("%s: Could not write to p:0x%04X",__FUNCTION__,address);
|
LOG_ERROR("%s: Could not write to p:0x%04X",__FUNCTION__,address);
|
||||||
context.flush = 1;
|
dsp5680xx_context.flush = 1;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
context.flush = 0;
|
dsp5680xx_context.flush = 0;
|
||||||
}
|
}
|
||||||
context.flush = 1;
|
dsp5680xx_context.flush = 1;
|
||||||
|
|
||||||
// Only one byte left, let's not overwrite the other byte (mem is 16bit)
|
// Only one byte left, let's not overwrite the other byte (mem is 16bit)
|
||||||
// Need to retrieve the part we do not want to overwrite.
|
// Need to retrieve the part we do not want to overwrite.
|
||||||
@@ -863,18 +866,18 @@ static int dsp5680xx_write_16(struct target * target, uint32_t address, uint32_t
|
|||||||
|
|
||||||
for(iter = 0; iter<count; iter++){
|
for(iter = 0; iter<count; iter++){
|
||||||
if(--counter==0){
|
if(--counter==0){
|
||||||
context.flush = 1;
|
dsp5680xx_context.flush = 1;
|
||||||
counter = FLUSH_COUNT_READ_WRITE;
|
counter = FLUSH_COUNT_READ_WRITE;
|
||||||
}
|
}
|
||||||
retval = dsp5680xx_write_16_single(target,address+iter,data[iter], pmem);
|
retval = dsp5680xx_write_16_single(target,address+iter,data[iter], pmem);
|
||||||
if(retval != ERROR_OK){
|
if(retval != ERROR_OK){
|
||||||
LOG_ERROR("%s: Could not write to p:0x%04X",__FUNCTION__,address);
|
LOG_ERROR("%s: Could not write to p:0x%04X",__FUNCTION__,address);
|
||||||
context.flush = 1;
|
dsp5680xx_context.flush = 1;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
context.flush = 0;
|
dsp5680xx_context.flush = 0;
|
||||||
}
|
}
|
||||||
context.flush = 1;
|
dsp5680xx_context.flush = 1;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -889,18 +892,18 @@ static int dsp5680xx_write_32(struct target * target, uint32_t address, uint32_t
|
|||||||
|
|
||||||
for(iter = 0; iter<count; iter++){
|
for(iter = 0; iter<count; iter++){
|
||||||
if(--counter==0){
|
if(--counter==0){
|
||||||
context.flush = 1;
|
dsp5680xx_context.flush = 1;
|
||||||
counter = FLUSH_COUNT_READ_WRITE;
|
counter = FLUSH_COUNT_READ_WRITE;
|
||||||
}
|
}
|
||||||
retval = dsp5680xx_write_32_single(target,address+(iter<<1),data[iter], pmem);
|
retval = dsp5680xx_write_32_single(target,address+(iter<<1),data[iter], pmem);
|
||||||
if(retval != ERROR_OK){
|
if(retval != ERROR_OK){
|
||||||
LOG_ERROR("%s: Could not write to p:0x%04X",__FUNCTION__,address);
|
LOG_ERROR("%s: Could not write to p:0x%04X",__FUNCTION__,address);
|
||||||
context.flush = 1;
|
dsp5680xx_context.flush = 1;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
context.flush = 0;
|
dsp5680xx_context.flush = 0;
|
||||||
}
|
}
|
||||||
context.flush = 1;
|
dsp5680xx_context.flush = 1;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1104,7 +1107,7 @@ static int dsp5680xx_f_execute_command(struct target * target, uint16_t command,
|
|||||||
}
|
}
|
||||||
}while (!(i&0x40)); // wait until current command is complete
|
}while (!(i&0x40)); // wait until current command is complete
|
||||||
|
|
||||||
context.flush = 0;
|
dsp5680xx_context.flush = 0;
|
||||||
|
|
||||||
retval = eonce_move_value_at_r2_disp(target,0x00,HFM_CNFG); // write to HFM_CNFG (lock=0, select bank) -- flash_desc.bank&0x03,0x01 == 0x00,0x01 ???
|
retval = eonce_move_value_at_r2_disp(target,0x00,HFM_CNFG); // write to HFM_CNFG (lock=0, select bank) -- flash_desc.bank&0x03,0x01 == 0x00,0x01 ???
|
||||||
err_check_propagate(retval);
|
err_check_propagate(retval);
|
||||||
@@ -1134,7 +1137,7 @@ static int dsp5680xx_f_execute_command(struct target * target, uint16_t command,
|
|||||||
retval = eonce_move_value_at_r2_disp(target,0x80,HFM_USTAT); // start the command
|
retval = eonce_move_value_at_r2_disp(target,0x80,HFM_USTAT); // start the command
|
||||||
err_check_propagate(retval);
|
err_check_propagate(retval);
|
||||||
|
|
||||||
context.flush = 1;
|
dsp5680xx_context.flush = 1;
|
||||||
retval = dsp5680xx_execute_queue();
|
retval = dsp5680xx_execute_queue();
|
||||||
err_check_propagate(retval);
|
err_check_propagate(retval);
|
||||||
|
|
||||||
@@ -1371,7 +1374,7 @@ int dsp5680xx_f_wr(struct target * target, uint8_t *buffer, uint32_t address, ui
|
|||||||
// Setup registers needed by pgm_write_pflash
|
// Setup registers needed by pgm_write_pflash
|
||||||
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||||
|
|
||||||
context.flush = 0;
|
dsp5680xx_context.flush = 0;
|
||||||
|
|
||||||
retval = eonce_move_long_to_r3(target,address); // Destination address to r3
|
retval = eonce_move_long_to_r3(target,address); // Destination address to r3
|
||||||
err_check_propagate(retval);
|
err_check_propagate(retval);
|
||||||
@@ -1400,7 +1403,7 @@ int dsp5680xx_f_wr(struct target * target, uint8_t *buffer, uint32_t address, ui
|
|||||||
err_check(retval,"Cannot handle odd number of words.");
|
err_check(retval,"Cannot handle odd number of words.");
|
||||||
}
|
}
|
||||||
|
|
||||||
context.flush = 1;
|
dsp5680xx_context.flush = 1;
|
||||||
retval = dsp5680xx_execute_queue();
|
retval = dsp5680xx_execute_queue();
|
||||||
err_check_propagate(retval);
|
err_check_propagate(retval);
|
||||||
|
|
||||||
@@ -1412,21 +1415,21 @@ int dsp5680xx_f_wr(struct target * target, uint8_t *buffer, uint32_t address, ui
|
|||||||
err_check_propagate(retval);
|
err_check_propagate(retval);
|
||||||
|
|
||||||
int counter = FLUSH_COUNT_FLASH;
|
int counter = FLUSH_COUNT_FLASH;
|
||||||
context.flush = 0;
|
dsp5680xx_context.flush = 0;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for(i=1; (i<count/2)&&(i<HFM_SIZE_WORDS); i++){
|
for(i=1; (i<count/2)&&(i<HFM_SIZE_WORDS); i++){
|
||||||
if(--counter==0){
|
if(--counter==0){
|
||||||
context.flush = 1;
|
dsp5680xx_context.flush = 1;
|
||||||
counter = FLUSH_COUNT_FLASH;
|
counter = FLUSH_COUNT_FLASH;
|
||||||
}
|
}
|
||||||
retval = eonce_tx_upper_data(target,buff16[i],&drscan_data);
|
retval = eonce_tx_upper_data(target,buff16[i],&drscan_data);
|
||||||
if(retval!=ERROR_OK){
|
if(retval!=ERROR_OK){
|
||||||
context.flush = 1;
|
dsp5680xx_context.flush = 1;
|
||||||
err_check_propagate(retval);
|
err_check_propagate(retval);
|
||||||
}
|
}
|
||||||
context.flush = 0;
|
dsp5680xx_context.flush = 0;
|
||||||
}
|
}
|
||||||
context.flush = 1;
|
dsp5680xx_context.flush = 1;
|
||||||
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||||
// Verify flash
|
// Verify flash
|
||||||
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
||||||
|
@@ -217,7 +217,9 @@ struct dsp5680xx_common{
|
|||||||
//TODO
|
//TODO
|
||||||
uint32_t stored_pc;
|
uint32_t stored_pc;
|
||||||
int flush;
|
int flush;
|
||||||
}context;
|
};
|
||||||
|
|
||||||
|
extern struct dsp5680xx_common dsp5680xx_context;
|
||||||
|
|
||||||
static inline struct dsp5680xx_common *target_to_dsp5680xx(struct target *target){
|
static inline struct dsp5680xx_common *target_to_dsp5680xx(struct target *target){
|
||||||
return target->arch_info;
|
return target->arch_info;
|
||||||
|
@@ -616,6 +616,14 @@ static int mips_m4k_unset_breakpoint(struct target *target,
|
|||||||
{
|
{
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* target_read_memory() gets us data in _target_ endianess.
|
||||||
|
* If we want to use this data on the host for comparisons with some macros
|
||||||
|
* we must first transform it to _host_ endianess using target_buffer_get_u32().
|
||||||
|
*/
|
||||||
|
current_instr = target_buffer_get_u32(target, (uint8_t *)¤t_instr);
|
||||||
|
|
||||||
if (current_instr == MIPS32_SDBBP)
|
if (current_instr == MIPS32_SDBBP)
|
||||||
{
|
{
|
||||||
if ((retval = target_write_memory(target, breakpoint->address, 4, 1,
|
if ((retval = target_write_memory(target, breakpoint->address, 4, 1,
|
||||||
@@ -877,11 +885,11 @@ static int mips_m4k_read_memory(struct target *target, uint32_t address,
|
|||||||
switch(size)
|
switch(size)
|
||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
t32 = *(uint32_t*)&buffer[i];
|
t32 = le_to_h_u32(&buffer[i]);
|
||||||
target_buffer_set_u32(target,&buffer[i], t32);
|
target_buffer_set_u32(target,&buffer[i], t32);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
t16 = *(uint16_t*)&buffer[i];
|
t16 = le_to_h_u16(&buffer[i]);
|
||||||
target_buffer_set_u16(target,&buffer[i], t16);
|
target_buffer_set_u16(target,&buffer[i], t16);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -930,11 +938,11 @@ static int mips_m4k_write_memory(struct target *target, uint32_t address,
|
|||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
t32 = target_buffer_get_u32(target,&buffer[i]);
|
t32 = target_buffer_get_u32(target,&buffer[i]);
|
||||||
*(uint32_t*)&t[i] = t32;
|
h_u32_to_le(&t[i], t32);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
t16 = target_buffer_get_u16(target,&buffer[i]);
|
t16 = target_buffer_get_u16(target,&buffer[i]);
|
||||||
*(uint16_t*)&t[i] = t16;
|
h_u16_to_le(&t[i], t16);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1074,7 +1082,7 @@ static int mips_m4k_bulk_write_memory(struct target *target, uint32_t address,
|
|||||||
for(i = 0; i < (count*4); i += 4)
|
for(i = 0; i < (count*4); i += 4)
|
||||||
{
|
{
|
||||||
t32 = target_buffer_get_u32(target,&buffer[i]);
|
t32 = target_buffer_get_u32(target,&buffer[i]);
|
||||||
*(uint32_t*)&t[i] = t32;
|
h_u32_to_le(&t[i], t32);
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = mips32_pracc_fastdata_xfer(ejtag_info, mips32->fast_data_area, write_t, address,
|
retval = mips32_pracc_fastdata_xfer(ejtag_info, mips32->fast_data_area, write_t, address,
|
||||||
|
@@ -81,7 +81,7 @@ extern struct target_type arm11_target;
|
|||||||
extern struct target_type mips_m4k_target;
|
extern struct target_type mips_m4k_target;
|
||||||
extern struct target_type avr_target;
|
extern struct target_type avr_target;
|
||||||
extern struct target_type dsp563xx_target;
|
extern struct target_type dsp563xx_target;
|
||||||
extern struct target_type dsp5680xx_target;
|
//extern struct target_type dsp5680xx_target;
|
||||||
extern struct target_type testee_target;
|
extern struct target_type testee_target;
|
||||||
extern struct target_type avr32_ap7k_target;
|
extern struct target_type avr32_ap7k_target;
|
||||||
|
|
||||||
@@ -104,7 +104,8 @@ static struct target_type *target_types[] =
|
|||||||
&mips_m4k_target,
|
&mips_m4k_target,
|
||||||
&avr_target,
|
&avr_target,
|
||||||
&dsp563xx_target,
|
&dsp563xx_target,
|
||||||
&dsp5680xx_target,
|
// Disabled for now, it generates warnings
|
||||||
|
// &dsp5680xx_target,
|
||||||
&testee_target,
|
&testee_target,
|
||||||
&avr32_ap7k_target,
|
&avr32_ap7k_target,
|
||||||
NULL,
|
NULL,
|
||||||
|
Reference in New Issue
Block a user