You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(75) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(70) |
Feb
(20) |
Mar
(52) |
Apr
(149) |
May
(387) |
Jun
(466) |
Jul
(133) |
Aug
(87) |
Sep
(122) |
Oct
(140) |
Nov
(185) |
Dec
(105) |
2010 |
Jan
(85) |
Feb
(45) |
Mar
(75) |
Apr
(17) |
May
(41) |
Jun
(52) |
Jul
(33) |
Aug
(29) |
Sep
(36) |
Oct
(15) |
Nov
(26) |
Dec
(34) |
2011 |
Jan
(26) |
Feb
(25) |
Mar
(26) |
Apr
(29) |
May
(20) |
Jun
(27) |
Jul
(15) |
Aug
(32) |
Sep
(13) |
Oct
(64) |
Nov
(60) |
Dec
(10) |
2012 |
Jan
(64) |
Feb
(63) |
Mar
(39) |
Apr
(43) |
May
(54) |
Jun
(11) |
Jul
(30) |
Aug
(45) |
Sep
(11) |
Oct
(70) |
Nov
(24) |
Dec
(23) |
2013 |
Jan
(17) |
Feb
(8) |
Mar
(35) |
Apr
(40) |
May
(20) |
Jun
(24) |
Jul
(36) |
Aug
(25) |
Sep
(42) |
Oct
(40) |
Nov
(9) |
Dec
(21) |
2014 |
Jan
(29) |
Feb
(24) |
Mar
(60) |
Apr
(22) |
May
(22) |
Jun
(46) |
Jul
(11) |
Aug
(23) |
Sep
(26) |
Oct
(10) |
Nov
(14) |
Dec
(2) |
2015 |
Jan
(28) |
Feb
(47) |
Mar
(33) |
Apr
(58) |
May
(5) |
Jun
(1) |
Jul
|
Aug
(8) |
Sep
(12) |
Oct
(25) |
Nov
(58) |
Dec
(21) |
2016 |
Jan
(12) |
Feb
(40) |
Mar
(2) |
Apr
(1) |
May
(67) |
Jun
(2) |
Jul
(5) |
Aug
(36) |
Sep
|
Oct
(24) |
Nov
(17) |
Dec
(50) |
2017 |
Jan
(14) |
Feb
(16) |
Mar
(2) |
Apr
(35) |
May
(14) |
Jun
(16) |
Jul
(3) |
Aug
(3) |
Sep
|
Oct
(19) |
Nov
|
Dec
(16) |
2018 |
Jan
(55) |
Feb
(11) |
Mar
(34) |
Apr
(14) |
May
(4) |
Jun
(20) |
Jul
(39) |
Aug
(16) |
Sep
(17) |
Oct
(16) |
Nov
(20) |
Dec
(30) |
2019 |
Jan
(29) |
Feb
(24) |
Mar
(37) |
Apr
(26) |
May
(19) |
Jun
(21) |
Jul
(2) |
Aug
(3) |
Sep
(9) |
Oct
(12) |
Nov
(12) |
Dec
(12) |
2020 |
Jan
(47) |
Feb
(36) |
Mar
(54) |
Apr
(44) |
May
(37) |
Jun
(19) |
Jul
(32) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(32) |
Dec
(11) |
2021 |
Jan
(14) |
Feb
(5) |
Mar
(40) |
Apr
(32) |
May
(42) |
Jun
(31) |
Jul
(29) |
Aug
(47) |
Sep
(38) |
Oct
(17) |
Nov
(74) |
Dec
(33) |
2022 |
Jan
(11) |
Feb
(15) |
Mar
(40) |
Apr
(21) |
May
(39) |
Jun
(44) |
Jul
(19) |
Aug
(46) |
Sep
(79) |
Oct
(35) |
Nov
(21) |
Dec
(15) |
2023 |
Jan
(56) |
Feb
(13) |
Mar
(43) |
Apr
(28) |
May
(60) |
Jun
(15) |
Jul
(29) |
Aug
(28) |
Sep
(32) |
Oct
(21) |
Nov
(42) |
Dec
(39) |
2024 |
Jan
(35) |
Feb
(17) |
Mar
(28) |
Apr
(7) |
May
(14) |
Jun
(35) |
Jul
(30) |
Aug
(35) |
Sep
(30) |
Oct
(28) |
Nov
(38) |
Dec
(18) |
2025 |
Jan
(21) |
Feb
(28) |
Mar
(36) |
Apr
(35) |
May
(34) |
Jun
(58) |
Jul
(9) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <du...@ma...> - 2009-04-24 04:13:05
|
Author: duane Date: 2009-04-24 04:13:02 +0200 (Fri, 24 Apr 2009) New Revision: 1518 Modified: trunk/src/jtag/gw16012.c Log: Remove warning Modified: trunk/src/jtag/gw16012.c =================================================================== --- trunk/src/jtag/gw16012.c 2009-04-23 18:55:13 UTC (rev 1517) +++ trunk/src/jtag/gw16012.c 2009-04-24 02:13:02 UTC (rev 1518) @@ -436,7 +436,7 @@ } #if PARPORT_USE_GIVEIO == 1 -static int gw16012_get_giveio_access() +static int gw16012_get_giveio_access(void) { HANDLE h; OSVERSIONINFO version; |
From: <oh...@ma...> - 2009-04-23 20:55:16
|
Author: oharboe Date: 2009-04-23 20:55:13 +0200 (Thu, 23 Apr 2009) New Revision: 1517 Modified: trunk/src/target/arm11.h Log: Michael Bruck <mb...@di...> include file fix Modified: trunk/src/target/arm11.h =================================================================== --- trunk/src/target/arm11.h 2009-04-23 14:03:42 UTC (rev 1516) +++ trunk/src/target/arm11.h 2009-04-23 18:55:13 UTC (rev 1517) @@ -26,7 +26,7 @@ #include "register.h" #include "embeddedice.h" #include "arm_jtag.h" -#include <stdbool.h> +#include "types.h" #define asizeof(x) (sizeof(x) / sizeof((x)[0])) |
From: oharboe at B. <oh...@ma...> - 2009-04-23 16:03:43
|
Author: oharboe Date: 2009-04-23 16:03:42 +0200 (Thu, 23 Apr 2009) New Revision: 1516 Modified: trunk/doc/openocd.texi trunk/src/target/target/stm32.cfg Log: stm32.cfg can expect one of 4 id's. Modified: trunk/doc/openocd.texi =================================================================== --- trunk/doc/openocd.texi 2009-04-23 13:24:56 UTC (rev 1515) +++ trunk/doc/openocd.texi 2009-04-23 14:03:42 UTC (rev 1516) @@ -1606,7 +1606,9 @@ @itemize @bullet @item @b{-expected-id NUMBER} @* By default it is zero. If non-zero represents the -expected tap ID used when the JTAG chain is examined. See below. +expected tap ID used when the JTAG chain is examined. Repeat +the option as many times as required if multiple id's can be +expected. See below. @item @b{-disable} @item @b{-enable} @* By default not specified the tap is enabled. Some chips have a Modified: trunk/src/target/target/stm32.cfg =================================================================== --- trunk/src/target/target/stm32.cfg 2009-04-23 13:24:56 UTC (rev 1515) +++ trunk/src/target/target/stm32.cfg 2009-04-23 14:03:42 UTC (rev 1516) @@ -37,15 +37,15 @@ # See STM Document RM0008 # Section 26.6.2 # Low density devices, Rev A - set _BSTAPID 0x06412041 + set _BSTAPID1 0x06412041 # Medium density devices, Rev A - set _BSTAPID 0x06410041 + set _BSTAPID2 0x06410041 # Medium density devices, Rev B and Rev Z - set _BSTAPID 0x16410041 + set _BSTAPID3 0x16410041 # High density devices, Rev A - set _BSTAPID 0x06414041 + set _BSTAPID4 0x06414041 } -jtag newtap $_CHIPNAME bs -irlen 5 -ircapture 0x1 -irmask 0x1 -expected-id $_BSTAPID +jtag newtap $_CHIPNAME bs -irlen 5 -ircapture 0x1 -irmask 0x1 -expected-id $_BSTAPID1 -expected-id $_BSTAPID2 -expected-id $_BSTAPID3 -expected-id $_BSTAPID4 set _TARGETNAME [format "%s.cpu" $_CHIPNAME] target create $_TARGETNAME cortex_m3 -endian $_ENDIAN -chain-position $_TARGETNAME |
From: oharboe at B. <oh...@ma...> - 2009-04-23 15:24:57
|
Author: oharboe Date: 2009-04-23 15:24:56 +0200 (Thu, 23 Apr 2009) New Revision: 1515 Modified: trunk/src/jtag/jtag.h zy1000/trunk/build/buildocd.sh Log: unbreak zy1000 Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-04-23 12:21:39 UTC (rev 1514) +++ trunk/src/jtag/jtag.h 2009-04-23 13:24:56 UTC (rev 1515) @@ -47,9 +47,24 @@ * * N.B. tap_get_tms_path() was changed to reflect this corrected * numbering and ordering of the TAP states. + * + * DANGER!!!! some interfaces care about the actual numbers used + * as they are handed off directly to hardware implementations. */ + typedef enum tap_state { +#if BUILD_ECOSBOARD +/* These are the old numbers. Leave as-is for now... */ + TAP_RESET = 0, TAP_IDLE = 8, + TAP_DRSELECT = 1, TAP_DRCAPTURE = 2, TAP_DRSHIFT = 3, TAP_DREXIT1 = 4, + TAP_DRPAUSE = 5, TAP_DREXIT2 = 6, TAP_DRUPDATE = 7, + TAP_IRSELECT = 9, TAP_IRCAPTURE = 10, TAP_IRSHIFT = 11, TAP_IREXIT1 = 12, + TAP_IRPAUSE = 13, TAP_IREXIT2 = 14, TAP_IRUPDATE = 15, + + TAP_NUM_STATES = 16, TAP_INVALID = -1, +#else + /* Proper ARM recommended numbers */ TAP_DREXIT2 = 0x0, TAP_DREXIT1 = 0x1, TAP_DRSHIFT = 0x2, @@ -70,8 +85,9 @@ TAP_NUM_STATES = 0x10, TAP_INVALID = -1, +#endif } tap_state_t; - + typedef struct tap_transition_s { tap_state_t high; Modified: zy1000/trunk/build/buildocd.sh =================================================================== --- zy1000/trunk/build/buildocd.sh 2009-04-23 12:21:39 UTC (rev 1514) +++ zy1000/trunk/build/buildocd.sh 2009-04-23 13:24:56 UTC (rev 1515) @@ -19,7 +19,7 @@ rm -rf /tmp/ecosboard/build mkdir /tmp/ecosboard/build cd /tmp/ecosboard/build -$OPENOCD/../../openocd/configure --enable-ioutil --host=arm-elf --includedir=/tmp/ecosboard/ecos/install/include/ --enable-ecosboard --prefix=/tmp/ecosboard/ocdinstall +$OPENOCD/../../openocd/configure --disable-werror --enable-ioutil --host=arm-elf --includedir=/tmp/ecosboard/ecos/install/include/ --enable-ecosboard --prefix=/tmp/ecosboard/ocdinstall echo >makephi.sh sh $OPENOCD/makephi.sh echo >>makephi.sh sh $OPENOCD/makefw.sh make |
From: oharboe at B. <oh...@ma...> - 2009-04-23 14:21:40
|
Author: oharboe Date: 2009-04-23 14:21:39 +0200 (Thu, 23 Apr 2009) New Revision: 1514 Modified: trunk/src/target/target/wi-9c.cfg Log: Laurentiu Cocanu - fix typo Modified: trunk/src/target/target/wi-9c.cfg =================================================================== --- trunk/src/target/target/wi-9c.cfg 2009-04-22 19:54:03 UTC (rev 1513) +++ trunk/src/target/target/wi-9c.cfg 2009-04-23 12:21:39 UTC (rev 1514) @@ -31,7 +31,7 @@ } set _TARGETNAME [format "%s.cpu" $_CHIPNAME] -jtag newtap_device $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID +jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID jtag_nsrst_delay 200 jtag_ntrst_delay 0 |
From: ntfreak at B. <nt...@ma...> - 2009-04-22 21:54:04
|
Author: ntfreak Date: 2009-04-22 21:54:03 +0200 (Wed, 22 Apr 2009) New Revision: 1513 Modified: trunk/src/helper/replacements.h Log: - fix win32 build after svn 1511 changes Modified: trunk/src/helper/replacements.h =================================================================== --- trunk/src/helper/replacements.h 2009-04-22 18:39:59 UTC (rev 1512) +++ trunk/src/helper/replacements.h 2009-04-22 19:54:03 UTC (rev 1513) @@ -41,6 +41,7 @@ /* include necessary headers for socket functionality */ #ifdef _WIN32 #include <winsock2.h> +#include <ws2tcpip.h> #else #include <sys/socket.h> #include <sys/poll.h> |
From: <oh...@ma...> - 2009-04-22 20:40:02
|
Author: oharboe Date: 2009-04-22 20:39:59 +0200 (Wed, 22 Apr 2009) New Revision: 1512 Modified: trunk/src/target/arm11.c trunk/src/target/arm11.h trunk/src/target/arm11_dbgtap.c Log: Michael Bruck <mb...@di...> ARM11 various updates + fix formatting. Modified: trunk/src/target/arm11.c =================================================================== --- trunk/src/target/arm11.c 2009-04-22 17:36:00 UTC (rev 1511) +++ trunk/src/target/arm11.c 2009-04-22 18:39:59 UTC (rev 1512) @@ -50,9 +50,11 @@ static void arm11_on_enter_debug_state(arm11_common_t * arm11); -bool arm11_config_memwrite_burst = true; -bool arm11_config_memwrite_error_fatal = true; -u32 arm11_vcr = 0; +bool arm11_config_memwrite_burst = true; +bool arm11_config_memwrite_error_fatal = true; +u32 arm11_vcr = 0; +bool arm11_config_memrw_no_increment = false; +bool arm11_config_step_irq_enable = false; #define ARM11_HANDLER(x) \ .x = arm11_##x @@ -131,9 +133,9 @@ typedef struct arm11_reg_defs_s { - char * name; - u32 num; - int gdb_num; + char * name; + u32 num; + int gdb_num; enum arm11_regtype type; } arm11_reg_defs_t; @@ -308,8 +310,8 @@ * * \param arm11 Target state variable. * \param dscr If the current DSCR content is - * available a pointer to a word holding the - * DSCR can be passed. Otherwise use NULL. + * available a pointer to a word holding the + * DSCR can be passed. Otherwise use NULL. */ void arm11_check_init(arm11_common_t * arm11, u32 * dscr) { @@ -319,37 +321,37 @@ if (!dscr) { - dscr = &dscr_local_tmp_copy; - *dscr = arm11_read_DSCR(arm11); + dscr = &dscr_local_tmp_copy; + *dscr = arm11_read_DSCR(arm11); } if (!(*dscr & ARM11_DSCR_MODE_SELECT)) { - LOG_DEBUG("Bringing target into debug mode"); + LOG_DEBUG("Bringing target into debug mode"); - *dscr |= ARM11_DSCR_MODE_SELECT; /* Halt debug-mode */ - arm11_write_DSCR(arm11, *dscr); + *dscr |= ARM11_DSCR_MODE_SELECT; /* Halt debug-mode */ + arm11_write_DSCR(arm11, *dscr); - /* add further reset initialization here */ + /* add further reset initialization here */ - arm11->simulate_reset_on_next_halt = true; + arm11->simulate_reset_on_next_halt = true; - if (*dscr & ARM11_DSCR_CORE_HALTED) - { - /** \todo TODO: this needs further scrutiny because - * arm11_on_enter_debug_state() never gets properly called - */ + if (*dscr & ARM11_DSCR_CORE_HALTED) + { + /** \todo TODO: this needs further scrutiny because + * arm11_on_enter_debug_state() never gets properly called + */ - arm11->target->state = TARGET_HALTED; - arm11->target->debug_reason = arm11_get_DSCR_debug_reason(*dscr); - } - else - { - arm11->target->state = TARGET_RUNNING; - arm11->target->debug_reason = DBG_REASON_NOTHALTED; - } + arm11->target->state = TARGET_HALTED; + arm11->target->debug_reason = arm11_get_DSCR_debug_reason(*dscr); + } + else + { + arm11->target->state = TARGET_RUNNING; + arm11->target->debug_reason = DBG_REASON_NOTHALTED; + } - arm11_sc7_clear_vbw(arm11); + arm11_sc7_clear_vbw(arm11); } } @@ -371,8 +373,8 @@ {size_t i; for(i = 0; i < asizeof(arm11->reg_values); i++) { - arm11->reg_list[i].valid = 1; - arm11->reg_list[i].dirty = 0; + arm11->reg_list[i].valid = 1; + arm11->reg_list[i].dirty = 0; }} /* Save DSCR */ @@ -383,21 +385,21 @@ if (R(DSCR) & ARM11_DSCR_WDTR_FULL) { - arm11_add_debug_SCAN_N(arm11, 0x05, TAP_INVALID); + arm11_add_debug_SCAN_N(arm11, 0x05, ARM11_TAP_DEFAULT); - arm11_add_IR(arm11, ARM11_INTEST, TAP_INVALID); + arm11_add_IR(arm11, ARM11_INTEST, ARM11_TAP_DEFAULT); - scan_field_t chain5_fields[3]; + scan_field_t chain5_fields[3]; - arm11_setup_field(arm11, 32, NULL, &R(WDTR), chain5_fields + 0); - arm11_setup_field(arm11, 1, NULL, NULL, chain5_fields + 1); - arm11_setup_field(arm11, 1, NULL, NULL, chain5_fields + 2); + arm11_setup_field(arm11, 32, NULL, &R(WDTR), chain5_fields + 0); + arm11_setup_field(arm11, 1, NULL, NULL, chain5_fields + 1); + arm11_setup_field(arm11, 1, NULL, NULL, chain5_fields + 2); - arm11_add_dr_scan_vc(asizeof(chain5_fields), chain5_fields, TAP_DRPAUSE); + arm11_add_dr_scan_vc(asizeof(chain5_fields), chain5_fields, TAP_DRPAUSE); } else { - arm11->reg_list[ARM11_RC_WDTR].valid = 0; + arm11->reg_list[ARM11_RC_WDTR].valid = 0; } @@ -413,35 +415,35 @@ /* From the spec: - Before executing any instruction in debug state you have to drain the write buffer. - This ensures that no imprecise Data Aborts can return at a later point:*/ + Before executing any instruction in debug state you have to drain the write buffer. + This ensures that no imprecise Data Aborts can return at a later point:*/ /** \todo TODO: Test drain write buffer. */ #if 0 while (1) { - /* MRC p14,0,R0,c5,c10,0 */ -// arm11_run_instr_no_data1(arm11, /*0xee150e1a*/0xe320f000); + /* MRC p14,0,R0,c5,c10,0 */ + // arm11_run_instr_no_data1(arm11, /*0xee150e1a*/0xe320f000); - /* mcr 15, 0, r0, cr7, cr10, {4} */ - arm11_run_instr_no_data1(arm11, 0xee070f9a); + /* mcr 15, 0, r0, cr7, cr10, {4} */ + arm11_run_instr_no_data1(arm11, 0xee070f9a); - u32 dscr = arm11_read_DSCR(arm11); + u32 dscr = arm11_read_DSCR(arm11); - LOG_DEBUG("DRAIN, DSCR %08x", dscr); + LOG_DEBUG("DRAIN, DSCR %08x", dscr); - if (dscr & ARM11_DSCR_STICKY_IMPRECISE_DATA_ABORT) - { - arm11_run_instr_no_data1(arm11, 0xe320f000); + if (dscr & ARM11_DSCR_STICKY_IMPRECISE_DATA_ABORT) + { + arm11_run_instr_no_data1(arm11, 0xe320f000); - dscr = arm11_read_DSCR(arm11); + dscr = arm11_read_DSCR(arm11); - LOG_DEBUG("DRAIN, DSCR %08x (DONE)", dscr); + LOG_DEBUG("DRAIN, DSCR %08x (DONE)", dscr); - break; + break; + } } - } #endif arm11_run_instr_data_prepare(arm11); @@ -453,8 +455,8 @@ {size_t i; for (i = 0; i < 15; i++) { - /* MCR p14,0,R?,c0,c5,0 */ - arm11_run_instr_data_from_core(arm11, 0xEE000E15 | (i << 12), &R(RX + i), 1); + /* MCR p14,0,R?,c0,c5,0 */ + arm11_run_instr_data_from_core(arm11, 0xEE000E15 | (i << 12), &R(RX + i), 1); }} /* save rDTR */ @@ -463,12 +465,12 @@ if (R(DSCR) & ARM11_DSCR_RDTR_FULL) { - /* MRC p14,0,R0,c0,c5,0 (move rDTR -> r0 (-> wDTR -> local var)) */ - arm11_run_instr_data_from_core_via_r0(arm11, 0xEE100E15, &R(RDTR)); + /* MRC p14,0,R0,c0,c5,0 (move rDTR -> r0 (-> wDTR -> local var)) */ + arm11_run_instr_data_from_core_via_r0(arm11, 0xEE100E15, &R(RDTR)); } else { - arm11->reg_list[ARM11_RC_RDTR].valid = 0; + arm11->reg_list[ARM11_RC_RDTR].valid = 0; } /* save CPSR */ @@ -485,27 +487,27 @@ if (R(CPSR) & ARM11_CPSR_J) /* Java state */ { - arm11->reg_values[ARM11_RC_PC] -= 0; + arm11->reg_values[ARM11_RC_PC] -= 0; } else if (R(CPSR) & ARM11_CPSR_T) /* Thumb state */ { - arm11->reg_values[ARM11_RC_PC] -= 4; + arm11->reg_values[ARM11_RC_PC] -= 4; } else /* ARM state */ { - arm11->reg_values[ARM11_RC_PC] -= 8; + arm11->reg_values[ARM11_RC_PC] -= 8; } if (arm11->simulate_reset_on_next_halt) { - arm11->simulate_reset_on_next_halt = false; + arm11->simulate_reset_on_next_halt = false; - LOG_DEBUG("Reset c1 Control Register"); + LOG_DEBUG("Reset c1 Control Register"); - /* Write 0 (reset value) to Control register 0 to disable MMU/Cache etc. */ + /* Write 0 (reset value) to Control register 0 to disable MMU/Cache etc. */ - /* MCR p15,0,R0,c1,c0,0 */ - arm11_run_instr_data_to_core_via_r0(arm11, 0xee010f10, 0); + /* MCR p15,0,R0,c1,c0,0 */ + arm11_run_instr_data_to_core_via_r0(arm11, 0xee010f10, 0); } @@ -519,23 +521,23 @@ {size_t i; for(i = 0; i < ARM11_REGCACHE_COUNT; i++) { - if (!arm11->reg_list[i].valid) - { - if (arm11->reg_history[i].valid) - LOG_INFO("%8s INVALID (%08x)", arm11_reg_defs[i].name, arm11->reg_history[i].value); - } - else - { - if (arm11->reg_history[i].valid) + if (!arm11->reg_list[i].valid) { - if (arm11->reg_history[i].value != arm11->reg_values[i]) - LOG_INFO("%8s %08x (%08x)", arm11_reg_defs[i].name, arm11->reg_values[i], arm11->reg_history[i].value); + if (arm11->reg_history[i].valid) + LOG_INFO("%8s INVALID (%08x)", arm11_reg_defs[i].name, arm11->reg_history[i].value); } else { - LOG_INFO("%8s %08x (INVALID)", arm11_reg_defs[i].name, arm11->reg_values[i]); + if (arm11->reg_history[i].valid) + { + if (arm11->reg_history[i].value != arm11->reg_values[i]) + LOG_INFO("%8s %08x (%08x)", arm11_reg_defs[i].name, arm11->reg_values[i], arm11->reg_history[i].value); + } + else + { + LOG_INFO("%8s %08x (INVALID)", arm11_reg_defs[i].name, arm11->reg_values[i]); + } } - } }} } @@ -556,28 +558,27 @@ {size_t i; for (i = 1; i < 15; i++) { - if (!arm11->reg_list[ARM11_RC_RX + i].dirty) - continue; + if (!arm11->reg_list[ARM11_RC_RX + i].dirty) + continue; - /* MRC p14,0,r?,c0,c5,0 */ - arm11_run_instr_data_to_core1(arm11, 0xee100e15 | (i << 12), R(RX + i)); + /* MRC p14,0,r?,c0,c5,0 */ + arm11_run_instr_data_to_core1(arm11, 0xee100e15 | (i << 12), R(RX + i)); -// LOG_DEBUG("RESTORE R" ZU " %08x", i, R(RX + i)); + // LOG_DEBUG("RESTORE R" ZU " %08x", i, R(RX + i)); }} arm11_run_instr_data_finish(arm11); /* spec says clear wDTR and rDTR; we assume they are clear as otherwise our programming would be sloppy */ - { - u32 DSCR = arm11_read_DSCR(arm11); + u32 DSCR = arm11_read_DSCR(arm11); - if (DSCR & (ARM11_DSCR_RDTR_FULL | ARM11_DSCR_WDTR_FULL)) - { - LOG_ERROR("wDTR/rDTR inconsistent (DSCR %08x)", DSCR); + if (DSCR & (ARM11_DSCR_RDTR_FULL | ARM11_DSCR_WDTR_FULL)) + { + LOG_ERROR("wDTR/rDTR inconsistent (DSCR %08x)", DSCR); + } } - } arm11_run_instr_data_prepare(arm11); @@ -585,8 +586,8 @@ if ((R(DSCR) & ARM11_DSCR_WDTR_FULL) || arm11->reg_list[ARM11_RC_WDTR].dirty) { - /* MCR p14,0,R0,c0,c5,0 */ - arm11_run_instr_data_to_core_via_r0(arm11, 0xee000e15, R(WDTR)); + /* MCR p14,0,R0,c0,c5,0 */ + arm11_run_instr_data_to_core_via_r0(arm11, 0xee000e15, R(WDTR)); } /* restore CPSR */ @@ -614,20 +615,20 @@ if (R(DSCR) & ARM11_DSCR_RDTR_FULL || arm11->reg_list[ARM11_RC_RDTR].dirty) { - arm11_add_debug_SCAN_N(arm11, 0x05, TAP_INVALID); + arm11_add_debug_SCAN_N(arm11, 0x05, ARM11_TAP_DEFAULT); - arm11_add_IR(arm11, ARM11_EXTEST, TAP_INVALID); + arm11_add_IR(arm11, ARM11_EXTEST, ARM11_TAP_DEFAULT); - scan_field_t chain5_fields[3]; + scan_field_t chain5_fields[3]; - u8 Ready = 0; /* ignored */ - u8 Valid = 0; /* ignored */ + u8 Ready = 0; /* ignored */ + u8 Valid = 0; /* ignored */ - arm11_setup_field(arm11, 32, &R(RDTR), NULL, chain5_fields + 0); - arm11_setup_field(arm11, 1, &Ready, NULL, chain5_fields + 1); - arm11_setup_field(arm11, 1, &Valid, NULL, chain5_fields + 2); + arm11_setup_field(arm11, 32, &R(RDTR), NULL, chain5_fields + 0); + arm11_setup_field(arm11, 1, &Ready, NULL, chain5_fields + 1); + arm11_setup_field(arm11, 1, &Valid, NULL, chain5_fields + 2); - arm11_add_dr_scan_vc(asizeof(chain5_fields), chain5_fields, TAP_DRPAUSE); + arm11_add_dr_scan_vc(asizeof(chain5_fields), chain5_fields, TAP_DRPAUSE); } arm11_record_register_history(arm11); @@ -638,11 +639,11 @@ {size_t i; for(i = 0; i < ARM11_REGCACHE_COUNT; i++) { - arm11->reg_history[i].value = arm11->reg_values[i]; - arm11->reg_history[i].valid = arm11->reg_list[i].valid; + arm11->reg_history[i].value = arm11->reg_values[i]; + arm11->reg_history[i].valid = arm11->reg_list[i].valid; - arm11->reg_list[i].valid = 0; - arm11->reg_list[i].dirty = 0; + arm11->reg_list[i].valid = 0; + arm11->reg_list[i].dirty = 0; }} } @@ -655,7 +656,7 @@ arm11_common_t * arm11 = target->arch_info; if (arm11->trst_active) - return ERROR_OK; + return ERROR_OK; u32 dscr = arm11_read_DSCR(arm11); @@ -665,28 +666,28 @@ if (dscr & ARM11_DSCR_CORE_HALTED) { - if (target->state != TARGET_HALTED) - { - enum target_state old_state = target->state; + if (target->state != TARGET_HALTED) + { + enum target_state old_state = target->state; - LOG_DEBUG("enter TARGET_HALTED"); - target->state = TARGET_HALTED; - target->debug_reason = arm11_get_DSCR_debug_reason(dscr); - arm11_on_enter_debug_state(arm11); + LOG_DEBUG("enter TARGET_HALTED"); + target->state = TARGET_HALTED; + target->debug_reason = arm11_get_DSCR_debug_reason(dscr); + arm11_on_enter_debug_state(arm11); - target_call_event_callbacks(target, - old_state == TARGET_DEBUG_RUNNING ? TARGET_EVENT_DEBUG_HALTED : TARGET_EVENT_HALTED); + target_call_event_callbacks(target, + old_state == TARGET_DEBUG_RUNNING ? TARGET_EVENT_DEBUG_HALTED : TARGET_EVENT_HALTED); + } } - } else { - if (target->state != TARGET_RUNNING && target->state != TARGET_DEBUG_RUNNING) - { - LOG_DEBUG("enter TARGET_RUNNING"); - target->state = TARGET_RUNNING; - target->debug_reason = DBG_REASON_NOTHALTED; + if (target->state != TARGET_RUNNING && target->state != TARGET_DEBUG_RUNNING) + { + LOG_DEBUG("enter TARGET_RUNNING"); + target->state = TARGET_RUNNING; + target->debug_reason = DBG_REASON_NOTHALTED; + } } - } return ERROR_OK; } @@ -716,11 +717,11 @@ arm11_common_t * arm11 = target->arch_info; LOG_DEBUG("target->state: %s", - Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name ); + Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name ); if (target->state == TARGET_UNKNOWN) { - arm11->simulate_reset_on_next_halt = true; + arm11->simulate_reset_on_next_halt = true; } if (target->state == TARGET_HALTED) @@ -731,8 +732,8 @@ if (arm11->trst_active) { - arm11->halt_requested = true; - return ERROR_OK; + arm11->halt_requested = true; + return ERROR_OK; } arm11_add_IR(arm11, ARM11_HALT, TAP_IDLE); @@ -746,10 +747,10 @@ while (1) { - dscr = arm11_read_DSCR(arm11); + dscr = arm11_read_DSCR(arm11); - if (dscr & ARM11_DSCR_CORE_HALTED) - break; + if (dscr & ARM11_DSCR_CORE_HALTED) + break; } arm11_on_enter_debug_state(arm11); @@ -760,7 +761,7 @@ target->debug_reason = arm11_get_DSCR_debug_reason(dscr); if((retval = target_call_event_callbacks(target, - old_state == TARGET_DEBUG_RUNNING ? TARGET_EVENT_DEBUG_HALTED : TARGET_EVENT_HALTED)) != ERROR_OK) + old_state == TARGET_DEBUG_RUNNING ? TARGET_EVENT_DEBUG_HALTED : TARGET_EVENT_HALTED)) != ERROR_OK) { return retval; } @@ -773,14 +774,14 @@ int retval = ERROR_OK; FNC_INFO; + + // LOG_DEBUG("current %d address %08x handle_breakpoints %d debug_execution %d", + // current, address, handle_breakpoints, debug_execution); -// LOG_DEBUG("current %d address %08x handle_breakpoints %d debug_execution %d", -// current, address, handle_breakpoints, debug_execution); - arm11_common_t * arm11 = target->arch_info; LOG_DEBUG("target->state: %s", - Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name ); + Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name ); if (target->state != TARGET_HALTED) @@ -790,7 +791,7 @@ } if (!current) - R(PC) = address; + R(PC) = address; LOG_INFO("RESUME PC %08x%s", R(PC), !current ? "!" : ""); @@ -800,43 +801,43 @@ /* Set up breakpoints */ if (!debug_execution) { - /* check if one matches PC and step over it if necessary */ + /* check if one matches PC and step over it if necessary */ - breakpoint_t * bp; + breakpoint_t * bp; - for (bp = target->breakpoints; bp; bp = bp->next) - { - if (bp->address == R(PC)) + for (bp = target->breakpoints; bp; bp = bp->next) { - LOG_DEBUG("must step over %08x", bp->address); - arm11_step(target, 1, 0, 0); - break; + if (bp->address == R(PC)) + { + LOG_DEBUG("must step over %08x", bp->address); + arm11_step(target, 1, 0, 0); + break; + } } - } - /* set all breakpoints */ + /* set all breakpoints */ - size_t brp_num = 0; + size_t brp_num = 0; - for (bp = target->breakpoints; bp; bp = bp->next) - { - arm11_sc7_action_t brp[2]; + for (bp = target->breakpoints; bp; bp = bp->next) + { + arm11_sc7_action_t brp[2]; - brp[0].write = 1; - brp[0].address = ARM11_SC7_BVR0 + brp_num; - brp[0].value = bp->address; - brp[1].write = 1; - brp[1].address = ARM11_SC7_BCR0 + brp_num; - brp[1].value = 0x1 | (3 << 1) | (0x0F << 5) | (0 << 14) | (0 << 16) | (0 << 20) | (0 << 21); + brp[0].write = 1; + brp[0].address = ARM11_SC7_BVR0 + brp_num; + brp[0].value = bp->address; + brp[1].write = 1; + brp[1].address = ARM11_SC7_BCR0 + brp_num; + brp[1].value = 0x1 | (3 << 1) | (0x0F << 5) | (0 << 14) | (0 << 16) | (0 << 20) | (0 << 21); - arm11_sc7_run(arm11, brp, asizeof(brp)); + arm11_sc7_run(arm11, brp, asizeof(brp)); - LOG_DEBUG("Add BP " ZU " at %08x", brp_num, bp->address); + LOG_DEBUG("Add BP " ZU " at %08x", brp_num, bp->address); - brp_num++; - } + brp_num++; + } - arm11_sc7_set_vcr(arm11, arm11_vcr); + arm11_sc7_set_vcr(arm11, arm11_vcr); } arm11_leave_debug_state(arm11); @@ -850,18 +851,19 @@ while (1) { - u32 dscr = arm11_read_DSCR(arm11); + u32 dscr = arm11_read_DSCR(arm11); - LOG_DEBUG("DSCR %08x", dscr); + LOG_DEBUG("DSCR %08x", dscr); - if (dscr & ARM11_DSCR_CORE_RESTARTED) - break; + if (dscr & ARM11_DSCR_CORE_RESTARTED) + break; } if (!debug_execution) { - target->state = TARGET_RUNNING; + target->state = TARGET_RUNNING; target->debug_reason = DBG_REASON_NOTHALTED; + if((retval = target_call_event_callbacks(target, TARGET_EVENT_RESUMED)) != ERROR_OK) { return retval; @@ -869,7 +871,7 @@ } else { - target->state = TARGET_DEBUG_RUNNING; + target->state = TARGET_DEBUG_RUNNING; target->debug_reason = DBG_REASON_NOTHALTED; if((retval = target_call_event_callbacks(target, TARGET_EVENT_RESUMED)) != ERROR_OK) { @@ -887,18 +889,18 @@ FNC_INFO; LOG_DEBUG("target->state: %s", - Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name ); + Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name ); if (target->state != TARGET_HALTED) { - LOG_WARNING("target was not halted"); - return ERROR_TARGET_NOT_HALTED; + LOG_WARNING("target was not halted"); + return ERROR_TARGET_NOT_HALTED; } arm11_common_t * arm11 = target->arch_info; if (!current) - R(PC) = address; + R(PC) = address; LOG_INFO("STEP PC %08x%s", R(PC), !current ? "!" : ""); @@ -911,81 +913,92 @@ /* skip over BKPT */ if ((next_instruction & 0xFFF00070) == 0xe1200070) { - R(PC) += 4; - arm11->reg_list[ARM11_RC_PC].valid = 1; - arm11->reg_list[ARM11_RC_PC].dirty = 0; - LOG_INFO("Skipping BKPT"); + R(PC) += 4; + arm11->reg_list[ARM11_RC_PC].valid = 1; + arm11->reg_list[ARM11_RC_PC].dirty = 0; + LOG_INFO("Skipping BKPT"); } /* skip over Wait for interrupt / Standby */ /* mcr 15, 0, r?, cr7, cr0, {4} */ else if ((next_instruction & 0xFFFF0FFF) == 0xee070f90) { - R(PC) += 4; - arm11->reg_list[ARM11_RC_PC].valid = 1; - arm11->reg_list[ARM11_RC_PC].dirty = 0; - LOG_INFO("Skipping WFI"); + R(PC) += 4; + arm11->reg_list[ARM11_RC_PC].valid = 1; + arm11->reg_list[ARM11_RC_PC].dirty = 0; + LOG_INFO("Skipping WFI"); } /* ignore B to self */ else if ((next_instruction & 0xFEFFFFFF) == 0xeafffffe) { - LOG_INFO("Not stepping jump to self"); + LOG_INFO("Not stepping jump to self"); } else { - /** \todo TODO: check if break-/watchpoints make any sense at all in combination - * with this. */ + /** \todo TODO: check if break-/watchpoints make any sense at all in combination + * with this. */ - /** \todo TODO: check if disabling IRQs might be a good idea here. Alternatively - * the VCR might be something worth looking into. */ + /** \todo TODO: check if disabling IRQs might be a good idea here. Alternatively + * the VCR might be something worth looking into. */ - /* Set up breakpoint for stepping */ + /* Set up breakpoint for stepping */ - arm11_sc7_action_t brp[2]; + arm11_sc7_action_t brp[2]; - brp[0].write = 1; - brp[0].address = ARM11_SC7_BVR0; - brp[0].value = R(PC); - brp[1].write = 1; - brp[1].address = ARM11_SC7_BCR0; - brp[1].value = 0x1 | (3 << 1) | (0x0F << 5) | (0 << 14) | (0 << 16) | (0 << 20) | (2 << 21); + brp[0].write = 1; + brp[0].address = ARM11_SC7_BVR0; + brp[0].value = R(PC); + brp[1].write = 1; + brp[1].address = ARM11_SC7_BCR0; + brp[1].value = 0x1 | (3 << 1) | (0x0F << 5) | (0 << 14) | (0 << 16) | (0 << 20) | (2 << 21); - arm11_sc7_run(arm11, brp, asizeof(brp)); + arm11_sc7_run(arm11, brp, asizeof(brp)); - /* resume */ + /* resume */ - arm11_leave_debug_state(arm11); - arm11_add_IR(arm11, ARM11_RESTART, TAP_IDLE); + if (arm11_config_step_irq_enable) + R(DSCR) &= ~ARM11_DSCR_INTERRUPTS_DISABLE; /* should be redundant */ + else + R(DSCR) |= ARM11_DSCR_INTERRUPTS_DISABLE; + - if((retval = jtag_execute_queue()) != ERROR_OK) - { - return retval; - } + arm11_leave_debug_state(arm11); - /** \todo TODO: add a timeout */ + arm11_add_IR(arm11, ARM11_RESTART, TAP_IDLE); - /* wait for halt */ + if((retval = jtag_execute_queue()) != ERROR_OK) + { + return retval; + } - while (1) - { - u32 dscr = arm11_read_DSCR(arm11); + /** \todo TODO: add a timeout */ - LOG_DEBUG("DSCR %08x", dscr); + /* wait for halt */ - if ((dscr & (ARM11_DSCR_CORE_RESTARTED | ARM11_DSCR_CORE_HALTED)) == - (ARM11_DSCR_CORE_RESTARTED | ARM11_DSCR_CORE_HALTED)) - break; - } + while (1) + { + u32 dscr = arm11_read_DSCR(arm11); - /* clear breakpoint */ - arm11_sc7_clear_vbw(arm11); + LOG_DEBUG("DSCR %08x", dscr); - /* save state */ - arm11_on_enter_debug_state(arm11); + if ((dscr & (ARM11_DSCR_CORE_RESTARTED | ARM11_DSCR_CORE_HALTED)) == + (ARM11_DSCR_CORE_RESTARTED | ARM11_DSCR_CORE_HALTED)) + break; + } + + /* clear breakpoint */ + arm11_sc7_clear_vbw(arm11); + + /* save state */ + arm11_on_enter_debug_state(arm11); + + /* restore default state */ + R(DSCR) &= ~ARM11_DSCR_INTERRUPTS_DISABLE; + } -// target->state = TARGET_HALTED; + // target->state = TARGET_HALTED; target->debug_reason = DBG_REASON_SINGLESTEP; if((retval = target_call_event_callbacks(target, TARGET_EVENT_HALTED)) != ERROR_OK) @@ -1028,7 +1041,7 @@ #if 0 LOG_DEBUG("target->state: %s", - Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name ); + Jim_Nvp_value2name_simple( nvp_target_state, target->state )->name ); /* deassert reset lines */ @@ -1038,7 +1051,7 @@ arm11->trst_active = false; if (arm11->halt_requested) - return arm11_halt(target); + return arm11_halt(target); #endif return ERROR_OK; @@ -1064,7 +1077,7 @@ {size_t i; for (i = 16; i < 24; i++) { - (*reg_list)[i] = &arm11_gdb_dummy_fp_reg; + (*reg_list)[i] = &arm11_gdb_dummy_fp_reg; }} (*reg_list)[24] = &arm11_gdb_dummy_fps_reg; @@ -1072,19 +1085,19 @@ {size_t i; for (i = 0; i < ARM11_REGCACHE_COUNT; i++) { - if (arm11_reg_defs[i].gdb_num == -1) - continue; + if (arm11_reg_defs[i].gdb_num == -1) + continue; - (*reg_list)[arm11_reg_defs[i].gdb_num] = arm11->reg_list + i; + (*reg_list)[arm11_reg_defs[i].gdb_num] = arm11->reg_list + i; }} return ERROR_OK; } /* target memory access -* size: 1 = byte (8bit), 2 = half-word (16bit), 4 = word (32bit) -* count: number of items of <size> -*/ + * size: 1 = byte (8bit), 2 = half-word (16bit), 4 = word (32bit) + * count: number of items of <size> + */ int arm11_read_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer) { /** \todo TODO: check if buffer cast to u32* and u16* might cause alignment problems */ @@ -1093,8 +1106,8 @@ if (target->state != TARGET_HALTED) { - LOG_WARNING("target was not halted"); - return ERROR_TARGET_NOT_HALTED; + LOG_WARNING("target was not halted"); + return ERROR_TARGET_NOT_HALTED; } LOG_DEBUG("ADDR %08x SIZE %08x COUNT %08x", address, size, count); @@ -1109,52 +1122,58 @@ switch (size) { case 1: - /** \todo TODO: check if dirty is the right choice to force a rewrite on arm11_resume() */ - arm11->reg_list[ARM11_RC_R1].dirty = 1; + /** \todo TODO: check if dirty is the right choice to force a rewrite on arm11_resume() */ + arm11->reg_list[ARM11_RC_R1].dirty = 1; - {size_t i; - for (i = 0; i < count; i++) - { - /* ldrb r1, [r0], #1 */ - arm11_run_instr_no_data1(arm11, 0xe4d01001); + {size_t i; + for (i = 0; i < count; i++) + { + /* ldrb r1, [r0], #1 */ + /* ldrb r1, [r0] */ + arm11_run_instr_no_data1(arm11, + !arm11_config_memrw_no_increment ? 0xe4d01001 : 0xe5d01000); - u32 res; - /* MCR p14,0,R1,c0,c5,0 */ - arm11_run_instr_data_from_core(arm11, 0xEE001E15, &res, 1); + u32 res; + /* MCR p14,0,R1,c0,c5,0 */ + arm11_run_instr_data_from_core(arm11, 0xEE001E15, &res, 1); - *buffer++ = res; - }} + *buffer++ = res; + }} - break; + break; case 2: - { - arm11->reg_list[ARM11_RC_R1].dirty = 1; + { + arm11->reg_list[ARM11_RC_R1].dirty = 1; - u16 * buf16 = (u16*)buffer; + u16 * buf16 = (u16*)buffer; - {size_t i; - for (i = 0; i < count; i++) - { - /* ldrh r1, [r0], #2 */ - arm11_run_instr_no_data1(arm11, 0xe0d010b2); + {size_t i; + for (i = 0; i < count; i++) + { + /* ldrh r1, [r0], #2 */ + arm11_run_instr_no_data1(arm11, + !arm11_config_memrw_no_increment ? 0xe0d010b2 : 0xe1d010b0); - u32 res; + u32 res; - /* MCR p14,0,R1,c0,c5,0 */ - arm11_run_instr_data_from_core(arm11, 0xEE001E15, &res, 1); + /* MCR p14,0,R1,c0,c5,0 */ + arm11_run_instr_data_from_core(arm11, 0xEE001E15, &res, 1); - *buf16++ = res; - }} + *buf16++ = res; + }} - break; - } + break; + } case 4: - /* LDC p14,c5,[R0],#4 */ - arm11_run_instr_data_from_core(arm11, 0xecb05e01, (u32 *)buffer, count); - break; + /* LDC p14,c5,[R0],#4 */ + /* LDC p14,c5,[R0] */ + arm11_run_instr_data_from_core(arm11, + (!arm11_config_memrw_no_increment ? 0xecb05e01 : 0xed905e00), + (u32 *)buffer, count); + break; } arm11_run_instr_data_finish(arm11); @@ -1168,8 +1187,8 @@ if (target->state != TARGET_HALTED) { - LOG_WARNING("target was not halted"); - return ERROR_TARGET_NOT_HALTED; + LOG_WARNING("target was not halted"); + return ERROR_TARGET_NOT_HALTED; } LOG_DEBUG("ADDR %08x SIZE %08x COUNT %08x", address, size, count); @@ -1184,77 +1203,88 @@ switch (size) { case 1: - { - arm11->reg_list[ARM11_RC_R1].dirty = 1; + { + arm11->reg_list[ARM11_RC_R1].dirty = 1; - {size_t i; - for (i = 0; i < count; i++) - { - /* MRC p14,0,r1,c0,c5,0 */ - arm11_run_instr_data_to_core1(arm11, 0xee101e15, *buffer++); + {size_t i; + for (i = 0; i < count; i++) + { + /* MRC p14,0,r1,c0,c5,0 */ + arm11_run_instr_data_to_core1(arm11, 0xee101e15, *buffer++); - /* strb r1, [r0], #1 */ - arm11_run_instr_no_data1(arm11, 0xe4c01001); - }} + /* strb r1, [r0], #1 */ + /* strb r1, [r0] */ + arm11_run_instr_no_data1(arm11, + !arm11_config_memrw_no_increment ? 0xe4c01001 : 0xe5c01000); + }} - break; - } + break; + } case 2: - { - arm11->reg_list[ARM11_RC_R1].dirty = 1; + { + arm11->reg_list[ARM11_RC_R1].dirty = 1; - u16 * buf16 = (u16*)buffer; + u16 * buf16 = (u16*)buffer; - {size_t i; - for (i = 0; i < count; i++) - { - /* MRC p14,0,r1,c0,c5,0 */ - arm11_run_instr_data_to_core1(arm11, 0xee101e15, *buf16++); + {size_t i; + for (i = 0; i < count; i++) + { + /* MRC p14,0,r1,c0,c5,0 */ + arm11_run_instr_data_to_core1(arm11, 0xee101e15, *buf16++); - /* strh r1, [r0], #2 */ - arm11_run_instr_no_data1(arm11, 0xe0c010b2); - }} + /* strh r1, [r0], #2 */ + /* strh r1, [r0] */ + arm11_run_instr_no_data1(arm11, + !arm11_config_memrw_no_increment ? 0xe0c010b2 : 0xe1c010b0); + }} - break; - } + break; + } case 4: - /** \todo TODO: check if buffer cast to u32* might cause alignment problems */ + /** \todo TODO: check if buffer cast to u32* might cause alignment problems */ - if (!arm11_config_memwrite_burst) - { - /* STC p14,c5,[R0],#4 */ - arm11_run_instr_data_to_core(arm11, 0xeca05e01, (u32 *)buffer, count); - } - else - { - /* STC p14,c5,[R0],#4 */ - arm11_run_instr_data_to_core_noack(arm11, 0xeca05e01, (u32 *)buffer, count); - } + if (!arm11_config_memwrite_burst) + { + /* STC p14,c5,[R0],#4 */ + /* STC p14,c5,[R0]*/ + arm11_run_instr_data_to_core(arm11, + (!arm11_config_memrw_no_increment ? 0xeca05e01 : 0xed805e00), + (u32 *)buffer, count); + } + else + { + /* STC p14,c5,[R0],#4 */ + /* STC p14,c5,[R0]*/ + arm11_run_instr_data_to_core_noack(arm11, + (!arm11_config_memrw_no_increment ? 0xeca05e01 : 0xed805e00), + (u32 *)buffer, count); + } - break; + break; } #if 1 /* r0 verification */ + if (!arm11_config_memrw_no_increment) { - u32 r0; + u32 r0; - /* MCR p14,0,R0,c0,c5,0 */ - arm11_run_instr_data_from_core(arm11, 0xEE000E15, &r0, 1); + /* MCR p14,0,R0,c0,c5,0 */ + arm11_run_instr_data_from_core(arm11, 0xEE000E15, &r0, 1); - if (address + size * count != r0) - { - LOG_ERROR("Data transfer failed. (%d)", (r0 - address) - size * count); + if (address + size * count != r0) + { + LOG_ERROR("Data transfer failed. (%d)", (r0 - address) - size * count); - if (arm11_config_memwrite_burst) - LOG_ERROR("use 'arm11 memwrite burst disable' to disable fast burst mode"); + if (arm11_config_memwrite_burst) + LOG_ERROR("use 'arm11 memwrite burst disable' to disable fast burst mode"); - if (arm11_config_memwrite_error_fatal) - return ERROR_FAIL; + if (arm11_config_memwrite_error_fatal) + return ERROR_FAIL; + } } - } #endif arm11_run_instr_data_finish(arm11); @@ -1270,8 +1300,8 @@ if (target->state != TARGET_HALTED) { - LOG_WARNING("target was not halted"); - return ERROR_TARGET_NOT_HALTED; + LOG_WARNING("target was not halted"); + return ERROR_TARGET_NOT_HALTED; } return arm11_write_memory(target, address, 4, count, buffer); @@ -1296,21 +1326,21 @@ #if 0 if (breakpoint->type == BKPT_SOFT) { - LOG_INFO("sw breakpoint requested, but software breakpoints not enabled"); - return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; + LOG_INFO("sw breakpoint requested, but software breakpoints not enabled"); + return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; } #endif if (!arm11->free_brps) { - LOG_INFO("no breakpoint unit available for hardware breakpoint"); - return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; + LOG_INFO("no breakpoint unit available for hardware breakpoint"); + return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; } if (breakpoint->length != 4) { - LOG_INFO("only breakpoints of four bytes length supported"); - return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; + LOG_INFO("only breakpoints of four bytes length supported"); + return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; } arm11->free_brps--; @@ -1552,7 +1582,6 @@ { /* Initialize anything we can set up without talking to the target */ return arm11_build_reg_cache(target); - } /* talk to the target and set things up */ @@ -1565,7 +1594,7 @@ /* check IDCODE */ - arm11_add_IR(arm11, ARM11_IDCODE, TAP_INVALID); + arm11_add_IR(arm11, ARM11_IDCODE, ARM11_TAP_DEFAULT); scan_field_t idcode_field; @@ -1575,9 +1604,9 @@ /* check DIDR */ - arm11_add_debug_SCAN_N(arm11, 0x00, TAP_INVALID); + arm11_add_debug_SCAN_N(arm11, 0x00, ARM11_TAP_DEFAULT); - arm11_add_IR(arm11, ARM11_INTEST, TAP_INVALID); + arm11_add_IR(arm11, ARM11_INTEST, ARM11_TAP_DEFAULT); scan_field_t chain0_fields[2]; @@ -1605,13 +1634,12 @@ arm11->debug_version = (arm11->didr >> 16) & 0x0F; if (arm11->debug_version != ARM11_DEBUG_V6 && - arm11->debug_version != ARM11_DEBUG_V61) + arm11->debug_version != ARM11_DEBUG_V61) { - LOG_ERROR("Only ARMv6 v6 and v6.1 architectures supported."); - return ERROR_FAIL; + LOG_ERROR("Only ARMv6 v6 and v6.1 architectures supported."); + return ERROR_FAIL; } - arm11->brp = ((arm11->didr >> 24) & 0x0F) + 1; arm11->wrp = ((arm11->didr >> 28) & 0x0F) + 1; @@ -1620,9 +1648,9 @@ arm11->free_wrps = arm11->wrp; LOG_DEBUG("IDCODE %08x IMPLEMENTOR %02x DIDR %08x", - arm11->device_id, - arm11->implementor, - arm11->didr); + arm11->device_id, + arm11->implementor, + arm11->didr); /* as a side-effect this reads DSCR and thus * clears the ARM11_DSCR_STICKY_PRECISE_DATA_ABORT / Sticky Precise Data Abort Flag @@ -1652,8 +1680,8 @@ if (target->state != TARGET_HALTED) { - LOG_WARNING("target was not halted"); - return ERROR_TARGET_NOT_HALTED; + LOG_WARNING("target was not halted"); + return ERROR_TARGET_NOT_HALTED; } /** \todo TODO: Check this. We assume that all registers are fetched at debug entry. */ @@ -1686,8 +1714,8 @@ { arm11_common_t *arm11 = target->arch_info; - NEW(reg_cache_t, cache, 1); - NEW(reg_t, reg_list, ARM11_REGCACHE_COUNT); + NEW(reg_cache_t, cache, 1); + NEW(reg_t, reg_list, ARM11_REGCACHE_COUNT); NEW(arm11_reg_state_t, arm11_reg_states, ARM11_REGCACHE_COUNT); if (arm11_regs_arch_type == -1) @@ -1714,32 +1742,33 @@ /* Not very elegant assertion */ if (ARM11_REGCACHE_COUNT != asizeof(arm11->reg_values) || - ARM11_REGCACHE_COUNT != asizeof(arm11_reg_defs) || - ARM11_REGCACHE_COUNT != ARM11_RC_MAX) + ARM11_REGCACHE_COUNT != asizeof(arm11_reg_defs) || + ARM11_REGCACHE_COUNT != ARM11_RC_MAX) { - LOG_ERROR("BUG: arm11->reg_values inconsistent (%d " ZU " " ZU " %d)", ARM11_REGCACHE_COUNT, asizeof(arm11->reg_values), asizeof(arm11_reg_defs), ARM11_RC_MAX); - exit(-1); + LOG_ERROR("BUG: arm11->reg_values inconsistent (%d " ZU " " ZU " %d)", ARM11_REGCACHE_COUNT, asizeof(arm11->reg_values), asizeof(arm11_reg_defs), ARM11_RC_MAX); + exit(-1); } for (i = 0; i < ARM11_REGCACHE_COUNT; i++) { - reg_t * r = reg_list + i; - const arm11_reg_defs_t * rd = arm11_reg_defs + i; - arm11_reg_state_t * rs = arm11_reg_states + i; + reg_t * r = reg_list + i; + const arm11_reg_defs_t * rd = arm11_reg_defs + i; + arm11_reg_state_t * rs = arm11_reg_states + i; - r->name = rd->name; - r->size = 32; - r->value = (u8 *)(arm11->reg_values + i); - r->dirty = 0; - r->valid = 0; - r->bitfield_desc = NULL; - r->num_bitfields = 0; - r->arch_type = arm11_regs_arch_type; - r->arch_info = rs; + r->name = rd->name; + r->size = 32; + r->value = (u8 *)(arm11->reg_values + i); + r->dirty = 0; + r->valid = 0; + r->bitfield_desc = NULL; + r->num_bitfields = 0; + r->arch_type = arm11_regs_arch_type; + r->arch_info = rs; - rs->def_index = i; - rs->target = target; + rs->def_index = i; + rs->target = target; } + return ERROR_OK; } @@ -1747,12 +1776,12 @@ { if (argc == 0) { - LOG_INFO("%s is %s.", name, *var ? "enabled" : "disabled"); - return ERROR_OK; + LOG_INFO("%s is %s.", name, *var ? "enabled" : "disabled"); + return ERROR_OK; } if (argc != 1) - return ERROR_COMMAND_SYNTAX_ERROR; + return ERROR_COMMAND_SYNTAX_ERROR; switch (args[0][0]) { @@ -1761,16 +1790,16 @@ case 'F': case 'd': /* disable */ case 'D': - *var = false; - break; + *var = false; + break; case '1': /* 1 */ case 't': /* true */ case 'T': case 'e': /* enable */ case 'E': - *var = true; - break; + *var = true; + break; } LOG_INFO("%s %s.", *var ? "Enabled" : "Disabled", name); @@ -1797,18 +1826,20 @@ #define RC_FINAL_BOOL(name, descr, var) \ register_command(cmd_ctx, top_cmd, name, arm11_handle_bool_##var, COMMAND_ANY, descr); -BOOL_WRAPPER(memwrite_burst, "memory write burst mode") -BOOL_WRAPPER(memwrite_error_fatal, "fatal error mode for memory writes") +BOOL_WRAPPER(memwrite_burst, "memory write burst mode") +BOOL_WRAPPER(memwrite_error_fatal, "fatal error mode for memory writes") +BOOL_WRAPPER(memrw_no_increment, "\"no increment\" mode for memory transfers") +BOOL_WRAPPER(step_irq_enable, "IRQs while stepping") int arm11_handle_vcr(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { if (argc == 1) { - arm11_vcr = strtoul(args[0], NULL, 0); + arm11_vcr = strtoul(args[0], NULL, 0); } else if (argc != 0) { - return ERROR_COMMAND_SYNTAX_ERROR; + return ERROR_COMMAND_SYNTAX_ERROR; } LOG_INFO("VCR 0x%08X", arm11_vcr); @@ -1817,11 +1848,11 @@ const u32 arm11_coproc_instruction_limits[] = { - 15, /* coprocessor */ - 7, /* opcode 1 */ - 15, /* CRn */ - 15, /* CRm */ - 7, /* opcode 2 */ + 15, /* coprocessor */ + 7, /* opcode 1 */ + 15, /* CRn */ + 15, /* CRm */ + 7, /* opcode 2 */ 0xFFFFFFFF, /* value */ }; @@ -1830,22 +1861,24 @@ arm11_common_t * arm11_find_target(const char * arg) { - jtag_tap_t *tap; - target_t * t; + jtag_tap_t * tap; + target_t * t; - tap = jtag_TapByString( arg ); - if( !tap ){ - return NULL; + tap = jtag_TapByString(arg); + + if (!tap) + return 0; + + for (t = all_targets; t; t = t->next) + { + if (t->tap != tap) + continue; + + /* if (t->type == arm11_target) */ + if (0 == strcmp(t->type->name, "arm11")) + return t->arch_info; } - for (t = all_targets; t; t = t->next){ - if( t->tap == tap ){ - if( 0 == strcmp(t->type->name,"arm11")){ - arm11_common_t * arm11 = t->arch_info; - return arm11; - } - } - } return 0; } @@ -1853,25 +1886,24 @@ { if (argc != (read ? 6 : 7)) { - LOG_ERROR("Invalid number of arguments. %s", read ? arm11_mrc_syntax : arm11_mcr_syntax); - return -1; + LOG_ERROR("Invalid number of arguments. %s", read ? arm11_mrc_syntax : arm11_mcr_syntax); + return -1; } arm11_common_t * arm11 = arm11_find_target(args[0]); if (!arm11) { - LOG_ERROR("Parameter 1 is not a the JTAG chain position of an ARM11 device. %s", - read ? arm11_mrc_syntax : arm11_mcr_syntax); + LOG_ERROR("Parameter 1 is not a the JTAG chain position of an ARM11 device. %s", + read ? arm11_mrc_syntax : arm11_mcr_syntax); - return -1; - + return -1; } if (arm11->target->state != TARGET_HALTED) { - LOG_WARNING("target was not halted"); - return ERROR_TARGET_NOT_HALTED; + LOG_WARNING("target was not halted"); + return ERROR_TARGET_NOT_HALTED; } u32 values[6]; @@ -1879,45 +1911,45 @@ {size_t i; for (i = 0; i < (read ? 5 : 6); i++) { - values[i] = strtoul(args[i + 1], NULL, 0); + values[i] = strtoul(args[i + 1], NULL, 0); - if (values[i] > arm11_coproc_instruction_limits[i]) - { - LOG_ERROR("Parameter %ld out of bounds (%d max). %s", - (long)(i + 2), arm11_coproc_instruction_limits[i], - read ? arm11_mrc_syntax : arm11_mcr_syntax); - return -1; - } + if (values[i] > arm11_coproc_instruction_limits[i]) + { + LOG_ERROR("Parameter %ld out of bounds (%d max). %s", + (long)(i + 2), arm11_coproc_instruction_limits[i], + read ? arm11_mrc_syntax : arm11_mcr_syntax); + return -1; + } }} u32 instr = 0xEE000010 | - (values[0] << 8) | - (values[1] << 21) | - (values[2] << 16) | - (values[3] << 0) | - (values[4] << 5); + (values[0] << 8) | + (values[1] << 21) | + (values[2] << 16) | + (values[3] << 0) | + (values[4] << 5); if (read) - instr |= 0x00100000; + instr |= 0x00100000; arm11_run_instr_data_prepare(arm11); if (read) { - u32 result; - arm11_run_instr_data_from_core_via_r0(arm11, instr, &result); + u32 result; + arm11_run_instr_data_from_core_via_r0(arm11, instr, &result); - LOG_INFO("MRC p%d, %d, R0, c%d, c%d, %d = 0x%08x (%d)", - values[0], values[1], values[2], values[3], values[4], result, result); + LOG_INFO("MRC p%d, %d, R0, c%d, c%d, %d = 0x%08x (%d)", + values[0], values[1], values[2], values[3], values[4], result, result); } else { - arm11_run_instr_data_to_core_via_r0(arm11, instr, values[5]); + arm11_run_instr_data_to_core_via_r0(arm11, instr, values[5]); - LOG_INFO("MRC p%d, %d, R0 (#0x%08x), c%d, c%d, %d", - values[0], values[1], - values[5], - values[2], values[3], values[4]); + LOG_INFO("MRC p%d, %d, R0 (#0x%08x), c%d, c%d, %d", + values[0], values[1], + values[5], + values[2], values[3], values[4]); } arm11_run_instr_data_finish(arm11); @@ -1942,25 +1974,30 @@ command_t * top_cmd = NULL; - RC_TOP( "arm11", "arm11 specific commands", + RC_TOP( "arm11", "arm11 specific commands", - RC_TOP( "memwrite", "Control memory write transfer mode", + RC_TOP( "memwrite", "Control memory write transfer mode", - RC_FINAL_BOOL( "burst", "Enable/Disable non-standard but fast burst mode (default: enabled)", + RC_FINAL_BOOL( "burst", "Enable/Disable non-standard but fast burst mode (default: enabled)", memwrite_burst) - RC_FINAL_BOOL( "error_fatal", - "Terminate program if transfer error was found (default: enabled)", + RC_FINAL_BOOL( "error_fatal", "Terminate program if transfer error was found (default: enabled)", memwrite_error_fatal) ) - RC_FINAL( "vcr", "Control (Interrupt) Vector Catch Register", + RC_FINAL_BOOL( "no_increment", "Don't increment address on multi-read/-write (default: disabled)", + memrw_no_increment) + + RC_FINAL_BOOL( "step_irq_enable", "Enable interrupts while stepping (default: disabled)", + step_irq_enable) + + RC_FINAL( "vcr", "Control (Interrupt) Vector Catch Register", arm11_handle_vcr) - RC_FINAL( "mrc", "Read Coprocessor register", + RC_FINAL( "mrc", "Read Coprocessor register", arm11_handle_mrc) - RC_FINAL( "mcr", "Write Coprocessor register", + RC_FINAL( "mcr", "Write Coprocessor register", arm11_handle_mcr) ) Modified: trunk/src/target/arm11.h =================================================================== --- trunk/src/target/arm11.h 2009-04-22 17:36:00 UTC (rev 1511) +++ trunk/src/target/arm11.h 2009-04-22 18:39:59 UTC (rev 1512) @@ -45,9 +45,12 @@ #define ARM11_REGCACHE_FREGS 0 #define ARM11_REGCACHE_COUNT (20 + \ - 23 * ARM11_REGCACHE_MODEREGS + \ + 23 * ARM11_REGCACHE_MODEREGS + \ 9 * ARM11_REGCACHE_FREGS) +#define ARM11_TAP_DEFAULT TAP_INVALID + + typedef struct arm11_register_history_s { u32 value; @@ -56,17 +59,17 @@ enum arm11_debug_version { - ARM11_DEBUG_V6 = 0x01, - ARM11_DEBUG_V61 = 0x02, - ARM11_DEBUG_V7 = 0x03, - ARM11_DEBUG_V7_CP14 = 0x04, + ARM11_DEBUG_V6 = 0x01, + ARM11_DEBUG_V61 = 0x02, + ARM11_DEBUG_V7 = 0x03, + ARM11_DEBUG_V7_CP14 = 0x04, }; typedef struct arm11_common_s { - target_t * target; + target_t * target; /**< Reference back to the owner */ - arm_jtag_t jtag_info; + arm_jtag_t jtag_info; /**< Handler to access assigned JTAG device */ /** \name Processor type detection */ /*@{*/ @@ -83,11 +86,13 @@ /*@}*/ u32 last_dscr; /**< Last retrieved DSCR value; - * Can be used to detect changes */ + Use only for debug message generation */ bool trst_active; - bool halt_requested; - bool simulate_reset_on_next_halt; + bool halt_requested; /**< Keep track if arm11_halt() calls occured + during reset. Otherwise do it ASAP. */ + + bool simulate_reset_on_next_halt; /**< Perform cleanups of the ARM state on next halt */ /** \name Shadow registers to save processor state */ /*@{*/ @@ -127,23 +132,24 @@ enum arm11_dscr { - ARM11_DSCR_CORE_HALTED = 1 << 0, - ARM11_DSCR_CORE_RESTARTED = 1 << 1, + ARM11_DSCR_CORE_HALTED = 1 << 0, + ARM11_DSCR_CORE_RESTARTED = 1 << 1, - ARM11_DSCR_METHOD_OF_DEBUG_ENTRY_MASK = 0x0F << 2, - ARM11_DSCR_METHOD_OF_DEBUG_ENTRY_HALT = 0x00 << 2, - ARM11_DSCR_METHOD_OF_DEBUG_ENTRY_BREAKPOINT = 0x01 << 2, - ARM11_DSCR_METHOD_OF_DEBUG_ENTRY_WATCHPOINT = 0x02 << 2, - ARM11_DSCR_METHOD_OF_DEBUG_ENTRY_BKPT_INSTRUCTION = 0x03 << 2, - ARM11_DSCR_METHOD_OF_DEBUG_ENTRY_EDBGRQ = 0x04 << 2, - ARM11_DSCR_METHOD_OF_DEBUG_ENTRY_VECTOR_CATCH = 0x05 << 2, + ARM11_DSCR_METHOD_OF_DEBUG_ENTRY_MASK = 0x0F << 2, + ARM11_DSCR_METHOD_OF_DEBUG_ENTRY_HALT = 0x00 << 2, + ARM11_DSCR_METHOD_OF_DEBUG_ENTRY_BREAKPOINT = 0x01 << 2, + ARM11_DSCR_METHOD_OF_DEBUG_ENTRY_WATCHPOINT = 0x02 << 2, + ARM11_DSCR_METHOD_OF_DEBUG_ENTRY_BKPT_INSTRUCTION = 0x03 << 2, + ARM11_DSCR_METHOD_OF_DEBUG_ENTRY_EDBGRQ = 0x04 << 2, + ARM11_DSCR_METHOD_OF_DEBUG_ENTRY_VECTOR_CATCH = 0x05 << 2, - ARM11_DSCR_STICKY_PRECISE_DATA_ABORT = 1 << 6, - ARM11_DSCR_STICKY_IMPRECISE_DATA_ABORT = 1 << 7, - ARM11_DSCR_EXECUTE_ARM_INSTRUCTION_ENABLE = 1 << 13, - ARM11_DSCR_MODE_SELECT = 1 << 14, - ARM11_DSCR_WDTR_FULL = 1 << 29, - ARM11_DSCR_RDTR_FULL = 1 << 30, + ARM11_DSCR_STICKY_PRECISE_DATA_ABORT = 1 << 6, + ARM11_DSCR_STICKY_IMPRECISE_DATA_ABORT = 1 << 7, + ARM11_DSCR_INTERRUPTS_DISABLE = 1 << 11, + ARM11_DSCR_EXECUTE_ARM_INSTRUCTION_ENABLE = 1 << 13, + ARM11_DSCR_MODE_SELECT = 1 << 14, + ARM11_DSCR_WDTR_FULL = 1 << 29, + ARM11_DSCR_RDTR_FULL = 1 << 30, }; enum arm11_cpsr @@ -229,23 +235,23 @@ /* internals */ -void arm11_setup_field (arm11_common_t * arm11, int num_bits, void * in_data, void * out_data, scan_field_t * field); -void arm11_add_IR (arm11_common_t * arm11, u8 instr, tap_state_t state); -void arm11_add_debug_SCAN_N (arm11_common_t * arm11, u8 chain, tap_state_t state); -void arm11_add_debug_INST (arm11_common_t * arm11, u32 inst, u8 * flag, tap_state_t state); -u32 arm11_read_DSCR (arm11_common_t * arm11); -void arm11_write_DSCR (arm11_common_t * arm11, u32 dscr); +void arm11_setup_field (arm11_common_t * arm11, int num_bits, void * in_data, void * out_data, scan_field_t * field); +void arm11_add_IR (arm11_common_t * arm11, u8 instr, tap_state_t state); +void arm11_add_debug_SCAN_N (arm11_common_t * arm11, u8 chain, tap_state_t state); +void arm11_add_debug_INST (arm11_common_t * arm11, u32 inst, u8 * flag, tap_state_t state); +u32 arm11_read_DSCR (arm11_common_t * arm11); +void arm11_write_DSCR (arm11_common_t * arm11, u32 dscr); enum target_debug_reason arm11_get_DSCR_debug_reason(u32 dscr); -void arm11_run_instr_data_prepare (arm11_common_t * arm11); -void arm11_run_instr_data_finish (arm11_common_t * arm11); -void arm11_run_instr_no_data (arm11_common_t * arm11, u32 * opcode, size_t count); -void arm11_run_instr_no_data1 (arm11_common_t * arm11, u32 opcode); -void arm11_run_instr_data_to_core (arm11_common_t * arm11, u32 opcode, u32 * data, size_t count); +void arm11_run_instr_data_prepare (arm11_common_t * arm11); +void arm11_run_instr_data_finish (arm11_common_t * arm11); +void arm11_run_instr_no_data (arm11_common_t * arm11, u32 * opcode, size_t count); +void arm11_run_instr_no_data1 (arm11_common_t * arm11, u32 opcode); +void arm11_run_instr_data_to_core (arm11_common_t * arm11, u32 opcode, u32 * data, size_t count); void arm11_run_instr_data_to_core_noack (arm11_common_t * arm11, u32 opcode, u32 * data, size_t count); -void arm11_run_instr_data_to_core1 (arm11_common_t * arm11, u32 opcode, u32 data); -void arm11_run_instr_data_from_core (arm11_common_t * arm11, u32 opcode, u32 * data, size_t count); +void arm11_run_instr_data_to_core1 (arm11_common_t * arm11, u32 opcode, u32 data); +void arm11_run_instr_data_from_core (arm11_common_t * arm11, u32 opcode, u32 * data, size_t count); void arm11_run_instr_data_from_core_via_r0 (arm11_common_t * arm11, u32 opcode, u32 * data); void arm11_run_instr_data_to_core_via_r0 (arm11_common_t * arm11, u32 opcode, u32 data); @@ -259,10 +265,10 @@ typedef struct arm11_sc7_action_s { bool write; /**< Access mode: true for write, false for read. */ - u8 address; /**< Register address mode. Use enum #arm11_sc7 */ + u8 address; /**< Register address mode. Use enum #arm11_sc7 */ u32 value; /**< If write then set this to value to be written. - In read mode this receives the read value when the - function returns. */ + In read mode this receives the read value when the + function returns. */ } arm11_sc7_action_t; void arm11_sc7_run(arm11_common_t * arm11, arm11_sc7_action_t * actions, size_t count); Modified: trunk/src/target/arm11_dbgtap.c =================================================================== --- trunk/src/target/arm11_dbgtap.c 2009-04-22 17:36:00 UTC (rev 1511) +++ trunk/src/target/arm11_dbgtap.c 2009-04-22 18:39:59 UTC (rev 1512) @@ -44,83 +44,79 @@ int arm11_add_ir_scan_vc(int num_fields, scan_field_t *fields, tap_state_t state) { - if (cmd_queue_cur_state == TAP_IRPAUSE) - jtag_add_pathmove(asizeof(arm11_move_pi_to_si_via_ci), arm11_move_pi_to_si_via_ci); + if (cmd_queue_cur_state == TAP_IRPAUSE) + jtag_add_pathmove(asizeof(arm11_move_pi_to_si_via_ci), arm11_move_pi_to_si_via_ci); - jtag_add_ir_scan(num_fields, fields, state); - return ERROR_OK; + jtag_add_ir_scan(num_fields, fields, state); + return ERROR_OK; } tap_state_t arm11_move_pd_to_sd_via_cd[] = { - TAP_DREXIT2, TAP_DRUPDATE, TAP_DRSELECT, TAP_DRCAPTURE, TAP_DRSHIFT + TAP_DREXIT2, TAP_DRUPDATE, TAP_DRSELECT, TAP_DRCAPTURE, TAP_DRSHIFT }; int arm11_add_dr_scan_vc(int num_fields, scan_field_t *fields, tap_state_t state) { - if (cmd_queue_cur_state == TAP_DRPAUSE) - jtag_add_pathmove(asizeof(arm11_move_pd_to_sd_via_cd), arm11_move_pd_to_sd_via_cd); + if (cmd_queue_cur_state == TAP_DRPAUSE) + jtag_add_pathmove(asizeof(arm11_move_pd_to_sd_via_cd), arm11_move_pd_to_sd_via_cd); - jtag_add_dr_scan(num_fields, fields, state); - return ERROR_OK; + jtag_add_dr_scan(num_fields, fields, state); + return ERROR_OK; } /** Code de-clutter: Construct scan_field_t to write out a value * - * \param arm11 Target state variable. - * \param num_bits Length of the data field - * \param out_data pointer to the data that will be sent out - * <em>(data is read when it is added to the JTAG queue)</em> - * \param in_data pointer to the memory that will receive data that was clocked in - * <em>(data is written when the JTAG queue is executed)</em> - * \param field target data structure that will be initialized + * \param arm11 Target state variable. + * \param num_bits Length of the data field + * \param out_data pointer to the data that will be sent out + * <em>(data is read when it is added to the JTAG queue)</em> + * \param in_data pointer to the memory that will receive data that was clocked in + * <em>(data is written when the JTAG queue is executed)</em> + * \param field target data structure that will be initialized */ void arm11_setup_field(arm11_common_t * arm11, int num_bits, void * out_data, void * in_data, scan_field_t * field) { - field->tap = arm11->jtag_info.tap; - field->num_bits = num_bits; - field->out_mask = NULL; - field->in_check_mask = NULL; - field->in_check_value = NULL; - field->in_handler = NULL; - field->in_handler_priv = NULL; + field->tap = arm11->jtag_info.tap; + field->num_bits = num_bits; + field->out_mask = NULL; + field->in_check_mask = NULL; + field->in_check_value = NULL; + field->in_handler = NULL; + field->in_handler_priv = NULL; - field->out_value = out_data; - field->in_value = in_data; + field->out_value = out_data; + field->in_value = in_data; } /** Write JTAG instruction register * - * \param arm11 Target state variable. - * \param instr An ARM11 DBGTAP instruction. Use enum #arm11_instructions. - * \param state Pass the final TAP state or TAP_INVALID for the default value (Pause-IR). + * \param arm11 Target state variable. + * \param instr An ARM11 DBGTAP instruction. Use enum #arm11_instructions. + * \param state Pass the final TAP state or ARM11_TAP_DEFAULT for the default value (Pause-IR). * - * \remarks This adds to the JTAG command queue but does \em not execute it. + * \remarks This adds to the JTAG command queue but does \em not execute it. */ void arm11_add_IR(arm11_common_t * arm11, u8 instr, tap_state_t state) { jtag_tap_t *tap; tap = arm11->jtag_info.tap; - if( tap == NULL ){ - /* FIX!!!! error is logged, but not propagated back up the call stack... */ - LOG_ERROR( "tap is null here! This is bad!"); - return; - } - if (buf_get_u32(tap->cur_instr, 0, 5) == instr){ + if (buf_get_u32(tap->cur_instr, 0, 5) == instr) + { JTAG_DEBUG("IR <= 0x%02x SKIPPED", instr); return; - } + } - JTAG_DEBUG("IR <= 0x%02x", instr); + JTAG_DEBUG("IR <= 0x%02x", instr); - scan_field_t field; + scan_field_t field; - arm11_setup_field(arm11, 5, &instr, NULL, &field); + arm11_setup_field(arm11, 5, &instr, NULL, &field); - arm11_add_ir_scan_vc(1, &field, state == TAP_INVALID ? TAP_IRPAUSE : state); + arm11_add_ir_scan_vc(1, &field, state == ARM11_TAP_DEFAULT ? TAP_IRPAUSE : state); } /** Verify shifted out data from Scan Chain Register (SCREG) @@ -130,17 +126,17 @@ */ static int arm11_in_handler_SCAN_N(u8 *in_value, void *priv, struct scan_field_s *field) { - /** \todo TODO: clarify why this isnt properly masked in jtag.c jtag_read_buffer() */ - u8 v = *in_value & 0x1F; + /** \todo TODO: clarify why this isnt properly masked in jtag.c jtag_read_buffer() */ + u8 v = *in_value & 0x1F; - if (v != 0x10) - { - LOG_ERROR("'arm11 target' JTAG communication error SCREG SCAN OUT 0x%02x (expected 0x10)", v); - return ERROR_FAIL; - } + if (v != 0x10) + { + LOG_ERROR("'arm11 target' JTAG communication error SCREG SCAN OUT 0x%02x (expected 0x10)", v); + return ERROR_FAIL; + } - JTAG_DEBUG("SCREG SCAN OUT 0x%02x", v); - return ERROR_OK; + JTAG_DEBUG("SCREG SCAN OUT 0x%02x", v); + return ERROR_OK; } /** Select and write to Scan Chain Register (SCREG) @@ -152,165 +148,165 @@ * * \param arm11 Target state variable. * \param chain Scan chain that will be selected. - * \param state Pass the final TAP state or TAP_INVALID for the default - * value (Pause-DR). + * \param state Pass the final TAP state or ARM11_TAP_DEFAULT for the default + * value (Pause-DR). * * The chain takes effect when Update-DR is passed (usually when subsequently * the INTEXT/EXTEST instructions are written). * - * \warning (Obsolete) Using this twice in a row will \em fail. The first call will end - * in Pause-DR. The second call, due to the IR caching, will not - * go through Capture-DR when shifting in the new scan chain number. - * As a result the verification in arm11_in_handler_SCAN_N() must - * fail. + * \warning (Obsolete) Using this twice in a row will \em fail. The first + * call will end in Pause-DR. The second call, due to the IR + * caching, will not go through Capture-DR when shifting in the + * new scan chain number. As a result the verification in + * arm11_in_handler_SCAN_N() must fail. * - * \remarks This adds to the JTAG command queue but does \em not execute it. + * \remarks This adds to the JTAG command queue but does \em not execute it. */ void arm11_add_debug_SCAN_N(arm11_common_t * arm11, u8 chain, tap_state_t state) { - JTAG_DEBUG("SCREG <= 0x%02x", chain); + JTAG_DEBUG("SCREG <= 0x%02x", chain); - arm11_add_IR(arm11, ARM11_SCAN_N, TAP_INVALID); + arm11_add_IR(arm11, ARM11_SCAN_N, ARM11_TAP_DEFAULT); - scan_field_t field; + scan_field_t field; - arm11_setup_field(arm11, 5, &chain, NULL, &field); + arm11_setup_field(arm11, 5, &chain, NULL, &field); - field.in_handler = arm11_in_handler_SCAN_N; + field.in_handler = arm11_in_handler_SCAN_N; - arm11_add_dr_scan_vc(1, &field, state == TAP_INVALID ? TAP_DRPAUSE : state); + arm11_add_dr_scan_vc(1, &field, state == ARM11_TAP_DEFAULT ? TAP_DRPAUSE : state); } /** Write an instruction into the ITR register * - * \param arm11 Target state variable. - * \param inst An ARM11 processor instruction/opcode. - * \param flag Optional parameter to retrieve the InstCompl flag - * (this will be written when the JTAG chain is executed). - * \param state Pass the final TAP state or TAP_INVALID for the default - * value (Run-Test/Idle). + * \param arm11 Target state variable. + * \param inst An ARM11 processor instruction/opcode. + * \param flag Optional parameter to retrieve the InstCompl flag + * (this will be written when the JTAG chain is executed). + * \param state Pass the final TAP state or ARM11_TAP_DEFAULT for the default + * value (Run-Test/Idle). * - * \remarks By default this ends with Run-Test/Idle state - * and causes the instruction to be executed. If - * a subsequent write to DTR is needed before - * executing the instruction then TAP_DRPAUSE should be - * passed to \p state. + * \remarks By default this ends with Run-Test/Idle state + * and causes the instruction to be executed. If + * a subsequent write to DTR is needed before + * executing the instruction then TAP_DRPAUSE should be + * passed to \p state. * - * \remarks This adds to the JTAG command queue but does \em not execute it. + * \remarks This adds to the JTAG command queue but does \em not execute it. */ void arm11_add_debug_INST(arm11_common_t * arm11, u32 inst, u8 * flag, tap_state_t state) { - JTAG_DEBUG("INST <= 0x%08x", inst); + JTAG_DEBUG("INST <= 0x%08x", inst); - scan_field_t itr[2]; + scan_field_t itr[2]; - arm11_setup_field(arm11, 32, &inst, NULL, itr + 0); - arm11_setup_field(arm11, 1, NULL, flag, itr + 1); + arm11_setup_field(arm11, 32, &inst, NULL, itr + 0); + arm11_setup_field(arm11, 1, NULL, flag, itr + 1); - arm11_add_dr_scan_vc(asizeof(itr), itr, state == TAP_INVALID ? TAP_IDLE : state); + arm11_add_dr_scan_vc(asizeof(itr), itr, state == ARM11_TAP_DEFAULT ? TAP_IDLE : state); } /** Read the Debug Status and Control Register (DSCR) * * same as CP14 c1 * - * \param arm11 Target state variable. - * \return DSCR content + * \param arm11 Target state variable. + * \return DSCR content * - * \remarks This is a stand-alone function that executes the JTAG command queue. + * \remarks This is a stand-alone function that executes the JTAG command queue. */ u32 arm11_read_DSCR(arm11_common_t * arm11) { - arm11_add_debug_SCAN_N(arm11, 0x01, TAP_INVALID); + arm11_add_debug_SCAN_N(arm11, 0x01, ARM11_TAP_DEFAULT); - arm11_add_IR(arm11, ARM11_INTEST, TAP_INVALID); + arm11_add_IR(arm11, ARM11_INTEST, ARM11_TAP_DEFAULT); - u32 dscr; - scan_field_t chain1_field; + u32 dscr; + scan_field_t chain1_field; - arm11_setup_field(arm11, 32, NULL, &dscr, &chain1_field); + arm11_setup_field(arm11, 32, NULL, &dscr, &chain1_field); - arm11_add_dr_scan_vc(1, &chain1_field, TAP_DRPAUSE); + arm11_add_dr_scan_vc(1, &chain1_field, TAP_DRPAUSE); - jtag_execute_queue(); + jtag_execute_queue(); - if (arm11->last_dscr != dscr) - JTAG_DEBUG("DSCR = %08x (OLD %08x)", dscr, arm11->last_dscr); + if (arm11->last_dscr != dscr) + JTAG_DEBUG("DSCR = %08x (OLD %08x)", dscr, arm11->last_dscr); - arm11->last_dscr = dscr; + arm11->last_dscr = dscr; - return dscr; + return dscr; } /** Write the Debug Status and Control Register (DSCR) * * same as CP14 c1 * - * \param arm11 Target state variable. - * \param dscr DSCR content + * \param arm11 Target state variable. + * \param dscr DSCR content * - * \remarks This is a stand-alone function that executes the JTAG command queue. + * \remarks This is a stand-alone function that executes the JTAG command queue. */ void arm11_write_DSCR(arm11_common_t * arm11, u32 dscr) { - arm11_add_debug_SCAN_N(arm11, 0x01, TAP_INVALID); + arm11_add_debug_SCAN_N(arm11, 0x01, ARM11_TAP_DEFAULT); - arm11_add_IR(arm11, ARM11_EXTEST, TAP_INVALID); + arm11_add_IR(arm11, ARM11_EXTEST, ARM11_TAP_DEFAULT); - scan_field_t chain1_field; + scan_field_t chain1_field; - arm11_setup_field(arm11, 32, &dscr, NULL, &chain1_field); + arm11_setup_field(arm11, 32, &dscr, NULL, &chain1_field); - arm11_add_dr_scan_vc(1, &chain1_field, TAP_DRPAUSE); + arm11_add_dr_scan_vc(1, &chain1_field, TAP_DRPAUSE); - jtag_execute_queue(); + jtag_execute_queue(); - JTAG_DEBUG("DSCR <= %08x (OLD %08x)", dscr, arm11->last_dscr); + JTAG_DEBUG("DSCR <= %08x (OLD %08x)", dscr, arm11->last_dscr); - arm11->last_dscr = dscr; + arm11->last_dscr = dscr; } /** Get the debug reason from Debug Status and Control Register (DSCR) * - * \param dscr DSCR value to analyze - * \return Debug reason + * \param dscr DSCR value to analyze + * \return Debug reason * */ enum target_debug_reason arm11_get_DSCR_debug_reason(u32 dscr) { - switch (dscr & ARM11_DSCR_METHOD_OF_DEBUG_ENTRY_MASK) - { - case ARM11_DSCR_METHOD_OF_DEBUG_ENTRY_HALT: - LOG_INFO("Debug entry: JTAG HALT"); - return DBG_REASON_DBGRQ; + switch (dscr & ARM11_DSCR_METHOD_OF_DEBUG_ENTRY_MASK) + { + case ARM11_DSCR_METHOD_OF_DEBUG_ENTRY_HALT: + LOG_INFO("Debug entry: JTAG HA... [truncated message content] |
From: <oh...@ma...> - 2009-04-22 19:36:04
|
Author: oharboe Date: 2009-04-22 19:36:00 +0200 (Wed, 22 Apr 2009) New Revision: 1511 Modified: trunk/src/server/server.c Log: Michael Bruck <mb...@di...> signed/unsigned incompatibility warning Modified: trunk/src/server/server.c =================================================================== --- trunk/src/server/server.c 2009-04-22 17:10:12 UTC (rev 1510) +++ trunk/src/server/server.c 2009-04-22 17:36:00 UTC (rev 1511) @@ -58,7 +58,7 @@ int add_connection(service_t *service, command_context_t *cmd_ctx) { - unsigned int address_size; + socklen_t address_size; connection_t *c, **p; int retval; int flag=1; @@ -422,7 +422,7 @@ if (service->type != CONNECTION_PIPE) { struct sockaddr_in sin; - unsigned int address_size = sizeof(sin); + socklen_t address_size = sizeof(sin); int tmp_fd; tmp_fd = accept(service->fd, (struct sockaddr *)&service->sin, &address_size); close_socket(tmp_fd); |
From: <oh...@ma...> - 2009-04-22 19:10:28
|
Author: oharboe Date: 2009-04-22 19:10:12 +0200 (Wed, 22 Apr 2009) New Revision: 1510 Modified: trunk/configure.in Log: Michael Bruck spotted a typo in help messages Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2009-04-22 13:54:04 UTC (rev 1509) +++ trunk/configure.in 2009-04-22 17:10:12 UTC (rev 1510) @@ -218,7 +218,7 @@ [Enable verbose USB communication messages (for debugging)]), [debug_usb_comms=$enableval], []) -AC_MSG_CHECKING([whether to enable verbose JTAB I/O messages]); +AC_MSG_CHECKING([whether to enable verbose JTAG I/O messages]); AC_MSG_RESULT($debug_jtag_io) if test $debug_jtag_io = yes; then AC_DEFINE([_DEBUG_JTAG_IO_],[1], [Print verbose JTAG I/O messages]) |
From: oharboe at B. <oh...@ma...> - 2009-04-22 15:54:04
|
Author: oharboe Date: 2009-04-22 15:54:04 +0200 (Wed, 22 Apr 2009) New Revision: 1509 Modified: trunk/src/jtag/jlink.c Log: Zach Welch <zw...@su...> do not pad TMS Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2009-04-22 11:37:27 UTC (rev 1508) +++ trunk/src/jtag/jlink.c 2009-04-22 13:54:04 UTC (rev 1509) @@ -623,6 +623,10 @@ int bit_index = tap_length % 8; u8 bit = 1 << bit_index; + // we do not pad TMS, so be sure to initialize all bits + if (0 == bit_index) + tms_buffer[index] = tdi_buffer[index] = 0; + if (tms) tms_buffer[index] |= bit; else @@ -669,16 +673,9 @@ if (!tap_length) return ERROR_OK; - /* Pad last byte so that tap_length is divisible by 8 */ - while (tap_length % 8 != 0) - { - /* More of the last TMS value keeps us in the same state, - * analogous to free-running JTAG interfaces. */ - jlink_tap_append_step(last_tms, 0); - } + // number of full bytes (plus one if some would be left over) + byte_length = tap_length / 8 + !!(tap_length % 8); - byte_length = tap_length / 8; - usb_out_buffer[0] = EMU_CMD_HW_JTAG3; usb_out_buffer[1] = 0; usb_out_buffer[2] = (tap_length >> 0) & 0xff; |
From: oharboe at B. <oh...@ma...> - 2009-04-22 13:37:29
|
Author: oharboe Date: 2009-04-22 13:37:27 +0200 (Wed, 22 Apr 2009) New Revision: 1508 Modified: trunk/src/jtag/jlink.c Log: Zach Welch <zw...@su...> set speed in init Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2009-04-22 10:59:23 UTC (rev 1507) +++ trunk/src/jtag/jlink.c 2009-04-22 11:37:27 UTC (rev 1508) @@ -329,6 +329,7 @@ jlink_reset(0, 0); jlink_tap_init(); + jlink_speed(jtag_speed); return ERROR_OK; } |
From: oharboe at B. <oh...@ma...> - 2009-04-22 12:59:33
|
Author: oharboe Date: 2009-04-22 12:59:23 +0200 (Wed, 22 Apr 2009) New Revision: 1507 Modified: trunk/src/jtag/jlink.c Log: Zach Welch <zw...@su...> fix jlink reset Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2009-04-22 10:46:37 UTC (rev 1506) +++ trunk/src/jtag/jlink.c 2009-04-22 10:59:23 UTC (rev 1507) @@ -463,6 +463,8 @@ if (srst == 0) { jlink_simple_command(EMU_CMD_HW_RESET1); + jlink_end_state(TAP_RESET); + jlink_state_move(); } else if (srst == 1) { @@ -472,6 +474,8 @@ if (trst == 0) { jlink_simple_command(EMU_CMD_HW_TRST1); + jlink_end_state(TAP_RESET); + jlink_state_move(); } else if (trst == 1) { |
From: oharboe at B. <oh...@ma...> - 2009-04-22 12:46:39
|
Author: oharboe Date: 2009-04-22 12:46:37 +0200 (Wed, 22 Apr 2009) New Revision: 1506 Modified: trunk/src/jtag/jtag.h Log: Zach Welch <zw...@su...> reorder enum tap_state Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-04-22 10:09:15 UTC (rev 1505) +++ trunk/src/jtag/jtag.h 2009-04-22 10:46:37 UTC (rev 1506) @@ -41,20 +41,37 @@ #endif -/* 16 Tap States, from page 21 of ASSET InterTech, Inc.'s svf.pdf +/* + * Tap states from ARM7TDMI-S Technical reference manual. + * Also, validated against several other ARM core technical manuals. + * + * N.B. tap_get_tms_path() was changed to reflect this corrected + * numbering and ordering of the TAP states. */ -enum tap_state { - TAP_RESET = 0, TAP_IDLE = 8, - TAP_DRSELECT = 1, TAP_DRCAPTURE = 2, TAP_DRSHIFT = 3, TAP_DREXIT1 = 4, - TAP_DRPAUSE = 5, TAP_DREXIT2 = 6, TAP_DRUPDATE = 7, - TAP_IRSELECT = 9, TAP_IRCAPTURE = 10, TAP_IRSHIFT = 11, TAP_IREXIT1 = 12, - TAP_IRPAUSE = 13, TAP_IREXIT2 = 14, TAP_IRUPDATE = 15, +typedef enum tap_state +{ + TAP_DREXIT2 = 0x0, + TAP_DREXIT1 = 0x1, + TAP_DRSHIFT = 0x2, + TAP_DRPAUSE = 0x3, + TAP_IRSELECT = 0x4, + TAP_DRUPDATE = 0x5, + TAP_DRCAPTURE = 0x6, + TAP_DRSELECT = 0x7, + TAP_IREXIT2 = 0x8, + TAP_IREXIT1 = 0x9, + TAP_IRSHIFT = 0xa, + TAP_IRPAUSE = 0xb, + TAP_IDLE = 0xc, + TAP_IRUPDATE = 0xd, + TAP_IRCAPTURE = 0xe, + TAP_RESET = 0x0f, - TAP_NUM_STATES = 16, TAP_INVALID = -1, -}; + TAP_NUM_STATES = 0x10, -typedef enum tap_state tap_state_t; - + TAP_INVALID = -1, +} tap_state_t; + typedef struct tap_transition_s { tap_state_t high; |
From: <ml...@ma...> - 2009-04-22 12:09:29
|
Author: mlu Date: 2009-04-22 12:09:15 +0200 (Wed, 22 Apr 2009) New Revision: 1505 Modified: trunk/src/helper/binarybuffer.c Log: Fix str_to_buf problem, thanks Andy Chenee Modified: trunk/src/helper/binarybuffer.c =================================================================== --- trunk/src/helper/binarybuffer.c 2009-04-22 07:34:47 UTC (rev 1504) +++ trunk/src/helper/binarybuffer.c 2009-04-22 10:09:15 UTC (rev 1505) @@ -244,7 +244,7 @@ int str_to_buf(const char *str, int str_len, u8 *buf, int buf_len, int radix) { char *charbuf; - char tmp; + u32 tmp; float factor; u8 *b256_buf; int b256_len; @@ -303,7 +303,7 @@ tmp = (tmp - 'A' + 10); else continue; /* skip characters other than [0-9,a-f,A-F] */ - if (tmp >= radix) + if (tmp >= (u32)radix) continue; /* skip digits invalid for the current radix */ for (j = 0; j < b256_len; j++) |
From: <kc...@ma...> - 2009-04-22 09:34:54
|
Author: kc8apf Date: 2009-04-22 09:34:47 +0200 (Wed, 22 Apr 2009) New Revision: 1504 Modified: trunk/src/jtag/jlink.c Log: Shrink JLink buffer sizes to specified 2KB courtesy of Jeff Williams <je...@ga...> and Zach Welch <zw...@su...> Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2009-04-22 07:32:09 UTC (rev 1503) +++ trunk/src/jtag/jlink.c 2009-04-22 07:34:47 UTC (rev 1504) @@ -42,8 +42,9 @@ #define JLINK_USB_TIMEOUT 1000 -#define JLINK_IN_BUFFER_SIZE 8192 -#define JLINK_OUT_BUFFER_SIZE 8192 +// See Section 1.3.2 of the Segger JLink USB protocol manual +#define JLINK_IN_BUFFER_SIZE 2048 +#define JLINK_OUT_BUFFER_SIZE 2048 #define JLINK_EMU_RESULT_BUFFER_SIZE 64 /* Global USB buffers */ |
From: <kc...@ma...> - 2009-04-22 09:32:12
|
Author: kc8apf Date: 2009-04-22 09:32:09 +0200 (Wed, 22 Apr 2009) New Revision: 1503 Modified: trunk/configure.in Log: Add D2XX support for OS X courtesy of Piotr Esden-Tempski <pi...@es...> Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2009-04-22 07:31:16 UTC (rev 1502) +++ trunk/configure.in 2009-04-22 07:32:09 UTC (rev 1503) @@ -28,6 +28,7 @@ is_cygwin=no is_mingw=no is_win32=no +is_darwin=no build_release=yes AC_ARG_ENABLE(release, @@ -110,10 +111,11 @@ ) #======================================== -# FTD2XXX support comes in 3 forms. +# FTD2XXX support comes in 4 forms. # (1) win32 - via a zip file # (2) linux - via a tar file # (3) linux/cygwin/mingw - via libftdi +# (4) darwin - installed under /usr/local # # In case (1) and (2) we need to know where the package was unpacked. @@ -350,6 +352,7 @@ fi AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.]) + AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.]) ;; *-mingw*) is_mingw=yes @@ -359,11 +362,22 @@ AC_DEFINE(IS_MINGW, 1, [1 if building for MinGW.]) AC_DEFINE(IS_WIN32, 1, [1 if building for Win32.]) + AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.]) ;; + *darwin*) + is_darwin=yes + + parport_use_giveio=no + + AC_DEFINE(IS_CYGWIN, 0, [0 if not building for Cygwin.]) + AC_DEFINE(IS_WIN32, 0, [0 if not building for Win32.]) + AC_DEFINE(IS_DARWIN, 1, [1 if building for Darwin.]) + ;; *) parport_use_giveio=no AC_DEFINE(IS_CYGWIN, 0, [0 if not building for Cygwin.]) AC_DEFINE(IS_WIN32, 0, [0 if not building for Win32.]) + AC_DEFINE(IS_DARWIN, 0, [0 if not building for Darwin.]) ;; esac @@ -559,16 +573,39 @@ fi fi -if test $is_win32 = no; then +if test $is_darwin = yes ; then +if test "${with_ftd2xx_win32_zipdir+set}" = set +then + AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only]) +fi +if test "${with_ftd2xx_linux_tardir+set}" = set +then + AC_MSG_ERROR([The option: with_ftd2xx_linux_tardir is for LINUX only.]) +fi +if test $build_ft2232_ftd2xx = yes ; then + AC_MSG_CHECKING([for libftd2xx.a (darwin)]) + + if test ! -f /usr/local/include/ftd2xx.h ; then + AC_MSG_ERROR([ftd2xx library from FTDICHIP.com seems to be missing, cannot find: /usr/local/include/ftd2xx.h]) + fi + + CFLAGS="$CFLAGS -I/usr/local/include" + LDFLAGS="$LDFLAGS -L/usr/local/lib" + LIBS="$LIBS -lftd2xx" + AC_MSG_RESULT([-L/usr/local/lib -lftd2xx]) +fi +fi + +if test $is_win32 = no && test $is_darwin = no ; then + if test "${with_ftd2xx_win32_zipdir+set}" = set then AC_MSG_ERROR([The option: --with-ftd2xx-win32-zipdir is for win32 only]) fi if test $build_ft2232_ftd2xx = yes ; then - # Must be linux - - # Cause FTDICHIP does not supply a MAC-OS version + # Must be linux if test $host_os != linux-gnu && test $host_os != linux ; then AC_MSG_ERROR([The (linux) ftd2xx library from FTDICHIP.com is linux only. Try --enable-ft2232-libftdi instead]) fi @@ -728,6 +765,7 @@ AM_CONDITIONAL(IS_CYGWIN, test $is_cygwin = yes) AM_CONDITIONAL(IS_MINGW, test $is_mingw = yes) AM_CONDITIONAL(IS_WIN32, test $is_win32 = yes) +AM_CONDITIONAL(IS_DARWIN, test $is_darwin = yes) AM_CONDITIONAL(BITQ, test $build_bitq = yes) AC_LANG_C |
From: <kc...@ma...> - 2009-04-22 09:31:22
|
Author: kc8apf Date: 2009-04-22 09:31:16 +0200 (Wed, 22 Apr 2009) New Revision: 1502 Modified: trunk/src/target/target.c Log: Fix use of wrong format conversion for size_t (%zu instead of %u) Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-04-22 06:56:59 UTC (rev 1501) +++ trunk/src/target/target.c 2009-04-22 07:31:16 UTC (rev 1502) @@ -2495,7 +2495,7 @@ { size_t written = fwrite(data, len, 1, f); if (written != len) - LOG_ERROR("failed to write %u bytes: %s", len, strerror(errno)); + LOG_ERROR("failed to write %zu bytes: %s", len, strerror(errno)); } static void writeLong(FILE *f, int l) |
From: <kc...@ma...> - 2009-04-22 08:57:02
|
Author: kc8apf Date: 2009-04-22 08:56:59 +0200 (Wed, 22 Apr 2009) New Revision: 1501 Modified: trunk/src/jtag/jtag.c Log: fix jtag run/idle state name courtesy of Jeff Williams <je...@ga...> and Zach Welch <zw...@su...> Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-04-22 06:55:34 UTC (rev 1500) +++ trunk/src/jtag/jtag.c 2009-04-22 06:56:59 UTC (rev 1501) @@ -3248,7 +3248,7 @@ switch( state ) { case TAP_RESET: ret = "RESET"; break; - case TAP_IDLE: ret = "IDLE"; break; + case TAP_IDLE: ret = "RUN/IDLE"; break; case TAP_DRSELECT: ret = "DRSELECT"; break; case TAP_DRCAPTURE: ret = "DRCAPTURE"; break; case TAP_DRSHIFT: ret = "DRSHIFT"; break; |
From: <kc...@ma...> - 2009-04-22 08:55:38
|
Author: kc8apf Date: 2009-04-22 08:55:34 +0200 (Wed, 22 Apr 2009) New Revision: 1500 Modified: trunk/src/jtag/jlink.c Log: refactor jlink_execute_queue courtesy of Zach Welch <zw...@su...> Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2009-04-22 06:16:53 UTC (rev 1499) +++ trunk/src/jtag/jlink.c 2009-04-22 06:55:34 UTC (rev 1500) @@ -130,95 +130,113 @@ .quit = jlink_quit }; -static int jlink_execute_queue(void) +static void jlink_execute_end_state(jtag_command_t *cmd) { - jtag_command_t *cmd = jtag_command_queue; - int scan_size; - enum scan_type type; - u8 *buffer; + DEBUG_JTAG_IO("end_state: %i", cmd->cmd.end_state->end_state); - while (cmd != NULL) - { - switch (cmd->type) - { - case JTAG_END_STATE: - DEBUG_JTAG_IO("end_state: %i", cmd->cmd.end_state->end_state); + if (cmd->cmd.end_state->end_state != TAP_INVALID) + jlink_end_state(cmd->cmd.end_state->end_state); +} - if (cmd->cmd.end_state->end_state != TAP_INVALID) - { - jlink_end_state(cmd->cmd.end_state->end_state); - } - break; +static void jlink_execute_runtest(jtag_command_t *cmd) +{ + DEBUG_JTAG_IO("runtest %i cycles, end in %i", + cmd->cmd.runtest->num_cycles, + cmd->cmd.runtest->end_state); - case JTAG_RUNTEST: - DEBUG_JTAG_IO( "runtest %i cycles, end in %i", cmd->cmd.runtest->num_cycles, \ - cmd->cmd.runtest->end_state); + if (cmd->cmd.runtest->end_state != TAP_INVALID) + jlink_end_state(cmd->cmd.runtest->end_state); - if (cmd->cmd.runtest->end_state != TAP_INVALID) - { - jlink_end_state(cmd->cmd.runtest->end_state); - } - jlink_runtest(cmd->cmd.runtest->num_cycles); - break; + jlink_runtest(cmd->cmd.runtest->num_cycles); +} - case JTAG_STATEMOVE: - DEBUG_JTAG_IO("statemove end in %i", cmd->cmd.statemove->end_state); +static void jlink_execute_statemove(jtag_command_t *cmd) +{ + DEBUG_JTAG_IO("statemove end in %i", cmd->cmd.statemove->end_state); - if (cmd->cmd.statemove->end_state != TAP_INVALID) - { - jlink_end_state(cmd->cmd.statemove->end_state); - } - jlink_state_move(); - break; + if (cmd->cmd.statemove->end_state != TAP_INVALID) + { + jlink_end_state(cmd->cmd.statemove->end_state); + } + jlink_state_move(); +} - case JTAG_PATHMOVE: - DEBUG_JTAG_IO("pathmove: %i states, end in %i", \ - cmd->cmd.pathmove->num_states, \ - cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]); +static void jlink_execute_pathmove(jtag_command_t *cmd) +{ + DEBUG_JTAG_IO("pathmove: %i states, end in %i", + cmd->cmd.pathmove->num_states, + cmd->cmd.pathmove->path[cmd->cmd.pathmove->num_states - 1]); - jlink_path_move(cmd->cmd.pathmove->num_states, cmd->cmd.pathmove->path); - break; + jlink_path_move(cmd->cmd.pathmove->num_states, + cmd->cmd.pathmove->path); +} - case JTAG_SCAN: - DEBUG_JTAG_IO("scan end in %i", cmd->cmd.scan->end_state); +static void jlink_execute_scan(jtag_command_t *cmd) +{ + int scan_size; + enum scan_type type; + u8 *buffer; - if (cmd->cmd.scan->end_state != TAP_INVALID) - { - jlink_end_state(cmd->cmd.scan->end_state); - } + DEBUG_JTAG_IO("scan end in %i", cmd->cmd.scan->end_state); - scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer); - DEBUG_JTAG_IO("scan input, length = %d", scan_size); + if (cmd->cmd.scan->end_state != TAP_INVALID) + jlink_end_state(cmd->cmd.scan->end_state); + scan_size = jtag_build_buffer(cmd->cmd.scan, &buffer); + DEBUG_JTAG_IO("scan input, length = %d", scan_size); + #ifdef _DEBUG_USB_COMMS_ - jlink_debug_buffer(buffer, (scan_size + 7) / 8); + jlink_debug_buffer(buffer, (scan_size + 7) / 8); #endif - type = jtag_scan_type(cmd->cmd.scan); - jlink_scan(cmd->cmd.scan->ir_scan, type, buffer, scan_size, cmd->cmd.scan); - break; + type = jtag_scan_type(cmd->cmd.scan); + jlink_scan(cmd->cmd.scan->ir_scan, + type, buffer, scan_size, cmd->cmd.scan); +} - case JTAG_RESET: - DEBUG_JTAG_IO("reset trst: %i srst %i", cmd->cmd.reset->trst, cmd->cmd.reset->srst); +static void jlink_execute_reset(jtag_command_t *cmd) +{ + DEBUG_JTAG_IO("reset trst: %i srst %i", + cmd->cmd.reset->trst, cmd->cmd.reset->srst); - jlink_tap_execute(); + jlink_tap_execute(); - if (cmd->cmd.reset->trst == 1) - { - tap_set_state(TAP_RESET); - } - jlink_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst); - break; + if (cmd->cmd.reset->trst == 1) + tap_set_state(TAP_RESET); - case JTAG_SLEEP: - DEBUG_JTAG_IO("sleep %i", cmd->cmd.sleep->us); - jlink_tap_execute(); - jtag_sleep(cmd->cmd.sleep->us); - break; + jlink_reset(cmd->cmd.reset->trst, cmd->cmd.reset->srst); +} - default: - LOG_ERROR("BUG: unknown JTAG command type encountered"); - exit(-1); - } +static void jlink_execute_sleep(jtag_command_t *cmd) +{ + DEBUG_JTAG_IO("sleep %i", cmd->cmd.sleep->us); + jlink_tap_execute(); + jtag_sleep(cmd->cmd.sleep->us); +} + +static void jlink_execute_command(jtag_command_t *cmd) +{ + switch (cmd->type) + { + case JTAG_END_STATE: jlink_execute_end_state(cmd); break; + case JTAG_RUNTEST: jlink_execute_runtest(cmd); break; + case JTAG_STATEMOVE: jlink_execute_statemove(cmd); break; + case JTAG_PATHMOVE: jlink_execute_pathmove(cmd); break; + case JTAG_SCAN: jlink_execute_scan(cmd); break; + case JTAG_RESET: jlink_execute_reset(cmd); break; + case JTAG_SLEEP: jlink_execute_sleep(cmd); break; + default: + LOG_ERROR("BUG: unknown JTAG command type encountered"); + exit(-1); + } +} + +static int jlink_execute_queue(void) +{ + jtag_command_t *cmd = jtag_command_queue; + + while (cmd != NULL) + { + jlink_execute_command(cmd); cmd = cmd->next; } |
From: oharboe at B. <oh...@ma...> - 2009-04-22 08:16:59
|
Author: oharboe Date: 2009-04-22 08:16:53 +0200 (Wed, 22 Apr 2009) New Revision: 1499 Removed: trunk/src/target/interface/luminary-libftdi.cfg trunk/src/target/interface/olimex-jtag-tiny-a.cfg Modified: trunk/src/target/interface/calao-usb-a9260-c01.cfg trunk/src/target/interface/flyswatter.cfg trunk/src/target/interface/jtagkey-tiny.cfg trunk/src/target/interface/luminary.cfg trunk/src/target/interface/olimex-arm-usb-ocd.cfg trunk/src/target/interface/olimex-jtag-tiny.cfg trunk/src/target/interface/openocd-usb.cfg trunk/src/target/interface/sheevaplug.cfg Log: Uwe Hermann <uw...@he...> Drop non-A variants of ft2232 targets Modified: trunk/src/target/interface/calao-usb-a9260-c01.cfg =================================================================== --- trunk/src/target/interface/calao-usb-a9260-c01.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/calao-usb-a9260-c01.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -6,7 +6,7 @@ interface ft2232 ft2232_layout jtagkey -ft2232_device_desc "USB-A9260" +ft2232_device_desc "USB-A9260 A" ft2232_vid_pid 0x0403 0x6010 script interface/calao-usb-a9260.cfg script target/at91sam9260minimal.cfg Modified: trunk/src/target/interface/flyswatter.cfg =================================================================== --- trunk/src/target/interface/flyswatter.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/flyswatter.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -5,7 +5,7 @@ # interface ft2232 -ft2232_device_desc "Flyswatter" +ft2232_device_desc "Flyswatter A" ft2232_layout "flyswatter" ft2232_vid_pid 0x0403 0x6010 jtag_speed 1 Modified: trunk/src/target/interface/jtagkey-tiny.cfg =================================================================== --- trunk/src/target/interface/jtagkey-tiny.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/jtagkey-tiny.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -4,8 +4,6 @@ # http://www.amontec.com/jtagkey-tiny.shtml # -interface ft2232 -ft2232_device_desc "Amontec JTAGkey" -ft2232_layout jtagkey -ft2232_vid_pid 0x0403 0xcff8 +# The JTAGkey-tiny uses exactly the same config as the JTAGkey. +source [find interface/jtagkey.cfg] Deleted: trunk/src/target/interface/luminary-libftdi.cfg =================================================================== --- trunk/src/target/interface/luminary-libftdi.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/luminary-libftdi.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -1,11 +0,0 @@ -# -# Luminary Micro Stellaris LM3S811 Evaluation Kit -# -# http://www.luminarymicro.com/products/stellaris_811_evaluation_kits.html -# - -interface ft2232 -ft2232_device_desc "Stellaris Evaluation Board" -ft2232_layout evb_lm3s811 -ft2232_vid_pid 0x0403 0xbcd9 - Modified: trunk/src/target/interface/luminary.cfg =================================================================== --- trunk/src/target/interface/luminary.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/luminary.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -1,5 +1,5 @@ # -# Luminary Micro LM3S811 Evaluation Kit(s) +# Luminary Micro Stellaris LM3S811 Evaluation Kit # # http://www.luminarymicro.com/products/stellaris_811_evaluation_kits.html # @@ -7,4 +7,5 @@ interface ft2232 ft2232_device_desc "Stellaris Evaluation Board A" ft2232_layout evb_lm3s811 +ft2232_vid_pid 0x0403 0xbcd9 Modified: trunk/src/target/interface/olimex-arm-usb-ocd.cfg =================================================================== --- trunk/src/target/interface/olimex-arm-usb-ocd.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/olimex-arm-usb-ocd.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -5,7 +5,7 @@ # interface ft2232 -ft2232_device_desc "Olimex OpenOCD JTAG" +ft2232_device_desc "Olimex OpenOCD JTAG A" ft2232_layout olimex-jtag ft2232_vid_pid 0x15ba 0x0003 Deleted: trunk/src/target/interface/olimex-jtag-tiny-a.cfg =================================================================== --- trunk/src/target/interface/olimex-jtag-tiny-a.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/olimex-jtag-tiny-a.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -1,11 +0,0 @@ -# -# Olimex ARM-USB-TINY -# -# http://www.olimex.com/dev/arm-usb-tiny.html -# - -interface ft2232 -ft2232_device_desc "Olimex OpenOCD JTAG TINY A" -ft2232_layout olimex-jtag -ft2232_vid_pid 0x15ba 0x0004 - Modified: trunk/src/target/interface/olimex-jtag-tiny.cfg =================================================================== --- trunk/src/target/interface/olimex-jtag-tiny.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/olimex-jtag-tiny.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -4,12 +4,8 @@ # http://www.olimex.com/dev/arm-usb-tiny.html # -# TODO: FIXME -# Linux USB tends to see the device description without the 'A' as in target/olimex-jtag-tiny.cfg, -# but Windows still needs the 'A'. This is a replacement for Linux users. - interface ft2232 -ft2232_device_desc "Olimex OpenOCD JTAG TINY" +ft2232_device_desc "Olimex OpenOCD JTAG TINY A" ft2232_layout olimex-jtag ft2232_vid_pid 0x15ba 0x0004 Modified: trunk/src/target/interface/openocd-usb.cfg =================================================================== --- trunk/src/target/interface/openocd-usb.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/openocd-usb.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -6,7 +6,7 @@ interface ft2232 ft2232_vid_pid 0x0403 0x6010 -ft2232_device_desc "Dual RS232" +ft2232_device_desc "Dual RS232 A" ft2232_layout "oocdlink" ft2232_latency 2 # 6/(1+n) Mhz TCLK Modified: trunk/src/target/interface/sheevaplug.cfg =================================================================== --- trunk/src/target/interface/sheevaplug.cfg 2009-04-21 15:39:49 UTC (rev 1498) +++ trunk/src/target/interface/sheevaplug.cfg 2009-04-22 06:16:53 UTC (rev 1499) @@ -7,5 +7,6 @@ interface ft2232 ft2232_layout sheevaplug ft2232_vid_pid 0x0403 0x6010 +# TODO: Add ft2232_device_desc? jtag_khz 3000 |
From: <oh...@ma...> - 2009-04-21 17:39:51
|
Author: oharboe Date: 2009-04-21 17:39:49 +0200 (Tue, 21 Apr 2009) New Revision: 1498 Modified: trunk/src/jtag/jlink.c Log: Zach Welch <zw...@su...> refactor Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2009-04-21 12:10:29 UTC (rev 1497) +++ trunk/src/jtag/jlink.c 2009-04-21 15:39:49 UTC (rev 1498) @@ -230,31 +230,26 @@ { int result; - if (speed <= JLINK_MAX_SPEED) + if (speed > JLINK_MAX_SPEED) { - /* check for RTCK setting */ - if (speed == 0) - speed = -1; + LOG_INFO("Ignoring speed request: %dkHz exceeds %dkHz maximum", + speed, JLINK_MAX_SPEED); + return ERROR_OK; + } - usb_out_buffer[0] = EMU_CMD_SET_SPEED; - usb_out_buffer[1] = (speed >> 0) & 0xff; - usb_out_buffer[2] = (speed >> 8) & 0xff; + /* check for RTCK setting */ + if (speed == 0) + speed = -1; - result = jlink_usb_write(jlink_jtag_handle, 3); + usb_out_buffer[0] = EMU_CMD_SET_SPEED; + usb_out_buffer[1] = (speed >> 0) & 0xff; + usb_out_buffer[2] = (speed >> 8) & 0xff; - if (result == 3) - { - return ERROR_OK; - } - else - { - LOG_ERROR("J-Link setting speed failed (%d)", result); - return ERROR_JTAG_DEVICE_ERROR; - } - } - else + result = jlink_usb_write(jlink_jtag_handle, 3); + if (result != 3) { - LOG_INFO("Requested speed %dkHz exceeds maximum of %dkHz, ignored", speed, JLINK_MAX_SPEED); + LOG_ERROR("J-Link setting speed failed (%d)", result); + return ERROR_JTAG_DEVICE_ERROR; } return ERROR_OK; @@ -485,53 +480,55 @@ int result; jlink_simple_command(EMU_CMD_GET_STATE); - result = jlink_usb_read(jlink_jtag_handle, 8); - if (result == 8) + result = jlink_usb_read(jlink_jtag_handle, 8); + if (result != 8) { - int vref = usb_in_buffer[0] + (usb_in_buffer[1] << 8); - LOG_INFO("Vref = %d.%d TCK = %d TDI = %d TDO = %d TMS = %d SRST = %d TRST = %d\n", \ - vref / 1000, vref % 1000, \ - usb_in_buffer[2], usb_in_buffer[3], usb_in_buffer[4], \ - usb_in_buffer[5], usb_in_buffer[6], usb_in_buffer[7]); - - if (vref < 1500) - { - LOG_ERROR("Vref too low. Check Target Power\n"); - } - } - else - { LOG_ERROR("J-Link command EMU_CMD_GET_STATE failed (%d)\n", result); + return ERROR_JTAG_DEVICE_ERROR; } + int vref = usb_in_buffer[0] + (usb_in_buffer[1] << 8); + LOG_INFO("Vref = %d.%d TCK = %d TDI = %d TDO = %d TMS = %d SRST = %d TRST = %d\n", \ + vref / 1000, vref % 1000, \ + usb_in_buffer[2], usb_in_buffer[3], usb_in_buffer[4], \ + usb_in_buffer[5], usb_in_buffer[6], usb_in_buffer[7]); + + if (vref < 1500) + LOG_ERROR("Vref too low. Check Target Power\n"); + return ERROR_OK; } static int jlink_get_version_info(void) { int result; - int len = 0; + int len; /* query hardware version */ jlink_simple_command(EMU_CMD_VERSION); - result = jlink_usb_read(jlink_jtag_handle, 2); - if (result == 2) + result = jlink_usb_read(jlink_jtag_handle, 2); + if (2 != result) { - len = buf_get_u32(usb_in_buffer, 0, 16); - result = jlink_usb_read(jlink_jtag_handle, len); + LOG_ERROR("J-Link command EMU_CMD_VERSION failed (%d)\n", + result); + return ERROR_JTAG_DEVICE_ERROR; + } - if (result == len) - { - usb_in_buffer[result] = 0; - LOG_INFO("%s", (char *)usb_in_buffer); - return ERROR_OK; - } + len = buf_get_u32(usb_in_buffer, 0, 16); + result = jlink_usb_read(jlink_jtag_handle, len); + if (result != len) + { + LOG_ERROR("J-Link command EMU_CMD_VERSION failed (%d)\n", + result); + return ERROR_JTAG_DEVICE_ERROR; } - LOG_ERROR("J-Link command EMU_CMD_VERSION failed (%d)\n", result); - return ERROR_JTAG_DEVICE_ERROR; + usb_in_buffer[result] = 0; + LOG_INFO("%s", (char *)usb_in_buffer); + + return ERROR_OK; } static int jlink_handle_jlink_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) @@ -551,7 +548,7 @@ /* 2048 is the max value we can use here */ #define JLINK_TAP_BUFFER_SIZE 2048 -static int tap_length; +static unsigned tap_length; static u8 tms_buffer[JLINK_TAP_BUFFER_SIZE]; static u8 tdi_buffer[JLINK_TAP_BUFFER_SIZE]; static u8 tdo_buffer[JLINK_TAP_BUFFER_SIZE]; @@ -593,40 +590,32 @@ last_tms = tms; int index = tap_length / 8; - if (index < JLINK_TAP_BUFFER_SIZE) + if (index >= JLINK_TAP_BUFFER_SIZE) { - int bit_index = tap_length % 8; - u8 bit = 1 << bit_index; + LOG_ERROR("jlink_tap_append_step: overflow"); + exit(-1); + } - if (tms) - { - tms_buffer[index] |= bit; - } - else - { - tms_buffer[index] &= ~bit; - } + int bit_index = tap_length % 8; + u8 bit = 1 << bit_index; - if (tdi) - { - tdi_buffer[index] |= bit; - } - else - { - tdi_buffer[index] &= ~bit; - } + if (tms) + tms_buffer[index] |= bit; + else + tms_buffer[index] &= ~bit; - tap_length++; - } + if (tdi) + tdi_buffer[index] |= bit; else - { - LOG_ERROR("jlink_tap_append_step, overflow"); - } + tdi_buffer[index] &= ~bit; + + tap_length++; } static void jlink_tap_append_scan(int length, u8 *buffer, scan_command_t *command) { - pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[pending_scan_results_length]; + pending_scan_result_t *pending_scan_result = + &pending_scan_results_buffer[pending_scan_results_length]; int i; pending_scan_result->first = tap_length; @@ -636,7 +625,9 @@ for (i = 0; i < length; i++) { - jlink_tap_append_step((i < length-1 ? 0 : 1), (buffer[i/8] >> (i%8)) & 1); + int tms = i < length - 1 ? 0 : 1; + int tdi = buffer[i / 8] & (1 << (i % 8)); + jlink_tap_append_step(tms, tdi); } pending_scan_results_length++; } @@ -651,82 +642,79 @@ int i; int result; - if (tap_length > 0) + if (!tap_length) + return ERROR_OK; + + /* Pad last byte so that tap_length is divisible by 8 */ + while (tap_length % 8 != 0) { - /* Pad last byte so that tap_length is divisible by 8 */ - while (tap_length % 8 != 0) - { - /* More of the last TMS value keeps us in the same state, - * analogous to free-running JTAG interfaces. */ - jlink_tap_append_step(last_tms, 0); - } + /* More of the last TMS value keeps us in the same state, + * analogous to free-running JTAG interfaces. */ + jlink_tap_append_step(last_tms, 0); + } - byte_length = tap_length / 8; + byte_length = tap_length / 8; - usb_out_buffer[0] = EMU_CMD_HW_JTAG3; - usb_out_buffer[1] = 0; - usb_out_buffer[2] = (tap_length >> 0) & 0xff; - usb_out_buffer[3] = (tap_length >> 8) & 0xff; + usb_out_buffer[0] = EMU_CMD_HW_JTAG3; + usb_out_buffer[1] = 0; + usb_out_buffer[2] = (tap_length >> 0) & 0xff; + usb_out_buffer[3] = (tap_length >> 8) & 0xff; - tms_offset = 4; - for (i = 0; i < byte_length; i++) - { - usb_out_buffer[tms_offset + i] = tms_buffer[i]; - } + tms_offset = 4; + for (i = 0; i < byte_length; i++) + { + usb_out_buffer[tms_offset + i] = tms_buffer[i]; + } - tdi_offset = tms_offset + byte_length; - for (i = 0; i < byte_length; i++) - { - usb_out_buffer[tdi_offset + i] = tdi_buffer[i]; - } + tdi_offset = tms_offset + byte_length; + for (i = 0; i < byte_length; i++) + { + usb_out_buffer[tdi_offset + i] = tdi_buffer[i]; + } - result = jlink_usb_message(jlink_jtag_handle, 4 + 2 * byte_length, byte_length); + result = jlink_usb_message(jlink_jtag_handle, 4 + 2 * byte_length, byte_length); - if (result == byte_length) - { - for (i = 0; i < byte_length; i++) - { - tdo_buffer[i] = usb_in_buffer[i]; - } + if (result != byte_length) + { + LOG_ERROR("jlink_tap_execute, wrong result %d (expected %d)", + result, byte_length); + return ERROR_JTAG_QUEUE_FAILED; + } - for (i = 0; i < pending_scan_results_length; i++) - { - pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[i]; - u8 *buffer = pending_scan_result->buffer; - int length = pending_scan_result->length; - int first = pending_scan_result->first; - scan_command_t *command = pending_scan_result->command; + for (i = 0; i < byte_length; i++) + tdo_buffer[i] = usb_in_buffer[i]; - /* Copy to buffer */ - buf_set_buf(tdo_buffer, first, buffer, 0, length); + for (i = 0; i < pending_scan_results_length; i++) + { + pending_scan_result_t *pending_scan_result = &pending_scan_results_buffer[i]; + u8 *buffer = pending_scan_result->buffer; + int length = pending_scan_result->length; + int first = pending_scan_result->first; + scan_command_t *command = pending_scan_result->command; - DEBUG_JTAG_IO("pending scan result, length = %d", length); + /* Copy to buffer */ + buf_set_buf(tdo_buffer, first, buffer, 0, length); + DEBUG_JTAG_IO("pending scan result, length = %d", length); + #ifdef _DEBUG_USB_COMMS_ - jlink_debug_buffer(buffer, byte_length); + jlink_debug_buffer(buffer, byte_length); #endif - if (jtag_read_buffer(buffer, command) != ERROR_OK) - { - jlink_tap_init(); - return ERROR_JTAG_QUEUE_FAILED; - } - - if (pending_scan_result->buffer != NULL) - { - free(pending_scan_result->buffer); - } - } - } - else + if (jtag_read_buffer(buffer, command) != ERROR_OK) { - LOG_ERROR("jlink_tap_execute, wrong result %d, expected %d", result, byte_length); + jlink_tap_init(); return ERROR_JTAG_QUEUE_FAILED; } - jlink_tap_init(); + if (pending_scan_result->buffer != NULL) + { + free(pending_scan_result->buffer); + } } + jlink_tap_init(); + return ERROR_OK; } @@ -792,59 +780,48 @@ int result2; result = jlink_usb_write(jlink_jtag, out_length); - if (result == out_length) + if (result != out_length) { - result = jlink_usb_read(jlink_jtag, in_length); - if (result == in_length || result == in_length+1) + LOG_ERROR("usb_bulk_write failed (requested=%d, result=%d)", + out_length, result); + return ERROR_JTAG_DEVICE_ERROR; + } + + result = jlink_usb_read(jlink_jtag, in_length); + if ((result != in_length) && (result != in_length + 1)) + { + LOG_ERROR("usb_bulk_read failed (requested=%d, result=%d)", + in_length, result); + return ERROR_JTAG_DEVICE_ERROR; + } + + if (result == in_length) + { + /* Must read the result from the EMU too */ + result2 = jlink_usb_read_emu_result(jlink_jtag); + if (1 != result2) { - if (result == in_length) - { - /* Must read the result from the EMU too */ - result2 = jlink_usb_read_emu_result(jlink_jtag); - if (1 == result2) - { - /* Check the result itself */ - if (0 == usb_emu_result_buffer[0]) - { - return result; - } - else - { - LOG_ERROR("jlink_usb_read_emu_result (requested=0, result=%d)", usb_emu_result_buffer[0]); - return -1; - } - } - else - { - LOG_ERROR("jlink_usb_read_emu_result len (requested=1, result=%d)", result2); - return -1; - } - } - else - { - /* Check the result itself */ - if (0 == usb_in_buffer[result-1]) - { - return result-1; - } - else - { - LOG_ERROR("jlink_usb_read_emu_result (requested=0, result=%d)", usb_in_buffer[result]); - return -1; - } - } + LOG_ERROR("jlink_usb_read_emu_result failed " + "(requested=1, result=%d)", result2); + return ERROR_JTAG_DEVICE_ERROR; } - else - { - LOG_ERROR("usb_bulk_read failed (requested=%d, result=%d)", in_length, result); - return -1; - } + + /* Check the result itself */ + result2 = usb_emu_result_buffer[0]; } else { - LOG_ERROR("usb_bulk_write failed (requested=%d, result=%d)", out_length, result); - return -1; + /* Save the result, then remove it from return value */ + result2 = usb_in_buffer[result--]; } + + if (result2) + { + LOG_ERROR("jlink_usb_message failed with result=%d)", result2); + return ERROR_JTAG_DEVICE_ERROR; + } + + return result; } /* calls the given usb_bulk_* function, allowing for the data to trickle in with some timeouts */ |
From: oharboe at B. <oh...@ma...> - 2009-04-21 14:10:29
|
Author: oharboe Date: 2009-04-21 14:10:29 +0200 (Tue, 21 Apr 2009) New Revision: 1497 Modified: trunk/src/jtag/ft2232.c Log: Zach Welch <zw...@su...> fix ft2232 usb io format warning Modified: trunk/src/jtag/ft2232.c =================================================================== --- trunk/src/jtag/ft2232.c 2009-04-21 12:09:35 UTC (rev 1496) +++ trunk/src/jtag/ft2232.c 2009-04-21 12:10:29 UTC (rev 1497) @@ -472,9 +472,10 @@ timeval_subtract(&d_inter2, &inter2, &start); timeval_subtract(&d_end, &end, &start); - LOG_INFO("inter: %i.%06i, inter2: %i.%06i end: %i.%06i", d_inter.tv_sec, d_inter.tv_usec, d_inter2.tv_sec, - d_inter2.tv_usec, d_end.tv_sec, - d_end.tv_usec); + LOG_INFO("inter: %u.%06u, inter2: %u.%06u end: %u.%06u", + (unsigned)d_inter.tv_sec, (unsigned)d_inter.tv_usec, + (unsigned)d_inter2.tv_sec, (unsigned)d_inter2.tv_usec, + (unsigned)d_end.tv_sec, (unsigned)d_end.tv_usec); #endif ft2232_buffer_size = bytes_read; |
From: oharboe at B. <oh...@ma...> - 2009-04-21 14:09:36
|
Author: oharboe Date: 2009-04-21 14:09:35 +0200 (Tue, 21 Apr 2009) New Revision: 1496 Modified: trunk/src/jtag/vsllink.c Log: Zach Welch <zw...@su...> add --enable-verbose* options Modified: trunk/src/jtag/vsllink.c =================================================================== --- trunk/src/jtag/vsllink.c 2009-04-21 11:37:15 UTC (rev 1495) +++ trunk/src/jtag/vsllink.c 2009-04-21 12:09:35 UTC (rev 1496) @@ -37,18 +37,6 @@ //#define _VSLLINK_IN_DEBUG_MODE_ -/* enable this to view USB communication - */ -#if 0 -#define _DEBUG_USB_COMMS_ -#endif - -#ifdef _DEBUG_JTAG_IO_ -#define DEBUG_JTAG_IO(expr ...) LOG_DEBUG(expr) -#else -#define DEBUG_JTAG_IO(expr ...) -#endif - #define VSLLINK_MODE_NORMAL 0 #define VSLLINK_MODE_DMA 1 |
From: oharboe at B. <oh...@ma...> - 2009-04-21 13:37:18
|
Author: oharboe Date: 2009-04-21 13:37:15 +0200 (Tue, 21 Apr 2009) New Revision: 1495 Modified: trunk/configure.in trunk/src/jtag/arm-jtag-ew.c trunk/src/jtag/ft2232.c trunk/src/jtag/jlink.c trunk/src/jtag/jtag.h Log: Zach Welch <zw...@su...> add --enable-verbose* options Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2009-04-21 11:35:58 UTC (rev 1494) +++ trunk/configure.in 2009-04-21 11:37:15 UTC (rev 1495) @@ -189,7 +189,52 @@ AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]), [gcc_werror=$enableval], [gcc_werror=$gcc_warnings]) +# set default verbose options, overridden by following options +debug_jtag_io=no +debug_usb_io=no +debug_usb_comms=no +AC_ARG_ENABLE(verbose, + AS_HELP_STRING([--enable-verbose], + [Enable verbose JTAG I/O messages (for debugging).]), + [ + debug_jtag_io=$enableval + debug_usb_io=$enableval + debug_usb_comms=$enableval + ], []) + +AC_ARG_ENABLE(verbose_jtag_io, + AS_HELP_STRING([--enable-verbose-jtag-io], + [Enable verbose JTAG I/O messages (for debugging).]), + [debug_jtag_io=$enableval], []) +AC_ARG_ENABLE(verbose_usb_io, + AS_HELP_STRING([--enable-verbose-usb-io], + [Enable verbose USB I/O messages (for debugging)]), + [debug_usb_io=$enableval], []) +AC_ARG_ENABLE(verbose_usb_comms, + AS_HELP_STRING([--enable-verbose-usb-comms], + [Enable verbose USB communication messages (for debugging)]), + [debug_usb_comms=$enableval], []) + +AC_MSG_CHECKING([whether to enable verbose JTAB I/O messages]); +AC_MSG_RESULT($debug_jtag_io) +if test $debug_jtag_io = yes; then + AC_DEFINE([_DEBUG_JTAG_IO_],[1], [Print verbose JTAG I/O messages]) +fi + +AC_MSG_CHECKING([whether to enable verbose USB I/O messages]); +AC_MSG_RESULT($debug_usb_io) +if test $debug_usb_io = yes; then + AC_DEFINE([_DEBUG_USB_IO_],[1], [Print verbose USB I/O messages]) +fi + +AC_MSG_CHECKING([whether to enable verbose USB communication messages]); +AC_MSG_RESULT($debug_usb_comms) +if test $debug_usb_comms = yes; then + AC_DEFINE([_DEBUG_USB_COMMS_],[1], [Print verbose USB communication messages]) +fi + + AC_ARG_ENABLE(parport, AS_HELP_STRING([--enable-parport], [Enable building the pc parallel port driver]), [build_parport=$enableval], [build_parport=no]) Modified: trunk/src/jtag/arm-jtag-ew.c =================================================================== --- trunk/src/jtag/arm-jtag-ew.c 2009-04-21 11:35:58 UTC (rev 1494) +++ trunk/src/jtag/arm-jtag-ew.c 2009-04-21 11:37:15 UTC (rev 1495) @@ -35,19 +35,6 @@ #include "log.h" -/* enable this to debug communication - */ -#if 1 -#define _DEBUG_USB_COMMS_ -#define _DEBUG_JTAG_IO_ -#endif - -#ifdef _DEBUG_JTAG_IO_ -#define DEBUG_JTAG_IO(expr ...) LOG_DEBUG(expr) -#else -#define DEBUG_JTAG_IO(expr ...) -#endif - #define USB_VID 0x15ba #define USB_PID 0x001e Modified: trunk/src/jtag/ft2232.c =================================================================== --- trunk/src/jtag/ft2232.c 2009-04-21 11:35:58 UTC (rev 1494) +++ trunk/src/jtag/ft2232.c 2009-04-21 11:37:15 UTC (rev 1495) @@ -58,18 +58,6 @@ #include <ftdi.h> #endif -/* enable this to debug io latency - */ -#if 0 -#define _DEBUG_USB_IO_ -#endif - -/* enable this to debug communication - */ -#if 0 -#define _DEBUG_USB_COMMS_ -#endif - static int ft2232_execute_queue(void); static int ft2232_speed(int speed); Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2009-04-21 11:35:58 UTC (rev 1494) +++ trunk/src/jtag/jlink.c 2009-04-21 11:37:15 UTC (rev 1495) @@ -34,18 +34,6 @@ #include "log.h" -/* enable this to debug communication - */ -#if 0 -#define _DEBUG_USB_COMMS_ -#endif - -#ifdef _DEBUG_JTAG_IO_ -#define DEBUG_JTAG_IO(expr ...) LOG_DEBUG(expr) -#else -#define DEBUG_JTAG_IO(expr ...) -#endif - #define VID 0x1366 #define PID 0x0101 Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-04-21 11:35:58 UTC (rev 1494) +++ trunk/src/jtag/jtag.h 2009-04-21 11:37:15 UTC (rev 1495) @@ -30,8 +30,10 @@ #include "command.h" -#if 0 -#define _DEBUG_JTAG_IO_ +#ifdef _DEBUG_JTAG_IO_ +#define DEBUG_JTAG_IO(expr ...) LOG_DEBUG(expr) +#else +#define DEBUG_JTAG_IO(expr ...) #endif #ifndef DEBUG_JTAG_IOZ |
From: oharboe at B. <oh...@ma...> - 2009-04-21 13:36:00
|
Author: oharboe Date: 2009-04-21 13:35:58 +0200 (Tue, 21 Apr 2009) New Revision: 1494 Modified: trunk/src/target/mips32.h trunk/src/target/mips32_pracc.c trunk/src/target/mips32_pracc.h Log: Nico Coesel <nc...@de...> MIPS32 speedup patches Modified: trunk/src/target/mips32.h =================================================================== --- trunk/src/target/mips32.h 2009-04-21 11:33:29 UTC (rev 1493) +++ trunk/src/target/mips32.h 2009-04-21 11:35:58 UTC (rev 1494) @@ -74,6 +74,7 @@ } mips32_core_reg_t; #define MIPS32_OP_BEQ 0x04 +#define MIPS32_OP_BNE 0x05 #define MIPS32_OP_ADDI 0x08 #define MIPS32_OP_AND 0x24 #define MIPS32_OP_COP0 0x10 @@ -102,6 +103,7 @@ #define MIPS32_AND(reg, off, val) MIPS32_R_INST(0, off, val, reg, 0, MIPS32_OP_AND) #define MIPS32_B(off) MIPS32_BEQ(0, 0, off) #define MIPS32_BEQ(src,tar,off) MIPS32_I_INST(MIPS32_OP_BEQ, src, tar, off) +#define MIPS32_BNE(src,tar,off) MIPS32_I_INST(MIPS32_OP_BNE, src, tar, off) #define MIPS32_MFC0(gpr, cpr, sel) MIPS32_R_INST(MIPS32_OP_COP0, MIPS32_COP0_MF, gpr, cpr, 0, sel) #define MIPS32_MTC0(gpr,cpr, sel) MIPS32_R_INST(MIPS32_OP_COP0, MIPS32_COP0_MT, gpr, cpr, 0, sel) #define MIPS32_LBU(reg, off, base) MIPS32_I_INST(MIPS32_OP_LBU, base, reg, off) Modified: trunk/src/target/mips32_pracc.c =================================================================== --- trunk/src/target/mips32_pracc.c 2009-04-21 11:33:29 UTC (rev 1493) +++ trunk/src/target/mips32_pracc.c 2009-04-21 11:35:58 UTC (rev 1494) @@ -19,6 +19,57 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + +/* +This version has optimized assembly routines for 32 bit operations: +- read word +- write word +- write array of words + +One thing to be aware of is that the MIPS32 cpu will execute the +instruction after a branch instruction (one delay slot). + +For example: + + + LW $2, ($5 +10) + B foo + LW $1, ($2 +100) + +The LW $1, ($2 +100) instruction is also executed. If this is +not wanted a NOP can be inserted: + + LW $2, ($5 +10) + B foo + NOP + LW $1, ($2 +100) + +or the code can be changed to: + + B foo + LW $2, ($5 +10) + LW $1, ($2 +100) + +The original code contained NOPs. I have removed these and moved +the branches. + +I also moved the PRACC_STACK to 0xFF204000. This allows +the use of 16 bits offsets to get pointers to the input +and output area relative to the stack. Note that the stack +isn't really a stack (the stack pointer is not 'moving') +but a FIFO simulated in software. + +These changes result in a 35% speed increase when programming an +external flash. + +More improvement could be gained if the registers do no need +to be preserved but in that case the routines should be aware +OpenOCD is used as a flash programmer or as a debug tool. + +Nico Coesel +*/ + + #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -94,7 +145,7 @@ * to start of debug vector */ data = 0; - LOG_ERROR("Error reading unexpected address"); + LOG_ERROR("Error reading unexpected address %8.8x", address); return ERROR_JTAG_DEVICE_ERROR; } @@ -103,10 +154,15 @@ mips_ejtag_drscan_32(ctx->ejtag_info, &data); /* Clear the access pending bit (let the processor eat!) */ + ejtag_ctrl = ejtag_info->ejtag_ctrl & ~EJTAG_CTRL_PRACC; mips_ejtag_set_instr(ctx->ejtag_info, EJTAG_INST_CONTROL, NULL); mips_ejtag_drscan_32(ctx->ejtag_info, &ejtag_ctrl); + + jtag_add_clocks(5); + jtag_execute_queue(); + return ERROR_OK; } @@ -115,7 +171,7 @@ u32 ejtag_ctrl,data; int offset; mips_ejtag_t *ejtag_info = ctx->ejtag_info; - + mips_ejtag_set_instr(ctx->ejtag_info, EJTAG_INST_DATA, NULL); mips_ejtag_drscan_32(ctx->ejtag_info, &data); @@ -123,6 +179,9 @@ ejtag_ctrl = ejtag_info->ejtag_ctrl & ~EJTAG_CTRL_PRACC; mips_ejtag_set_instr(ctx->ejtag_info, EJTAG_INST_CONTROL, NULL); mips_ejtag_drscan_32(ctx->ejtag_info, &ejtag_ctrl); + + jtag_add_clocks(5); + jtag_execute_queue(); if ((address >= MIPS32_PRACC_PARAM_IN) && (address <= MIPS32_PRACC_PARAM_IN + ctx->num_iparam * 4)) @@ -143,7 +202,7 @@ } else { - LOG_ERROR("Error writing unexpected address"); + LOG_ERROR("Error writing unexpected address %8.8x", address); return ERROR_JTAG_DEVICE_ERROR; } @@ -175,6 +234,8 @@ address = data = 0; mips_ejtag_set_instr(ejtag_info, EJTAG_INST_ADDRESS, NULL); mips_ejtag_drscan_32(ejtag_info, &address); + +// printf("Adres: %.8x\n", address); /* Check for read or write */ if (ejtag_ctrl & EJTAG_CTRL_PRNW) @@ -194,6 +255,7 @@ if ((retval = mips32_pracc_exec_read(&ctx, address)) != ERROR_OK) return retval; + } if (cycle == 0) @@ -309,23 +371,16 @@ MIPS32_LUI(15,UPPER16(MIPS32_PRACC_STACK)), /* $15 = MIPS32_PRACC_STACK */ MIPS32_ORI(15,15,LOWER16(MIPS32_PRACC_STACK)), MIPS32_SW(8,0,15), /* sw $8,($15) */ - MIPS32_SW(9,0,15), /* sw $9,($15) */ - MIPS32_LUI(8,UPPER16(MIPS32_PRACC_PARAM_IN)), /* $8 = MIPS32_PRACC_PARAM_IN */ - MIPS32_ORI(8,8,LOWER16(MIPS32_PRACC_PARAM_IN)), - MIPS32_LW(8,0,8), /* $8=mem[$8]; read addr */ - MIPS32_LUI(9,UPPER16(MIPS32_PRACC_PARAM_OUT)), /* $9=MIPS32_PRACC_PARAM_OUT */ - MIPS32_ORI(9,9,LOWER16(MIPS32_PRACC_PARAM_OUT)), + MIPS32_LW(8,NEG16(MIPS32_PRACC_STACK-MIPS32_PRACC_PARAM_IN), 15), //load R8 @ param_in[0] = address MIPS32_LW(8,0,8), /* lw $8,0($8), Load $8 with the word @mem[$8] */ - MIPS32_SW(8,0,9), /* sw $8,0($9) */ + MIPS32_SW(8,NEG16(MIPS32_PRACC_STACK-MIPS32_PRACC_PARAM_OUT),15), /* sw $8,0($9) */ - MIPS32_LW(9,0,15), /* lw $9,($15) */ MIPS32_LW(8,0,15), /* lw $8,($15) */ - MIPS32_MFC0(15,31,0), /* move COP0 DeSave to $15 */ + MIPS32_B(NEG16(9)), //was 17 /* b start */ + MIPS32_MFC0(15,31,0), //this instruction will be executed (MIPS executes instruction after jump) /* move COP0 DeSave to $15 */ MIPS32_NOP, - MIPS32_B(NEG16(17)), /* b start */ - MIPS32_NOP, }; int retval = ERROR_OK; @@ -520,6 +575,8 @@ int mips32_pracc_write_mem32(mips_ejtag_t *ejtag_info, u32 addr, int count, u32 *buf) { + +//NC: use destination pointer as loop counter (last address is in $10) u32 code[] = { /* start: */ MIPS32_MTC0(15,31,0), /* move $15 to COP0 DeSave */ @@ -530,41 +587,33 @@ MIPS32_SW(10,0,15), /* sw $10,($15) */ MIPS32_SW(11,0,15), /* sw $11,($15) */ - MIPS32_LUI(8,UPPER16(MIPS32_PRACC_PARAM_IN)), /* $8 = MIPS32_PRACC_PARAM_IN */ - MIPS32_ORI(8,8,LOWER16(MIPS32_PRACC_PARAM_IN)), + MIPS32_ADDI(8,15,NEG16(MIPS32_PRACC_STACK-MIPS32_PRACC_PARAM_IN)), //$8= MIPS32_PRACC_PARAM_IN MIPS32_LW(9,0,8), /* Load write addr to $9 */ - MIPS32_LW(10,4,8), /* Load write count to $10 */ - MIPS32_ADDI(8,8,8), /* $8+=8 */ - MIPS32_NOP, - /* loop: */ - MIPS32_BEQ(0,10,9), /* beq $0, $10, end */ - MIPS32_NOP, - + MIPS32_LW(10,4,8), //last address /* Load write count to $10 */ + MIPS32_ADDI(8,8,8), // $8+=8 beginning of data + +//loop: MIPS32_LW(11,0,8), /* lw $11,0($8), Load $11 with the word @mem[$8] */ MIPS32_SW(11,0,9), /* sw $11,0($9) */ - MIPS32_ADDI(10,10,NEG16(1)), /* $10-- */ MIPS32_ADDI(9,9,4), /* $9+=4 */ - MIPS32_ADDI(8,8,4), /* $8+=4 */ - MIPS32_NOP, - MIPS32_B(NEG16(9)), /* b loop */ - MIPS32_NOP, + MIPS32_BNE(10,9,NEG16(4)), //was 9 BNE $10, 9, loop /* b loop */ + MIPS32_ADDI(8,8,4), //this instruction is part of the loop (one delay slot)! /* $8+=4 */ /* end: */ MIPS32_LW(11,0,15), /* lw $11,($15) */ MIPS32_LW(10,0,15), /* lw $10,($15) */ MIPS32_LW(9,0,15), /* lw $9,($15) */ MIPS32_LW(8,0,15), /* lw $8,($15) */ + MIPS32_B(NEG16(21)), //was 30 /* b start */ MIPS32_MFC0(15,31,0), /* move COP0 DeSave to $15 */ - MIPS32_NOP, - MIPS32_B(NEG16(30)), /* b start */ - MIPS32_NOP, + MIPS32_NOP, //this one will not be executed }; /* TODO remove array */ u32 param_in[count+2]; param_in[0] = addr; - param_in[1] = count; - + param_in[1] = addr + count * sizeof(u32); //last address + memcpy(¶m_in[2], buf, count * sizeof(u32)); mips32_pracc_exec(ejtag_info, sizeof(code)/sizeof(code[0]), code, \ @@ -582,20 +631,17 @@ MIPS32_ORI(15,15,LOWER16(MIPS32_PRACC_STACK)), MIPS32_SW(8,0,15), /* sw $8,($15) */ MIPS32_SW(9,0,15), /* sw $9,($15) */ + + MIPS32_LW(8,NEG16((MIPS32_PRACC_STACK-MIPS32_PRACC_PARAM_IN)-4), 15), //load R8 @ param_in[1] = data + MIPS32_LW(9,NEG16(MIPS32_PRACC_STACK-MIPS32_PRACC_PARAM_IN), 15), //load R9 @ param_in[0] = address - MIPS32_LUI(8,UPPER16((MIPS32_PRACC_PARAM_IN+4))), /* $8 = MIPS32_PRACC_PARAM_IN+4 */ - MIPS32_ORI(8,8,LOWER16((MIPS32_PRACC_PARAM_IN+4))), - MIPS32_LW(9,NEG16(4),8), /* Load write addr to $9 */ - - MIPS32_LW(8,0,8), /* lw $8,0($8), Load $8 with the word @mem[$8] */ MIPS32_SW(8,0,9), /* sw $8,0($9) */ MIPS32_LW(9,0,15), /* lw $9,($15) */ MIPS32_LW(8,0,15), /* lw $8,($15) */ - MIPS32_MFC0(15,31,0), /* move COP0 DeSave to $15 */ + MIPS32_B(NEG16(11)), /* b start */ + MIPS32_MFC0(15,31,0), /* move COP0 DeSave to $15 */ MIPS32_NOP, - MIPS32_B(NEG16(15)), /* b start */ - MIPS32_NOP, }; /* TODO remove array */ Modified: trunk/src/target/mips32_pracc.h =================================================================== --- trunk/src/target/mips32_pracc.h 2009-04-21 11:33:29 UTC (rev 1493) +++ trunk/src/target/mips32_pracc.h 2009-04-21 11:35:58 UTC (rev 1494) @@ -25,7 +25,8 @@ #include "mips_ejtag.h" #define MIPS32_PRACC_TEXT 0xFF200200 -#define MIPS32_PRACC_STACK 0xFF2FFFFC +//#define MIPS32_PRACC_STACK 0xFF2FFFFC +#define MIPS32_PRACC_STACK 0xFF204000 #define MIPS32_PRACC_PARAM_IN 0xFF201000 #define MIPS32_PRACC_PARAM_IN_SIZE 0x1000 #define MIPS32_PRACC_PARAM_OUT (MIPS32_PRACC_PARAM_IN + MIPS32_PRACC_PARAM_IN_SIZE) |