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: ntfreak at B. <nt...@ma...> - 2009-04-29 15:24:06
|
Author: ntfreak Date: 2009-04-29 15:24:05 +0200 (Wed, 29 Apr 2009) New Revision: 1568 Modified: trunk/src/target/board/olimex_LPC2378STK.cfg trunk/src/target/interface/icebear.cfg Log: - add missing svn props from svn 1565 commit Property changes on: trunk/src/target/board/olimex_LPC2378STK.cfg ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/target/interface/icebear.cfg ___________________________________________________________________ Name: svn:eol-style + native |
From: oharboe at B. <oh...@ma...> - 2009-04-29 13:37:34
|
Author: oharboe Date: 2009-04-29 13:37:33 +0200 (Wed, 29 Apr 2009) New Revision: 1567 Modified: trunk/src/target/arm11.h trunk/src/target/arm11_dbgtap.c Log: comments and debug code Modified: trunk/src/target/arm11.h =================================================================== --- trunk/src/target/arm11.h 2009-04-29 07:40:07 UTC (rev 1566) +++ trunk/src/target/arm11.h 2009-04-29 11:37:33 UTC (rev 1567) @@ -56,7 +56,10 @@ int __retval = (action); \ \ if (__retval != ERROR_OK) \ + { \ + LOG_DEBUG("error while calling \"" # action "\""); \ return __retval; \ + } \ \ } while (0) Modified: trunk/src/target/arm11_dbgtap.c =================================================================== --- trunk/src/target/arm11_dbgtap.c 2009-04-29 07:40:07 UTC (rev 1566) +++ trunk/src/target/arm11_dbgtap.c 2009-04-29 11:37:33 UTC (rev 1567) @@ -36,6 +36,13 @@ #define JTAG_DEBUG(expr ...) do {} while(0) #endif +/* +This pathmove goes from Pause-IR to Shift-IR while avoiding RTI. The +behavior of the FTDI driver IIRC was to go via RTI. + +Conversely there may be other places in this code where the ARM11 code relies +on the driver to hit through RTI when coming from Update-?R. +*/ tap_state_t arm11_move_pi_to_si_via_ci[] = { TAP_IREXIT2, TAP_IRUPDATE, TAP_DRSELECT, TAP_IRSELECT, TAP_IRCAPTURE, TAP_IRSHIFT @@ -476,6 +483,8 @@ * layer (FT2232) that is long enough to finish execution on * the core but still shorter than any manually inducible delays. * + * To disable this code, try "memwrite burst false" + * */ tap_state_t arm11_MOVE_DRPAUSE_IDLE_DRPAUSE_with_delay[] = { @@ -613,7 +622,7 @@ do { arm11_add_dr_scan_vc(asizeof(chain5_fields), chain5_fields, count ? TAP_IDLE : TAP_DRPAUSE); - + CHECK_RETVAL(jtag_execute_queue()); JTAG_DEBUG("DTR Data %08x Ready %d nRetry %d", Data, Ready, nRetry); @@ -715,7 +724,7 @@ JTAG_DEBUG("SC7 <= Address %02x Data %08x nRW %d", AddressOut, DataOut, nRW); arm11_add_dr_scan_vc(asizeof(chain7_fields), chain7_fields, TAP_DRPAUSE); - + CHECK_RETVAL(jtag_execute_queue()); JTAG_DEBUG("SC7 => Address %02x Data %08x Ready %d", AddressIn, DataIn, Ready); |
From: <zw...@ma...> - 2009-04-29 09:40:13
|
Author: zwelch Date: 2009-04-29 09:40:07 +0200 (Wed, 29 Apr 2009) New Revision: 1566 Added: trunk/src/target/board/olimex_LPC2378STK.cfg Log: Sten <de...@sa...>: add support for Olimex LPC2378STK eval board. Added: trunk/src/target/board/olimex_LPC2378STK.cfg =================================================================== --- trunk/src/target/board/olimex_LPC2378STK.cfg 2009-04-29 07:38:35 UTC (rev 1565) +++ trunk/src/target/board/olimex_LPC2378STK.cfg 2009-04-29 07:40:07 UTC (rev 1566) @@ -0,0 +1,11 @@ +##################################################### +# Olimex LPC2378STK eval board +# +# http://olimex.com/dev/lpc-2378stk.html +# +# Author: Sten, de...@sa... +##################################################### +# + +source [find target/lpc2378.cfg] + |
From: <zw...@ma...> - 2009-04-29 09:38:44
|
Author: zwelch Date: 2009-04-29 09:38:35 +0200 (Wed, 29 Apr 2009) New Revision: 1565 Added: trunk/src/target/interface/icebear.cfg Modified: trunk/src/jtag/ft2232.c Log: Sten <de...@sa...>: add support for ICEbear FDTI-based interface. Modified: trunk/src/jtag/ft2232.c =================================================================== --- trunk/src/jtag/ft2232.c 2009-04-29 06:30:44 UTC (rev 1564) +++ trunk/src/jtag/ft2232.c 2009-04-29 07:38:35 UTC (rev 1565) @@ -114,6 +114,7 @@ static int stm32stick_init(void); static int axm0432_jtag_init(void); static int sheevaplug_init(void); +static int icebear_jtag_init(void); /* reset procedures for supported layouts */ static void usbjtag_reset(int trst, int srst); @@ -125,6 +126,7 @@ static void stm32stick_reset(int trst, int srst); static void axm0432_jtag_reset(int trst, int srst); static void sheevaplug_reset(int trst, int srst); +static void icebear_jtag_reset(int trst, int srst); /* blink procedures for layouts that support a blinking led */ static void olimex_jtag_blink(void); @@ -146,6 +148,7 @@ { "stm32stick", stm32stick_init, stm32stick_reset, NULL }, { "axm0432_jtag", axm0432_jtag_init, axm0432_jtag_reset, NULL }, {"sheevaplug", sheevaplug_init, sheevaplug_reset, NULL }, + { "icebear", icebear_jtag_init, icebear_jtag_reset, NULL }, { NULL, NULL, NULL, NULL }, }; @@ -2661,3 +2664,105 @@ return retval; } + +/* --------------------------------------------------------------------- + * Support for IceBear JTAG adapter from Section5: + * http://section5.ch/icebear + * + * Author: Sten, de...@sa... + */ + +/* Icebear pin layout + * + * ADBUS5 (nEMU) nSRST | 2 1| GND (10k->VCC) + * GND GND | 4 3| n.c. + * ADBUS3 TMS | 6 5| ADBUS6 VCC + * ADBUS0 TCK | 8 7| ADBUS7 (GND) + * ADBUS4 nTRST |10 9| ACBUS0 (GND) + * ADBUS1 TDI |12 11| ACBUS1 (GND) + * ADBUS2 TDO |14 13| GND GND + * + * ADBUS0 O L TCK ACBUS0 GND + * ADBUS1 O L TDI ACBUS1 GND + * ADBUS2 I TDO ACBUS2 n.c. + * ADBUS3 O H TMS ACBUS3 n.c. + * ADBUS4 O H nTRST + * ADBUS5 O H nSRST + * ADBUS6 - VCC + * ADBUS7 - GND + */ +static int icebear_jtag_init(void) { + u8 buf[3]; + u32 bytes_written; + + low_direction = 0x0b; /* output: TCK TDI TMS; input: TDO */ + low_output = 0x08; /* high: TMS; low: TCK TDI */ + nTRST = 0x10; + nSRST = 0x20; + + if ((jtag_reset_config & RESET_TRST_OPEN_DRAIN) != 0) { + low_direction &= ~nTRST; /* nTRST high impedance */ + } + else { + low_direction |= nTRST; + low_output |= nTRST; + } + + low_direction |= nSRST; + low_output |= nSRST; + + /* initialize low byte for jtag */ + buf[0] = 0x80; /* command "set data bits low byte" */ + buf[1] = low_output; + buf[2] = low_direction; + LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); + + if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) { + LOG_ERROR("couldn't initialize FT2232 with 'IceBear' layout (low)"); + return ERROR_JTAG_INIT_FAILED; + } + + high_output = 0x0; + high_direction = 0x00; + + + /* initialize high port */ + buf[0] = 0x82; /* command "set data bits high byte" */ + buf[1] = high_output; /* value */ + buf[2] = high_direction; /* all outputs (xRST and xRSTnOE) */ + LOG_DEBUG("%2.2x %2.2x %2.2x", buf[0], buf[1], buf[2]); + + if ( ( ( ft2232_write(buf, 3, &bytes_written) ) != ERROR_OK ) || (bytes_written != 3) ) { + LOG_ERROR("couldn't initialize FT2232 with 'IceBear' layout (high)"); + return ERROR_JTAG_INIT_FAILED; + } + + return ERROR_OK; +} + +static void icebear_jtag_reset(int trst, int srst) { + + if (trst == 1) { + low_direction |= nTRST; + low_output &= ~nTRST; + } + else if (trst == 0) { + if ((jtag_reset_config & RESET_TRST_OPEN_DRAIN) != 0) + low_direction &= ~nTRST; + else + low_output |= nTRST; + } + + if (srst == 1) { + low_output &= ~nSRST; + } + else if (srst == 0) { + low_output |= nSRST; + } + + /* command "set data bits low byte" */ + BUFFER_ADD = 0x80; + BUFFER_ADD = low_output; + BUFFER_ADD = low_direction; + LOG_DEBUG("trst: %i, srst: %i, low_output: 0x%2.2x, low_direction: 0x%2.2x", trst, srst, low_output, low_direction); +} Added: trunk/src/target/interface/icebear.cfg =================================================================== --- trunk/src/target/interface/icebear.cfg 2009-04-29 06:30:44 UTC (rev 1564) +++ trunk/src/target/interface/icebear.cfg 2009-04-29 07:38:35 UTC (rev 1565) @@ -0,0 +1,23 @@ +##################################################### +# IceBear Configuration +# +# http://section5.ch/icebear +# +# Author: Sten, de...@sa... +##################################################### +# +# Add file /etc/udev/rules.d/45-icebear.rules +# +#BUS!="usb", ACTION!="add", SUBSYSTEM!=="usb_device", GOTO="kcontrol_rules_end" +# +#SYSFS{idProduct}=="c140", SYSFS{idVendor}=="0403", MODE="666", GROUP="usb" +#SYSFS{idProduct}=="c141", SYSFS{idVendor}=="0403", MODE="666", GROUP="usb" +# +#LABEL="kcontrol_rules_end" +# + +interface ft2232 +#ft2232_device_desc "" +ft2232_layout icebear +ft2232_vid_pid 0x0403 0xc140 + |
From: <zw...@ma...> - 2009-04-29 08:31:03
|
Author: zwelch Date: 2009-04-29 08:30:44 +0200 (Wed, 29 Apr 2009) New Revision: 1564 Modified: trunk/src/jtag/jlink.c Log: Fix jlink usb_bulk_with_retries to return actual error codes. Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2009-04-29 05:22:14 UTC (rev 1563) +++ trunk/src/jtag/jlink.c 2009-04-29 06:30:44 UTC (rev 1564) @@ -31,6 +31,7 @@ #include <usb.h> #include <string.h> +#include <errno.h> #include "log.h" @@ -867,21 +868,17 @@ usb_dev_handle *dev, int ep, char *bytes, int size, int timeout) { - int rc = 0, tries = 3, this_size; + int tries = 3, count = 0; - while (tries && size) { - - this_size = f(dev, ep, bytes, size, timeout); - if (this_size > 0) { - - size -= this_size; - rc += this_size; - bytes += this_size; - - } else - tries --; + while (tries && (count < size)) + { + int result = f(dev, ep, bytes + count, size - count, timeout); + if (result > 0) + count += result; + else if ((-ETIMEDOUT != result) || !--tries) + return result; } - return rc; + return count; } static int wrap_usb_bulk_write(usb_dev_handle *dev, int ep, |
From: <zw...@ma...> - 2009-04-29 07:22:26
|
Author: zwelch Date: 2009-04-29 07:22:14 +0200 (Wed, 29 Apr 2009) New Revision: 1563 Modified: trunk/src/jtag/jlink.c Log: Remove vestigial last_tms variable from jlink driver. Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2009-04-29 03:28:12 UTC (rev 1562) +++ trunk/src/jtag/jlink.c 2009-04-29 05:22:14 UTC (rev 1563) @@ -621,8 +621,6 @@ static int pending_scan_results_length; static pending_scan_result_t pending_scan_results_buffer[MAX_PENDING_SCAN_RESULTS]; -static int last_tms; - static void jlink_tap_init(void) { tap_length = 0; @@ -642,7 +640,6 @@ static void jlink_tap_append_step(int tms, int tdi) { - last_tms = tms; int index = tap_length / 8; if (index >= JLINK_TAP_BUFFER_SIZE) |
From: <zw...@ma...> - 2009-04-29 05:28:26
|
Author: zwelch Date: 2009-04-29 05:28:12 +0200 (Wed, 29 Apr 2009) New Revision: 1562 Modified: trunk/configure.in Log: Add -Wredundant-decls to prevent unwanted duplicate declarations. Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2009-04-29 02:18:50 UTC (rev 1561) +++ trunk/configure.in 2009-04-29 03:28:12 UTC (rev 1562) @@ -779,6 +779,7 @@ GCC_WARNINGS="${GCC_WARNINGS} -Wextra -Wno-unused-parameter" GCC_WARNINGS="${GCC_WARNINGS} -Wbad-function-cast" GCC_WARNINGS="${GCC_WARNINGS} -Wcast-align" + GCC_WARNINGS="${GCC_WARNINGS} -Wredundant-decls" fi if test "${gcc_werror}" = yes; then GCC_WARNINGS="${GCC_WARNINGS} -Werror" |
From: <zw...@ma...> - 2009-04-29 04:18:55
|
Author: zwelch Date: 2009-04-29 04:18:50 +0200 (Wed, 29 Apr 2009) New Revision: 1561 Modified: trunk/src/jtag/jlink.c Log: Fix jlink for Debian/Ubuntu (by Ben Dooks <ben...@fl...>). Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2009-04-29 01:43:01 UTC (rev 1560) +++ trunk/src/jtag/jlink.c 2009-04-29 02:18:50 UTC (rev 1561) @@ -886,12 +886,21 @@ } return rc; } + +static int wrap_usb_bulk_write(usb_dev_handle *dev, int ep, + char *buff, int size, int timeout) +{ + /* usb_bulk_write() takes const char *buff */ + return usb_bulk_write(dev, ep, buff, size, timeout); +} + static inline int usb_bulk_write_ex(usb_dev_handle *dev, int ep, char *bytes, int size, int timeout) { - return usb_bulk_with_retries(&usb_bulk_write, + return usb_bulk_with_retries(&wrap_usb_bulk_write, dev, ep, bytes, size, timeout); } + static inline int usb_bulk_read_ex(usb_dev_handle *dev, int ep, char *bytes, int size, int timeout) { |
From: <zw...@ma...> - 2009-04-29 03:43:39
|
Author: zwelch Date: 2009-04-29 03:43:01 +0200 (Wed, 29 Apr 2009) New Revision: 1560 Modified: trunk/src/flash/stellaris.c trunk/src/helper/fileio.c trunk/src/helper/jim.c trunk/src/helper/replacements.c trunk/src/helper/replacements.h trunk/src/helper/time_support.c trunk/src/jtag/jtag.h trunk/src/server/tcl_server.c trunk/src/target/arm7_9_common.h trunk/src/target/arm7tdmi.c trunk/src/target/arm926ejs.c trunk/src/target/arm9tdmi.c trunk/src/target/armv4_5.h trunk/src/target/armv4_5_mmu.c trunk/src/target/armv7m.h trunk/src/target/embeddedice.c trunk/src/target/etb.c trunk/src/target/etm.c Log: Remove redundant declarations to allow building with -Wredundant-decls. Modified: trunk/src/flash/stellaris.c =================================================================== --- trunk/src/flash/stellaris.c 2009-04-29 00:33:35 UTC (rev 1559) +++ trunk/src/flash/stellaris.c 2009-04-29 01:43:01 UTC (rev 1560) @@ -59,7 +59,6 @@ static void stellaris_set_flash_mode(flash_bank_t *bank,int mode); //static u32 stellaris_wait_status_busy(flash_bank_t *bank, u32 waitbits, int timeout); -static int stellaris_read_part_info(struct flash_bank_s *bank); static int stellaris_handle_mass_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); static int stellaris_mass_erase(struct flash_bank_s *bank); Modified: trunk/src/helper/fileio.c =================================================================== --- trunk/src/helper/fileio.c 2009-04-29 00:33:35 UTC (rev 1559) +++ trunk/src/helper/fileio.c 2009-04-29 01:43:01 UTC (rev 1560) @@ -43,7 +43,6 @@ #include <errno.h> #include <ctype.h> -int fileio_close(fileio_t *fileio); int fileio_dispatch_read(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_read); int fileio_open_local(fileio_t *fileio) Modified: trunk/src/helper/jim.c =================================================================== --- trunk/src/helper/jim.c 2009-04-29 00:33:35 UTC (rev 1559) +++ trunk/src/helper/jim.c 2009-04-29 01:43:01 UTC (rev 1560) @@ -11979,7 +11979,7 @@ if (argc == 1) { -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__USE_GNU) extern char **environ; #endif Modified: trunk/src/helper/replacements.c =================================================================== --- trunk/src/helper/replacements.c 2009-04-29 00:33:35 UTC (rev 1559) +++ trunk/src/helper/replacements.c 2009-04-29 01:43:01 UTC (rev 1560) @@ -64,6 +64,7 @@ return t; } +#define IN_REPLACEMENTS_C #include "replacements.h" #include <stdio.h> Modified: trunk/src/helper/replacements.h =================================================================== --- trunk/src/helper/replacements.h 2009-04-29 00:33:35 UTC (rev 1559) +++ trunk/src/helper/replacements.h 2009-04-29 01:43:01 UTC (rev 1560) @@ -103,9 +103,11 @@ extern int gettimeofday(struct timeval *tv, struct timezone *tz); #endif +#ifndef IN_REPLACEMENTS_C /**** clear_malloc & fill_malloc ****/ void *clear_malloc(size_t size); void *fill_malloc(size_t size); +#endif /* * Now you have 3 ways for the malloc function: Modified: trunk/src/helper/time_support.c =================================================================== --- trunk/src/helper/time_support.c 2009-04-29 00:33:35 UTC (rev 1559) +++ trunk/src/helper/time_support.c 2009-04-29 01:43:01 UTC (rev 1560) @@ -33,9 +33,6 @@ #include <stdlib.h> -int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y); -int timeval_add(struct timeval *result, struct timeval *x, struct timeval *y); -int timeval_add_time(struct timeval *result, int sec, int usec); /* calculate difference between two struct timeval values */ int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y) Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-04-29 00:33:35 UTC (rev 1559) +++ trunk/src/jtag/jtag.h 2009-04-29 01:43:01 UTC (rev 1560) @@ -395,7 +395,6 @@ }; extern jtag_tap_t* jtag_AllTaps(void); extern jtag_tap_t* jtag_TapByPosition(int n); -extern jtag_tap_t* jtag_TapByPosition(int n); extern jtag_tap_t* jtag_TapByString(const char* dotted_name); extern jtag_tap_t* jtag_TapByJimObj(Jim_Interp* interp, Jim_Obj* obj); extern jtag_tap_t* jtag_TapByAbsPosition(int abs_position); Modified: trunk/src/server/tcl_server.c =================================================================== --- trunk/src/server/tcl_server.c 2009-04-29 00:33:35 UTC (rev 1559) +++ trunk/src/server/tcl_server.c 2009-04-29 01:43:01 UTC (rev 1560) @@ -43,7 +43,6 @@ int tc_outerror; /* flag an output error */ } tcl_connection_t; -extern Jim_Interp *interp; static unsigned short tcl_port = 0; /* commands */ Modified: trunk/src/target/arm7_9_common.h =================================================================== --- trunk/src/target/arm7_9_common.h 2009-04-29 00:33:35 UTC (rev 1559) +++ trunk/src/target/arm7_9_common.h 2009-04-29 01:43:01 UTC (rev 1560) @@ -127,7 +127,6 @@ int arm7_9_prepare_reset_halt(struct target_s *target); int arm7_9_halt(target_t *target); -int arm7_9_debug_entry(target_t *target); int arm7_9_full_context(target_t *target); int arm7_9_restore_context(target_t *target); int arm7_9_resume(struct target_s *target, int current, u32 address, int handle_breakpoints, int debug_execution); Modified: trunk/src/target/arm7tdmi.c =================================================================== --- trunk/src/target/arm7tdmi.c 2009-04-29 00:33:35 UTC (rev 1559) +++ trunk/src/target/arm7tdmi.c 2009-04-29 01:43:01 UTC (rev 1560) @@ -43,13 +43,9 @@ #define _DEBUG_INSTRUCTION_EXECUTION_ #endif -/* cli handling */ -int arm7tdmi_register_commands(struct command_context_s *cmd_ctx); - /* forward declarations */ int arm7tdmi_target_create(struct target_s *target,Jim_Interp *interp); -int arm7tdmi_init_target(struct command_context_s *cmd_ctx, struct target_s *target); int arm7tdmi_quit(void); /* target function declarations */ Modified: trunk/src/target/arm926ejs.c =================================================================== --- trunk/src/target/arm926ejs.c 2009-04-29 00:33:35 UTC (rev 1559) +++ trunk/src/target/arm926ejs.c 2009-04-29 01:43:01 UTC (rev 1560) @@ -34,8 +34,6 @@ #endif /* cli handling */ -int arm926ejs_register_commands(struct command_context_s *cmd_ctx); - int arm926ejs_handle_cp15_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int arm926ejs_handle_cp15i_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int arm926ejs_handle_virt2phys_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); @@ -50,10 +48,8 @@ int arm926ejs_target_create(struct target_s *target, Jim_Interp *interp); int arm926ejs_init_target(struct command_context_s *cmd_ctx, struct target_s *target); int arm926ejs_quit(void); -int arm926ejs_arch_state(struct target_s *target); int arm926ejs_read_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer); -int arm926ejs_write_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer); -int arm926ejs_soft_reset_halt(struct target_s *target); + static int arm926ejs_virt2phys(struct target_s *target, u32 virtual, u32 *physical); static int arm926ejs_mmu(struct target_s *target, int *enabled); Modified: trunk/src/target/arm9tdmi.c =================================================================== --- trunk/src/target/arm9tdmi.c 2009-04-29 00:33:35 UTC (rev 1559) +++ trunk/src/target/arm9tdmi.c 2009-04-29 01:43:01 UTC (rev 1560) @@ -48,13 +48,11 @@ #endif /* cli handling */ -int arm9tdmi_register_commands(struct command_context_s *cmd_ctx); int handle_arm9tdmi_catch_vectors_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); /* forward declarations */ int arm9tdmi_target_create( struct target_s *target, Jim_Interp *interp ); -int arm9tdmi_init_target(struct command_context_s *cmd_ctx, struct target_s *target); int arm9tdmi_quit(void); target_type_t arm9tdmi_target = Modified: trunk/src/target/armv4_5.h =================================================================== --- trunk/src/target/armv4_5.h 2009-04-29 00:33:35 UTC (rev 1559) +++ trunk/src/target/armv4_5.h 2009-04-29 01:43:01 UTC (rev 1560) @@ -139,7 +139,6 @@ extern int armv4_5_arch_state(struct target_s *target); extern int armv4_5_get_gdb_reg_list(target_t *target, reg_t **reg_list[], int *reg_list_size); -extern int armv4_5_invalidate_core_regs(target_t *target); extern int armv4_5_register_commands(struct command_context_s *cmd_ctx); extern int armv4_5_init_arch_info(target_t *target, armv4_5_common_t *armv4_5); Modified: trunk/src/target/armv4_5_mmu.c =================================================================== --- trunk/src/target/armv4_5_mmu.c 2009-04-29 00:33:35 UTC (rev 1559) +++ trunk/src/target/armv4_5_mmu.c 2009-04-29 01:43:01 UTC (rev 1560) @@ -30,8 +30,6 @@ #include <stdlib.h> u32 armv4mmu_translate_va(target_t *target, armv4_5_mmu_common_t *armv4_5_mmu, u32 va, int *type, u32 *cb, int *domain, u32 *ap); -int armv4_5_mmu_read_physical(target_t *target, armv4_5_mmu_common_t *armv4_5_mmu, u32 address, u32 size, u32 count, u8 *buffer); -int armv4_5_mmu_write_physical(target_t *target, armv4_5_mmu_common_t *armv4_5_mmu, u32 address, u32 size, u32 count, u8 *buffer); char* armv4_5_mmu_page_type_names[] = { Modified: trunk/src/target/armv7m.h =================================================================== --- trunk/src/target/armv7m.h 2009-04-29 00:33:35 UTC (rev 1559) +++ trunk/src/target/armv7m.h 2009-04-29 01:43:01 UTC (rev 1560) @@ -121,7 +121,6 @@ extern int armv7m_arch_state(struct target_s *target); extern int armv7m_get_gdb_reg_list(target_t *target, reg_t **reg_list[], int *reg_list_size); -extern int armv7m_invalidate_core_regs(target_t *target); extern int armv7m_register_commands(struct command_context_s *cmd_ctx); extern int armv7m_init_arch_info(target_t *target, armv7m_common_t *armv7m); Modified: trunk/src/target/embeddedice.c =================================================================== --- trunk/src/target/embeddedice.c 2009-04-29 00:33:35 UTC (rev 1559) +++ trunk/src/target/embeddedice.c 2009-04-29 01:43:01 UTC (rev 1560) @@ -86,12 +86,7 @@ int embeddedice_reg_arch_type = -1; int embeddedice_get_reg(reg_t *reg); -void embeddedice_set_reg(reg_t *reg, u32 value); -int embeddedice_set_reg_w_exec(reg_t *reg, u8 *buf); -void embeddedice_write_reg(reg_t *reg, u32 value); -int embeddedice_read_reg(reg_t *reg); - reg_cache_t* embeddedice_build_reg_cache(target_t *target, arm7_9_common_t *arm7_9) { int retval; Modified: trunk/src/target/etb.c =================================================================== --- trunk/src/target/etb.c 2009-04-29 00:33:35 UTC (rev 1559) +++ trunk/src/target/etb.c 2009-04-29 01:43:01 UTC (rev 1560) @@ -52,12 +52,7 @@ int etb_reg_arch_type = -1; int etb_get_reg(reg_t *reg); -int etb_set_reg(reg_t *reg, u32 value); -int etb_set_reg_w_exec(reg_t *reg, u8 *buf); -int etb_write_reg(reg_t *reg, u32 value); -int etb_read_reg(reg_t *reg); - int handle_etb_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int etb_set_instr(etb_t *etb, u32 new_instr) Modified: trunk/src/target/etm.c =================================================================== --- trunk/src/target/etm.c 2009-04-29 00:33:35 UTC (rev 1559) +++ trunk/src/target/etm.c 2009-04-29 01:43:01 UTC (rev 1560) @@ -208,12 +208,7 @@ int etm_reg_arch_type = -1; int etm_get_reg(reg_t *reg); -int etm_set_reg(reg_t *reg, u32 value); -int etm_set_reg_w_exec(reg_t *reg, u8 *buf); -int etm_write_reg(reg_t *reg, u32 value); -int etm_read_reg(reg_t *reg); - command_t *etm_cmd = NULL; reg_cache_t* etm_build_reg_cache(target_t *target, arm_jtag_t *jtag_info, etm_context_t *etm_ctx) @@ -480,7 +475,6 @@ /* ETM trace analysis functionality * */ -extern etm_capture_driver_t etb_capture_driver; extern etm_capture_driver_t etm_dummy_capture_driver; #if BUILD_OOCD_TRACE == 1 extern etm_capture_driver_t oocd_trace_capture_driver; |
From: <zw...@ma...> - 2009-04-29 03:23:09
|
Author: zwelch Date: 2009-04-29 02:33:35 +0200 (Wed, 29 Apr 2009) New Revision: 1559 Modified: trunk/configure.in trunk/src/helper/jim-eventloop.c trunk/src/helper/replacements.h trunk/src/jtag/jtag.c Log: Add missing header files to fix C99 compatibility. Modified: trunk/configure.in =================================================================== --- trunk/configure.in 2009-04-28 20:59:52 UTC (rev 1558) +++ trunk/configure.in 2009-04-29 00:33:35 UTC (rev 1559) @@ -9,6 +9,7 @@ AC_CHECK_HEADERS(jtag_minidriver.h) AC_CHECK_HEADERS(sys/param.h) AC_CHECK_HEADERS(sys/time.h) +AC_CHECK_HEADERS(sys/select.h) AC_CHECK_HEADERS(elf.h) AC_CHECK_HEADERS(strings.h) AC_CHECK_HEADERS(stdbool.h) Modified: trunk/src/helper/jim-eventloop.c =================================================================== --- trunk/src/helper/jim-eventloop.c 2009-04-28 20:59:52 UTC (rev 1558) +++ trunk/src/helper/jim-eventloop.c 2009-04-29 00:33:35 UTC (rev 1559) @@ -62,6 +62,7 @@ #include <sys/time.h> #include <sys/types.h> #include <unistd.h> +#include <stdio.h> #include <errno.h> #include "replacements.h" Modified: trunk/src/helper/replacements.h =================================================================== --- trunk/src/helper/replacements.h 2009-04-28 20:59:52 UTC (rev 1558) +++ trunk/src/helper/replacements.h 2009-04-29 00:33:35 UTC (rev 1559) @@ -35,9 +35,16 @@ #if BUILD_ECOSBOARD #include <pkgconf/system.h> #include <stdlib.h> -#include <sys/select.h> #endif +#ifdef HAVE_SYS_SELECT_H +#include <sys/select.h> /* select, FD_SET and friends (POSIX.1-2001) */ +#endif + +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> /* FD_SET and friends (pre-POSIX.1-2001) */ +#endif + /* include necessary headers for socket functionality */ #ifdef _WIN32 #include <winsock2.h> Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-04-28 20:59:52 UTC (rev 1558) +++ trunk/src/jtag/jtag.c 2009-04-29 00:33:35 UTC (rev 1559) @@ -35,9 +35,12 @@ #include "command.h" #include "log.h" -#include "stdlib.h" -#include "string.h" +#include <stdlib.h> +#include <string.h> #include <unistd.h> +#ifdef HAVE_STRINGS_H +#include <strings.h> +#endif /* note that this is not marked as static as it must be available from outside jtag.c for those that implement the jtag_xxx() minidriver layer |
From: <oh...@ma...> - 2009-04-28 22:59:54
|
Author: oharboe Date: 2009-04-28 22:59:52 +0200 (Tue, 28 Apr 2009) New Revision: 1558 Modified: trunk/src/jtag/jtag.h Log: more docs on jtag_add_pathmove() Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-04-28 19:02:29 UTC (rev 1557) +++ trunk/src/jtag/jtag.h 2009-04-28 20:59:52 UTC (rev 1558) @@ -575,7 +575,18 @@ extern void jtag_add_tlr(void); extern int interface_jtag_add_tlr(void); -/* Do not use jtag_add_pathmove() unless you need to, but do use it +/* Application code *must* assume that interfaces will + * implement transitions between states with different + * paths and path lengths through the state diagram. The + * path will vary across interface and also across versions + * of the same interface over time. Even if the OpenOCD code + * is unchanged, the actual path taken may vary over time + * and versions of interface firmware or PCB revisions. + * + * Use jtag_add_pathmove() when specific transition sequences + * are required. + * + * Do not use jtag_add_pathmove() unless you need to, but do use it * if you have to. * * DANGER! If the target is dependent upon a particular sequence |
From: <oh...@ma...> - 2009-04-28 21:02:31
|
Author: oharboe Date: 2009-04-28 21:02:29 +0200 (Tue, 28 Apr 2009) New Revision: 1557 Modified: trunk/src/jtag/jtag.c trunk/src/jtag/jtag.h Log: Dick Hollenbeck <di...@so...> and Jeff Williams tap_get_tms_path_len() Modified: trunk/src/jtag/jtag.c =================================================================== --- trunk/src/jtag/jtag.c 2009-04-28 17:40:02 UTC (rev 1556) +++ trunk/src/jtag/jtag.c 2009-04-28 19:02:29 UTC (rev 1557) @@ -1245,7 +1245,7 @@ bit_count = 0; #ifdef _DEBUG_JTAG_IO_ - LOG_DEBUG("num_fields: %i",cmd->num_fields); + LOG_DEBUG("%s num_fields: %i", cmd->ir_scan ? "IRSCAN" : "DRSCAN", cmd->num_fields); #endif for (i = 0; i < cmd->num_fields; i++) @@ -1261,10 +1261,20 @@ free(char_buf); #endif } + else + { +#ifdef _DEBUG_JTAG_IO_ + LOG_DEBUG("fields[%i].out_value[%i]: NULL", i, cmd->fields[i].num_bits); +#endif + } bit_count += cmd->fields[i].num_bits; } +#ifdef _DEBUG_JTAG_IO_ + //LOG_DEBUG("bit_count totalling: %i", bit_count ); +#endif + return bit_count; } @@ -3053,14 +3063,6 @@ { /* given a stable state, return the index into the tms_seqs[] array within tap_get_tms_path() */ - /* old version - const static int move_map[16] = - { - 0, -1, -1, 2, -1, 3, -1, -1, - 1, -1, -1, 4, -1, 5, -1, -1 - }; - */ - int ndx; switch( astate ) @@ -3079,48 +3081,109 @@ return ndx; } -int tap_get_tms_path( tap_state_t from, tap_state_t to ) + +/* tap_move[i][j]: tap movement command to go from state i to state j + * 0: Test-Logic-Reset + * 1: Run-Test/Idle + * 2: Shift-DR + * 3: Pause-DR + * 4: Shift-IR + * 5: Pause-IR + * + * DRSHIFT->DRSHIFT and IRSHIFT->IRSHIFT have to be caught in interface specific code + */ +static struct { - /* tap_move[i][j]: tap movement command to go from state i to state j - * 0: Test-Logic-Reset - * 1: Run-Test/Idle - * 2: Shift-DR - * 3: Pause-DR - * 4: Shift-IR - * 5: Pause-IR - * - * DRSHIFT->DRSHIFT and IRSHIFT->IRSHIFT have to be caught in interface specific code + u8 bits; + u8 bit_count; + +} tms_seqs[6][6] = /* [from_state_ndx][to_state_ndx] */ +{ + /* value clocked to TMS to move from one of six stable states to another. + * N.B. OOCD clocks TMS from LSB first, so read these right-to-left. + * N.B. These values are tightly bound to the table in tap_get_tms_path_len(). + * N.B. Reset only needs to be 0b11111, but in JLink an even byte of 1's is more stable. + * These extra ones cause no TAP state problem, because we go into reset and stay in reset. */ - static const u8 tms_seqs[6][6] = - { - /* value clocked to TMS to move from one of six stable states to another */ - /* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */ - { 0x7f, 0x00, 0x17, 0x0a, 0x1b, 0x16 }, /* RESET */ - { 0x7f, 0x00, 0x25, 0x05, 0x2b, 0x0b }, /* IDLE */ - { 0x7f, 0x31, 0x00, 0x01, 0x0f, 0x2f }, /* DRSHIFT */ - { 0x7f, 0x30, 0x20, 0x17, 0x1e, 0x2f }, /* DRPAUSE */ - { 0x7f, 0x31, 0x07, 0x17, 0x00, 0x01 }, /* IRSHIFT */ - { 0x7f, 0x30, 0x1c, 0x17, 0x20, 0x2f } /* IRPAUSE */ - }; +/* + * These macros allow us to specify TMS state transitions by bits rather than hex bytes. + * Read the bits from LSBit first to MSBit last (right-to-left). + */ +#define HEX__(n) 0x##n##LU - if( !tap_is_state_stable(from) ) - { - LOG_ERROR( "fatal: tap_state \"from\" (=%s) is not stable", tap_state_name(from) ); - exit(1); - } +#define B8__(x) \ + (((x) & 0x0000000FLU)?(1<<0):0) \ + +(((x) & 0x000000F0LU)?(1<<1):0) \ + +(((x) & 0x00000F00LU)?(1<<2):0) \ + +(((x) & 0x0000F000LU)?(1<<3):0) \ + +(((x) & 0x000F0000LU)?(1<<4):0) \ + +(((x) & 0x00F00000LU)?(1<<5):0) \ + +(((x) & 0x0F000000LU)?(1<<6):0) \ + +(((x) & 0xF0000000LU)?(1<<7):0) - if( !tap_is_state_stable(to) ) - { - LOG_ERROR( "fatal: tap_state \"to\" (=%s) is not stable", tap_state_name(to) ); - exit(1); - } +#define B8(bits,count) { ((u8)B8__(HEX__(bits))), (count) } - /* @todo: support other than 7 clocks ? */ - return tms_seqs[tap_move_ndx(from)][tap_move_ndx(to)]; +#if 0 && ((BUILD_FT2232_FTD2XX==1) || (BUILD_FT2232_LIBFTDI==1)) + /* this is the table submitted by Jeff Williams on 3/30/2009 with this comment: + + OK, I added Peter's version of the state table, and it works OK for + me on MC1322x. I've recreated the jlink portion of patch with this + new state table. His changes to my state table are pretty minor in + terms of total transitions, but Peter feels that his version fixes + some long-standing problems. + Jeff + + I added the bit count into the table + Dick + */ + + /* to state: */ + /* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */ /* from state: */ + { B8(11111,5), B8(0,1), B8(0010,4), B8(01010,5), B8(00110,5), B8(010110,6) }, /* RESET */ + { B8(11111,5), B8(0,1), B8(001,3), B8(0101,4), B8(0011,4), B8(01011,5) }, /* IDLE */ + { B8(11111,5), B8(011,3), B8(00111,5), B8(01,2), B8(001111,6), B8(0101111,7) }, /* DRSHIFT */ + { B8(11111,5), B8(011,3), B8(01,2), B8(0,1), B8(001111,6), B8(0101111,7) }, /* DRPAUSE */ + { B8(11111,5), B8(011,3), B8(00111,5), B8(010111,6), B8(001111,6), B8(01,2) }, /* IRSHIFT */ + { B8(11111,5), B8(011,3), B8(00111,5), B8(010111,6), B8(01,2), B8(0,1) } /* IRPAUSE */ + +#else /* this is the old table, converted from hex and with the bit_count set to 7 for each combo, like before */ + + /* to state: */ + /* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */ /* from state: */ + { B8(1111111,7), B8(0000000,7), B8(0010111,7), B8(0001010,7), B8(0011011,7), B8(0010110,7) }, /* RESET */ + { B8(1111111,7), B8(0000000,7), B8(0100101,7), B8(0000101,7), B8(0101011,7), B8(0001011,7) }, /* IDLE */ + { B8(1111111,7), B8(0110001,7), B8(0000000,7), B8(0000001,7), B8(0001111,7), B8(0101111,7) }, /* DRSHIFT */ + { B8(1111111,7), B8(0110000,7), B8(0100000,7), B8(0010111,7), B8(0011110,7), B8(0101111,7) }, /* DRPAUSE */ + { B8(1111111,7), B8(0110001,7), B8(0000111,7), B8(0010111,7), B8(0000000,7), B8(0000001,7) }, /* IRSHIFT */ + { B8(1111111,7), B8(0110000,7), B8(0011100,7), B8(0010111,7), B8(0100000,7), B8(0101111,7) } /* IRPAUSE */ + +#endif + +#if 0 /* keeping old hex stuff for awhile, for reference */ + /* RESET IDLE DRSHIFT DRPAUSE IRSHIFT IRPAUSE */ + { 0x7f, 0x00, 0x17, 0x0a, 0x1b, 0x16 }, /* RESET */ + { 0x7f, 0x00, 0x25, 0x05, 0x2b, 0x0b }, /* IDLE */ + { 0x7f, 0x31, 0x00, 0x01, 0x0f, 0x2f }, /* DRSHIFT */ + { 0x7f, 0x30, 0x20, 0x17, 0x1e, 0x2f }, /* DRPAUSE */ + { 0x7f, 0x31, 0x07, 0x17, 0x00, 0x01 }, /* IRSHIFT */ + { 0x7f, 0x30, 0x1c, 0x17, 0x20, 0x2f } /* IRPAUSE */ +#endif +}; + + +int tap_get_tms_path( tap_state_t from, tap_state_t to ) +{ + return tms_seqs[tap_move_ndx(from)][tap_move_ndx(to)].bits; } +int tap_get_tms_path_len( tap_state_t from, tap_state_t to ) +{ + return tms_seqs[tap_move_ndx(from)][tap_move_ndx(to)].bit_count; +} + + bool tap_is_state_stable(tap_state_t astate) { bool is_stable; @@ -3250,7 +3313,7 @@ switch( state ) { case TAP_RESET: ret = "RESET"; break; - case TAP_IDLE: ret = "RUN/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; Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-04-28 17:40:02 UTC (rev 1556) +++ trunk/src/jtag/jtag.h 2009-04-28 19:02:29 UTC (rev 1557) @@ -181,7 +181,26 @@ */ int tap_get_tms_path(tap_state_t from, tap_state_t to); + /** + * Function int tap_get_tms_path_len + * returns the total number of bits that represents a TMS path + * transition as given by the function tap_get_tms_path(). + * + * For at least one interface (JLink) it's not OK to simply "pad" TMS sequences + * to fit a whole byte. (I suspect this is a general TAP problem within OOCD.) + * Padding TMS causes all manner of instability that's not easily + * discovered. Using this routine we can apply EXACTLY the state transitions + * required to make something work - no more - no less. + * + * @param from is the starting state + * @param to is the resultant or final state + * @return int - the total number of bits in a transition. + */ +int tap_get_tms_path_len(tap_state_t from, tap_state_t to); + + +/** * Function tap_move_ndx * when given a stable state, returns an index from 0-5. The index corresponds to a * sequence of stable states which are given in this order: <p> |
From: <ml...@ma...> - 2009-04-28 19:40:05
|
Author: mlu Date: 2009-04-28 19:40:02 +0200 (Tue, 28 Apr 2009) New Revision: 1556 Modified: trunk/src/jtag/jlink.c Log: Correctedout buffer size and missing jlink_tap_init() call. Expanded JLink adapter info at startup. Modified: trunk/src/jtag/jlink.c =================================================================== --- trunk/src/jtag/jlink.c 2009-04-28 13:40:06 UTC (rev 1555) +++ trunk/src/jtag/jlink.c 2009-04-28 17:40:02 UTC (rev 1556) @@ -44,7 +44,7 @@ // 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_OUT_BUFFER_SIZE 2*2048+4 #define JLINK_EMU_RESULT_BUFFER_SIZE 64 /* Global USB buffers */ @@ -53,14 +53,16 @@ static u8 usb_emu_result_buffer[JLINK_EMU_RESULT_BUFFER_SIZE]; /* Constants for JLink command */ -#define EMU_CMD_VERSION 0x01 -#define EMU_CMD_SET_SPEED 0x05 -#define EMU_CMD_GET_STATE 0x07 -#define EMU_CMD_HW_JTAG3 0xcf -#define EMU_CMD_HW_RESET0 0xdc -#define EMU_CMD_HW_RESET1 0xdd -#define EMU_CMD_HW_TRST0 0xde -#define EMU_CMD_HW_TRST1 0xdf +#define EMU_CMD_VERSION 0x01 +#define EMU_CMD_SET_SPEED 0x05 +#define EMU_CMD_GET_STATE 0x07 +#define EMU_CMD_HW_JTAG3 0xcf +#define EMU_CMD_GET_MAX_MEM_BLOCK 0xd4 +#define EMU_CMD_HW_RESET0 0xdc +#define EMU_CMD_HW_RESET1 0xdd +#define EMU_CMD_HW_TRST0 0xde +#define EMU_CMD_HW_TRST1 0xdf +#define EMU_CMD_GET_CAPS 0xe8 /* max speed 12MHz v5.0 jlink */ #define JLINK_MAX_SPEED 12000 @@ -530,6 +532,7 @@ { int result; int len; + u32 jlink_caps, jlink_max_size; /* query hardware version */ jlink_simple_command(EMU_CMD_VERSION); @@ -537,8 +540,7 @@ result = jlink_usb_read(jlink_jtag_handle, 2); if (2 != result) { - LOG_ERROR("J-Link command EMU_CMD_VERSION failed (%d)\n", - result); + LOG_ERROR("J-Link command EMU_CMD_VERSION failed (%d)\n", result); return ERROR_JTAG_DEVICE_ERROR; } @@ -546,14 +548,41 @@ result = jlink_usb_read(jlink_jtag_handle, len); if (result != len) { - LOG_ERROR("J-Link command EMU_CMD_VERSION failed (%d)\n", - result); + 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); + /* query hardware capabilities */ + jlink_simple_command(EMU_CMD_GET_CAPS); + + result = jlink_usb_read(jlink_jtag_handle, 4); + if (4 != result) + { + LOG_ERROR("J-Link command EMU_CMD_GET_CAPS failed (%d)\n", result); + return ERROR_JTAG_DEVICE_ERROR; + } + + jlink_caps = buf_get_u32(usb_in_buffer, 0, 32); + LOG_INFO("JLink caps 0x%x", jlink_caps); + + + /* query hardware maximum memory block */ + jlink_simple_command(EMU_CMD_GET_MAX_MEM_BLOCK); + + result = jlink_usb_read(jlink_jtag_handle, 4); + if (4 != result) + { + LOG_ERROR("J-Link command EMU_CMD_GET_MAX_MEM_BLOCK failed (%d)\n", result); + return ERROR_JTAG_DEVICE_ERROR; + } + + jlink_max_size = buf_get_u32(usb_in_buffer, 0, 32); + LOG_INFO("JLink max mem block %i", jlink_max_size); + + return ERROR_OK; } @@ -689,8 +718,8 @@ result = jlink_usb_message(jlink_jtag_handle, 4 + 2 * byte_length, byte_length); if (result != byte_length) { - LOG_ERROR("jlink_tap_execute, wrong result %d (expected %d)", - result, byte_length); + LOG_ERROR("jlink_tap_execute, wrong result %d (expected %d)", result, byte_length); + jlink_tap_init(); return ERROR_JTAG_QUEUE_FAILED; } @@ -726,7 +755,6 @@ } jlink_tap_init(); - return ERROR_OK; } @@ -800,7 +828,7 @@ } result = jlink_usb_read(jlink_jtag, in_length); - if ((result != in_length) && (result != in_length + 1)) + if ((result != in_length) && (result != (in_length + 1))) { LOG_ERROR("usb_bulk_read failed (requested=%d, result=%d)", in_length, result); |
From: ntfreak at B. <nt...@ma...> - 2009-04-28 15:40:10
|
Author: ntfreak Date: 2009-04-28 15:40:06 +0200 (Tue, 28 Apr 2009) New Revision: 1555 Modified: trunk/src/helper/replacements.c Log: - fix win32 build Modified: trunk/src/helper/replacements.c =================================================================== --- trunk/src/helper/replacements.c 2009-04-28 08:42:09 UTC (rev 1554) +++ trunk/src/helper/replacements.c 2009-04-28 13:40:06 UTC (rev 1555) @@ -172,7 +172,8 @@ /* build an array of handles for non-sockets */ for (i = 0; i < max_fd; i++) { if (SAFE_FD_ISSET(i, rfds) || SAFE_FD_ISSET(i, wfds) || SAFE_FD_ISSET(i, efds)) { - handles[n_handles] = (HANDLE)_get_osfhandle(i); + long handle = _get_osfhandle(i); + handles[n_handles] = (HANDLE)handle; if (handles[n_handles] == INVALID_HANDLE_VALUE) { /* socket */ if (SAFE_FD_ISSET(i, rfds)) { @@ -246,8 +247,9 @@ if (WAIT_OBJECT_0 == WaitForSingleObject(handles[i], 0)) { if (SAFE_FD_ISSET(handle_slot_to_fd[i], rfds)) { DWORD dwBytes; + long handle = _get_osfhandle(handle_slot_to_fd[i]); - if (PeekNamedPipe((HANDLE)_get_osfhandle(handle_slot_to_fd[i]), NULL, 0, NULL, &dwBytes, NULL)) + if (PeekNamedPipe((HANDLE)handle, NULL, 0, NULL, &dwBytes, NULL)) { /* check to see if gdb pipe has data available */ if (dwBytes) |
From: oharboe at B. <oh...@ma...> - 2009-04-28 10:42:10
|
Author: oharboe Date: 2009-04-28 10:42:09 +0200 (Tue, 28 Apr 2009) New Revision: 1554 Modified: trunk/src/target/arm11.c Log: fix checksum memory. By failing the fallback code will handle checksum calculation Modified: trunk/src/target/arm11.c =================================================================== --- trunk/src/target/arm11.c 2009-04-28 07:34:43 UTC (rev 1553) +++ trunk/src/target/arm11.c 2009-04-28 08:42:09 UTC (rev 1554) @@ -1305,11 +1305,13 @@ return arm11_write_memory(target, address, 4, count, buffer); } +/* here we have nothing target specific to contribute, so we fail and then the + * fallback code will read data from the target and calculate the CRC on the + * host. + */ int arm11_checksum_memory(struct target_s *target, u32 address, u32 count, u32* checksum) { - FNC_INFO_NOTIMPLEMENTED; - - return ERROR_OK; + return ERROR_FAIL; } /* target break-/watchpoint control |
From: oharboe at B. <oh...@ma...> - 2009-04-28 09:34:44
|
Author: oharboe Date: 2009-04-28 09:34:43 +0200 (Tue, 28 Apr 2009) New Revision: 1553 Modified: trunk/src/jtag/gw16012.c Log: Zach Welch <zw...@su...> fix gw16012 with --enable-parport_ppdev Modified: trunk/src/jtag/gw16012.c =================================================================== --- trunk/src/jtag/gw16012.c 2009-04-28 07:33:50 UTC (rev 1552) +++ trunk/src/jtag/gw16012.c 2009-04-28 07:34:43 UTC (rev 1553) @@ -461,32 +461,65 @@ } #endif -static int gw16012_init(void) +#if PARPORT_USE_PPDEV == 1 + +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + +#define GW16012_PPDEV_NAME "ppi" + +static int gw16012_init_ioctls(void) { -#if PARPORT_USE_PPDEV == 1 + int temp = 0; + temp = ioctl(device_handle, PPCLAIM); + if (temp < 0) + { + LOG_ERROR("cannot claim device"); + return ERROR_JTAG_INIT_FAILED; + } + + temp = PARPORT_MODE_COMPAT; + temp = ioctl(device_handle, PPSETMODE, &temp); + if (temp < 0) + { + LOG_ERROR(" cannot set compatible mode to device"); + return ERROR_JTAG_INIT_FAILED; + } + + temp = IEEE1284_MODE_COMPAT; + temp = ioctl(device_handle, PPNEGOT, &temp); + if (temp < 0) + { + LOG_ERROR("cannot set compatible 1284 mode to device"); + return ERROR_JTAG_INIT_FAILED; + } + return ERROR_OK; +} +#else + +#define GW16012_PPDEV_NAME "parport" + +static int gw16012_init_ioctls(void) +{ + return ERROR_OK; +} + +#endif // defined(__FreeBSD__) || defined(__FreeBSD_kernel__) + +static int gw16012_init_device(void) +{ + const char *device_name = GW16012_PPDEV_NAME; char buffer[256]; - int i = 0; -#endif - u8 status_port; -#if PARPORT_USE_PPDEV == 1 - if (device_handle>0) + if (device_handle > 0) { LOG_ERROR("device is already opened"); return ERROR_JTAG_INIT_FAILED; } -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - LOG_DEBUG("opening /dev/ppi%d...", gw16012_port); + snprintf(buffer, 256, "/dev/%s%d", device_name, gw16012_port); + LOG_DEBUG("opening %s...", buffer); - snprintf(buffer, 256, "/dev/ppi%d", gw16012_port); device_handle = open(buffer, O_WRONLY); -#else - LOG_DEBUG("opening /dev/parport%d...", gw16012_port); - - snprintf(buffer, 256, "/dev/parport%d", gw16012_port); - device_handle = open(buffer, O_WRONLY); -#endif if (device_handle<0) { LOG_ERROR("cannot open device. check it exists and that user read and write rights are set"); @@ -495,31 +528,16 @@ LOG_DEBUG("...open"); -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) - i=ioctl(device_handle, PPCLAIM); - if (i<0) - { - LOG_ERROR("cannot claim device"); + if (gw16012_init_ioctls() != ERROR_OK) return ERROR_JTAG_INIT_FAILED; - } - i = PARPORT_MODE_COMPAT; - i= ioctl(device_handle, PPSETMODE, & i); - if (i<0) - { - LOG_ERROR(" cannot set compatible mode to device"); - return ERROR_JTAG_INIT_FAILED; - } + return ERROR_OK; +} - i = IEEE1284_MODE_COMPAT; - i = ioctl(device_handle, PPNEGOT, & i); - if (i<0) - { - LOG_ERROR("cannot set compatible 1284 mode to device"); - return ERROR_JTAG_INIT_FAILED; - } -#endif -#else +#else // PARPORT_USE_PPDEV + +static int gw16012_init_device(void) +{ if (gw16012_port == 0) { gw16012_port = 0x378; @@ -544,8 +562,18 @@ #else outb(0x0, gw16012_port + 2); #endif -#endif /* PARPORT_USE_PPDEV */ + return ERROR_OK; +} +#endif // PARPORT_USE_PPDEV + +static int gw16012_init(void) +{ + u8 status_port; + + if (gw16012_init_device() != ERROR_OK) + return ERROR_JTAG_INIT_FAILED; + gw16012_input(&status_port); gw16012_msb = (status_port & 0x80) ^ 0x80; |
From: oharboe at B. <oh...@ma...> - 2009-04-28 09:33:51
|
Author: oharboe Date: 2009-04-28 09:33:50 +0200 (Tue, 28 Apr 2009) New Revision: 1552 Modified: trunk/src/target/arm11.c Log: convert some LOG_INFO()'s during stepping into LOG_DEBUG() Modified: trunk/src/target/arm11.c =================================================================== --- trunk/src/target/arm11.c 2009-04-28 07:29:18 UTC (rev 1551) +++ trunk/src/target/arm11.c 2009-04-28 07:33:50 UTC (rev 1552) @@ -322,7 +322,7 @@ if (!dscr) { dscr = &dscr_local_tmp_copy; - + CHECK_RETVAL(arm11_read_DSCR(arm11, dscr)); } @@ -673,7 +673,7 @@ return ERROR_OK; u32 dscr; - + CHECK_RETVAL(arm11_read_DSCR(arm11, &dscr)); LOG_DEBUG("DSCR %08x", dscr); @@ -861,7 +861,7 @@ while (1) { u32 dscr; - + CHECK_RETVAL(arm11_read_DSCR(arm11, &dscr)); LOG_DEBUG("DSCR %08x", dscr); @@ -906,7 +906,7 @@ if (!current) R(PC) = address; - LOG_INFO("STEP PC %08x%s", R(PC), !current ? "!" : ""); + LOG_DEBUG("STEP PC %08x%s", R(PC), !current ? "!" : ""); /** \todo TODO: Thumb not supported here */ @@ -920,7 +920,7 @@ R(PC) += 4; arm11->reg_list[ARM11_RC_PC].valid = 1; arm11->reg_list[ARM11_RC_PC].dirty = 0; - LOG_INFO("Skipping BKPT"); + LOG_DEBUG("Skipping BKPT"); } /* skip over Wait for interrupt / Standby */ /* mcr 15, 0, r?, cr7, cr0, {4} */ @@ -929,12 +929,12 @@ R(PC) += 4; arm11->reg_list[ARM11_RC_PC].valid = 1; arm11->reg_list[ARM11_RC_PC].dirty = 0; - LOG_INFO("Skipping WFI"); + LOG_DEBUG("Skipping WFI"); } /* ignore B to self */ else if ((next_instruction & 0xFEFFFFFF) == 0xeafffffe) { - LOG_INFO("Not stepping jump to self"); + LOG_DEBUG("Not stepping jump to self"); } else { @@ -1331,13 +1331,13 @@ if (!arm11->free_brps) { - LOG_INFO("no breakpoint unit available for hardware breakpoint"); + LOG_DEBUG("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"); + LOG_DEBUG("only breakpoints of four bytes length supported"); return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; } |
From: oharboe at B. <oh...@ma...> - 2009-04-28 09:29:18
|
Author: oharboe Date: 2009-04-28 09:29:18 +0200 (Tue, 28 Apr 2009) New Revision: 1551 Modified: trunk/src/target/arm11.c trunk/src/target/arm11.h trunk/src/target/arm11_dbgtap.c Log: Michael Bruck <mb...@di...> macros for error handling Modified: trunk/src/target/arm11.c =================================================================== --- trunk/src/target/arm11.c 2009-04-28 06:29:32 UTC (rev 1550) +++ trunk/src/target/arm11.c 2009-04-28 07:29:18 UTC (rev 1551) @@ -316,15 +316,14 @@ int arm11_check_init(arm11_common_t * arm11, u32 * dscr) { FNC_INFO; - int retval; u32 dscr_local_tmp_copy; if (!dscr) { dscr = &dscr_local_tmp_copy; - if ((retval=arm11_read_DSCR(arm11, dscr))!=ERROR_OK) - return retval; + + CHECK_RETVAL(arm11_read_DSCR(arm11, dscr)); } if (!(*dscr & ARM11_DSCR_MODE_SELECT)) @@ -382,9 +381,7 @@ }} /* Save DSCR */ - int retval; - if ((retval=arm11_read_DSCR(arm11, &R(DSCR)))!=ERROR_OK) - return retval; + CHECK_RETVAL(arm11_read_DSCR(arm11, &R(DSCR))); /* Save wDTR */ @@ -586,12 +583,9 @@ otherwise our programming would be sloppy */ { u32 DSCR; - int retval; - if ((retval=arm11_read_DSCR(arm11, &DSCR))!=ERROR_OK) - { - return retval; - } + CHECK_RETVAL(arm11_read_DSCR(arm11, &DSCR)); + if (DSCR & (ARM11_DSCR_RDTR_FULL | ARM11_DSCR_WDTR_FULL)) { LOG_ERROR("wDTR/rDTR inconsistent (DSCR %08x)", DSCR); @@ -679,14 +673,12 @@ return ERROR_OK; u32 dscr; - int retval; - if ((retval=arm11_read_DSCR(arm11, &dscr))!=ERROR_OK) - return retval; + + CHECK_RETVAL(arm11_read_DSCR(arm11, &dscr)); LOG_DEBUG("DSCR %08x", dscr); - if ((retval=arm11_check_init(arm11, &dscr))!=ERROR_OK) - return retval; + CHECK_RETVAL(arm11_check_init(arm11, &dscr)); if (dscr & ARM11_DSCR_CORE_HALTED) { @@ -739,8 +731,6 @@ /* target execution control */ int arm11_halt(struct target_s *target) { - int retval = ERROR_OK; - FNC_INFO; arm11_common_t * arm11 = target->arch_info; @@ -767,19 +757,13 @@ arm11_add_IR(arm11, ARM11_HALT, TAP_IDLE); - if((retval = jtag_execute_queue()) != ERROR_OK) - { - return retval; - } + CHECK_RETVAL(jtag_execute_queue()); u32 dscr; while (1) { - int retval; - retval = arm11_read_DSCR(arm11, &dscr); - if (retval!=ERROR_OK) - return retval; + CHECK_RETVAL(arm11_read_DSCR(arm11, &dscr)); if (dscr & ARM11_DSCR_CORE_HALTED) break; @@ -792,19 +776,15 @@ target->state = TARGET_HALTED; 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) - { - return retval; - } + CHECK_RETVAL( + target_call_event_callbacks(target, + old_state == TARGET_DEBUG_RUNNING ? TARGET_EVENT_DEBUG_HALTED : TARGET_EVENT_HALTED)); return ERROR_OK; } int arm11_resume(struct target_s *target, int current, u32 address, int handle_breakpoints, int debug_execution) { - int retval = ERROR_OK; - FNC_INFO; // LOG_DEBUG("current %d address %08x handle_breakpoints %d debug_execution %d", @@ -876,17 +856,13 @@ arm11_add_IR(arm11, ARM11_RESTART, TAP_IDLE); - if((retval = jtag_execute_queue()) != ERROR_OK) - { - return retval; - } + CHECK_RETVAL(jtag_execute_queue()); while (1) { u32 dscr; - retval = arm11_read_DSCR(arm11, &dscr); - if (retval!=ERROR_OK) - return retval; + + CHECK_RETVAL(arm11_read_DSCR(arm11, &dscr)); LOG_DEBUG("DSCR %08x", dscr); @@ -899,19 +875,14 @@ target->state = TARGET_RUNNING; target->debug_reason = DBG_REASON_NOTHALTED; - if((retval = target_call_event_callbacks(target, TARGET_EVENT_RESUMED)) != ERROR_OK) - { - return retval; - } + CHECK_RETVAL(target_call_event_callbacks(target, TARGET_EVENT_RESUMED)); } else { target->state = TARGET_DEBUG_RUNNING; target->debug_reason = DBG_REASON_NOTHALTED; - if((retval = target_call_event_callbacks(target, TARGET_EVENT_RESUMED)) != ERROR_OK) - { - return retval; - } + + CHECK_RETVAL(target_call_event_callbacks(target, TARGET_EVENT_RESUMED)); } return ERROR_OK; @@ -919,8 +890,6 @@ int arm11_step(struct target_s *target, int current, u32 address, int handle_breakpoints) { - int retval = ERROR_OK; - FNC_INFO; LOG_DEBUG("target->state: %s", @@ -943,8 +912,7 @@ u32 next_instruction; - if ((arm11_read_memory_word(arm11, R(PC), &next_instruction))!=ERROR_OK) - return retval; + CHECK_RETVAL(arm11_read_memory_word(arm11, R(PC), &next_instruction)); /* skip over BKPT */ if ((next_instruction & 0xFFF00070) == 0xe1200070) @@ -988,8 +956,7 @@ brp[1].address = ARM11_SC7_BCR0; brp[1].value = 0x1 | (3 << 1) | (0x0F << 5) | (0 << 14) | (0 << 16) | (0 << 20) | (2 << 21); - if ((retval=arm11_sc7_run(arm11, brp, asizeof(brp)))!=ERROR_OK) - return retval; + CHECK_RETVAL(arm11_sc7_run(arm11, brp, asizeof(brp))); /* resume */ @@ -1000,15 +967,11 @@ R(DSCR) |= ARM11_DSCR_INTERRUPTS_DISABLE; - if ((retval=arm11_leave_debug_state(arm11))!=ERROR_OK) - return retval; + CHECK_RETVAL(arm11_leave_debug_state(arm11)); arm11_add_IR(arm11, ARM11_RESTART, TAP_IDLE); - if((retval = jtag_execute_queue()) != ERROR_OK) - { - return retval; - } + CHECK_RETVAL(jtag_execute_queue()); /** \todo TODO: add a timeout */ @@ -1017,10 +980,9 @@ while (1) { u32 dscr; - retval = arm11_read_DSCR(arm11, &dscr); - if (retval!=ERROR_OK) - return retval; + CHECK_RETVAL(arm11_read_DSCR(arm11, &dscr)); + LOG_DEBUG("DSCR %08x", dscr); if ((dscr & (ARM11_DSCR_CORE_RESTARTED | ARM11_DSCR_CORE_HALTED)) == @@ -1032,8 +994,7 @@ arm11_sc7_clear_vbw(arm11); /* save state */ - if((retval = arm11_on_enter_debug_state(arm11))!=ERROR_OK) - return retval; + CHECK_RETVAL(arm11_on_enter_debug_state(arm11)); /* restore default state */ R(DSCR) &= ~ARM11_DSCR_INTERRUPTS_DISABLE; @@ -1043,10 +1004,7 @@ // target->state = TARGET_HALTED; target->debug_reason = DBG_REASON_SINGLESTEP; - if((retval = target_call_event_callbacks(target, TARGET_EVENT_HALTED)) != ERROR_OK) - { - return retval; - } + CHECK_RETVAL(target_call_event_callbacks(target, TARGET_EVENT_HALTED)); return ERROR_OK; } @@ -1069,9 +1027,7 @@ if (target->reset_halt) { - int retval; - if ((retval = target_halt(target))!=ERROR_OK) - return retval; + CHECK_RETVAL(target_halt(target)); } return ERROR_OK; @@ -1511,25 +1467,18 @@ } // no debug, otherwise breakpoint is not set - if((retval = target_resume(target, 0, entry_point, 1, 0)) != ERROR_OK) - { - return retval; - } + CHECK_RETVAL(target_resume(target, 0, entry_point, 1, 0)); - if((retval = target_wait_state(target, TARGET_HALTED, timeout_ms)) != ERROR_OK) - { - return retval; - } + CHECK_RETVAL(target_wait_state(target, TARGET_HALTED, timeout_ms)); if (target->state != TARGET_HALTED) { - if ((retval=target_halt(target))!=ERROR_OK) - return retval; - if ((retval=target_wait_state(target, TARGET_HALTED, 500))!=ERROR_OK) - { - return retval; - } + CHECK_RETVAL(target_halt(target)); + + CHECK_RETVAL(target_wait_state(target, TARGET_HALTED, 500)); + retval = ERROR_TARGET_TIMEOUT; + goto del_breakpoint; } @@ -1590,7 +1539,6 @@ int arm11_target_create(struct target_s *target, Jim_Interp *interp) { - int retval = ERROR_OK; FNC_INFO; NEW(arm11_common_t, arm11, 1); @@ -1601,10 +1549,7 @@ arm11->jtag_info.tap = target->tap; arm11->jtag_info.scann_size = 5; - if((retval = arm_jtag_setup_connection(&arm11->jtag_info)) != ERROR_OK) - { - return retval; - } + CHECK_RETVAL(arm_jtag_setup_connection(&arm11->jtag_info)); if (target->tap==NULL) return ERROR_FAIL; @@ -1630,7 +1575,6 @@ int arm11_examine(struct target_s *target) { FNC_INFO; - int retval; arm11_common_t * arm11 = target->arch_info; @@ -1657,10 +1601,8 @@ arm11_add_dr_scan_vc(asizeof(chain0_fields), chain0_fields, TAP_IDLE); - if ((retval=jtag_execute_queue())!=ERROR_OK) - return retval; + CHECK_RETVAL(jtag_execute_queue()); - switch (arm11->device_id & 0x0FFFF000) { case 0x07B36000: LOG_INFO("found ARM1136"); break; Modified: trunk/src/target/arm11.h =================================================================== --- trunk/src/target/arm11.h 2009-04-28 06:29:32 UTC (rev 1550) +++ trunk/src/target/arm11.h 2009-04-28 07:29:18 UTC (rev 1551) @@ -51,6 +51,16 @@ #define ARM11_TAP_DEFAULT TAP_INVALID +#define CHECK_RETVAL(action) \ +do { \ + int __retval = (action); \ + \ + if (__retval != ERROR_OK) \ + return __retval; \ + \ +} while (0) + + typedef struct arm11_register_history_s { u32 value; Modified: trunk/src/target/arm11_dbgtap.c =================================================================== --- trunk/src/target/arm11_dbgtap.c 2009-04-28 06:29:32 UTC (rev 1550) +++ trunk/src/target/arm11_dbgtap.c 2009-04-28 07:29:18 UTC (rev 1551) @@ -229,11 +229,7 @@ arm11_add_dr_scan_vc(1, &chain1_field, TAP_DRPAUSE); - int retval; - if ((retval=jtag_execute_queue())!=ERROR_OK) - { - return retval; - } + CHECK_RETVAL(jtag_execute_queue()); if (arm11->last_dscr != dscr) JTAG_DEBUG("DSCR = %08x (OLD %08x)", dscr, arm11->last_dscr); @@ -242,7 +238,7 @@ *value=dscr; - return retval; + return ERROR_OK; } /** Write the Debug Status and Control Register (DSCR) @@ -266,9 +262,7 @@ arm11_add_dr_scan_vc(1, &chain1_field, TAP_DRPAUSE); - int retval; - if ((retval=jtag_execute_queue())!=ERROR_OK) - return retval; + CHECK_RETVAL(jtag_execute_queue()); JTAG_DEBUG("DSCR <= %08x (OLD %08x)", dscr, arm11->last_dscr); @@ -383,9 +377,7 @@ arm11_add_debug_INST(arm11, 0, &flag, count ? TAP_IDLE : TAP_DRPAUSE); - int retval; - if ((retval=jtag_execute_queue())!=ERROR_OK) - return retval; + CHECK_RETVAL(jtag_execute_queue()); if (flag) break; @@ -447,10 +439,9 @@ Data = *data; arm11_add_dr_scan_vc(asizeof(chain5_fields), chain5_fields, TAP_IDLE); - int retval; - if ((retval=jtag_execute_queue())!=ERROR_OK) - return retval; + CHECK_RETVAL(jtag_execute_queue()); + JTAG_DEBUG("DTR Ready %d nRetry %d", Ready, nRetry); } while (!Ready); @@ -465,10 +456,9 @@ Data = 0; arm11_add_dr_scan_vc(asizeof(chain5_fields), chain5_fields, TAP_DRPAUSE); - int retval; - if ((retval=jtag_execute_queue())!=ERROR_OK) - return retval; + CHECK_RETVAL(jtag_execute_queue()); + JTAG_DEBUG("DTR Data %08x Ready %d nRetry %d", Data, Ready, nRetry); } while (!Ready); @@ -550,9 +540,7 @@ arm11_add_dr_scan_vc(asizeof(chain5_fields), chain5_fields, TAP_DRPAUSE); - int retval; - if ((retval=jtag_execute_queue())!=ERROR_OK) - return retval; + CHECK_RETVAL(jtag_execute_queue()); size_t error_count = 0; @@ -625,9 +613,8 @@ do { arm11_add_dr_scan_vc(asizeof(chain5_fields), chain5_fields, count ? TAP_IDLE : TAP_DRPAUSE); - int retval; - if ((retval=jtag_execute_queue())!=ERROR_OK) - return retval; + + CHECK_RETVAL(jtag_execute_queue()); JTAG_DEBUG("DTR Data %08x Ready %d nRetry %d", Data, Ready, nRetry); } @@ -728,9 +715,8 @@ JTAG_DEBUG("SC7 <= Address %02x Data %08x nRW %d", AddressOut, DataOut, nRW); arm11_add_dr_scan_vc(asizeof(chain7_fields), chain7_fields, TAP_DRPAUSE); - int retval; - if ((retval=jtag_execute_queue())!=ERROR_OK) - return retval; + + CHECK_RETVAL(jtag_execute_queue()); JTAG_DEBUG("SC7 => Address %02x Data %08x Ready %d", AddressIn, DataIn, Ready); } @@ -826,16 +812,13 @@ */ int arm11_read_memory_word(arm11_common_t * arm11, u32 address, u32 * result) { - int retval; arm11_run_instr_data_prepare(arm11); /* MRC p14,0,r0,c0,c5,0 (r0 = address) */ - if ((retval=arm11_run_instr_data_to_core1(arm11, 0xee100e15, address))!=ERROR_OK) - return retval; + CHECK_RETVAL(arm11_run_instr_data_to_core1(arm11, 0xee100e15, address)); /* LDC p14,c5,[R0],#4 (DTR = [r0]) */ - if ((retval=arm11_run_instr_data_from_core(arm11, 0xecb05e01, result, 1))!=ERROR_OK) - return retval; + CHECK_RETVAL(arm11_run_instr_data_from_core(arm11, 0xecb05e01, result, 1)); arm11_run_instr_data_finish(arm11); |
From: oharboe at B. <oh...@ma...> - 2009-04-28 08:29:32
|
Author: oharboe Date: 2009-04-28 08:29:32 +0200 (Tue, 28 Apr 2009) New Revision: 1550 Modified: trunk/PATCHES trunk/contrib/openocd.udev Log: eol-style native Modified: trunk/PATCHES =================================================================== --- trunk/PATCHES 2009-04-28 06:28:39 UTC (rev 1549) +++ trunk/PATCHES 2009-04-28 06:29:32 UTC (rev 1550) @@ -1,28 +1,28 @@ -Please mail patches to: - -op...@li... - -The patch should be against svn trunk using an SVN -diff. - -Attach the patch to the email as a .txt file and -also write a short change log entry that maintainers -can copy and paste into the commit message - -Add yourself to the GPL copyright for non-trivial changes. - -To create a patch from the command line: - -svn diff >mypatch.txt - -http://svnbook.red-bean.com/en/1.0/re09.html - -NB! remember to use "svn add" on new files first! - -http://svnbook.red-bean.com/en/1.0/re01.html - - - -If you have a decent SVN GUI, then that should be -able to create and apply patches as well... +Please mail patches to: + +op...@li... + +The patch should be against svn trunk using an SVN +diff. + +Attach the patch to the email as a .txt file and +also write a short change log entry that maintainers +can copy and paste into the commit message + +Add yourself to the GPL copyright for non-trivial changes. + +To create a patch from the command line: + +svn diff >mypatch.txt + +http://svnbook.red-bean.com/en/1.0/re09.html + +NB! remember to use "svn add" on new files first! + +http://svnbook.red-bean.com/en/1.0/re01.html + + + +If you have a decent SVN GUI, then that should be +able to create and apply patches as well... \ No newline at end of file Property changes on: trunk/PATCHES ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/contrib/openocd.udev =================================================================== --- trunk/contrib/openocd.udev 2009-04-28 06:28:39 UTC (rev 1549) +++ trunk/contrib/openocd.udev 2009-04-28 06:29:32 UTC (rev 1550) @@ -1,56 +1,56 @@ -BUS!="usb", ACTION!="add", SUBSYSTEM!=="usb_device", GOTO="openocd_rules_end" - -# Olimex ARM-USB-OCD -SYSFS{idVendor}=="15ba", SYSFS{idProduct}=="0003", MODE="664", GROUP="plugdev" - -# Olimex ARM-USB-OCD-TINY -SYSFS{idVendor}=="15ba", SYSFS{idProduct}=="0004", MODE="664", GROUP="plugdev" - -# Olimex ARM-JTAG-EW -SYSFS{idVendor}=="15ba", SYSFS{idProduct}=="001e", MODE="664", GROUP="plugdev" - -# USBprog with OpenOCD firmware -SYSFS{idVendor}=="1781", SYSFS{idProduct}=="0c63", MODE="664", GROUP="plugdev" - -# Amontec JTAGkey and JTAGkey-tiny -SYSFS{idVendor}=="0403", SYSFS{idProduct}=="cff8", MODE="664", GROUP="plugdev" - -# Amontec JTAGkey-HiSpeed -SYSFS{idVendor}=="0fbb", SYSFS{idProduct}=="1000", MODE="664", GROUP="plugdev" - -# Axiom AXM-0432 Link (Symphony SoundBite?) -# Calao Systems USB-A9260-C01 -# TinCanTools Flyswatter -# OOCD-Link -# Marvell Sheevaplug (early development versions) -SYSFS{idVendor}=="0403", SYSFS{idProduct}=="6010", MODE="664", GROUP="plugdev" - -# Calao Systems USB-A9260-C02 -SYSFS{idVendor}=="0403", SYSFS{idProduct}=="6001", MODE="664", GROUP="plugdev" - -# IAR J-Link USB -SYSFS{idVendor}=="1366", SYSFS{idProduct}=="0101", MODE="664", GROUP="plugdev" - -# Raisonance RLink -SYSFS{idVendor}=="138e", SYSFS{idProduct}=="9000", MODE="664", GROUP="plugdev" - -# Hitex STR9-comStick -SYSFS{idVendor}=="0640", SYSFS{idProduct}=="002c", MODE="664", GROUP="plugdev" - -# Hitex STM32-PerformanceStick -SYSFS{idVendor}=="0640", SYSFS{idProduct}=="002d", MODE="664", GROUP="plugdev" - -# Luminary Micro Stellaris/LM3S811 -SYSFS{idVendor}=="0403", SYSFS{idProduct}=="bcd9", MODE="664", GROUP="plugdev" - -# Xverve Signalyzer Tool (DT-USB-ST) -SYSFS{idVendor}=="0403", SYSFS{idProduct}=="bca0", MODE="664", GROUP="plugdev" - -# egnite Turtelizer 2 -SYSFS{idVendor}=="0403", SYSFS{idProduct}=="bdc8", MODE="664", GROUP="plugdev" - -# Marvell Sheevaplug -SYSFS{idVendor}=="9e88", SYSFS{idProduct}=="9e8f", MODE="664", GROUP="plugdev" - -LABEL="openocd_rules_end" - +BUS!="usb", ACTION!="add", SUBSYSTEM!=="usb_device", GOTO="openocd_rules_end" + +# Olimex ARM-USB-OCD +SYSFS{idVendor}=="15ba", SYSFS{idProduct}=="0003", MODE="664", GROUP="plugdev" + +# Olimex ARM-USB-OCD-TINY +SYSFS{idVendor}=="15ba", SYSFS{idProduct}=="0004", MODE="664", GROUP="plugdev" + +# Olimex ARM-JTAG-EW +SYSFS{idVendor}=="15ba", SYSFS{idProduct}=="001e", MODE="664", GROUP="plugdev" + +# USBprog with OpenOCD firmware +SYSFS{idVendor}=="1781", SYSFS{idProduct}=="0c63", MODE="664", GROUP="plugdev" + +# Amontec JTAGkey and JTAGkey-tiny +SYSFS{idVendor}=="0403", SYSFS{idProduct}=="cff8", MODE="664", GROUP="plugdev" + +# Amontec JTAGkey-HiSpeed +SYSFS{idVendor}=="0fbb", SYSFS{idProduct}=="1000", MODE="664", GROUP="plugdev" + +# Axiom AXM-0432 Link (Symphony SoundBite?) +# Calao Systems USB-A9260-C01 +# TinCanTools Flyswatter +# OOCD-Link +# Marvell Sheevaplug (early development versions) +SYSFS{idVendor}=="0403", SYSFS{idProduct}=="6010", MODE="664", GROUP="plugdev" + +# Calao Systems USB-A9260-C02 +SYSFS{idVendor}=="0403", SYSFS{idProduct}=="6001", MODE="664", GROUP="plugdev" + +# IAR J-Link USB +SYSFS{idVendor}=="1366", SYSFS{idProduct}=="0101", MODE="664", GROUP="plugdev" + +# Raisonance RLink +SYSFS{idVendor}=="138e", SYSFS{idProduct}=="9000", MODE="664", GROUP="plugdev" + +# Hitex STR9-comStick +SYSFS{idVendor}=="0640", SYSFS{idProduct}=="002c", MODE="664", GROUP="plugdev" + +# Hitex STM32-PerformanceStick +SYSFS{idVendor}=="0640", SYSFS{idProduct}=="002d", MODE="664", GROUP="plugdev" + +# Luminary Micro Stellaris/LM3S811 +SYSFS{idVendor}=="0403", SYSFS{idProduct}=="bcd9", MODE="664", GROUP="plugdev" + +# Xverve Signalyzer Tool (DT-USB-ST) +SYSFS{idVendor}=="0403", SYSFS{idProduct}=="bca0", MODE="664", GROUP="plugdev" + +# egnite Turtelizer 2 +SYSFS{idVendor}=="0403", SYSFS{idProduct}=="bdc8", MODE="664", GROUP="plugdev" + +# Marvell Sheevaplug +SYSFS{idVendor}=="9e88", SYSFS{idProduct}=="9e8f", MODE="664", GROUP="plugdev" + +LABEL="openocd_rules_end" + Property changes on: trunk/contrib/openocd.udev ___________________________________________________________________ Name: svn:eol-style + native |
From: oharboe at B. <oh...@ma...> - 2009-04-28 08:28:41
|
Author: oharboe Date: 2009-04-28 08:28:39 +0200 (Tue, 28 Apr 2009) New Revision: 1549 Modified: trunk/src/jtag/dummy.c trunk/src/server/httpd/Stylizer.java trunk/src/target/arm_adi_v5.c trunk/src/target/arm_adi_v5.h trunk/src/target/target/at91sam9260_ext_RAM_ext_flash.cfg trunk/src/target/target/mega128.cfg trunk/testing/examples/SAM7X256Test/prj/eclipse_ram.gdb trunk/testing/examples/SAM7X256Test/prj/eclipse_rom.gdb trunk/testing/examples/SAM7X256Test/prj/sam7x256_jtagkey.cfg trunk/testing/examples/SAM7X256Test/prj/sam7x256_ram.ld trunk/testing/examples/SAM7X256Test/prj/sam7x256_reset.script trunk/testing/examples/SAM7X256Test/prj/sam7x256_rom.ld trunk/testing/examples/STM32-103/readme.txt Log: eol-style native Modified: trunk/src/jtag/dummy.c =================================================================== --- trunk/src/jtag/dummy.c 2009-04-27 19:35:31 UTC (rev 1548) +++ trunk/src/jtag/dummy.c 2009-04-28 06:28:39 UTC (rev 1549) @@ -1,186 +1,186 @@ -/*************************************************************************** - * Copyright (C) 2008 by vind Harboe * - * oyv...@zy... * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "replacements.h" - -#include "jtag.h" -#include "bitbang.h" - - -/* my private tap controller state, which tracks state for calling code */ -static tap_state_t dummy_state = TAP_RESET; - -static int dummy_clock; /* edge detector */ - -static int clock_count; /* count clocks in any stable state, only stable states */ - -static u32 dummy_data; - - -static int dummy_speed(int speed); -static int dummy_register_commands(struct command_context_s *cmd_ctx); -static int dummy_init(void); -static int dummy_quit(void); -static int dummy_khz(int khz, int *jtag_speed); -static int dummy_speed_div(int speed, int *khz); - - -/* The dummy driver is used to easily check the code path - * where the target is unresponsive. - */ -jtag_interface_t dummy_interface = -{ - .name = "dummy", - - .execute_queue = bitbang_execute_queue, - - .speed = dummy_speed, - .register_commands = dummy_register_commands, - .khz = dummy_khz, - .speed_div = dummy_speed_div, - - .init = dummy_init, - .quit = dummy_quit, -}; - -static int dummy_read(void); -static void dummy_write(int tck, int tms, int tdi); -static void dummy_reset(int trst, int srst); -static void dummy_led(int on); - -static bitbang_interface_t dummy_bitbang = -{ - .read = dummy_read, - .write = dummy_write, - .reset = dummy_reset, - .blink = dummy_led -}; - -static int dummy_read(void) -{ - int data = 1 & dummy_data; - dummy_data = (dummy_data >> 1) | (1<<31); - return data; -} - - -static void dummy_write(int tck, int tms, int tdi) -{ - /* TAP standard: "state transitions occur on rising edge of clock" */ - if( tck != dummy_clock ) - { - if( tck ) - { - tap_state_t old_state = dummy_state; - dummy_state = tap_state_transition( old_state, tms ); - - if( old_state != dummy_state ) - { - if( clock_count ) - { - LOG_DEBUG("dummy_tap: %d stable clocks", clock_count); - clock_count = 0; - } - - LOG_DEBUG("dummy_tap: %s", tap_state_name(dummy_state) ); - -#if defined(DEBUG) - if(dummy_state == TAP_DRCAPTURE) - dummy_data = 0x01255043; -#endif - } - else - { - /* this is a stable state clock edge, no change of state here, - * simply increment clock_count for subsequent logging - */ - ++clock_count; - } - } - dummy_clock = tck; - } -} - -static void dummy_reset(int trst, int srst) -{ - dummy_clock = 0; - - if (trst || (srst && (jtag_reset_config & RESET_SRST_PULLS_TRST))) - dummy_state = TAP_RESET; - - LOG_DEBUG("reset to: %s", tap_state_name(dummy_state) ); -} - -static int dummy_khz(int khz, int *jtag_speed) -{ - if (khz==0) - { - *jtag_speed=0; - } - else - { - *jtag_speed=64000/khz; - } - return ERROR_OK; -} - -static int dummy_speed_div(int speed, int *khz) -{ - if (speed==0) - { - *khz = 0; - } - else - { - *khz=64000/speed; - } - - return ERROR_OK; -} - -static int dummy_speed(int speed) -{ - return ERROR_OK; -} - -static int dummy_register_commands(struct command_context_s *cmd_ctx) -{ - return ERROR_OK; -} - -static int dummy_init(void) -{ - bitbang_interface = &dummy_bitbang; - - return ERROR_OK; -} - -static int dummy_quit(void) -{ - return ERROR_OK; -} - -static void dummy_led(int on) -{ -} - +/*************************************************************************** + * Copyright (C) 2008 by vind Harboe * + * oyv...@zy... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "replacements.h" + +#include "jtag.h" +#include "bitbang.h" + + +/* my private tap controller state, which tracks state for calling code */ +static tap_state_t dummy_state = TAP_RESET; + +static int dummy_clock; /* edge detector */ + +static int clock_count; /* count clocks in any stable state, only stable states */ + +static u32 dummy_data; + + +static int dummy_speed(int speed); +static int dummy_register_commands(struct command_context_s *cmd_ctx); +static int dummy_init(void); +static int dummy_quit(void); +static int dummy_khz(int khz, int *jtag_speed); +static int dummy_speed_div(int speed, int *khz); + + +/* The dummy driver is used to easily check the code path + * where the target is unresponsive. + */ +jtag_interface_t dummy_interface = +{ + .name = "dummy", + + .execute_queue = bitbang_execute_queue, + + .speed = dummy_speed, + .register_commands = dummy_register_commands, + .khz = dummy_khz, + .speed_div = dummy_speed_div, + + .init = dummy_init, + .quit = dummy_quit, +}; + +static int dummy_read(void); +static void dummy_write(int tck, int tms, int tdi); +static void dummy_reset(int trst, int srst); +static void dummy_led(int on); + +static bitbang_interface_t dummy_bitbang = +{ + .read = dummy_read, + .write = dummy_write, + .reset = dummy_reset, + .blink = dummy_led +}; + +static int dummy_read(void) +{ + int data = 1 & dummy_data; + dummy_data = (dummy_data >> 1) | (1<<31); + return data; +} + + +static void dummy_write(int tck, int tms, int tdi) +{ + /* TAP standard: "state transitions occur on rising edge of clock" */ + if( tck != dummy_clock ) + { + if( tck ) + { + tap_state_t old_state = dummy_state; + dummy_state = tap_state_transition( old_state, tms ); + + if( old_state != dummy_state ) + { + if( clock_count ) + { + LOG_DEBUG("dummy_tap: %d stable clocks", clock_count); + clock_count = 0; + } + + LOG_DEBUG("dummy_tap: %s", tap_state_name(dummy_state) ); + +#if defined(DEBUG) + if(dummy_state == TAP_DRCAPTURE) + dummy_data = 0x01255043; +#endif + } + else + { + /* this is a stable state clock edge, no change of state here, + * simply increment clock_count for subsequent logging + */ + ++clock_count; + } + } + dummy_clock = tck; + } +} + +static void dummy_reset(int trst, int srst) +{ + dummy_clock = 0; + + if (trst || (srst && (jtag_reset_config & RESET_SRST_PULLS_TRST))) + dummy_state = TAP_RESET; + + LOG_DEBUG("reset to: %s", tap_state_name(dummy_state) ); +} + +static int dummy_khz(int khz, int *jtag_speed) +{ + if (khz==0) + { + *jtag_speed=0; + } + else + { + *jtag_speed=64000/khz; + } + return ERROR_OK; +} + +static int dummy_speed_div(int speed, int *khz) +{ + if (speed==0) + { + *khz = 0; + } + else + { + *khz=64000/speed; + } + + return ERROR_OK; +} + +static int dummy_speed(int speed) +{ + return ERROR_OK; +} + +static int dummy_register_commands(struct command_context_s *cmd_ctx) +{ + return ERROR_OK; +} + +static int dummy_init(void) +{ + bitbang_interface = &dummy_bitbang; + + return ERROR_OK; +} + +static int dummy_quit(void) +{ + return ERROR_OK; +} + +static void dummy_led(int on) +{ +} + Property changes on: trunk/src/jtag/dummy.c ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/src/server/httpd/Stylizer.java =================================================================== --- trunk/src/server/httpd/Stylizer.java 2009-04-27 19:35:31 UTC (rev 1548) +++ trunk/src/server/httpd/Stylizer.java 2009-04-28 06:28:39 UTC (rev 1549) @@ -1,114 +1,114 @@ -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; - -import org.apache.xpath.XPathAPI; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -/** used to generate .tcl files from */ -public class Stylizer -{ - // Global value so it can be ref'd by the tree-adapter - static Document document; - public static void main(String argv[]) - { - if (argv.length != 3) - { - System.err.println("Usage: java Stylizer stylesheet xmlfile outputdir"); - System.exit(1); - } - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - try - { - System.err.println("Starting conversion..."); - - File stylesheet = new File(argv[0]); - File datafile = new File(argv[1]); - DocumentBuilder builder = factory.newDocumentBuilder(); - document = builder.parse(datafile); - - NodeList list = XPathAPI.selectNodeList(document, "website/language/page"); - - for (int i=0; i<list.getLength(); i++) - { - Node node=list.item(i); - - // Use a Transformer for output - TransformerFactory tFactory = TransformerFactory.newInstance(); - StreamSource stylesource = new StreamSource(stylesheet); - Transformer transformer = tFactory.newTransformer(stylesource); - - Node fileName = XPathAPI.selectSingleNode(node, "outfile/text()"); - - System.err.println("Converting " + fileName.getNodeValue()); - DOMSource source = new DOMSource(document); - - OutputStream output=new FileOutputStream(new File(argv[2], fileName.getNodeValue())); - - - try - { - StreamResult result = new StreamResult(output); - - transformer.setParameter("pagetogenerate", fileName.getNodeValue()); - transformer.transform(source, result); - } - finally - { - output.close(); - } - } - } catch (TransformerConfigurationException tce) - { - // Error generated by the parser - System.out.println("\n** Transformer Factory error"); - System.out.println(" " + tce.getMessage()); - // Use the contained exception, if any - Throwable x = tce; - if (tce.getException() != null) - x = tce.getException(); - x.printStackTrace(); - } catch (TransformerException te) - { - // Error generated by the parser - System.out.println("\n** Transformation error"); - System.out.println(" " + te.getMessage()); - // Use the contained exception, if any - Throwable x = te; - if (te.getException() != null) - x = te.getException(); - x.printStackTrace(); - } catch (SAXException sxe) - { - // Error generated by this application - // (or a parser-initialization error) - Exception x = sxe; - if (sxe.getException() != null) - x = sxe.getException(); - x.printStackTrace(); - } catch (ParserConfigurationException pce) - { - // Parser with specified options can't be built - pce.printStackTrace(); - } catch (IOException ioe) - { - // I/O error - ioe.printStackTrace(); - } - } // main -} +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; + +import org.apache.xpath.XPathAPI; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +/** used to generate .tcl files from */ +public class Stylizer +{ + // Global value so it can be ref'd by the tree-adapter + static Document document; + public static void main(String argv[]) + { + if (argv.length != 3) + { + System.err.println("Usage: java Stylizer stylesheet xmlfile outputdir"); + System.exit(1); + } + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + try + { + System.err.println("Starting conversion..."); + + File stylesheet = new File(argv[0]); + File datafile = new File(argv[1]); + DocumentBuilder builder = factory.newDocumentBuilder(); + document = builder.parse(datafile); + + NodeList list = XPathAPI.selectNodeList(document, "website/language/page"); + + for (int i=0; i<list.getLength(); i++) + { + Node node=list.item(i); + + // Use a Transformer for output + TransformerFactory tFactory = TransformerFactory.newInstance(); + StreamSource stylesource = new StreamSource(stylesheet); + Transformer transformer = tFactory.newTransformer(stylesource); + + Node fileName = XPathAPI.selectSingleNode(node, "outfile/text()"); + + System.err.println("Converting " + fileName.getNodeValue()); + DOMSource source = new DOMSource(document); + + OutputStream output=new FileOutputStream(new File(argv[2], fileName.getNodeValue())); + + + try + { + StreamResult result = new StreamResult(output); + + transformer.setParameter("pagetogenerate", fileName.getNodeValue()); + transformer.transform(source, result); + } + finally + { + output.close(); + } + } + } catch (TransformerConfigurationException tce) + { + // Error generated by the parser + System.out.println("\n** Transformer Factory error"); + System.out.println(" " + tce.getMessage()); + // Use the contained exception, if any + Throwable x = tce; + if (tce.getException() != null) + x = tce.getException(); + x.printStackTrace(); + } catch (TransformerException te) + { + // Error generated by the parser + System.out.println("\n** Transformation error"); + System.out.println(" " + te.getMessage()); + // Use the contained exception, if any + Throwable x = te; + if (te.getException() != null) + x = te.getException(); + x.printStackTrace(); + } catch (SAXException sxe) + { + // Error generated by this application + // (or a parser-initialization error) + Exception x = sxe; + if (sxe.getException() != null) + x = sxe.getException(); + x.printStackTrace(); + } catch (ParserConfigurationException pce) + { + // Parser with specified options can't be built + pce.printStackTrace(); + } catch (IOException ioe) + { + // I/O error + ioe.printStackTrace(); + } + } // main +} Property changes on: trunk/src/server/httpd/Stylizer.java ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/target/arm_adi_v5.c ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/target/arm_adi_v5.h ___________________________________________________________________ Name: svn:eol-style + native Property changes on: trunk/src/target/target/at91sam9260_ext_RAM_ext_flash.cfg ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/src/target/target/mega128.cfg =================================================================== --- trunk/src/target/target/mega128.cfg 2009-04-27 19:35:31 UTC (rev 1548) +++ trunk/src/target/target/mega128.cfg 2009-04-28 06:28:39 UTC (rev 1549) @@ -1,42 +1,42 @@ -# for avr - - set _CHIPNAME avr - set _ENDIAN little - -# jtag speed -jtag_khz 4500 - -reset_config srst_only -jtag_nsrst_delay 100 - -#jtag scan chain -if { [info exists CPUTAPID ] } { - set _CPUTAPID $CPUTAPID -} else { - set _CPUTAPID 0x8970203F -} -jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID - -set _TARGETNAME [format "%s.cpu" $_CHIPNAME] -target create $_TARGETNAME avr -endian $_ENDIAN -chain-position $_TARGETNAME - -#$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x20000000 -work-area-size 16384 -work-area-backup 0 - -flash bank avr 0 0 0 0 0 - -#to use it, script will be like: -#init -#jtag_khz 4500 -#reset init -#verify_ircapture disable -# -#halt -#wait halt -#poll -#avr mass_erase 0 -#flash write_image E:/Versaloon/Software/CAMERAPROTOCOLAGENT.hex -#reset run -#shutdown -# -# For more information about the configuration files, take a look at: -# openocd.texi +# for avr + + set _CHIPNAME avr + set _ENDIAN little + +# jtag speed +jtag_khz 4500 + +reset_config srst_only +jtag_nsrst_delay 100 + +#jtag scan chain +if { [info exists CPUTAPID ] } { + set _CPUTAPID $CPUTAPID +} else { + set _CPUTAPID 0x8970203F +} +jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID + +set _TARGETNAME [format "%s.cpu" $_CHIPNAME] +target create $_TARGETNAME avr -endian $_ENDIAN -chain-position $_TARGETNAME + +#$_TARGETNAME configure -work-area-virt 0 -work-area-phys 0x20000000 -work-area-size 16384 -work-area-backup 0 + +flash bank avr 0 0 0 0 0 + +#to use it, script will be like: +#init +#jtag_khz 4500 +#reset init +#verify_ircapture disable +# +#halt +#wait halt +#poll +#avr mass_erase 0 +#flash write_image E:/Versaloon/Software/CAMERAPROTOCOLAGENT.hex +#reset run +#shutdown +# +# For more information about the configuration files, take a look at: +# openocd.texi Property changes on: trunk/src/target/target/mega128.cfg ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/testing/examples/SAM7X256Test/prj/eclipse_ram.gdb =================================================================== --- trunk/testing/examples/SAM7X256Test/prj/eclipse_ram.gdb 2009-04-27 19:35:31 UTC (rev 1548) +++ trunk/testing/examples/SAM7X256Test/prj/eclipse_ram.gdb 2009-04-28 06:28:39 UTC (rev 1549) @@ -1,32 +1,32 @@ -target remote localhost:3333 -monitor reset -monitor sleep 500 -monitor poll -monitor soft_reset_halt -monitor arm7_9 sw_bkpts enable - -# WDT_MR, disable watchdog -monitor mww 0xFFFFFD44 0x00008000 - -# RSTC_MR, enable user reset -monitor mww 0xfffffd08 0xa5000001 - -# CKGR_MOR -monitor mww 0xFFFFFC20 0x00000601 -monitor sleep 10 - -# CKGR_PLLR -monitor mww 0xFFFFFC2C 0x00481c0e -monitor sleep 10 - -# PMC_MCKR -monitor mww 0xFFFFFC30 0x00000007 -monitor sleep 10 - -# PMC_IER -monitor mww 0xFFFFFF60 0x00480100 -monitor sleep 100 - -load -break main -continue +target remote localhost:3333 +monitor reset +monitor sleep 500 +monitor poll +monitor soft_reset_halt +monitor arm7_9 sw_bkpts enable + +# WDT_MR, disable watchdog +monitor mww 0xFFFFFD44 0x00008000 + +# RSTC_MR, enable user reset +monitor mww 0xfffffd08 0xa5000001 + +# CKGR_MOR +monitor mww 0xFFFFFC20 0x00000601 +monitor sleep 10 + +# CKGR_PLLR +monitor mww 0xFFFFFC2C 0x00481c0e +monitor sleep 10 + +# PMC_MCKR +monitor mww 0xFFFFFC30 0x00000007 +monitor sleep 10 + +# PMC_IER +monitor mww 0xFFFFFF60 0x00480100 +monitor sleep 100 + +load +break main +continue Property changes on: trunk/testing/examples/SAM7X256Test/prj/eclipse_ram.gdb ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/testing/examples/SAM7X256Test/prj/eclipse_rom.gdb =================================================================== --- trunk/testing/examples/SAM7X256Test/prj/eclipse_rom.gdb 2009-04-27 19:35:31 UTC (rev 1548) +++ trunk/testing/examples/SAM7X256Test/prj/eclipse_rom.gdb 2009-04-28 06:28:39 UTC (rev 1549) @@ -1,32 +1,32 @@ -target remote localhost:3333 -monitor reset -monitor sleep 500 -monitor poll -monitor soft_reset_halt -monitor arm7_9 force_hw_bkpts enable - -# WDT_MR, disable watchdog -monitor mww 0xFFFFFD44 0x00008000 - -# RSTC_MR, enable user reset -monitor mww 0xfffffd08 0xa5000001 - -# CKGR_MOR -monitor mww 0xFFFFFC20 0x00000601 -monitor sleep 10 - -# CKGR_PLLR -monitor mww 0xFFFFFC2C 0x00481c0e -monitor sleep 10 - -# PMC_MCKR -monitor mww 0xFFFFFC30 0x00000007 -monitor sleep 10 - -# PMC_IER -monitor mww 0xFFFFFF60 0x00480100 -monitor sleep 100 - -load -break main -continue +target remote localhost:3333 +monitor reset +monitor sleep 500 +monitor poll +monitor soft_reset_halt +monitor arm7_9 force_hw_bkpts enable + +# WDT_MR, disable watchdog +monitor mww 0xFFFFFD44 0x00008000 + +# RSTC_MR, enable user reset +monitor mww 0xfffffd08 0xa5000001 + +# CKGR_MOR +monitor mww 0xFFFFFC20 0x00000601 +monitor sleep 10 + +# CKGR_PLLR +monitor mww 0xFFFFFC2C 0x00481c0e +monitor sleep 10 + +# PMC_MCKR +monitor mww 0xFFFFFC30 0x00000007 +monitor sleep 10 + +# PMC_IER +monitor mww 0xFFFFFF60 0x00480100 +monitor sleep 100 + +load +break main +continue Property changes on: trunk/testing/examples/SAM7X256Test/prj/eclipse_rom.gdb ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/testing/examples/SAM7X256Test/prj/sam7x256_jtagkey.cfg =================================================================== --- trunk/testing/examples/SAM7X256Test/prj/sam7x256_jtagkey.cfg 2009-04-27 19:35:31 UTC (rev 1548) +++ trunk/testing/examples/SAM7X256Test/prj/sam7x256_jtagkey.cfg 2009-04-28 06:28:39 UTC (rev 1549) @@ -1,40 +1,40 @@ -#daemon configuration -telnet_port 4444 -gdb_port 3333 - -# tell gdb our flash memory map -# and enable flash programming -gdb_memory_map enable -gdb_flash_program enable - -#interface -interface ft2232 -ft2232_device_desc "Amontec JTAGkey A" -ft2232_layout jtagkey -ft2232_vid_pid 0x0403 0xcff8 -jtag_speed 0 -jtag_nsrst_delay 200 -jtag_ntrst_delay 200 - - -#use combined on interfaces or targets that can't set TRST/SRST separately -reset_config srst_only srst_pulls_trst - -#jtag scan chain -#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE) -jtag_device 4 0x1 0xf 0xe - -#target configuration -target create target0 arm7tdmi -endian little -chain-position 0 -variant arm7tdmi -[new_target_name] configure -work-area-virt 0 -work-area-phys 0x00200000 -work-area-size 0x4000 -work-area-backup false - -target_script 0 reset .\prj\sam7x256_reset.script - -#flash bank <driver> <base> <size> <chip_width> <bus_width> -flash bank at91sam7 0 0 0 0 0 - -# For more information about the configuration files, take a look at: -# http://openfacts.berlios.de/index-en.phtml?title=Open+On-Chip+Debugger - -init -reset halt +#daemon configuration +telnet_port 4444 +gdb_port 3333 + +# tell gdb our flash memory map +# and enable flash programming +gdb_memory_map enable +gdb_flash_program enable + +#interface +interface ft2232 +ft2232_device_desc "Amontec JTAGkey A" +ft2232_layout jtagkey +ft2232_vid_pid 0x0403 0xcff8 +jtag_speed 0 +jtag_nsrst_delay 200 +jtag_ntrst_delay 200 + + +#use combined on interfaces or targets that can't set TRST/SRST separately +reset_config srst_only srst_pulls_trst + +#jtag scan chain +#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE) +jtag_device 4 0x1 0xf 0xe + +#target configuration +target create target0 arm7tdmi -endian little -chain-position 0 -variant arm7tdmi +[new_target_name] configure -work-area-virt 0 -work-area-phys 0x00200000 -work-area-size 0x4000 -work-area-backup false + +target_script 0 reset .\prj\sam7x256_reset.script + +#flash bank <driver> <base> <size> <chip_width> <bus_width> +flash bank at91sam7 0 0 0 0 0 + +# For more information about the configuration files, take a look at: +# http://openfacts.berlios.de/index-en.phtml?title=Open+On-Chip+Debugger + +init +reset halt Property changes on: trunk/testing/examples/SAM7X256Test/prj/sam7x256_jtagkey.cfg ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/testing/examples/SAM7X256Test/prj/sam7x256_ram.ld =================================================================== --- trunk/testing/examples/SAM7X256Test/prj/sam7x256_ram.ld 2009-04-27 19:35:31 UTC (rev 1548) +++ trunk/testing/examples/SAM7X256Test/prj/sam7x256_ram.ld 2009-04-28 06:28:39 UTC (rev 1549) @@ -1,132 +1,132 @@ -/**************************************************************************** -* Copyright (c) 2006 by Michael Fischer. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* 3. Neither the name of the author nor the names of its contributors may -* be used to endorse or promote products derived from this software -* without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF -* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGE. -* -**************************************************************************** -* -* History: -* -* 30.03.06 mifi First Version -****************************************************************************/ - - -ENTRY(ResetHandler) -SEARCH_DIR(.) - -/* - * Define stack size here - */ -FIQ_STACK_SIZE = 0x0100; -IRQ_STACK_SIZE = 0x0100; -ABT_STACK_SIZE = 0x0100; -UND_STACK_SIZE = 0x0100; -SVC_STACK_SIZE = 0x0400; - - -MEMORY -{ - ram : org = 0x00200000, len = 64k -} - -/* - * Do not change the next code - */ -SECTIONS -{ - .text : - { - *(.vectors); - . = ALIGN(4); - *(.init); - . = ALIGN(4); - *(.text); - . = ALIGN(4); - *(.rodata); - . = ALIGN(4); - *(.rodata*); - . = ALIGN(4); - *(.glue_7t); - . = ALIGN(4); - *(.glue_7); - . = ALIGN(4); - etext = .; - } > ram - - .data : - { - PROVIDE (__data_start = .); - *(.data) - . = ALIGN(4); - edata = .; - _edata = .; - PROVIDE (__data_end = .); - } > ram - - .bss : - { - PROVIDE (__bss_start = .); - *(.bss) - *(COMMON) - . = ALIGN(4); - PROVIDE (__bss_end = .); - - . = ALIGN(256); - - PROVIDE (__stack_start = .); - - PROVIDE (__stack_fiq_start = .); - . += FIQ_STACK_SIZE; - . = ALIGN(4); - PROVIDE (__stack_fiq_end = .); - - PROVIDE (__stack_irq_start = .); - . += IRQ_STACK_SIZE; - . = ALIGN(4); - PROVIDE (__stack_irq_end = .); - - PROVIDE (__stack_abt_start = .); - . += ABT_STACK_SIZE; - . = ALIGN(4); - PROVIDE (__stack_abt_end = .); - - PROVIDE (__stack_und_start = .); - . += UND_STACK_SIZE; - . = ALIGN(4); - PROVIDE (__stack_und_end = .); - - PROVIDE (__stack_svc_start = .); - . += SVC_STACK_SIZE; - . = ALIGN(4); - PROVIDE (__stack_svc_end = .); - PROVIDE (__stack_end = .); - PROVIDE (__heap_start = .); - } > ram - -} -/*** EOF ***/ - +/**************************************************************************** +* Copyright (c) 2006 by Michael Fischer. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* 3. Neither the name of the author nor the names of its contributors may +* be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +* +**************************************************************************** +* +* History: +* +* 30.03.06 mifi First Version +****************************************************************************/ + + +ENTRY(ResetHandler) +SEARCH_DIR(.) + +/* + * Define stack size here + */ +FIQ_STACK_SIZE = 0x0100; +IRQ_STACK_SIZE = 0x0100; +ABT_STACK_SIZE = 0x0100; +UND_STACK_SIZE = 0x0100; +SVC_STACK_SIZE = 0x0400; + + +MEMORY +{ + ram : org = 0x00200000, len = 64k +} + +/* + * Do not change the next code + */ +SECTIONS +{ + .text : + { + *(.vectors); + . = ALIGN(4); + *(.init); + . = ALIGN(4); + *(.text); + . = ALIGN(4); + *(.rodata); + . = ALIGN(4); + *(.rodata*); + . = ALIGN(4); + *(.glue_7t); + . = ALIGN(4); + *(.glue_7); + . = ALIGN(4); + etext = .; + } > ram + + .data : + { + PROVIDE (__data_start = .); + *(.data) + . = ALIGN(4); + edata = .; + _edata = .; + PROVIDE (__data_end = .); + } > ram + + .bss : + { + PROVIDE (__bss_start = .); + *(.bss) + *(COMMON) + . = ALIGN(4); + PROVIDE (__bss_end = .); + + . = ALIGN(256); + + PROVIDE (__stack_start = .); + + PROVIDE (__stack_fiq_start = .); + . += FIQ_STACK_SIZE; + . = ALIGN(4); + PROVIDE (__stack_fiq_end = .); + + PROVIDE (__stack_irq_start = .); + . += IRQ_STACK_SIZE; + . = ALIGN(4); + PROVIDE (__stack_irq_end = .); + + PROVIDE (__stack_abt_start = .); + . += ABT_STACK_SIZE; + . = ALIGN(4); + PROVIDE (__stack_abt_end = .); + + PROVIDE (__stack_und_start = .); + . += UND_STACK_SIZE; + . = ALIGN(4); + PROVIDE (__stack_und_end = .); + + PROVIDE (__stack_svc_start = .); + . += SVC_STACK_SIZE; + . = ALIGN(4); + PROVIDE (__stack_svc_end = .); + PROVIDE (__stack_end = .); + PROVIDE (__heap_start = .); + } > ram + +} +/*** EOF ***/ + Property changes on: trunk/testing/examples/SAM7X256Test/prj/sam7x256_ram.ld ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/testing/examples/SAM7X256Test/prj/sam7x256_reset.script =================================================================== --- trunk/testing/examples/SAM7X256Test/prj/sam7x256_reset.script 2009-04-27 19:35:31 UTC (rev 1548) +++ trunk/testing/examples/SAM7X256Test/prj/sam7x256_reset.script 2009-04-28 06:28:39 UTC (rev 1549) @@ -1,17 +1,17 @@ -# -# Init - taken form the script openocd_at91sam7_ecr.script -# -# I take this script from the following page: -# -# http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/openocd_intro/index.html -# -mww 0xfffffd44 0x00008000 # disable watchdog -mww 0xfffffd08 0xa5000001 # enable user reset -mww 0xfffffc20 0x00000601 # CKGR_MOR : enable the main oscillator -sleep 10 -mww 0xfffffc2c 0x00481c0e # CKGR_PLLR: 96.1097 MHz -sleep 10 -mww 0xfffffc30 0x00000007 # PMC_MCKR : MCK = PLL / 2 ~= 48 MHz -sleep 10 -mww 0xffffff60 0x003c0100 # MC_FMR: flash mode (FWS=1,FMCN=60) -sleep 100 +# +# Init - taken form the script openocd_at91sam7_ecr.script +# +# I take this script from the following page: +# +# http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/openocd_intro/index.html +# +mww 0xfffffd44 0x00008000 # disable watchdog +mww 0xfffffd08 0xa5000001 # enable user reset +mww 0xfffffc20 0x00000601 # CKGR_MOR : enable the main oscillator +sleep 10 +mww 0xfffffc2c 0x00481c0e # CKGR_PLLR: 96.1097 MHz +sleep 10 +mww 0xfffffc30 0x00000007 # PMC_MCKR : MCK = PLL / 2 ~= 48 MHz +sleep 10 +mww 0xffffff60 0x003c0100 # MC_FMR: flash mode (FWS=1,FMCN=60) +sleep 100 Property changes on: trunk/testing/examples/SAM7X256Test/prj/sam7x256_reset.script ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/testing/examples/SAM7X256Test/prj/sam7x256_rom.ld =================================================================== --- trunk/testing/examples/SAM7X256Test/prj/sam7x256_rom.ld 2009-04-27 19:35:31 UTC (rev 1548) +++ trunk/testing/examples/SAM7X256Test/prj/sam7x256_rom.ld 2009-04-28 06:28:39 UTC (rev 1549) @@ -1,133 +1,133 @@ -/**************************************************************************** -* Copyright (c) 2006 by Michael Fischer. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions -* are met: -* -* 1. Redistributions of source code must retain the above copyright -* notice, this list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright -* notice, this list of conditions and the following disclaimer in the -* documentation and/or other materials provided with the distribution. -* 3. Neither the name of the author nor the names of its contributors may -* be used to endorse or promote products derived from this software -* without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF -* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGE. -* -**************************************************************************** -* -* History: -* -* 26.01.08 mifi First Version -****************************************************************************/ - - -ENTRY(ResetHandler) -SEARCH_DIR(.) - -/* - * Define stack size here - */ -FIQ_STACK_SIZE = 0x0100; -IRQ_STACK_SIZE = 0x0100; -ABT_STACK_SIZE = 0x0100; -UND_STACK_SIZE = 0x0100; -SVC_STACK_SIZE = 0x0400; - - -MEMORY -{ - rom : org = 0x00100000, len = 256k - ram : org = 0x00200000, len = 64k -} - -/* - * Do not change the next code - */ -SECTIONS -{ - .text : - { - *(.vectors); - . = ALIGN(4); - *(.init); - . = ALIGN(4); - *(.text); - . = ALIGN(4); - *(.rodata); - . = ALIGN(4); - *(.rodata*); - . = ALIGN(4); - *(.glue_7t); - . = ALIGN(4); - *(.glue_7); - . = ALIGN(4); - etext = .; - } > rom - - .data : - { - PROVIDE (__data_start = .); - *(.data) - . = ALIGN(4); - edata = .; - _edata = .; - PROVIDE (__data_end = .); - } > ram - - .bss : - { - PROVIDE (__bss_start = .); - *(.bss) - *(COMMON) - . = ALIGN(4); - PROVIDE (__bss_end = .); - - . = ALIGN(256); - - PROVIDE (__stack_start = .); - - PROVIDE (__stack_fiq_start = .); - . += FIQ_STACK_SIZE; - . = ALIGN(4); - PROVIDE (__stack_fiq_end = .); - - PROVIDE (__stack_irq_start = .); - . += IRQ_STACK_SIZE; - . = ALIGN(4); - PROVIDE (__stack_irq_end = .); - - PROVIDE (__stack_abt_start = .); - . += ABT_STACK_SIZE; - . = ALIGN(4); - PROVIDE (__stack_abt_end = .); - - PROVIDE (__stack_und_start = .); - . += UND_STACK_SIZE; - . = ALIGN(4); - PROVIDE (__stack_und_end = .); - - PROVIDE (__stack_svc_start = .); - . += SVC_STACK_SIZE; - . = ALIGN(4); - PROVIDE (__stack_svc_end = .); - PROVIDE (__stack_end = .); - PROVIDE (__heap_start = .); - } > ram - -} -/*** EOF ***/ - +/**************************************************************************** +* Copyright (c) 2006 by Michael Fischer. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* 3. Neither the name of the author nor the names of its contributors may +* be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +* +**************************************************************************** +* +* History: +* +* 26.01.08 mifi First Version +****************************************************************************/ + + +ENTRY(ResetHandler) +SEARCH_DIR(.) + +/* + * Define stack size here + */ +FIQ_STACK_SIZE = 0x0100; +IRQ_STACK_SIZE = 0x0100; +ABT_STACK_SIZE = 0x0100; +UND_STACK_SIZE = 0x0100; +SVC_STACK_SIZE = 0x0400; + + +MEMORY +{ + rom : org = 0x00100000, len = 256k + ram : org = 0x00200000, len = 64k +} + +/* + * Do not change the next code + */ +SECTIONS +{ + .text : + { + *(.vectors); + . = ALIGN(4); + *(.init); + . = ALIGN(4); + *(.text); + . = ALIGN(4); + *(.rodata); + . = ALIGN(4); + *(.rodata*); + . = ALIGN(4); + *(.glue_7t); + . = ALIGN(4); + *(.glue_7); + . = ALIGN(4); + etext = .; + } > rom + + .data : + { + PROVIDE (__data_start = .); + *(.data) + . = ALIGN(4); + edata = .; + _edata = .; + PROVIDE (__data_end = .); + } > ram + + .bss : + { + PROVIDE (__bss_start = .); + *(.bss) + *(COMMON) + . = ALIGN(4); + PROVIDE (__bss_end = .); + + . = ALIGN(256); + + PROVIDE (__stack_start = .); + + PROVIDE (__stack_fiq_start = .); + . += FIQ_STACK_SIZE; + . = ALIGN(4); + PROVIDE (__stack_fiq_end = .); + + PROVIDE (__stack_irq_start = .); + . += IRQ_STACK_SIZE; + . = ALIGN(4); + PROVIDE (__stack_irq_end = .); + + PROVIDE (__stack_abt_start = .); + . += ABT_STACK_SIZE; + . = ALIGN(4); + PROVIDE (__stack_abt_end = .); + + PROVIDE (__stack_und_start = .); + . += UND_STACK_SIZE; + . = ALIGN(4); + PROVIDE (__stack_und_end = .); + + PROVIDE (__stack_svc_start = .); + . += SVC_STACK_SIZE; + . = ALIGN(4); + PROVIDE (__stack_svc_end = .); + PROVIDE (__stack_end = .); + PROVIDE (__heap_start = .); + } > ram + +} +/*** EOF ***/ + Property changes on: trunk/testing/examples/SAM7X256Test/prj/sam7x256_rom.ld ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/testing/examples/STM32-103/readme.txt =================================================================== --- trunk/testing/examples/STM32-103/readme.txt 2009-04-27 19:35:31 UTC (rev 1548) +++ trunk/testing/examples/STM32-103/readme.txt 2009-04-28 06:28:39 UTC (rev 1549) @@ -1,6 +1,6 @@ -Olimex STM32-p103 board. - -main.elf is a file that can be programmed to flash for -testing purposes(e.g. test GDB load performance). - +Olimex STM32-p103 board. + +main.elf is a file that can be programmed to flash for +testing purposes(e.g. test GDB load performance). + http://www.olimex.com/dev/stm32-p103.html \ No newline at end of file Property changes on: trunk/testing/examples/STM32-103/readme.txt ___________________________________________________________________ Name: svn:eol-style + native |
From: <oh...@ma...> - 2009-04-27 21:35:37
|
Author: oharboe Date: 2009-04-27 21:35:31 +0200 (Mon, 27 Apr 2009) New Revision: 1548 Modified: trunk/src/flash/avrf.c trunk/src/flash/avrf.h trunk/src/target/avrt.c trunk/src/target/avrt.h Log: SimonQian <sim...@si...> fix warnings(which stops compilation) and some bugs Modified: trunk/src/flash/avrf.c =================================================================== --- trunk/src/flash/avrf.c 2009-04-27 16:08:25 UTC (rev 1547) +++ trunk/src/flash/avrf.c 2009-04-27 19:35:31 UTC (rev 1548) @@ -1,500 +1,500 @@ -/*************************************************************************** - * Copyright (C) 2009 by Simon Qian * - * Sim...@Si... * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "replacements.h" - -#include "avrf.h" -#include "avrt.h" -#include "flash.h" -#include "target.h" -#include "log.h" -#include "algorithm.h" -#include "binarybuffer.h" - -#include <stdlib.h> -#include <string.h> - -/* AVR_JTAG_Instructions */ -#define AVR_JTAG_INS_LEN 4 -// Public Instructions: -#define AVR_JTAG_INS_EXTEST 0x00 -#define AVR_JTAG_INS_IDCODE 0x01 -#define AVR_JTAG_INS_SAMPLE_PRELOAD 0x02 -#define AVR_JTAG_INS_BYPASS 0x0F -// AVR Specified Public Instructions: -#define AVR_JTAG_INS_AVR_RESET 0x0C -#define AVR_JTAG_INS_PROG_ENABLE 0x04 -#define AVR_JTAG_INS_PROG_COMMANDS 0x05 -#define AVR_JTAG_INS_PROG_PAGELOAD 0x06 -#define AVR_JTAG_INS_PROG_PAGEREAD 0x07 - -// Data Registers: -#define AVR_JTAG_REG_Bypass_Len 1 -#define AVR_JTAG_REG_DeviceID_Len 32 - -#define AVR_JTAG_REG_Reset_Len 1 -#define AVR_JTAG_REG_JTAGID_Len 32 -#define AVR_JTAG_REG_ProgrammingEnable_Len 16 -#define AVR_JTAG_REG_ProgrammingCommand_Len 15 -#define AVR_JTAG_REG_FlashDataByte_Len 16 - -avrf_type_t avft_chips_info[] = -{ -// name, chip_id, flash_page_size, flash_page_num, eeprom_page_size, eeprom_page_num - {"atmega128", 0x9702, 256, 512, 8, 512}, -}; - -static int avrf_register_commands(struct command_context_s *cmd_ctx); -static int avrf_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); -static int avrf_erase(struct flash_bank_s *bank, int first, int last); -static int avrf_protect(struct flash_bank_s *bank, int set, int first, int last); -static int avrf_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count); -static int avrf_probe(struct flash_bank_s *bank); -static int avrf_auto_probe(struct flash_bank_s *bank); -//static int avrf_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); -static int avrf_protect_check(struct flash_bank_s *bank); -static int avrf_info(struct flash_bank_s *bank, char *buf, int buf_size); - -static int avrf_handle_mass_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - -extern int avr_jtag_sendinstr(jtag_tap_t *tap, u8 *ir_in, u8 ir_out); -extern int avr_jtag_senddat(jtag_tap_t *tap, u32 *dr_in, u32 dr_out, int len); - -extern int mcu_write_ir(jtag_tap_t *tap, u8 *ir_in, u8 *ir_out, int ir_len, int rti); -extern int mcu_write_dr(jtag_tap_t *tap, u8 *ir_in, u8 *ir_out, int dr_len, int rti); -extern int mcu_write_ir_u8(jtag_tap_t *tap, u8 *ir_in, u8 ir_out, int ir_len, int rti); -extern int mcu_write_dr_u8(jtag_tap_t *tap, u8 *ir_in, u8 ir_out, int dr_len, int rti); -extern int mcu_write_ir_u16(jtag_tap_t *tap, u16 *ir_in, u16 ir_out, int ir_len, int rti); -extern int mcu_write_dr_u16(jtag_tap_t *tap, u16 *ir_in, u16 ir_out, int dr_len, int rti); -extern int mcu_write_ir_u32(jtag_tap_t *tap, u32 *ir_in, u32 ir_out, int ir_len, int rti); -extern int mcu_write_dr_u32(jtag_tap_t *tap, u32 *ir_in, u32 ir_out, int dr_len, int rti); -extern int mcu_execute_queue(void); - -flash_driver_t avr_flash = -{ - .name = "avr", - .register_commands = avrf_register_commands, - .flash_bank_command = avrf_flash_bank_command, - .erase = avrf_erase, - .protect = avrf_protect, - .write = avrf_write, - .probe = avrf_probe, - .auto_probe = avrf_auto_probe, - .erase_check = default_flash_mem_blank_check, - .protect_check = avrf_protect_check, - .info = avrf_info -}; - -/* avr program functions */ -static int avr_jtag_reset(avr_common_t *avr, u32 reset) -{ - avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_AVR_RESET); - avr_jtag_senddat(avr->jtag_info.tap, NULL, reset ,AVR_JTAG_REG_Reset_Len); - - return ERROR_OK; -} - -static int avr_jtag_read_jtagid(avr_common_t *avr, u32 *id) -{ - avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_IDCODE); - avr_jtag_senddat(avr->jtag_info.tap, id, 0, AVR_JTAG_REG_JTAGID_Len); - - return ERROR_OK; -} - -static int avr_jtagprg_enterprogmode(avr_common_t *avr) -{ - avr_jtag_reset(avr, 1); - - avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_ENABLE); - avr_jtag_senddat(avr->jtag_info.tap, NULL, 0xA370, AVR_JTAG_REG_ProgrammingEnable_Len); - - return ERROR_OK; -} - -static int avr_jtagprg_leaveprogmode(avr_common_t *avr) -{ - avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_COMMANDS); - avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x2300, AVR_JTAG_REG_ProgrammingCommand_Len); - avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3300, AVR_JTAG_REG_ProgrammingCommand_Len); - - avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_ENABLE); - avr_jtag_senddat(avr->jtag_info.tap, NULL, 0, AVR_JTAG_REG_ProgrammingEnable_Len); - - avr_jtag_reset(avr, 0); - - return ERROR_OK; -} - -static int avr_jtagprg_chiperase(avr_common_t *avr) -{ - u32 poll_value; - - avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_COMMANDS); - avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x2380, AVR_JTAG_REG_ProgrammingCommand_Len); - avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3180, AVR_JTAG_REG_ProgrammingCommand_Len); - avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3380, AVR_JTAG_REG_ProgrammingCommand_Len); - avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3380, AVR_JTAG_REG_ProgrammingCommand_Len); - - do{ - poll_value = 0; - avr_jtag_senddat(avr->jtag_info.tap, &poll_value, 0x3380, AVR_JTAG_REG_ProgrammingCommand_Len); - if (ERROR_OK != mcu_execute_queue()) - { - return ERROR_FAIL; - } - LOG_DEBUG("poll_value = 0x%04X", poll_value); - }while(!(poll_value & 0x0200)); - - return ERROR_OK; -} - -static int avr_jtagprg_writeflashpage(avr_common_t *avr, u8 *page_buf, u32 buf_size, u32 addr, u32 page_size) -{ - u32 i, poll_value; - - avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_COMMANDS); - avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x2310, AVR_JTAG_REG_ProgrammingCommand_Len); - - // load addr high byte - avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x0700 | ((addr >> 9) & 0xFF), AVR_JTAG_REG_ProgrammingCommand_Len); - - // load addr low byte - avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x0300 | ((addr >> 1) & 0xFF), AVR_JTAG_REG_ProgrammingCommand_Len); - - avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_PAGELOAD); - - for (i = 0; i < page_size; i++) - { - if (i < buf_size) - { - avr_jtag_senddat(avr->jtag_info.tap, NULL, page_buf[i], 8); - } - else - { - avr_jtag_senddat(avr->jtag_info.tap, NULL, 0xFF, 8); - } - } - - avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_COMMANDS); - - avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3700, AVR_JTAG_REG_ProgrammingCommand_Len); - avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3500, AVR_JTAG_REG_ProgrammingCommand_Len); - avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3700, AVR_JTAG_REG_ProgrammingCommand_Len); - avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3700, AVR_JTAG_REG_ProgrammingCommand_Len); - - do{ - poll_value = 0; - avr_jtag_senddat(avr->jtag_info.tap, &poll_value, 0x3700, AVR_JTAG_REG_ProgrammingCommand_Len); - if (ERROR_OK != mcu_execute_queue()) - { - return ERROR_FAIL; - } - LOG_DEBUG("poll_value = 0x%04X", poll_value); - }while(!(poll_value & 0x0200)); - - return ERROR_OK; -} - -/* interface command */ -static int avrf_register_commands(struct command_context_s *cmd_ctx) -{ - command_t *avr_cmd = register_command(cmd_ctx, NULL, "avr", NULL, COMMAND_ANY, "avr flash specific commands"); - - register_command(cmd_ctx, avr_cmd, "mass_erase", avrf_handle_mass_erase_command, COMMAND_EXEC, - "mass erase device"); - - return ERROR_OK; -} - -static int avrf_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) -{ - avrf_flash_bank_t *avrf_info; - - if (argc < 6) - { - LOG_WARNING("incomplete flash_bank avr configuration"); - return ERROR_FLASH_BANK_INVALID; - } - - avrf_info = malloc(sizeof(avrf_flash_bank_t)); - bank->driver_priv = avrf_info; - - avrf_info->probed = 0; - - return ERROR_OK; -} - -static int avrf_erase(struct flash_bank_s *bank, int first, int last) -{ - LOG_INFO(__FUNCTION__); - return ERROR_OK; -} - -static int avrf_protect(struct flash_bank_s *bank, int set, int first, int last) -{ - LOG_INFO(__FUNCTION__); - return ERROR_OK; -} - -static int avrf_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count) -{ - target_t *target = bank->target; - avr_common_t *avr = target->arch_info; - u32 cur_size, cur_buffer_size, page_size; - - if (bank->target->state != TARGET_HALTED) - { - LOG_ERROR("Target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - - page_size = bank->sectors[0].size; - if ((offset % page_size) != 0) - { - LOG_WARNING("offset 0x%x breaks required %d-byte alignment", offset, page_size); - return ERROR_FLASH_DST_BREAKS_ALIGNMENT; - } - - LOG_DEBUG("offset is 0x%08X", offset); - LOG_DEBUG("count is %d", count); - - if (ERROR_OK != avr_jtagprg_enterprogmode(avr)) - { - return ERROR_FAIL; - } - - cur_size = 0; - while(count > 0) - { - if (count > page_size) - { - cur_buffer_size = page_size; - } - else - { - cur_buffer_size = count; - } - avr_jtagprg_writeflashpage(avr, buffer + cur_size, cur_buffer_size, offset + cur_size, page_size); - count -= cur_buffer_size; - cur_size += cur_buffer_size; - - keep_alive(); - } - - return avr_jtagprg_leaveprogmode(avr); -} - -#define EXTRACT_MFG(X) (((X) & 0xffe) >> 1) -#define EXTRACT_PART(X) (((X) & 0xffff000) >> 12) -#define EXTRACT_VER(X) (((X) & 0xf0000000) >> 28) -static int avrf_probe(struct flash_bank_s *bank) -{ - target_t *target = bank->target; - avrf_flash_bank_t *avrf_info = bank->driver_priv; - avr_common_t *avr = target->arch_info; - avrf_type_t *avr_info; - int i; - u32 device_id; - - if (bank->target->state != TARGET_HALTED) - { - LOG_ERROR("Target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - - avrf_info->probed = 0; - - avr_jtag_read_jtagid(avr, &device_id); - if (ERROR_OK != mcu_execute_queue()) - { - return ERROR_FAIL; - } - - LOG_INFO( "device id = 0x%08x", device_id ); - if (EXTRACT_MFG(device_id) != 0x1F) - { - LOG_ERROR("0x%X is invalid Manufacturer for avr, 0x%X is expected", EXTRACT_MFG(device_id), 0x1F); - } - - for (i = 0; i < (int)(sizeof(avft_chips_info) / sizeof(avft_chips_info[0])); i++) - { - if (avft_chips_info[i].chip_id == EXTRACT_PART(device_id)) - { - avr_info = &avft_chips_info[i]; - LOG_INFO("target device is %s", avr_info->name); - break; - } - } - - if (i < (int)(sizeof(avft_chips_info) / sizeof(avft_chips_info[0]))) - { - // chip found - bank->base = 0x00000000; - bank->size = (avr_info->flash_page_size * avr_info->flash_page_num); - bank->num_sectors = avr_info->flash_page_num; - bank->sectors = malloc(sizeof(flash_sector_t) * avr_info->flash_page_num); - - for (i = 0; i < avr_info->flash_page_num; i++) - { - bank->sectors[i].offset = i * avr_info->flash_page_size; - bank->sectors[i].size = avr_info->flash_page_size; - bank->sectors[i].is_erased = -1; - bank->sectors[i].is_protected = 1; - } - - avrf_info->probed = 1; - return ERROR_OK; - } - else - { - // chip not supported - LOG_ERROR("0x%X is not support for avr", EXTRACT_PART(device_id)); - - avrf_info->probed = 1; - return ERROR_FAIL; - } -} - -static int avrf_auto_probe(struct flash_bank_s *bank) -{ - avrf_flash_bank_t *avrf_info = bank->driver_priv; - if (avrf_info->probed) - return ERROR_OK; - return avrf_probe(bank); -} - -static int avrf_protect_check(struct flash_bank_s *bank) -{ - LOG_INFO(__FUNCTION__); - return ERROR_OK; -} - -static int avrf_info(struct flash_bank_s *bank, char *buf, int buf_size) -{ - target_t *target = bank->target; - avr_common_t *avr = target->arch_info; - avrf_type_t *avr_info; - int i; - u32 device_id; - - if (bank->target->state != TARGET_HALTED) - { - LOG_ERROR("Target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - - avr_jtag_read_jtagid(avr, &device_id); - if (ERROR_OK != mcu_execute_queue()) - { - return ERROR_FAIL; - } - - LOG_INFO( "device id = 0x%08x", device_id ); - if (EXTRACT_MFG(device_id) != 0x1F) - { - LOG_ERROR("0x%X is invalid Manufacturer for avr, 0x%X is expected", EXTRACT_MFG(device_id), 0x1F); - } - - for (i = 0; i < (int)(sizeof(avft_chips_info) / sizeof(avft_chips_info[0])); i++) - { - if (avft_chips_info[i].chip_id == EXTRACT_PART(device_id)) - { - avr_info = &avft_chips_info[i]; - LOG_INFO("target device is %s", avr_info->name); - - return ERROR_OK; - } - } - - if (i < (int)(sizeof(avft_chips_info) / sizeof(avft_chips_info[0]))) - { - // chip found - snprintf(buf, buf_size, "%s - Rev: 0x%X", avr_info->name, EXTRACT_VER(device_id)); - return ERROR_OK; - } - else - { - // chip not supported - snprintf(buf, buf_size, "Cannot identify target as a avr\n"); - return ERROR_FLASH_OPERATION_FAILED; - } -} - -static int avrf_mass_erase(struct flash_bank_s *bank) -{ - target_t *target = bank->target; - avr_common_t *avr = target->arch_info; - - if (target->state != TARGET_HALTED) - { - LOG_ERROR("Target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - - if ((ERROR_OK != avr_jtagprg_enterprogmode(avr)) - || (ERROR_OK != avr_jtagprg_chiperase(avr)) - || (ERROR_OK != avr_jtagprg_leaveprogmode(avr))) - { - return ERROR_FAIL; - } - - return ERROR_OK; -} - -static int avrf_handle_mass_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) -{ - flash_bank_t *bank; - int i; - - if (argc < 1) - { - command_print(cmd_ctx, "avr mass_erase <bank>"); - return ERROR_OK; - } - - bank = get_flash_bank_by_num(strtoul(args[0], NULL, 0)); - if (!bank) - { - command_print(cmd_ctx, "flash bank '#%s' is out of bounds", args[0]); - return ERROR_OK; - } - - if (avrf_mass_erase(bank) == ERROR_OK) - { - /* set all sectors as erased */ - for (i = 0; i < bank->num_sectors; i++) - { - bank->sectors[i].is_erased = 1; - } - - command_print(cmd_ctx, "avr mass erase complete"); - } - else - { - command_print(cmd_ctx, "avr mass erase failed"); - } - - LOG_DEBUG(__FUNCTION__); - return ERROR_OK; -} +/*************************************************************************** + * Copyright (C) 2009 by Simon Qian * + * Sim...@Si... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "replacements.h" + +#include "avrf.h" +#include "avrt.h" +#include "flash.h" +#include "target.h" +#include "log.h" +#include "algorithm.h" +#include "binarybuffer.h" + +#include <stdlib.h> +#include <string.h> + +/* AVR_JTAG_Instructions */ +#define AVR_JTAG_INS_LEN 4 +// Public Instructions: +#define AVR_JTAG_INS_EXTEST 0x00 +#define AVR_JTAG_INS_IDCODE 0x01 +#define AVR_JTAG_INS_SAMPLE_PRELOAD 0x02 +#define AVR_JTAG_INS_BYPASS 0x0F +// AVR Specified Public Instructions: +#define AVR_JTAG_INS_AVR_RESET 0x0C +#define AVR_JTAG_INS_PROG_ENABLE 0x04 +#define AVR_JTAG_INS_PROG_COMMANDS 0x05 +#define AVR_JTAG_INS_PROG_PAGELOAD 0x06 +#define AVR_JTAG_INS_PROG_PAGEREAD 0x07 + +// Data Registers: +#define AVR_JTAG_REG_Bypass_Len 1 +#define AVR_JTAG_REG_DeviceID_Len 32 + +#define AVR_JTAG_REG_Reset_Len 1 +#define AVR_JTAG_REG_JTAGID_Len 32 +#define AVR_JTAG_REG_ProgrammingEnable_Len 16 +#define AVR_JTAG_REG_ProgrammingCommand_Len 15 +#define AVR_JTAG_REG_FlashDataByte_Len 16 + +avrf_type_t avft_chips_info[] = +{ +// name, chip_id, flash_page_size, flash_page_num, eeprom_page_size, eeprom_page_num + {"atmega128", 0x9702, 256, 512, 8, 512}, +}; + +static int avrf_register_commands(struct command_context_s *cmd_ctx); +static int avrf_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank); +static int avrf_erase(struct flash_bank_s *bank, int first, int last); +static int avrf_protect(struct flash_bank_s *bank, int set, int first, int last); +static int avrf_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count); +static int avrf_probe(struct flash_bank_s *bank); +static int avrf_auto_probe(struct flash_bank_s *bank); +//static int avrf_handle_part_id_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); +static int avrf_protect_check(struct flash_bank_s *bank); +static int avrf_info(struct flash_bank_s *bank, char *buf, int buf_size); + +static int avrf_handle_mass_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); + +extern int avr_jtag_sendinstr(jtag_tap_t *tap, u8 *ir_in, u8 ir_out); +extern int avr_jtag_senddat(jtag_tap_t *tap, u32 *dr_in, u32 dr_out, int len); + +extern int mcu_write_ir(jtag_tap_t *tap, u8 *ir_in, u8 *ir_out, int ir_len, int rti); +extern int mcu_write_dr(jtag_tap_t *tap, u8 *ir_in, u8 *ir_out, int dr_len, int rti); +extern int mcu_write_ir_u8(jtag_tap_t *tap, u8 *ir_in, u8 ir_out, int ir_len, int rti); +extern int mcu_write_dr_u8(jtag_tap_t *tap, u8 *ir_in, u8 ir_out, int dr_len, int rti); +extern int mcu_write_ir_u16(jtag_tap_t *tap, u16 *ir_in, u16 ir_out, int ir_len, int rti); +extern int mcu_write_dr_u16(jtag_tap_t *tap, u16 *ir_in, u16 ir_out, int dr_len, int rti); +extern int mcu_write_ir_u32(jtag_tap_t *tap, u32 *ir_in, u32 ir_out, int ir_len, int rti); +extern int mcu_write_dr_u32(jtag_tap_t *tap, u32 *ir_in, u32 ir_out, int dr_len, int rti); +extern int mcu_execute_queue(void); + +flash_driver_t avr_flash = +{ + .name = "avr", + .register_commands = avrf_register_commands, + .flash_bank_command = avrf_flash_bank_command, + .erase = avrf_erase, + .protect = avrf_protect, + .write = avrf_write, + .probe = avrf_probe, + .auto_probe = avrf_auto_probe, + .erase_check = default_flash_mem_blank_check, + .protect_check = avrf_protect_check, + .info = avrf_info +}; + +/* avr program functions */ +static int avr_jtag_reset(avr_common_t *avr, u32 reset) +{ + avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_AVR_RESET); + avr_jtag_senddat(avr->jtag_info.tap, NULL, reset ,AVR_JTAG_REG_Reset_Len); + + return ERROR_OK; +} + +static int avr_jtag_read_jtagid(avr_common_t *avr, u32 *id) +{ + avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_IDCODE); + avr_jtag_senddat(avr->jtag_info.tap, id, 0, AVR_JTAG_REG_JTAGID_Len); + + return ERROR_OK; +} + +static int avr_jtagprg_enterprogmode(avr_common_t *avr) +{ + avr_jtag_reset(avr, 1); + + avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_ENABLE); + avr_jtag_senddat(avr->jtag_info.tap, NULL, 0xA370, AVR_JTAG_REG_ProgrammingEnable_Len); + + return ERROR_OK; +} + +static int avr_jtagprg_leaveprogmode(avr_common_t *avr) +{ + avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_COMMANDS); + avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x2300, AVR_JTAG_REG_ProgrammingCommand_Len); + avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3300, AVR_JTAG_REG_ProgrammingCommand_Len); + + avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_ENABLE); + avr_jtag_senddat(avr->jtag_info.tap, NULL, 0, AVR_JTAG_REG_ProgrammingEnable_Len); + + avr_jtag_reset(avr, 0); + + return ERROR_OK; +} + +static int avr_jtagprg_chiperase(avr_common_t *avr) +{ + u32 poll_value; + + avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_COMMANDS); + avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x2380, AVR_JTAG_REG_ProgrammingCommand_Len); + avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3180, AVR_JTAG_REG_ProgrammingCommand_Len); + avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3380, AVR_JTAG_REG_ProgrammingCommand_Len); + avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3380, AVR_JTAG_REG_ProgrammingCommand_Len); + + do{ + poll_value = 0; + avr_jtag_senddat(avr->jtag_info.tap, &poll_value, 0x3380, AVR_JTAG_REG_ProgrammingCommand_Len); + if (ERROR_OK != mcu_execute_queue()) + { + return ERROR_FAIL; + } + LOG_DEBUG("poll_value = 0x%04X", poll_value); + }while(!(poll_value & 0x0200)); + + return ERROR_OK; +} + +static int avr_jtagprg_writeflashpage(avr_common_t *avr, u8 *page_buf, u32 buf_size, u32 addr, u32 page_size) +{ + u32 i, poll_value; + + avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_COMMANDS); + avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x2310, AVR_JTAG_REG_ProgrammingCommand_Len); + + // load addr high byte + avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x0700 | ((addr >> 9) & 0xFF), AVR_JTAG_REG_ProgrammingCommand_Len); + + // load addr low byte + avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x0300 | ((addr >> 1) & 0xFF), AVR_JTAG_REG_ProgrammingCommand_Len); + + avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_PAGELOAD); + + for (i = 0; i < page_size; i++) + { + if (i < buf_size) + { + avr_jtag_senddat(avr->jtag_info.tap, NULL, page_buf[i], 8); + } + else + { + avr_jtag_senddat(avr->jtag_info.tap, NULL, 0xFF, 8); + } + } + + avr_jtag_sendinstr(avr->jtag_info.tap, NULL, AVR_JTAG_INS_PROG_COMMANDS); + + avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3700, AVR_JTAG_REG_ProgrammingCommand_Len); + avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3500, AVR_JTAG_REG_ProgrammingCommand_Len); + avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3700, AVR_JTAG_REG_ProgrammingCommand_Len); + avr_jtag_senddat(avr->jtag_info.tap, NULL, 0x3700, AVR_JTAG_REG_ProgrammingCommand_Len); + + do{ + poll_value = 0; + avr_jtag_senddat(avr->jtag_info.tap, &poll_value, 0x3700, AVR_JTAG_REG_ProgrammingCommand_Len); + if (ERROR_OK != mcu_execute_queue()) + { + return ERROR_FAIL; + } + LOG_DEBUG("poll_value = 0x%04X", poll_value); + }while(!(poll_value & 0x0200)); + + return ERROR_OK; +} + +/* interface command */ +static int avrf_register_commands(struct command_context_s *cmd_ctx) +{ + command_t *avr_cmd = register_command(cmd_ctx, NULL, "avr", NULL, COMMAND_ANY, "avr flash specific commands"); + + register_command(cmd_ctx, avr_cmd, "mass_erase", avrf_handle_mass_erase_command, COMMAND_EXEC, + "mass erase device"); + + return ERROR_OK; +} + +static int avrf_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank) +{ + avrf_flash_bank_t *avrf_info; + + if (argc < 6) + { + LOG_WARNING("incomplete flash_bank avr configuration"); + return ERROR_FLASH_BANK_INVALID; + } + + avrf_info = malloc(sizeof(avrf_flash_bank_t)); + bank->driver_priv = avrf_info; + + avrf_info->probed = 0; + + return ERROR_OK; +} + +static int avrf_erase(struct flash_bank_s *bank, int first, int last) +{ + LOG_INFO(__FUNCTION__); + return ERROR_OK; +} + +static int avrf_protect(struct flash_bank_s *bank, int set, int first, int last) +{ + LOG_INFO(__FUNCTION__); + return ERROR_OK; +} + +static int avrf_write(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count) +{ + target_t *target = bank->target; + avr_common_t *avr = target->arch_info; + u32 cur_size, cur_buffer_size, page_size; + + if (bank->target->state != TARGET_HALTED) + { + LOG_ERROR("Target not halted"); + return ERROR_TARGET_NOT_HALTED; + } + + page_size = bank->sectors[0].size; + if ((offset % page_size) != 0) + { + LOG_WARNING("offset 0x%x breaks required %d-byte alignment", offset, page_size); + return ERROR_FLASH_DST_BREAKS_ALIGNMENT; + } + + LOG_DEBUG("offset is 0x%08X", offset); + LOG_DEBUG("count is %d", count); + + if (ERROR_OK != avr_jtagprg_enterprogmode(avr)) + { + return ERROR_FAIL; + } + + cur_size = 0; + while(count > 0) + { + if (count > page_size) + { + cur_buffer_size = page_size; + } + else + { + cur_buffer_size = count; + } + avr_jtagprg_writeflashpage(avr, buffer + cur_size, cur_buffer_size, offset + cur_size, page_size); + count -= cur_buffer_size; + cur_size += cur_buffer_size; + + keep_alive(); + } + + return avr_jtagprg_leaveprogmode(avr); +} + +#define EXTRACT_MFG(X) (((X) & 0xffe) >> 1) +#define EXTRACT_PART(X) (((X) & 0xffff000) >> 12) +#define EXTRACT_VER(X) (((X) & 0xf0000000) >> 28) +static int avrf_probe(struct flash_bank_s *bank) +{ + target_t *target = bank->target; + avrf_flash_bank_t *avrf_info = bank->driver_priv; + avr_common_t *avr = target->arch_info; + avrf_type_t *avr_info = NULL; + int i; + u32 device_id; + + if (bank->target->state != TARGET_HALTED) + { + LOG_ERROR("Target not halted"); + return ERROR_TARGET_NOT_HALTED; + } + + avrf_info->probed = 0; + + avr_jtag_read_jtagid(avr, &device_id); + if (ERROR_OK != mcu_execute_queue()) + { + return ERROR_FAIL; + } + + LOG_INFO( "device id = 0x%08x", device_id ); + if (EXTRACT_MFG(device_id) != 0x1F) + { + LOG_ERROR("0x%X is invalid Manufacturer for avr, 0x%X is expected", EXTRACT_MFG(device_id), 0x1F); + } + + for (i = 0; i < (int)(sizeof(avft_chips_info) / sizeof(avft_chips_info[0])); i++) + { + if (avft_chips_info[i].chip_id == EXTRACT_PART(device_id)) + { + avr_info = &avft_chips_info[i]; + LOG_INFO("target device is %s", avr_info->name); + break; + } + } + + if (avr_info != NULL) + { + // chip found + bank->base = 0x00000000; + bank->size = (avr_info->flash_page_size * avr_info->flash_page_num); + bank->num_sectors = avr_info->flash_page_num; + bank->sectors = malloc(sizeof(flash_sector_t) * avr_info->flash_page_num); + + for (i = 0; i < avr_info->flash_page_num; i++) + { + bank->sectors[i].offset = i * avr_info->flash_page_size; + bank->sectors[i].size = avr_info->flash_page_size; + bank->sectors[i].is_erased = -1; + bank->sectors[i].is_protected = 1; + } + + avrf_info->probed = 1; + return ERROR_OK; + } + else + { + // chip not supported + LOG_ERROR("0x%X is not support for avr", EXTRACT_PART(device_id)); + + avrf_info->probed = 1; + return ERROR_FAIL; + } +} + +static int avrf_auto_probe(struct flash_bank_s *bank) +{ + avrf_flash_bank_t *avrf_info = bank->driver_priv; + if (avrf_info->probed) + return ERROR_OK; + return avrf_probe(bank); +} + +static int avrf_protect_check(struct flash_bank_s *bank) +{ + LOG_INFO(__FUNCTION__); + return ERROR_OK; +} + +static int avrf_info(struct flash_bank_s *bank, char *buf, int buf_size) +{ + target_t *target = bank->target; + avr_common_t *avr = target->arch_info; + avrf_type_t *avr_info = NULL; + int i; + u32 device_id; + + if (bank->target->state != TARGET_HALTED) + { + LOG_ERROR("Target not halted"); + return ERROR_TARGET_NOT_HALTED; + } + + avr_jtag_read_jtagid(avr, &device_id); + if (ERROR_OK != mcu_execute_queue()) + { + return ERROR_FAIL; + } + + LOG_INFO( "device id = 0x%08x", device_id ); + if (EXTRACT_MFG(device_id) != 0x1F) + { + LOG_ERROR("0x%X is invalid Manufacturer for avr, 0x%X is expected", EXTRACT_MFG(device_id), 0x1F); + } + + for (i = 0; i < (int)(sizeof(avft_chips_info) / sizeof(avft_chips_info[0])); i++) + { + if (avft_chips_info[i].chip_id == EXTRACT_PART(device_id)) + { + avr_info = &avft_chips_info[i]; + LOG_INFO("target device is %s", avr_info->name); + + break; + } + } + + if (avr_info != NULL) + { + // chip found + snprintf(buf, buf_size, "%s - Rev: 0x%X", avr_info->name, EXTRACT_VER(device_id)); + return ERROR_OK; + } + else + { + // chip not supported + snprintf(buf, buf_size, "Cannot identify target as a avr\n"); + return ERROR_FLASH_OPERATION_FAILED; + } +} + +static int avrf_mass_erase(struct flash_bank_s *bank) +{ + target_t *target = bank->target; + avr_common_t *avr = target->arch_info; + + if (target->state != TARGET_HALTED) + { + LOG_ERROR("Target not halted"); + return ERROR_TARGET_NOT_HALTED; + } + + if ((ERROR_OK != avr_jtagprg_enterprogmode(avr)) + || (ERROR_OK != avr_jtagprg_chiperase(avr)) + || (ERROR_OK != avr_jtagprg_leaveprogmode(avr))) + { + return ERROR_FAIL; + } + + return ERROR_OK; +} + +static int avrf_handle_mass_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +{ + flash_bank_t *bank; + int i; + + if (argc < 1) + { + command_print(cmd_ctx, "avr mass_erase <bank>"); + return ERROR_OK; + } + + bank = get_flash_bank_by_num(strtoul(args[0], NULL, 0)); + if (!bank) + { + command_print(cmd_ctx, "flash bank '#%s' is out of bounds", args[0]); + return ERROR_OK; + } + + if (avrf_mass_erase(bank) == ERROR_OK) + { + /* set all sectors as erased */ + for (i = 0; i < bank->num_sectors; i++) + { + bank->sectors[i].is_erased = 1; + } + + command_print(cmd_ctx, "avr mass erase complete"); + } + else + { + command_print(cmd_ctx, "avr mass erase failed"); + } + + LOG_DEBUG(__FUNCTION__); + return ERROR_OK; +} Property changes on: trunk/src/flash/avrf.c ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/src/flash/avrf.h =================================================================== --- trunk/src/flash/avrf.h 2009-04-27 16:08:25 UTC (rev 1547) +++ trunk/src/flash/avrf.h 2009-04-27 19:35:31 UTC (rev 1548) @@ -1,39 +1,39 @@ -/*************************************************************************** - * Copyright (C) 2009 by Simon Qian * - * Sim...@Si... * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifndef AVRF_H -#define AVRF_H - -typedef struct avrf_type_s -{ - char name[15]; - u16 chip_id; - int flash_page_size; - int flash_page_num; - int eeprom_page_size; - int eeprom_page_num; -} avrf_type_t; - -typedef struct avrf_flash_bank_s -{ - int ppage_size; - int probed; -} avrf_flash_bank_t; - -#endif /* AVRF_H */ +/*************************************************************************** + * Copyright (C) 2009 by Simon Qian * + * Sim...@Si... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef AVRF_H +#define AVRF_H + +typedef struct avrf_type_s +{ + char name[15]; + u16 chip_id; + int flash_page_size; + int flash_page_num; + int eeprom_page_size; + int eeprom_page_num; +} avrf_type_t; + +typedef struct avrf_flash_bank_s +{ + int ppage_size; + int probed; +} avrf_flash_bank_t; + +#endif /* AVRF_H */ Property changes on: trunk/src/flash/avrf.h ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/src/target/avrt.c =================================================================== --- trunk/src/target/avrt.c 2009-04-27 16:08:25 UTC (rev 1547) +++ trunk/src/target/avrt.c 2009-04-27 19:35:31 UTC (rev 1548) @@ -1,354 +1,354 @@ -/*************************************************************************** - * Copyright (C) 2009 by Simon Qian * - * Sim...@Si... * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "replacements.h" - -#include "avrt.h" - -#include "register.h" -#include "target.h" -#include "log.h" -#include "jtag.h" -#include "binarybuffer.h" -#include "time_support.h" -#include "breakpoints.h" -#include "fileio.h" - -#include <stdlib.h> -#include <string.h> - -#include <sys/types.h> -#include <unistd.h> -#include <errno.h> - -#define AVR_JTAG_INS_LEN 4 - -/* cli handling */ -int avr_register_commands(struct command_context_s *cmd_ctx); - -/* forward declarations */ -int avr_target_create(struct target_s *target, Jim_Interp *interp); -int avr_init_target(struct command_context_s *cmd_ctx, struct target_s *target); -int avr_quit(void); - -int avr_arch_state(struct target_s *target); -int avr_poll(target_t *target); -int avr_halt(target_t *target); -int avr_resume(struct target_s *target, int current, u32 address, int handle_breakpoints, int debug_execution); -int avr_step(struct target_s *target, int current, u32 address, int handle_breakpoints); - -int avr_assert_reset(target_t *target); -int avr_deassert_reset(target_t *target); -int avr_soft_reset_halt(struct target_s *target); - -/* IR and DR functions */ -int avr_jtag_sendinstr(jtag_tap_t *tap, u8 *ir_in, u8 ir_out); -int avr_jtag_senddat(jtag_tap_t *tap, u32 *dr_in, u32 dr_out, int len); - -int mcu_write_ir(jtag_tap_t *tap, u8 *ir_in, u8 *ir_out, int ir_len, int rti); -int mcu_write_dr(jtag_tap_t *tap, u8 *dr_in, u8 *dr_out, int dr_len, int rti); -int mcu_write_ir_u8(jtag_tap_t *tap, u8 *ir_in, u8 ir_out, int ir_len, int rti); -int mcu_write_dr_u8(jtag_tap_t *tap, u8 *ir_in, u8 ir_out, int dr_len, int rti); -int mcu_write_ir_u16(jtag_tap_t *tap, u16 *ir_in, u16 ir_out, int ir_len, int rti); -int mcu_write_dr_u16(jtag_tap_t *tap, u16 *ir_in, u16 ir_out, int dr_len, int rti); -int mcu_write_ir_u32(jtag_tap_t *tap, u32 *ir_in, u32 ir_out, int ir_len, int rti); -int mcu_write_dr_u32(jtag_tap_t *tap, u32 *ir_in, u32 ir_out, int dr_len, int rti); -int mcu_execute_queue(void); - -target_type_t avr_target = -{ - .name = "avr", - - .poll = avr_poll, - .arch_state = avr_arch_state, - - .target_request_data = NULL, - - .halt = avr_halt, - .resume = avr_resume, - .step = avr_step, - - .assert_reset = avr_assert_reset, - .deassert_reset = avr_deassert_reset, - .soft_reset_halt = avr_soft_reset_halt, -/* - .get_gdb_reg_list = avr_get_gdb_reg_list, - - .read_memory = avr_read_memory, - .write_memory = avr_write_memory, - .bulk_write_memory = avr_bulk_write_memory, - .checksum_memory = avr_checksum_memory, - .blank_check_memory = avr_blank_check_memory, - - .run_algorithm = avr_run_algorithm, - - .add_breakpoint = avr_add_breakpoint, - .remove_breakpoint = avr_remove_breakpoint, - .add_watchpoint = avr_add_watchpoint, - .remove_watchpoint = avr_remove_watchpoint, -*/ - .register_commands = avr_register_commands, - .target_create = avr_target_create, - .init_target = avr_init_target, - .quit = avr_quit, -/* - .virt2phys = avr_virt2phys, - .mmu = avr_mmu -*/ -}; - -int avr_register_commands(struct command_context_s *cmd_ctx) -{ - LOG_DEBUG(__FUNCTION__); - return ERROR_OK; -} - -int avr_target_create(struct target_s *target, Jim_Interp *interp) -{ - avr_common_t *avr = calloc(1, sizeof(avr_common_t)); - - avr->jtag_info.tap = target->tap; - target->arch_info = avr; - - return ERROR_OK; -} - -int avr_init_target(struct command_context_s *cmd_ctx, struct target_s *target) -{ - LOG_DEBUG(__FUNCTION__); - return ERROR_OK; -} - -int avr_quit(void) -{ - LOG_DEBUG(__FUNCTION__); - return ERROR_OK; -} - -int avr_arch_state(struct target_s *target) -{ - LOG_DEBUG(__FUNCTION__); - return ERROR_OK; -} - -int avr_poll(target_t *target) -{ - if ((target->state == TARGET_RUNNING) || (target->state == TARGET_DEBUG_RUNNING)) - { - target->state = TARGET_HALTED; - } - - LOG_DEBUG(__FUNCTION__); - return ERROR_OK; -} - -int avr_halt(target_t *target) -{ - LOG_DEBUG(__FUNCTION__); - return ERROR_OK; -} - -int avr_resume(struct target_s *target, int current, u32 address, int handle_breakpoints, int debug_execution) -{ - LOG_DEBUG(__FUNCTION__); - return ERROR_OK; -} - -int avr_step(struct target_s *target, int current, u32 address, int handle_breakpoints) -{ - LOG_DEBUG(__FUNCTION__); - return ERROR_OK; -} - -int avr_assert_reset(target_t *target) -{ - target->state = TARGET_RESET; - - LOG_DEBUG(__FUNCTION__); - return ERROR_OK; -} - -int avr_deassert_reset(target_t *target) -{ - target->state = TARGET_RUNNING; - - LOG_DEBUG(__FUNCTION__); - return ERROR_OK; -} - -int avr_soft_reset_halt(struct target_s *target) -{ - LOG_DEBUG(__FUNCTION__); - return ERROR_OK; -} - -int avr_jtag_senddat(jtag_tap_t *tap, u32* dr_in, u32 dr_out, int len) -{ - return mcu_write_dr_u32(tap, dr_in, dr_out, len, 1); -} - -int avr_jtag_sendinstr(jtag_tap_t *tap, u8 *ir_in, u8 ir_out) -{ - return mcu_write_ir_u8(tap, ir_in, ir_out, AVR_JTAG_INS_LEN, 1); -} - -/* IR and DR functions */ -int mcu_write_ir(jtag_tap_t *tap, u8 *ir_in, u8 *ir_out, int ir_len, int rti) -{ - if (NULL == tap) - { - LOG_ERROR("invalid tap"); - return ERROR_FAIL; - } - if (ir_len != tap->ir_length) - { - LOG_ERROR("invalid ir_len"); - return ERROR_FAIL; - } - - { - scan_field_t field[1]; - - field[0].tap = tap; - field[0].num_bits = tap->ir_length; - field[0].out_value = ir_out; - field[0].out_mask = NULL; - field[0].in_value = ir_in; - field[0].in_check_value = NULL; - field[0].in_check_mask = NULL; - field[0].in_handler = NULL; - field[0].in_handler_priv = NULL; - jtag_add_plain_ir_scan(sizeof(field) / sizeof(field[0]), field, TAP_IDLE); - } - - return ERROR_OK; -} - -int mcu_write_dr(jtag_tap_t *tap, u8 *dr_in, u8 *dr_out, int dr_len, int rti) -{ - if (NULL == tap) - { - LOG_ERROR("invalid tap"); - return ERROR_FAIL; - } - - { - scan_field_t field[1]; - - field[0].tap = tap; - field[0].num_bits = dr_len; - field[0].out_value = dr_out; - field[0].out_mask = NULL; - field[0].in_value = dr_in; - field[0].in_check_value = NULL; - field[0].in_check_mask = NULL; - field[0].in_handler = NULL; - field[0].in_handler_priv = NULL; - jtag_add_plain_dr_scan(sizeof(field) / sizeof(field[0]), field, TAP_IDLE); - } - - return ERROR_OK; -} - -int mcu_write_ir_u8(jtag_tap_t *tap, u8 *ir_in, u8 ir_out, int ir_len, int rti) -{ - if (ir_len > 8) - { - LOG_ERROR("ir_len overflow, maxium is 8"); - return ERROR_FAIL; - } - - mcu_write_ir(tap, ir_in, &ir_out, ir_len, rti); - - return ERROR_OK; -} - -int mcu_write_dr_u8(jtag_tap_t *tap, u8 *dr_in, u8 dr_out, int dr_len, int rti) -{ - if (dr_len > 8) - { - LOG_ERROR("dr_len overflow, maxium is 8"); - return ERROR_FAIL; - } - - mcu_write_dr(tap, dr_in, &dr_out, dr_len, rti); - - return ERROR_OK; -} - -int mcu_write_ir_u16(jtag_tap_t *tap, u16 *ir_in, u16 ir_out, int ir_len, int rti) -{ - if (ir_len > 16) - { - LOG_ERROR("ir_len overflow, maxium is 16"); - return ERROR_FAIL; - } - - mcu_write_ir(tap, (u8*)ir_in, (u8*)&ir_out, ir_len, rti); - - return ERROR_OK; -} - -int mcu_write_dr_u16(jtag_tap_t *tap, u16 *dr_in, u16 dr_out, int dr_len, int rti) -{ - if (dr_len > 16) - { - LOG_ERROR("dr_len overflow, maxium is 16"); - return ERROR_FAIL; - } - - mcu_write_dr(tap, (u8*)dr_in, (u8*)&dr_out, dr_len, rti); - - return ERROR_OK; -} - -int mcu_write_ir_u32(jtag_tap_t *tap, u32 *ir_in, u32 ir_out, int ir_len, int rti) -{ - if (ir_len > 32) - { - LOG_ERROR("ir_len overflow, maxium is 32"); - return ERROR_FAIL; - } - - mcu_write_ir(tap, (u8*)ir_in, (u8*)&ir_out, ir_len, rti); - - return ERROR_OK; -} - -int mcu_write_dr_u32(jtag_tap_t *tap, u32 *dr_in, u32 dr_out, int dr_len, int rti) -{ - if (dr_len > 32) - { - LOG_ERROR("dr_len overflow, maxium is 32"); - return ERROR_FAIL; - } - - mcu_write_dr(tap, (u8*)dr_in, (u8*)&dr_out, dr_len, rti); - - return ERROR_OK; -} - -int mcu_execute_queue(void) -{ - return jtag_execute_queue(); -} +/*************************************************************************** + * Copyright (C) 2009 by Simon Qian * + * Sim...@Si... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "replacements.h" + +#include "avrt.h" + +#include "register.h" +#include "target.h" +#include "log.h" +#include "jtag.h" +#include "binarybuffer.h" +#include "time_support.h" +#include "breakpoints.h" +#include "fileio.h" + +#include <stdlib.h> +#include <string.h> + +#include <sys/types.h> +#include <unistd.h> +#include <errno.h> + +#define AVR_JTAG_INS_LEN 4 + +/* cli handling */ +int avr_register_commands(struct command_context_s *cmd_ctx); + +/* forward declarations */ +int avr_target_create(struct target_s *target, Jim_Interp *interp); +int avr_init_target(struct command_context_s *cmd_ctx, struct target_s *target); +int avr_quit(void); + +int avr_arch_state(struct target_s *target); +int avr_poll(target_t *target); +int avr_halt(target_t *target); +int avr_resume(struct target_s *target, int current, u32 address, int handle_breakpoints, int debug_execution); +int avr_step(struct target_s *target, int current, u32 address, int handle_breakpoints); + +int avr_assert_reset(target_t *target); +int avr_deassert_reset(target_t *target); +int avr_soft_reset_halt(struct target_s *target); + +/* IR and DR functions */ +int avr_jtag_sendinstr(jtag_tap_t *tap, u8 *ir_in, u8 ir_out); +int avr_jtag_senddat(jtag_tap_t *tap, u32 *dr_in, u32 dr_out, int len); + +int mcu_write_ir(jtag_tap_t *tap, u8 *ir_in, u8 *ir_out, int ir_len, int rti); +int mcu_write_dr(jtag_tap_t *tap, u8 *dr_in, u8 *dr_out, int dr_len, int rti); +int mcu_write_ir_u8(jtag_tap_t *tap, u8 *ir_in, u8 ir_out, int ir_len, int rti); +int mcu_write_dr_u8(jtag_tap_t *tap, u8 *ir_in, u8 ir_out, int dr_len, int rti); +int mcu_write_ir_u16(jtag_tap_t *tap, u16 *ir_in, u16 ir_out, int ir_len, int rti); +int mcu_write_dr_u16(jtag_tap_t *tap, u16 *ir_in, u16 ir_out, int dr_len, int rti); +int mcu_write_ir_u32(jtag_tap_t *tap, u32 *ir_in, u32 ir_out, int ir_len, int rti); +int mcu_write_dr_u32(jtag_tap_t *tap, u32 *ir_in, u32 ir_out, int dr_len, int rti); +int mcu_execute_queue(void); + +target_type_t avr_target = +{ + .name = "avr", + + .poll = avr_poll, + .arch_state = avr_arch_state, + + .target_request_data = NULL, + + .halt = avr_halt, + .resume = avr_resume, + .step = avr_step, + + .assert_reset = avr_assert_reset, + .deassert_reset = avr_deassert_reset, + .soft_reset_halt = avr_soft_reset_halt, +/* + .get_gdb_reg_list = avr_get_gdb_reg_list, + + .read_memory = avr_read_memory, + .write_memory = avr_write_memory, + .bulk_write_memory = avr_bulk_write_memory, + .checksum_memory = avr_checksum_memory, + .blank_check_memory = avr_blank_check_memory, + + .run_algorithm = avr_run_algorithm, + + .add_breakpoint = avr_add_breakpoint, + .remove_breakpoint = avr_remove_breakpoint, + .add_watchpoint = avr_add_watchpoint, + .remove_watchpoint = avr_remove_watchpoint, +*/ + .register_commands = avr_register_commands, + .target_create = avr_target_create, + .init_target = avr_init_target, + .quit = avr_quit, +/* + .virt2phys = avr_virt2phys, + .mmu = avr_mmu +*/ +}; + +int avr_register_commands(struct command_context_s *cmd_ctx) +{ + LOG_DEBUG(__FUNCTION__); + return ERROR_OK; +} + +int avr_target_create(struct target_s *target, Jim_Interp *interp) +{ + avr_common_t *avr = calloc(1, sizeof(avr_common_t)); + + avr->jtag_info.tap = target->tap; + target->arch_info = avr; + + return ERROR_OK; +} + +int avr_init_target(struct command_context_s *cmd_ctx, struct target_s *target) +{ + LOG_DEBUG(__FUNCTION__); + return ERROR_OK; +} + +int avr_quit(void) +{ + LOG_DEBUG(__FUNCTION__); + return ERROR_OK; +} + +int avr_arch_state(struct target_s *target) +{ + LOG_DEBUG(__FUNCTION__); + return ERROR_OK; +} + +int avr_poll(target_t *target) +{ + if ((target->state == TARGET_RUNNING) || (target->state == TARGET_DEBUG_RUNNING)) + { + target->state = TARGET_HALTED; + } + + LOG_DEBUG(__FUNCTION__); + return ERROR_OK; +} + +int avr_halt(target_t *target) +{ + LOG_DEBUG(__FUNCTION__); + return ERROR_OK; +} + +int avr_resume(struct target_s *target, int current, u32 address, int handle_breakpoints, int debug_execution) +{ + LOG_DEBUG(__FUNCTION__); + return ERROR_OK; +} + +int avr_step(struct target_s *target, int current, u32 address, int handle_breakpoints) +{ + LOG_DEBUG(__FUNCTION__); + return ERROR_OK; +} + +int avr_assert_reset(target_t *target) +{ + target->state = TARGET_RESET; + + LOG_DEBUG(__FUNCTION__); + return ERROR_OK; +} + +int avr_deassert_reset(target_t *target) +{ + target->state = TARGET_RUNNING; + + LOG_DEBUG(__FUNCTION__); + return ERROR_OK; +} + +int avr_soft_reset_halt(struct target_s *target) +{ + LOG_DEBUG(__FUNCTION__); + return ERROR_OK; +} + +int avr_jtag_senddat(jtag_tap_t *tap, u32* dr_in, u32 dr_out, int len) +{ + return mcu_write_dr_u32(tap, dr_in, dr_out, len, 1); +} + +int avr_jtag_sendinstr(jtag_tap_t *tap, u8 *ir_in, u8 ir_out) +{ + return mcu_write_ir_u8(tap, ir_in, ir_out, AVR_JTAG_INS_LEN, 1); +} + +/* IR and DR functions */ +int mcu_write_ir(jtag_tap_t *tap, u8 *ir_in, u8 *ir_out, int ir_len, int rti) +{ + if (NULL == tap) + { + LOG_ERROR("invalid tap"); + return ERROR_FAIL; + } + if (ir_len != tap->ir_length) + { + LOG_ERROR("invalid ir_len"); + return ERROR_FAIL; + } + + { + scan_field_t field[1]; + + field[0].tap = tap; + field[0].num_bits = tap->ir_length; + field[0].out_value = ir_out; + field[0].out_mask = NULL; + field[0].in_value = ir_in; + field[0].in_check_value = NULL; + field[0].in_check_mask = NULL; + field[0].in_handler = NULL; + field[0].in_handler_priv = NULL; + jtag_add_plain_ir_scan(sizeof(field) / sizeof(field[0]), field, TAP_IDLE); + } + + return ERROR_OK; +} + +int mcu_write_dr(jtag_tap_t *tap, u8 *dr_in, u8 *dr_out, int dr_len, int rti) +{ + if (NULL == tap) + { + LOG_ERROR("invalid tap"); + return ERROR_FAIL; + } + + { + scan_field_t field[1]; + + field[0].tap = tap; + field[0].num_bits = dr_len; + field[0].out_value = dr_out; + field[0].out_mask = NULL; + field[0].in_value = dr_in; + field[0].in_check_value = NULL; + field[0].in_check_mask = NULL; + field[0].in_handler = NULL; + field[0].in_handler_priv = NULL; + jtag_add_plain_dr_scan(sizeof(field) / sizeof(field[0]), field, TAP_IDLE); + } + + return ERROR_OK; +} + +int mcu_write_ir_u8(jtag_tap_t *tap, u8 *ir_in, u8 ir_out, int ir_len, int rti) +{ + if (ir_len > 8) + { + LOG_ERROR("ir_len overflow, maxium is 8"); + return ERROR_FAIL; + } + + mcu_write_ir(tap, ir_in, &ir_out, ir_len, rti); + + return ERROR_OK; +} + +int mcu_write_dr_u8(jtag_tap_t *tap, u8 *dr_in, u8 dr_out, int dr_len, int rti) +{ + if (dr_len > 8) + { + LOG_ERROR("dr_len overflow, maxium is 8"); + return ERROR_FAIL; + } + + mcu_write_dr(tap, dr_in, &dr_out, dr_len, rti); + + return ERROR_OK; +} + +int mcu_write_ir_u16(jtag_tap_t *tap, u16 *ir_in, u16 ir_out, int ir_len, int rti) +{ + if (ir_len > 16) + { + LOG_ERROR("ir_len overflow, maxium is 16"); + return ERROR_FAIL; + } + + mcu_write_ir(tap, (u8*)ir_in, (u8*)&ir_out, ir_len, rti); + + return ERROR_OK; +} + +int mcu_write_dr_u16(jtag_tap_t *tap, u16 *dr_in, u16 dr_out, int dr_len, int rti) +{ + if (dr_len > 16) + { + LOG_ERROR("dr_len overflow, maxium is 16"); + return ERROR_FAIL; + } + + mcu_write_dr(tap, (u8*)dr_in, (u8*)&dr_out, dr_len, rti); + + return ERROR_OK; +} + +int mcu_write_ir_u32(jtag_tap_t *tap, u32 *ir_in, u32 ir_out, int ir_len, int rti) +{ + if (ir_len > 32) + { + LOG_ERROR("ir_len overflow, maxium is 32"); + return ERROR_FAIL; + } + + mcu_write_ir(tap, (u8*)ir_in, (u8*)&ir_out, ir_len, rti); + + return ERROR_OK; +} + +int mcu_write_dr_u32(jtag_tap_t *tap, u32 *dr_in, u32 dr_out, int dr_len, int rti) +{ + if (dr_len > 32) + { + LOG_ERROR("dr_len overflow, maxium is 32"); + return ERROR_FAIL; + } + + mcu_write_dr(tap, (u8*)dr_in, (u8*)&dr_out, dr_len, rti); + + return ERROR_OK; +} + +int mcu_execute_queue(void) +{ + return jtag_execute_queue(); +} Property changes on: trunk/src/target/avrt.c ___________________________________________________________________ Name: svn:eol-style + native Modified: trunk/src/target/avrt.h =================================================================== --- trunk/src/target/avrt.h 2009-04-27 16:08:25 UTC (rev 1547) +++ trunk/src/target/avrt.h 2009-04-27 19:35:31 UTC (rev 1548) @@ -1,33 +1,33 @@ -/*************************************************************************** - * Copyright (C) 2009 by Simon Qian * - * Sim...@Si... * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifndef AVRT_H -#define AVRT_H - -typedef struct mcu_jtag_s -{ - jtag_tap_t *tap; -} mcu_jtag_t; - -typedef struct avr_common_s -{ - mcu_jtag_t jtag_info; -} avr_common_t; - -#endif /* AVRT_H */ +/*************************************************************************** + * Copyright (C) 2009 by Simon Qian * + * Sim...@Si... * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef AVRT_H +#define AVRT_H + +typedef struct mcu_jtag_s +{ + jtag_tap_t *tap; +} mcu_jtag_t; + +typedef struct avr_common_s +{ + mcu_jtag_t jtag_info; +} avr_common_t; + +#endif /* AVRT_H */ Property changes on: trunk/src/target/avrt.h ___________________________________________________________________ Name: svn:eol-style + native |
From: <ml...@ma...> - 2009-04-27 18:08:26
|
Author: mlu Date: 2009-04-27 18:08:25 +0200 (Mon, 27 Apr 2009) New Revision: 1547 Modified: trunk/src/target/arm_adi_v5.h trunk/src/target/armv7m.c Log: Added dap baseaddr and dap apid commands Modified: trunk/src/target/arm_adi_v5.h =================================================================== --- trunk/src/target/arm_adi_v5.h 2009-04-27 16:03:39 UTC (rev 1546) +++ trunk/src/target/arm_adi_v5.h 2009-04-27 16:08:25 UTC (rev 1547) @@ -136,7 +136,9 @@ extern int dap_info_command(struct command_context_s *cmd_ctx, swjdp_common_t *swjdp, int apsel); /* Commands for user dap access */ +/* Currently implemented in armv7m, needs armv7m target structure to find jtag and swjdp structures */ extern int handle_dap_info_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); extern int handle_dap_apsel_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); - +extern int handle_dap_apid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); +extern int handle_dap_baseaddr_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); #endif Modified: trunk/src/target/armv7m.c =================================================================== --- trunk/src/target/armv7m.c 2009-04-27 16:03:39 UTC (rev 1546) +++ trunk/src/target/armv7m.c 2009-04-27 16:08:25 UTC (rev 1547) @@ -372,7 +372,7 @@ for (i = 0; i < num_reg_params; i++) { reg_t *reg = register_get_by_name(armv7m->core_cache, reg_params[i].reg_name, 0); - u32 regvalue; +// u32 regvalue; if (!reg) { @@ -386,7 +386,7 @@ exit(-1); } - regvalue = buf_get_u32(reg_params[i].value, 0, 32); +// regvalue = buf_get_u32(reg_params[i].value, 0, 32); armv7m_set_core_reg(reg, reg_params[i].value); } @@ -553,8 +553,10 @@ command_t *arm_adi_v5_dap_cmd; arm_adi_v5_dap_cmd = register_command(cmd_ctx, NULL, "dap", NULL, COMMAND_ANY, "cortex dap specific commands"); - register_command(cmd_ctx, arm_adi_v5_dap_cmd, "info", handle_dap_info_command, COMMAND_EXEC, "dap info for ap [num] (default 0)"); + register_command(cmd_ctx, arm_adi_v5_dap_cmd, "info", handle_dap_info_command, COMMAND_EXEC, "dap info for ap [num], default currently selected AP"); register_command(cmd_ctx, arm_adi_v5_dap_cmd, "apsel", handle_dap_apsel_command, COMMAND_EXEC, "select a different AP [num] (default 0)"); + register_command(cmd_ctx, arm_adi_v5_dap_cmd, "apid", handle_dap_apid_command, COMMAND_EXEC, "return id reg from AP [num], default currently selected AP"); + register_command(cmd_ctx, arm_adi_v5_dap_cmd, "baseaddr", handle_dap_baseaddr_command, COMMAND_EXEC, "return debug base address from AP [num], default currently selected AP"); return ERROR_OK; } @@ -702,6 +704,75 @@ return ERROR_OK; } +/******************************************************************************************************************** +* Return the debug ap baseaddress in hexadecimal, no extra output to simplify script processing +*********************************************************************************************************************/ +int handle_dap_baseaddr_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +{ + target_t *target = get_current_target(cmd_ctx); + armv7m_common_t *armv7m = target->arch_info; + swjdp_common_t *swjdp = &armv7m->swjdp_info; + u32 apsel, apselsave, baseaddr; + int retval; + + apsel = swjdp->apsel; + apselsave = swjdp->apsel; + if (argc > 0) + { + apsel = strtoul(args[0], NULL, 0); + } + if (apselsave != apsel) + { + dap_ap_select(swjdp, apsel); + } + + dap_ap_read_reg_u32(swjdp, 0xF8, &baseaddr); + retval = swjdp_transaction_endcheck(swjdp); + command_print(cmd_ctx, "0x%8.8x", baseaddr); + + if (apselsave != apsel) + { + dap_ap_select(swjdp, apselsave); + } + + return retval; +} + + +/******************************************************************************************************************** +* Return the debug ap id in hexadecimal, no extra output to simplify script processing +*********************************************************************************************************************/ +extern int handle_dap_apid_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +{ + target_t *target = get_current_target(cmd_ctx); + armv7m_common_t *armv7m = target->arch_info; + swjdp_common_t *swjdp = &armv7m->swjdp_info; + u32 apsel, apselsave, apid; + int retval; + + apsel = swjdp->apsel; + apselsave = swjdp->apsel; + if (argc > 0) + { + apsel = strtoul(args[0], NULL, 0); + } + + if (apselsave != apsel) + { + dap_ap_select(swjdp, apsel); + } + + dap_ap_read_reg_u32(swjdp, 0xFC, &apid); + retval = swjdp_transaction_endcheck(swjdp); + command_print(cmd_ctx, "0x%8.8x", apid); + if (apselsave != apsel) + { + dap_ap_select(swjdp, apselsave); + } + + return retval; +} + int handle_dap_apsel_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target = get_current_target(cmd_ctx); @@ -732,7 +803,7 @@ int retval; u32 apsel; - apsel = 0; + apsel = swjdp->apsel; if (argc > 0) { apsel = strtoul(args[0], NULL, 0); |
From: <oh...@ma...> - 2009-04-27 18:03:41
|
Author: oharboe Date: 2009-04-27 18:03:39 +0200 (Mon, 27 Apr 2009) New Revision: 1546 Modified: trunk/src/jtag/jtag.h Log: Dick Hollenbeck <di...@so...> Collect some macros, add DIM() Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-04-27 13:00:29 UTC (rev 1545) +++ trunk/src/jtag/jtag.h 2009-04-27 16:03:39 UTC (rev 1546) @@ -40,7 +40,18 @@ #define DEBUG_JTAG_IOZ 64 #endif +/*-----<Macros>--------------------------------------------------*/ +/** When given an array, compute its DIMension, i.e. number of elements in the array */ +#define DIM(x) (sizeof(x)/sizeof((x)[0])) + +/** Calculate the number of bytes required to hold @a n TAP scan bits */ +#define TAP_SCAN_BYTES(n) CEIL(n, 8) + +/*-----</Macros>-------------------------------------------------*/ + + + /* * Tap states from ARM7TDMI-S Technical reference manual. * Also, validated against several other ARM core technical manuals. @@ -236,9 +247,6 @@ struct scan_field_s; typedef int (*in_handler_t)(u8* in_value, void* priv, struct scan_field_s* field); -/// @brief calculates number of bytes required to hold @a n TAP scan bits -#define TAP_SCAN_BYTES(n) CEIL(n, 8) - typedef struct scan_field_s { jtag_tap_t* tap; /* tap pointer this instruction refers to */ |
From: oharboe at B. <oh...@ma...> - 2009-04-27 15:00:30
|
Author: oharboe Date: 2009-04-27 15:00:29 +0200 (Mon, 27 Apr 2009) New Revision: 1545 Modified: trunk/src/jtag/vsllink.c Log: SimonQian <sim...@si...> patch for error compiling vsllink if --enable-verbose-jtag-io is set Modified: trunk/src/jtag/vsllink.c =================================================================== --- trunk/src/jtag/vsllink.c 2009-04-27 12:12:44 UTC (rev 1544) +++ trunk/src/jtag/vsllink.c 2009-04-27 13:00:29 UTC (rev 1545) @@ -242,7 +242,7 @@ static int vsllink_usb_write(vsllink_jtag_t *vsllink_jtag, int out_length); static int vsllink_usb_read(vsllink_jtag_t *vsllink_jtag); -#ifdef _DEBUG_USB_COMMS_ +#if defined _DEBUG_USB_COMMS_ || defined _DEBUG_JTAG_IO_ static void vsllink_debug_buffer(u8 *buffer, int length); #endif @@ -1243,7 +1243,7 @@ // which is merged from the last tms shift command vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = VSLLINK_CMDJTAGSEQ_SCAN | 1; vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = ((tdi_len + 1) >> 0) & 0xff; - vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = ((tdi_len + 1)>> 8) & 0xff; + vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = ((tdi_len + 1) >> 8) & 0xff; vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = tms_tmp; vsllink_usb_out_buffer[vsllink_usb_out_buffer_idx++] = buffer[0] << (8 - vsllink_tms_data_len); @@ -1917,7 +1917,7 @@ #define BYTES_PER_LINE 16 -#ifdef _DEBUG_USB_COMMS_ +#if defined _DEBUG_USB_COMMS_ || defined _DEBUG_JTAG_IO_ static void vsllink_debug_buffer(u8 *buffer, int length) { char line[81]; @@ -1936,4 +1936,4 @@ LOG_DEBUG("%s", line); } } -#endif // _DEBUG_USB_COMMS_ +#endif // _DEBUG_USB_COMMS_ || _DEBUG_JTAG_IO_ |
From: oharboe at B. <oh...@ma...> - 2009-04-27 14:12:45
|
Author: oharboe Date: 2009-04-27 14:12:44 +0200 (Mon, 27 Apr 2009) New Revision: 1544 Modified: trunk/src/target/arm11.c Log: clean up debug/info output to be in line with other targets Modified: trunk/src/target/arm11.c =================================================================== --- trunk/src/target/arm11.c 2009-04-27 12:02:07 UTC (rev 1543) +++ trunk/src/target/arm11.c 2009-04-27 12:12:44 UTC (rev 1544) @@ -525,24 +525,30 @@ void arm11_dump_reg_changes(arm11_common_t * arm11) { + + if (!(debug_level >= LOG_LVL_DEBUG)) + { + return; + } + {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); + LOG_DEBUG("%8s INVALID (%08x)", arm11_reg_defs[i].name, arm11->reg_history[i].value); } else { 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); + LOG_DEBUG("%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]); + LOG_DEBUG("%8s %08x (INVALID)", arm11_reg_defs[i].name, arm11->reg_values[i]); } } }} @@ -712,8 +718,13 @@ /* architecture specific status reply */ int arm11_arch_state(struct target_s *target) { - FNC_INFO_NOTIMPLEMENTED; + arm11_common_t * arm11 = target->arch_info; + LOG_USER("target halted due to %s\ncpsr: 0x%8.8x pc: 0x%8.8x", + Jim_Nvp_value2name_simple( nvp_target_debug_reason, target->debug_reason )->name, + R(CPSR), + R(PC)); + return ERROR_OK; } @@ -814,7 +825,7 @@ if (!current) R(PC) = address; - LOG_INFO("RESUME PC %08x%s", R(PC), !current ? "!" : ""); + LOG_DEBUG("RESUME PC %08x%s", R(PC), !current ? "!" : ""); /* clear breakpoints/watchpoints and VCR*/ arm11_sc7_clear_vbw(arm11); |