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
(16) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <zw...@ma...> - 2009-06-17 02:31:04
|
Author: zwelch Date: 2009-06-17 02:30:52 +0200 (Wed, 17 Jun 2009) New Revision: 2259 Modified: trunk/src/helper/command.c trunk/src/helper/command.h Log: Change parse_type macros to be sed-friendly. Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2009-06-17 00:30:44 UTC (rev 2258) +++ trunk/src/helper/command.c 2009-06-17 00:30:52 UTC (rev 2259) @@ -884,7 +884,7 @@ DEFINE_PARSE_NUM_TYPE(_llong, long long, strtoll, LLONG_MIN, LLONG_MAX) #define DEFINE_PARSE_WRAPPER(name, type, min, max, functype, funcname) \ - int parse_##name(const char *str, type *ul) \ + int parse##name(const char *str, type *ul) \ { \ functype n; \ int retval = parse##funcname(str, &n); \ @@ -900,14 +900,14 @@ #define DEFINE_PARSE_ULONG(name, type, min, max) \ DEFINE_PARSE_WRAPPER(name, type, min, max, unsigned long, _ulong) -DEFINE_PARSE_ULONG(uint, unsigned, 0, UINT_MAX) -DEFINE_PARSE_ULONG(u32, uint32_t, 0, UINT32_MAX) -DEFINE_PARSE_ULONG(u16, uint16_t, 0, UINT16_MAX) -DEFINE_PARSE_ULONG(u8, uint8_t, 0, UINT8_MAX) +DEFINE_PARSE_ULONG(_uint, unsigned, 0, UINT_MAX) +DEFINE_PARSE_ULONG(_u32, uint32_t, 0, UINT32_MAX) +DEFINE_PARSE_ULONG(_u16, uint16_t, 0, UINT16_MAX) +DEFINE_PARSE_ULONG(_u8, uint8_t, 0, UINT8_MAX) #define DEFINE_PARSE_LONG(name, type, min, max) \ DEFINE_PARSE_WRAPPER(name, type, min, max, long, _long) -DEFINE_PARSE_LONG(int, int, n < INT_MIN, INT_MAX) -DEFINE_PARSE_LONG(s32, int32_t, n < INT32_MIN, INT32_MAX) -DEFINE_PARSE_LONG(s16, int16_t, n < INT16_MIN, INT16_MAX) -DEFINE_PARSE_LONG(s8, int8_t, n < INT8_MIN, INT8_MAX) +DEFINE_PARSE_LONG(_int, int, n < INT_MIN, INT_MAX) +DEFINE_PARSE_LONG(_s32, int32_t, n < INT32_MIN, INT32_MAX) +DEFINE_PARSE_LONG(_s16, int16_t, n < INT16_MIN, INT16_MAX) +DEFINE_PARSE_LONG(_s8, int8_t, n < INT8_MIN, INT8_MAX) Modified: trunk/src/helper/command.h =================================================================== --- trunk/src/helper/command.h 2009-06-17 00:30:44 UTC (rev 2258) +++ trunk/src/helper/command.h 2009-06-17 00:30:52 UTC (rev 2259) @@ -117,17 +117,17 @@ int parse_llong(const char *str, long long *ul); #define DECLARE_PARSE_WRAPPER(name, type) \ - int parse_##name(const char *str, type *ul) + int parse##name(const char *str, type *ul) -DECLARE_PARSE_WRAPPER(uint, unsigned); -DECLARE_PARSE_WRAPPER(u32, uint32_t); -DECLARE_PARSE_WRAPPER(u16, uint16_t); -DECLARE_PARSE_WRAPPER(u8, uint8_t); +DECLARE_PARSE_WRAPPER(_uint, unsigned); +DECLARE_PARSE_WRAPPER(_u32, uint32_t); +DECLARE_PARSE_WRAPPER(_u16, uint16_t); +DECLARE_PARSE_WRAPPER(_u8, uint8_t); -DECLARE_PARSE_WRAPPER(int, int); -DECLARE_PARSE_WRAPPER(s32, int32_t); -DECLARE_PARSE_WRAPPER(s16, int16_t); -DECLARE_PARSE_WRAPPER(s8, int8_t); +DECLARE_PARSE_WRAPPER(_int, int); +DECLARE_PARSE_WRAPPER(_s32, int32_t); +DECLARE_PARSE_WRAPPER(_s16, int16_t); +DECLARE_PARSE_WRAPPER(_s8, int8_t); void script_debug(Jim_Interp *interp, const char *cmd, int argc, Jim_Obj *const *argv); |
From: <zw...@ma...> - 2009-06-17 02:30:49
|
Author: zwelch Date: 2009-06-17 02:30:44 +0200 (Wed, 17 Jun 2009) New Revision: 2258 Modified: trunk/src/helper/command.c trunk/src/helper/command.h Log: Add argument parsing errors in command.h, use in parse_type routines. Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2009-06-17 00:30:36 UTC (rev 2257) +++ trunk/src/helper/command.c 2009-06-17 00:30:44 UTC (rev 2258) @@ -867,13 +867,15 @@ int parse##name(const char *str, type *ul) \ { \ if (!*str) \ - return ERROR_COMMAND_SYNTAX_ERROR; \ + return ERROR_COMMAND_ARGUMENT_INVALID; \ char *end; \ *ul = func(str, &end, 0); \ if (*end) \ - return ERROR_COMMAND_SYNTAX_ERROR; \ - if (*ul == max || (min && min == *ul)) \ - return ERROR_COMMAND_SYNTAX_ERROR; \ + return ERROR_COMMAND_ARGUMENT_INVALID; \ + if (*ul == max) \ + return ERROR_COMMAND_ARGUMENT_OVERFLOW; \ + if (min && min == *ul) \ + return ERROR_COMMAND_ARGUMENT_UNDERFLOW; \ return ERROR_OK; \ } DEFINE_PARSE_NUM_TYPE(_ulong, unsigned long , strtoul, 0, ULONG_MAX) @@ -889,9 +891,9 @@ if (ERROR_OK != retval) \ return retval; \ if (n > max) \ - return ERROR_COMMAND_SYNTAX_ERROR; \ + return ERROR_COMMAND_ARGUMENT_OVERFLOW; \ if (min) \ - return ERROR_COMMAND_SYNTAX_ERROR; \ + return ERROR_COMMAND_ARGUMENT_UNDERFLOW; \ *ul = n; \ return ERROR_OK; \ } Modified: trunk/src/helper/command.h =================================================================== --- trunk/src/helper/command.h 2009-06-17 00:30:36 UTC (rev 2257) +++ trunk/src/helper/command.h 2009-06-17 00:30:44 UTC (rev 2258) @@ -98,6 +98,9 @@ #define ERROR_COMMAND_CLOSE_CONNECTION (-600) #define ERROR_COMMAND_SYNTAX_ERROR (-601) #define ERROR_COMMAND_NOTFOUND (-602) +#define ERROR_COMMAND_ARGUMENT_INVALID (-603) +#define ERROR_COMMAND_ARGUMENT_OVERFLOW (-604) +#define ERROR_COMMAND_ARGUMENT_UNDERFLOW (-605) extern int fast_and_dangerous; |
From: <zw...@ma...> - 2009-06-17 02:30:43
|
Author: zwelch Date: 2009-06-17 02:30:36 +0200 (Wed, 17 Jun 2009) New Revision: 2257 Modified: trunk/src/helper/command.c trunk/src/helper/command.h Log: Move definition of parse_type helpers to command.c: - Add declarations in header file. - Improve wrapper implementations to check for underflow. Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2009-06-17 00:30:29 UTC (rev 2256) +++ trunk/src/helper/command.c 2009-06-17 00:30:36 UTC (rev 2257) @@ -880,3 +880,32 @@ DEFINE_PARSE_NUM_TYPE(_ullong, unsigned long long, strtoull, 0, ULLONG_MAX) DEFINE_PARSE_NUM_TYPE(_long, long , strtol, LONG_MIN, LONG_MAX) DEFINE_PARSE_NUM_TYPE(_llong, long long, strtoll, LLONG_MIN, LLONG_MAX) + +#define DEFINE_PARSE_WRAPPER(name, type, min, max, functype, funcname) \ + int parse_##name(const char *str, type *ul) \ + { \ + functype n; \ + int retval = parse##funcname(str, &n); \ + if (ERROR_OK != retval) \ + return retval; \ + if (n > max) \ + return ERROR_COMMAND_SYNTAX_ERROR; \ + if (min) \ + return ERROR_COMMAND_SYNTAX_ERROR; \ + *ul = n; \ + return ERROR_OK; \ + } + +#define DEFINE_PARSE_ULONG(name, type, min, max) \ + DEFINE_PARSE_WRAPPER(name, type, min, max, unsigned long, _ulong) +DEFINE_PARSE_ULONG(uint, unsigned, 0, UINT_MAX) +DEFINE_PARSE_ULONG(u32, uint32_t, 0, UINT32_MAX) +DEFINE_PARSE_ULONG(u16, uint16_t, 0, UINT16_MAX) +DEFINE_PARSE_ULONG(u8, uint8_t, 0, UINT8_MAX) + +#define DEFINE_PARSE_LONG(name, type, min, max) \ + DEFINE_PARSE_WRAPPER(name, type, min, max, long, _long) +DEFINE_PARSE_LONG(int, int, n < INT_MIN, INT_MAX) +DEFINE_PARSE_LONG(s32, int32_t, n < INT32_MIN, INT32_MAX) +DEFINE_PARSE_LONG(s16, int16_t, n < INT16_MIN, INT16_MAX) +DEFINE_PARSE_LONG(s8, int8_t, n < INT8_MIN, INT8_MAX) Modified: trunk/src/helper/command.h =================================================================== --- trunk/src/helper/command.h 2009-06-17 00:30:29 UTC (rev 2256) +++ trunk/src/helper/command.h 2009-06-17 00:30:36 UTC (rev 2257) @@ -113,28 +113,18 @@ int parse_long(const char *str, long *ul); int parse_llong(const char *str, long long *ul); -#define DEFINE_PARSE_NUM_WRAP(name, type, max, functype, funcname) \ - static inline int parse_##name(const char *str, type *ul) \ - { \ - functype n; \ - int retval = parse##funcname(str, &n); \ - *ul = n; \ - return n > (max) ? ERROR_COMMAND_SYNTAX_ERROR : retval; \ - } +#define DECLARE_PARSE_WRAPPER(name, type) \ + int parse_##name(const char *str, type *ul) -#define DEFINE_PARSE_ULONG(name, type, max) \ - DEFINE_PARSE_NUM_WRAP(name, type, max, unsigned long, _ulong) -DEFINE_PARSE_ULONG(uint, unsigned, UINT_MAX) -DEFINE_PARSE_ULONG(u32, uint32_t, UINT32_MAX) -DEFINE_PARSE_ULONG(u16, uint16_t, UINT16_MAX) -DEFINE_PARSE_ULONG(u8, uint8_t, UINT8_MAX) +DECLARE_PARSE_WRAPPER(uint, unsigned); +DECLARE_PARSE_WRAPPER(u32, uint32_t); +DECLARE_PARSE_WRAPPER(u16, uint16_t); +DECLARE_PARSE_WRAPPER(u8, uint8_t); -#define DEFINE_PARSE_LONG(name, type, max) \ - DEFINE_PARSE_NUM_WRAP(name, type, max, long, _long) -DEFINE_PARSE_LONG(int, int, INT_MAX) -DEFINE_PARSE_LONG(s32, int32_t, INT32_MAX) -DEFINE_PARSE_LONG(s16, int16_t, INT16_MAX) -DEFINE_PARSE_LONG(s8, int8_t, INT8_MAX) +DECLARE_PARSE_WRAPPER(int, int); +DECLARE_PARSE_WRAPPER(s32, int32_t); +DECLARE_PARSE_WRAPPER(s16, int16_t); +DECLARE_PARSE_WRAPPER(s8, int8_t); void script_debug(Jim_Interp *interp, const char *cmd, int argc, Jim_Obj *const *argv); |
From: <zw...@ma...> - 2009-06-17 02:30:33
|
Author: zwelch Date: 2009-06-17 02:30:29 +0200 (Wed, 17 Jun 2009) New Revision: 2256 Modified: trunk/src/helper/command.c Log: Convert core parse_type implementations to check for underflow errors. Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2009-06-17 00:30:20 UTC (rev 2255) +++ trunk/src/helper/command.c 2009-06-17 00:30:29 UTC (rev 2256) @@ -863,16 +863,20 @@ return 0; } -#define DEFINE_PARSE_NUM_TYPE(name, type, func, max) \ +#define DEFINE_PARSE_NUM_TYPE(name, type, func, min, max) \ int parse##name(const char *str, type *ul) \ { \ + if (!*str) \ + return ERROR_COMMAND_SYNTAX_ERROR; \ char *end; \ *ul = func(str, &end, 0); \ - bool is_okay = *str && !*end && (max != *ul); \ - return is_okay ? ERROR_OK : ERROR_COMMAND_SYNTAX_ERROR; \ + if (*end) \ + return ERROR_COMMAND_SYNTAX_ERROR; \ + if (*ul == max || (min && min == *ul)) \ + return ERROR_COMMAND_SYNTAX_ERROR; \ + return ERROR_OK; \ } -DEFINE_PARSE_NUM_TYPE(_ulong, unsigned long , strtoul, ULONG_MAX) -DEFINE_PARSE_NUM_TYPE(_ullong, unsigned long long, strtoull, ULLONG_MAX) -DEFINE_PARSE_NUM_TYPE(_long, long , strtol, LONG_MAX) -DEFINE_PARSE_NUM_TYPE(_llong, long long, strtoll, LLONG_MAX) - +DEFINE_PARSE_NUM_TYPE(_ulong, unsigned long , strtoul, 0, ULONG_MAX) +DEFINE_PARSE_NUM_TYPE(_ullong, unsigned long long, strtoull, 0, ULLONG_MAX) +DEFINE_PARSE_NUM_TYPE(_long, long , strtol, LONG_MIN, LONG_MAX) +DEFINE_PARSE_NUM_TYPE(_llong, long long, strtoll, LLONG_MIN, LLONG_MAX) |
From: <zw...@ma...> - 2009-06-17 02:30:27
|
Author: zwelch Date: 2009-06-17 02:30:20 +0200 (Wed, 17 Jun 2009) New Revision: 2255 Modified: trunk/src/helper/command.c trunk/src/helper/command.h Log: Add improved support for parsing signed integers. Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2009-06-17 00:30:11 UTC (rev 2254) +++ trunk/src/helper/command.c 2009-06-17 00:30:20 UTC (rev 2255) @@ -873,4 +873,6 @@ } DEFINE_PARSE_NUM_TYPE(_ulong, unsigned long , strtoul, ULONG_MAX) DEFINE_PARSE_NUM_TYPE(_ullong, unsigned long long, strtoull, ULLONG_MAX) +DEFINE_PARSE_NUM_TYPE(_long, long , strtol, LONG_MAX) +DEFINE_PARSE_NUM_TYPE(_llong, long long, strtoll, LLONG_MAX) Modified: trunk/src/helper/command.h =================================================================== --- trunk/src/helper/command.h 2009-06-17 00:30:11 UTC (rev 2254) +++ trunk/src/helper/command.h 2009-06-17 00:30:20 UTC (rev 2255) @@ -110,6 +110,9 @@ int parse_ulong(const char *str, unsigned long *ul); int parse_ullong(const char *str, unsigned long long *ul); +int parse_long(const char *str, long *ul); +int parse_llong(const char *str, long long *ul); + #define DEFINE_PARSE_NUM_WRAP(name, type, max, functype, funcname) \ static inline int parse_##name(const char *str, type *ul) \ { \ @@ -126,6 +129,13 @@ DEFINE_PARSE_ULONG(u16, uint16_t, UINT16_MAX) DEFINE_PARSE_ULONG(u8, uint8_t, UINT8_MAX) +#define DEFINE_PARSE_LONG(name, type, max) \ + DEFINE_PARSE_NUM_WRAP(name, type, max, long, _long) +DEFINE_PARSE_LONG(int, int, INT_MAX) +DEFINE_PARSE_LONG(s32, int32_t, INT32_MAX) +DEFINE_PARSE_LONG(s16, int16_t, INT16_MAX) +DEFINE_PARSE_LONG(s8, int8_t, INT8_MAX) + void script_debug(Jim_Interp *interp, const char *cmd, int argc, Jim_Obj *const *argv); #endif /* COMMAND_H */ |
From: <zw...@ma...> - 2009-06-17 02:30:17
|
Author: zwelch Date: 2009-06-17 02:30:11 +0200 (Wed, 17 Jun 2009) New Revision: 2254 Modified: trunk/src/helper/command.h Log: Update parse_type macro definitions to allow re-use with signed types. Modified: trunk/src/helper/command.h =================================================================== --- trunk/src/helper/command.h 2009-06-17 00:29:56 UTC (rev 2253) +++ trunk/src/helper/command.h 2009-06-17 00:30:11 UTC (rev 2254) @@ -110,14 +110,17 @@ int parse_ulong(const char *str, unsigned long *ul); int parse_ullong(const char *str, unsigned long long *ul); -#define DEFINE_PARSE_ULONG(name, type, max) \ +#define DEFINE_PARSE_NUM_WRAP(name, type, max, functype, funcname) \ static inline int parse_##name(const char *str, type *ul) \ { \ - unsigned long n; \ - int retval = parse_ulong(str, &n); \ + functype n; \ + int retval = parse##funcname(str, &n); \ *ul = n; \ return n > (max) ? ERROR_COMMAND_SYNTAX_ERROR : retval; \ } + +#define DEFINE_PARSE_ULONG(name, type, max) \ + DEFINE_PARSE_NUM_WRAP(name, type, max, unsigned long, _ulong) DEFINE_PARSE_ULONG(uint, unsigned, UINT_MAX) DEFINE_PARSE_ULONG(u32, uint32_t, UINT32_MAX) DEFINE_PARSE_ULONG(u16, uint16_t, UINT16_MAX) |
From: <zw...@ma...> - 2009-06-17 02:30:08
|
Author: zwelch Date: 2009-06-17 02:29:56 +0200 (Wed, 17 Jun 2009) New Revision: 2253 Modified: trunk/src/helper/command.c Log: Improve definitions of parse_ulong and parse_ullong: - Use macro to eliminate duplicate body definitions. - Rename okay as is_okay; add parenthesis to help "clarify" logic. Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2009-06-16 12:17:26 UTC (rev 2252) +++ trunk/src/helper/command.c 2009-06-17 00:29:56 UTC (rev 2253) @@ -863,17 +863,14 @@ return 0; } -int parse_ullong(const char *str, unsigned long long *ul) -{ - char *end; - *ul = strtoull(str, &end, 0); - bool okay = *str && !*end && ULLONG_MAX != *ul; - return okay ? ERROR_OK : ERROR_COMMAND_SYNTAX_ERROR; -} -int parse_ulong(const char *str, unsigned long *ul) -{ - char *end; - *ul = strtoul(str, &end, 0); - bool okay = *str && !*end && ULONG_MAX != *ul; - return okay ? ERROR_OK : ERROR_COMMAND_SYNTAX_ERROR; -} +#define DEFINE_PARSE_NUM_TYPE(name, type, func, max) \ + int parse##name(const char *str, type *ul) \ + { \ + char *end; \ + *ul = func(str, &end, 0); \ + bool is_okay = *str && !*end && (max != *ul); \ + return is_okay ? ERROR_OK : ERROR_COMMAND_SYNTAX_ERROR; \ + } +DEFINE_PARSE_NUM_TYPE(_ulong, unsigned long , strtoul, ULONG_MAX) +DEFINE_PARSE_NUM_TYPE(_ullong, unsigned long long, strtoull, ULLONG_MAX) + |
From: <zw...@ma...> - 2009-06-16 14:17:30
|
Author: zwelch Date: 2009-06-16 14:17:26 +0200 (Tue, 16 Jun 2009) New Revision: 2252 Modified: trunk/src/jtag/tcl.c Log: David Brownell <da...@pa...>: Fix a bug preventing ICEpick "enable that TAP" code from working: the "runtest" command wrongly finished with a JTAG reset, discarding the work the TAP enable handler just finished! Instead, JTAG should stay in RUN/IDLE state. Modified: trunk/src/jtag/tcl.c =================================================================== --- trunk/src/jtag/tcl.c 2009-06-16 12:17:18 UTC (rev 2251) +++ trunk/src/jtag/tcl.c 2009-06-16 12:17:26 UTC (rev 2252) @@ -1130,7 +1130,7 @@ if (ERROR_OK != retval) return retval; - jtag_add_runtest(num_clocks, jtag_get_end_state()); + jtag_add_runtest(num_clocks, TAP_IDLE); jtag_execute_queue(); return ERROR_OK; |
From: <zw...@ma...> - 2009-06-16 14:17:23
|
Author: zwelch Date: 2009-06-16 14:17:18 +0200 (Tue, 16 Jun 2009) New Revision: 2251 Modified: trunk/src/jtag/core.c trunk/src/jtag/jtag.h trunk/src/jtag/tcl.c trunk/src/target/target.c Log: David Brownell <da...@pa...>: Extend the internal JTAG event handlers to cover enable/disable, and use those events to make sure that targets get "examined" if they were disabled when the scan chain was first set up: - Remove "enum jtag_tap_event", merge with "enum jtag_event", so C code can now listen for TAP enable/disable events. - Report those events so they can trigger callbacks. - During startup, make target_examine() register a handler to catch ENABLE events for any then-disabled targets. This fixes bugs like "can't halt target after enabling its TAP". One class of unresolved bugs: if the target has an ETM hooked up to an ETB, nothing activates the ETB. But starting up the ETM without access to the ETB registers fails... Modified: trunk/src/jtag/core.c =================================================================== --- trunk/src/jtag/core.c 2009-06-16 12:17:12 UTC (rev 2250) +++ trunk/src/jtag/core.c 2009-06-16 12:17:18 UTC (rev 2251) @@ -61,6 +61,8 @@ static const char *jtag_event_strings[] = { [JTAG_TRST_ASSERTED] = "JTAG controller reset (RESET or TRST)", + [JTAG_TAP_EVENT_ENABLE] = "TAP enabled", + [JTAG_TAP_EVENT_DISABLE] = "TAP disabled", }; static int jtag_trst = 0; Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-16 12:17:12 UTC (rev 2250) +++ trunk/src/jtag/jtag.h 2009-06-16 12:17:18 UTC (rev 2251) @@ -201,19 +201,18 @@ * - SRST pulls TRST * - TRST asserted * - **/ + * TAP activation/deactivation is currently implemented outside the core + * using scripted code that understands the specific router type. + */ enum jtag_event { - JTAG_TRST_ASSERTED -}; - -enum jtag_tap_event { + JTAG_TRST_ASSERTED, JTAG_TAP_EVENT_ENABLE, - JTAG_TAP_EVENT_DISABLE + JTAG_TAP_EVENT_DISABLE, }; struct jtag_tap_event_action_s { - enum jtag_tap_event event; + enum jtag_event event; Jim_Obj* body; jtag_tap_event_action_t* next; }; Modified: trunk/src/jtag/tcl.c =================================================================== --- trunk/src/jtag/tcl.c 2009-06-16 12:17:12 UTC (rev 2250) +++ trunk/src/jtag/tcl.c 2009-06-16 12:17:18 UTC (rev 2251) @@ -256,7 +256,7 @@ jteap = tap->event_action; /* replace existing? */ while (jteap) { - if (jteap->event == (enum jtag_tap_event)n->value) { + if (jteap->event == (enum jtag_event)n->value) { break; } jteap = jteap->next; @@ -460,7 +460,7 @@ return JIM_ERR; } -static void jtag_tap_handle_event( jtag_tap_t * tap, enum jtag_tap_event e) +static void jtag_tap_handle_event(jtag_tap_t *tap, enum jtag_event e) { jtag_tap_event_action_t * jteap; int done; @@ -594,6 +594,8 @@ * - scan chain length grew by one (this) * - IDs and IR lengths are as expected */ + + jtag_call_event_callbacks(JTAG_TAP_EVENT_ENABLE); break; case JTAG_CMD_TAPDISABLE: if (!t->enabled) @@ -606,6 +608,8 @@ * - scan chain length shrank by one (this) * - IDs and IR lengths are as expected */ + + jtag_call_event_callbacks(JTAG_TAP_EVENT_DISABLE); break; } e = t->enabled; Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-16 12:17:12 UTC (rev 2250) +++ trunk/src/target/target.c 2009-06-16 12:17:18 UTC (rev 2251) @@ -478,6 +478,18 @@ return target->type->examine(target); } +static int jtag_enable_callback(enum jtag_event event, void *priv) +{ + target_t *target = priv; + + if (event != JTAG_TAP_EVENT_ENABLE || !target->tap->enabled) + return ERROR_OK; + + jtag_unregister_event_callback(jtag_enable_callback, target); + return target_examine_one(target); +} + + /* Targets that correctly implement init+examine, i.e. * no communication with target during init: * @@ -490,8 +502,12 @@ for (target = all_targets; target; target = target->next) { - if (!target->tap->enabled) + /* defer examination, but don't skip it */ + if (!target->tap->enabled) { + jtag_register_event_callback(jtag_enable_callback, + target); continue; + } if ((retval = target_examine_one(target)) != ERROR_OK) return retval; } |
From: <zw...@ma...> - 2009-06-16 14:17:18
|
Author: zwelch Date: 2009-06-16 14:17:12 +0200 (Tue, 16 Jun 2009) New Revision: 2250 Modified: trunk/src/jtag/tcl.c Log: David Brownell <da...@pa...>: Tighten error handling on TAP enable/disable paths a bit: - Don't enable/disable unless it's necessary. Those event handlers could have nasty side effects... - Don't *succeed* enables/disables if there was no code which could have implemented that action. This prevents bugs like wrongly acting as if the scan chain changed. - Minor whitespace cleanup in enable/disable command code. The big problem is still the lack of code to verify scan chains were actually updated as requested; this adds a comment on that. I suspect the best we can do near term will be to verify IDCODE. Modified: trunk/src/jtag/tcl.c =================================================================== --- trunk/src/jtag/tcl.c 2009-06-16 00:23:32 UTC (rev 2249) +++ trunk/src/jtag/tcl.c 2009-06-16 12:17:12 UTC (rev 2250) @@ -478,6 +478,12 @@ Jim_GetString(jteap->body, NULL) ); if (Jim_EvalObj(interp, jteap->body) != JIM_OK) { Jim_PrintErrorMessage(interp); + } else { + /* NOTE: we currently assume the handlers + * can't fail. That presumes later code + * will be verifying the scan chains ... + */ + tap->enabled = (e == JTAG_TAP_EVENT_ENABLE); } } @@ -569,26 +575,41 @@ { jtag_tap_t *t; - t = jtag_tap_by_jim_obj( goi.interp, goi.argv[0] ); - if( t == NULL ){ + + t = jtag_tap_by_jim_obj(goi.interp, goi.argv[0]); + if (t == NULL) return JIM_ERR; - } - switch( n->value ){ + + switch (n->value) { case JTAG_CMD_TAPISENABLED: - e = t->enabled; break; case JTAG_CMD_TAPENABLE: - jtag_tap_handle_event( t, JTAG_TAP_EVENT_ENABLE); - e = 1; - t->enabled = e; + if (t->enabled) + break; + jtag_tap_handle_event(t, JTAG_TAP_EVENT_ENABLE); + if (!t->enabled) + break; + + /* FIXME add JTAG sanity checks, w/o TLR + * - scan chain length grew by one (this) + * - IDs and IR lengths are as expected + */ break; case JTAG_CMD_TAPDISABLE: - jtag_tap_handle_event( t, JTAG_TAP_EVENT_DISABLE); - e = 0; - t->enabled = e; + if (!t->enabled) + break; + jtag_tap_handle_event(t, JTAG_TAP_EVENT_DISABLE); + if (t->enabled) + break; + + /* FIXME add JTAG sanity checks, w/o TLR + * - scan chain length shrank by one (this) + * - IDs and IR lengths are as expected + */ break; } - Jim_SetResult( goi.interp, Jim_NewIntObj( goi.interp, e ) ); + e = t->enabled; + Jim_SetResult(goi.interp, Jim_NewIntObj(goi.interp, e)); return JIM_OK; } break; |
From: <zw...@ma...> - 2009-06-16 02:23:38
|
Author: zwelch Date: 2009-06-16 02:23:32 +0200 (Tue, 16 Jun 2009) New Revision: 2249 Modified: trunk/src/jtag/tcl.c Log: David Brownell <da...@pa...>: Fix bug in a warning. It warned about "huge IRlength" for an older JRC with a two bit instruction register ... wrong! Modified: trunk/src/jtag/tcl.c =================================================================== --- trunk/src/jtag/tcl.c 2009-06-16 00:23:22 UTC (rev 2248) +++ trunk/src/jtag/tcl.c 2009-06-16 00:23:32 UTC (rev 2249) @@ -416,7 +416,7 @@ } switch(n->value){ case NTAP_OPT_IRLEN: - if (w < (jim_wide) sizeof(pTap->ir_capture_value)) + if (w > (jim_wide) (8 * sizeof(pTap->ir_capture_value))) LOG_WARNING("huge IR length %d", (int) w); pTap->ir_length = w; reqbits &= (~(NTREQ_IRLEN)); |
From: <zw...@ma...> - 2009-06-16 02:23:28
|
Author: zwelch Date: 2009-06-16 02:23:22 +0200 (Tue, 16 Jun 2009) New Revision: 2248 Modified: trunk/doc/openocd.texi Log: David Brownell <da...@pa...>: Distributing FTDI's "ftd2xx" library with OpenOCD violates the OpenOCD license (GNU GPLv2 with no exceptions). Make that clear where that build option is presented, and don't describe the FTDI libraries as an option for any packager. (It's fine for personal use, of course.) Plus some related clarifications: libftdi version 0.16 for the new FT2232H chips (for RTCK and high speed USB); the Amontec drivers are just ftd2xx variants. Modified: trunk/doc/openocd.texi =================================================================== --- trunk/doc/openocd.texi 2009-06-16 00:23:13 UTC (rev 2247) +++ trunk/doc/openocd.texi 2009-06-16 00:23:22 UTC (rev 2248) @@ -238,27 +238,11 @@ suggestions: @enumerate -@item @b{Send patches, including config files, upstream.} -@item @b{Always build with printer ports enabled.} -@item @b{Try to use LIBFTDI + LIBUSB where possible. You cover more bases.} +@item Send patches, including config files, upstream. +@item Always build with printer ports enabled. +@item Use libftdi + libusb for FT2232 support. @end enumerate -@itemize @bullet -@item @b{Why YES to LIBFTDI + LIBUSB?} -@itemize @bullet -@item @b{LESS} work - libusb perhaps already there -@item @b{LESS} work - identical code, multiple platforms -@item @b{MORE} dongles are supported -@item @b{MORE} platforms are supported -@item @b{MORE} complete solution -@end itemize -@item @b{Why not LIBFTDI + LIBUSB} (i.e.: ftd2xx instead)? -@itemize @bullet -@item @b{LESS} speed - some say it is slower -@item @b{LESS} complex to distribute (external dependencies) -@end itemize -@end itemize - @section Building From Source You can download the current SVN version with an SVN client of your choice from the @@ -297,16 +281,21 @@ @itemize @bullet @item @b{ftdi2232} libftdi (@uref{http://www.intra2net.com/opensource/ftdi/}) -@item @b{ftd2xx} libftd2xx (@uref{http://www.ftdichip.com/Drivers/D2XX.htm}) -@item When using the Amontec JTAGkey, you have to get the drivers from the Amontec -homepage (@uref{http://www.amontec.com}). The JTAGkey uses a non-standard VID/PID. +@item @b{ftd2xx} libftd2xx (@uref{http://www.ftdichip.com/Drivers/D2XX.htm}), +or the Amontec version (from @uref{http://www.amontec.com}), +for easier support of JTAGkey's vendor and product IDs. @end itemize libftdi is supported under Windows. Do not use versions earlier than 0.14. +To use the newer FT2232H chips, supporting RTCK and USB high speed (480 Mbps), +you need libftdi version 0.16 or newer. -In general, the D2XX driver provides superior performance (several times as fast), -but has the draw-back of being binary-only - though that isn't that bad, as it isn't -a kernel module, only a user space library. +Some people say that FTDI's libftd2xx code provides better performance. +However, it is binary-only, while OpenOCD is licenced according +to GNU GPLv2 without any exceptions. +That means that @emph{distributing} copies of OpenOCD built with +the FTDI code would violate the OpenOCD licensing terms. +You may, however, build such copies for personal use. To build OpenOCD (on both Linux and Cygwin), use the following commands: @@ -354,9 +343,12 @@ @item @option{--enable-gw16012} - Enable building support for the Gateworks GW16012 JTAG programmer. @item -@option{--enable-ft2232_ftd2xx} - Numerous USB type ARM JTAG dongles use the FT2232C chip from this FTDICHIP.COM chip (closed source). +@option{--enable-ft2232_ftd2xx} - Support FT2232-family chips using +the closed-source library from FTDICHIP.COM +(result not for re-distribution). @item -@option{--enable-ft2232_libftdi} - An open source (free) alternative to FTDICHIP.COM ftd2xx solution (Linux, MacOS, Cygwin). +@option{--enable-ft2232_libftdi} - Support FT2232-family chips using +a GPL'd ft2232 support library (result OK for re-distribution). @item @option{--with-ftd2xx-win32-zipdir=PATH} - If using FTDICHIP.COM ft2232c driver, give the directory where the Win32 FTDICHIP.COM 'CDM' driver zip file was unpacked. @@ -399,7 +391,10 @@ There are 2 methods of using the FTD2232, either (1) using the FTDICHIP.COM closed source driver, or (2) the open (and free) driver -libftdi. Some claim the (closed) FTDICHIP.COM solution is faster. +libftdi. Some claim the (closed) FTDICHIP.COM solution is faster, +which is the motivation for supporting it even though its licensing +restricts it to non-redistributable OpenOCD binaries, and it is +not available for all operating systems used with OpenOCD. The FTDICHIP drivers come as either a (win32) ZIP file, or a (Linux) TAR.GZ file. You must unpack them ``some where'' convient. As of this |
From: <zw...@ma...> - 2009-06-16 02:23:19
|
Author: zwelch Date: 2009-06-16 02:23:13 +0200 (Tue, 16 Jun 2009) New Revision: 2247 Modified: trunk/src/target/target.c Log: David Brownell <da...@pa...>: Fix some polling issues: - Don't background-poll disabled TAPs ... this was just a bug waiting to happen. (And then it happened!) - Don't fail command line polls of disabled taps; that's not any kind of error, it's just that you can't do much. But do show that tap-disabled status. - Spell "continuous" correctly in the variable name. ;) Not resolved by this patch: the need for an interlock whereby other code (like the JTAG layer) can block all other access to the JTAG layer, e.g. while enabling or disabling TAPs. And that interlock needs to be timer-safe... Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-16 00:23:00 UTC (rev 2246) +++ trunk/src/target/target.c 2009-06-16 00:23:13 UTC (rev 2247) @@ -269,7 +269,7 @@ return x+1; } -static int target_continous_poll = 1; +static int target_continuous_poll = 1; /* read a u32 from a buffer in target memory endianness */ u32 target_buffer_get_u32(target_t *target, const u8 *buffer) @@ -436,13 +436,13 @@ * more predictable, i.e. dr/irscan & pathmove in events will * not have JTAG operations injected into the middle of a sequence. */ - int save_poll = target_continous_poll; - target_continous_poll = 0; + int save_poll = target_continuous_poll; + target_continuous_poll = 0; sprintf( buf, "ocd_process_reset %s", n->name ); retval = Jim_Eval( interp, buf ); - target_continous_poll = save_poll; + target_continuous_poll = save_poll; if(retval != JIM_OK) { Jim_PrintErrorMessage(interp); @@ -1650,20 +1650,23 @@ recursive = 0; } - target_t *target = all_targets; - - while (target) + /* Poll targets for state changes unless that's globally disabled. + * Skip targets that are currently disabled. + */ + for (target_t *target = all_targets; + target_continuous_poll && target; + target = target->next) { + if (!target->tap->enabled) + continue; /* only poll target if we've got power and srst isn't asserted */ - if (target_continous_poll&&!powerDropout&&!srstAsserted) + if (!powerDropout && !srstAsserted) { /* polling may fail silently until the target has been examined */ if((retval = target_poll(target)) != ERROR_OK) return retval; } - - target = target->next; } return retval; @@ -1791,7 +1794,12 @@ if (argc == 0) { command_print(cmd_ctx, "background polling: %s", - target_continous_poll ? "on" : "off"); + target_continuous_poll ? "on" : "off"); + command_print(cmd_ctx, "TAP: %s (%s)", + target->tap->dotted_name, + target->tap->enabled ? "enabled" : "disabled"); + if (!target->tap->enabled) + return ERROR_OK; if ((retval = target_poll(target)) != ERROR_OK) return retval; if ((retval = target_arch_state(target)) != ERROR_OK) @@ -1802,11 +1810,11 @@ { if (strcmp(args[0], "on") == 0) { - target_continous_poll = 1; + target_continuous_poll = 1; } else if (strcmp(args[0], "off") == 0) { - target_continous_poll = 0; + target_continuous_poll = 0; } else { |
From: <zw...@ma...> - 2009-06-16 02:23:12
|
Author: zwelch Date: 2009-06-16 02:23:00 +0200 (Tue, 16 Jun 2009) New Revision: 2246 Modified: trunk/doc/openocd.texi trunk/src/jtag/core.c trunk/src/jtag/jtag.h trunk/src/jtag/tcl.c Log: David Brownell <da...@pa...>: Doc update: say "jtag newtap ... -disable" records the state after exiting the RESET state, matching the only implementation we're working with so far (TI ICEpick-C). Matching code updates. Now we can be sure that the "enabled" flag value is correct after JTAG resets. Modified: trunk/doc/openocd.texi =================================================================== --- trunk/doc/openocd.texi 2009-06-16 00:22:52 UTC (rev 2245) +++ trunk/doc/openocd.texi 2009-06-16 00:23:00 UTC (rev 2246) @@ -2314,8 +2314,9 @@ @itemize @bullet @item @code{-disable} (or @code{-enable}) -@*Use the @code{-disable} paramater to flag a TAP which is not -linked in to the scan chain when it is declared. +@*Use the @code{-disable} parameter to flag a TAP which is not +linked in to the scan chain after a reset using either TRST +or the JTAG state machine's @sc{reset} state. You may use @code{-enable} to highlight the default state (the TAP is linked in). @xref{Enabling and Disabling TAPs}. @@ -5079,7 +5080,7 @@ @end itemize Note that only six of those states are fully ``stable'' in the -face of TMS fixed (usually low) +face of TMS fixed (low except for @sc{reset}) and a free-running JTAG clock. For all the others, the next TCK transition changes to a new state. Modified: trunk/src/jtag/core.c =================================================================== --- trunk/src/jtag/core.c 2009-06-16 00:22:52 UTC (rev 2245) +++ trunk/src/jtag/core.c 2009-06-16 00:23:00 UTC (rev 2246) @@ -792,6 +792,8 @@ if (event == JTAG_TRST_ASSERTED) { + tap->enabled = !tap->disabled_after_reset; + buf_set_ones(tap->cur_instr, tap->ir_length); tap->bypass = 1; } Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-16 00:22:52 UTC (rev 2245) +++ trunk/src/jtag/jtag.h 2009-06-16 00:23:00 UTC (rev 2246) @@ -151,8 +151,10 @@ const char* tapname; const char* dotted_name; int abs_chain_position; - /// Is this TAP enabled? - int enabled; + /// Is this TAP disabled after JTAG reset? + bool disabled_after_reset; + /// Is this TAP currently enabled? + bool enabled; int ir_length; /**< size of instruction register */ u32 ir_capture_value; u8* expected; /**< Capture-IR expected value */ Modified: trunk/src/jtag/tcl.c =================================================================== --- trunk/src/jtag/tcl.c 2009-06-16 00:22:52 UTC (rev 2245) +++ trunk/src/jtag/tcl.c 2009-06-16 00:23:00 UTC (rev 2246) @@ -359,9 +359,6 @@ LOG_DEBUG("Creating New Tap, Chip: %s, Tap: %s, Dotted: %s, %d params", pTap->chip, pTap->tapname, pTap->dotted_name, goi->argc); - /* default is enabled */ - pTap->enabled = 1; - /* deal with options */ #define NTREQ_IRLEN 1 #define NTREQ_IRCAPTURE 2 @@ -379,10 +376,10 @@ LOG_DEBUG("Processing option: %s", n->name ); switch( n->value ){ case NTAP_OPT_ENABLED: - pTap->enabled = 1; + pTap->disabled_after_reset = false; break; case NTAP_OPT_DISABLED: - pTap->enabled = 0; + pTap->disabled_after_reset = true; break; case NTAP_OPT_EXPECTED_ID: { @@ -446,6 +443,9 @@ } /* switch(n->value) */ } /* while( goi->argc ) */ + /* default is enabled-after-reset */ + pTap->enabled = !pTap->disabled_after_reset; + /* Did all the required option bits get cleared? */ if (0 == reqbits) { |
From: <zw...@ma...> - 2009-06-16 02:22:57
|
Author: zwelch Date: 2009-06-16 02:22:52 +0200 (Tue, 16 Jun 2009) New Revision: 2245 Modified: trunk/src/jtag/core.c trunk/src/jtag/jtag.h Log: David Brownell <da...@pa...>: Fix a memory leak in jtag_tap_free(): unregister the event callback too. Also fix the associated conceptual bug in unregistering JTAG event callbacks: since the same callback procedure is used many times with different callback data (a TAP handle), that data must be considered when unregistering any callback. This could fix some crashes after TAP registration errors, by making sure the reset event handler doesn't scribble over memory that's now used by something else. Modified: trunk/src/jtag/core.c =================================================================== --- trunk/src/jtag/core.c 2009-06-16 00:22:40 UTC (rev 2244) +++ trunk/src/jtag/core.c 2009-06-16 00:22:52 UTC (rev 2245) @@ -243,24 +243,30 @@ return ERROR_OK; } -int jtag_unregister_event_callback(jtag_event_handler_t callback) +int jtag_unregister_event_callback(jtag_event_handler_t callback, void *priv) { - jtag_event_callback_t **callbacks_p = &jtag_event_callbacks; + jtag_event_callback_t **callbacks_p; + jtag_event_callback_t **next; if (callback == NULL) { return ERROR_INVALID_ARGUMENTS; } - while (*callbacks_p) + for (callbacks_p = &jtag_event_callbacks; + *callbacks_p != NULL; + callbacks_p = next) { - jtag_event_callback_t **next = &((*callbacks_p)->next); + next = &((*callbacks_p)->next); + + if ((*callbacks_p)->priv != priv) + continue; + if ((*callbacks_p)->callback == callback) { free(*callbacks_p); *callbacks_p = *next; } - callbacks_p = next; } return ERROR_OK; @@ -1092,6 +1098,8 @@ void jtag_tap_free(jtag_tap_t *tap) { + jtag_unregister_event_callback(&jtag_reset_callback, tap); + /// @todo is anything missing? no memory leaks please free((void *)tap->expected_ids); free((void *)tap->chip); Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-16 00:22:40 UTC (rev 2244) +++ trunk/src/jtag/jtag.h 2009-06-16 00:22:52 UTC (rev 2245) @@ -230,7 +230,7 @@ typedef int (*jtag_event_handler_t)(enum jtag_event event, void* priv); extern int jtag_register_event_callback(jtag_event_handler_t f, void *x); -extern int jtag_unregister_event_callback(jtag_event_handler_t f); +extern int jtag_unregister_event_callback(jtag_event_handler_t f, void *x); extern int jtag_call_event_callbacks(enum jtag_event event); |
From: <zw...@ma...> - 2009-06-16 02:22:49
|
Author: zwelch Date: 2009-06-16 02:22:40 +0200 (Tue, 16 Jun 2009) New Revision: 2244 Modified: trunk/src/jtag/core.c trunk/src/jtag/jtag.h trunk/src/jtag/tcl.c Log: David Brownell <da...@pa...>: Minor jtag cleanup: - remove hidden assumption about JTAG event numbering - move function declarations to a header - some end'o'line whitespace - use "calloc" not "malloc + memset" Modified: trunk/src/jtag/core.c =================================================================== --- trunk/src/jtag/core.c 2009-06-16 00:22:12 UTC (rev 2243) +++ trunk/src/jtag/core.c 2009-06-16 00:22:40 UTC (rev 2244) @@ -58,9 +58,9 @@ */ static int jtag_error = ERROR_OK; -static char* jtag_event_strings[] = +static const char *jtag_event_strings[] = { - "JTAG controller reset (RESET or TRST)" + [JTAG_TRST_ASSERTED] = "JTAG controller reset (RESET or TRST)", }; static int jtag_trst = 0; Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-16 00:22:12 UTC (rev 2243) +++ trunk/src/jtag/jtag.h 2009-06-16 00:22:40 UTC (rev 2244) @@ -175,6 +175,10 @@ jtag_tap_t* next_tap; }; + +void jtag_tap_init(jtag_tap_t *tap); +void jtag_tap_free(jtag_tap_t *tap); + extern jtag_tap_t* jtag_all_taps(void); extern const char *jtag_tap_name(const jtag_tap_t *tap); extern jtag_tap_t* jtag_tap_by_string(const char* dotted_name); @@ -185,16 +189,16 @@ extern unsigned jtag_tap_count(void); -/* +/* * There are three cases when JTAG_TRST_ASSERTED callback is invoked. The - * event is invoked *after* TRST is asserted(or queued rather). It is illegal - * to communicate with the JTAG interface during the callback(as there is + * event is invoked *after* TRST is asserted(or queued rather). It is illegal + * to communicate with the JTAG interface during the callback(as there is * currently a queue being built). - * + * * - TMS reset * - SRST pulls TRST * - TRST asserted - * + * **/ enum jtag_event { JTAG_TRST_ASSERTED @@ -235,7 +239,7 @@ int jtag_get_speed(void); /** * Given a @a speed setting, use the interface @c speed_div callback to - * adjust the setting. + * adjust the setting. * @param speed The speed setting to convert back to readable KHz. * @returns ERROR_OK if the interface has not been initialized or on success; * otherwise, the error code produced by the @c speed_div callback. @@ -507,7 +511,7 @@ * @param goal_state The final TAP state. * @return ERROR_OK on success, or an error code on failure. * - * Moves from the current state to the goal \a state. + * Moves from the current state to the goal \a state. * * This needs to be handled according to the xsvf spec, see the XSTATE * command description. From the XSVF spec, pertaining to XSTATE: Modified: trunk/src/jtag/tcl.c =================================================================== --- trunk/src/jtag/tcl.c 2009-06-16 00:22:12 UTC (rev 2243) +++ trunk/src/jtag/tcl.c 2009-06-16 00:22:40 UTC (rev 2244) @@ -306,9 +306,6 @@ return (w & v) != 0; } -extern void jtag_tap_init(jtag_tap_t *tap); -extern void jtag_tap_free(jtag_tap_t *tap); - static int jim_newtap_cmd( Jim_GetOptInfo *goi ) { jtag_tap_t *pTap; @@ -334,12 +331,12 @@ { .name = NULL , .value = -1 }, }; - pTap = malloc( sizeof(jtag_tap_t) ); - memset( pTap, 0, sizeof(*pTap) ); - if( !pTap ){ - Jim_SetResult_sprintf( goi->interp, "no memory"); + pTap = calloc(1, sizeof(jtag_tap_t)); + if (!pTap) { + Jim_SetResult_sprintf(goi->interp, "no memory"); return JIM_ERR; } + /* * we expect CHIP + TAP + OPTIONS * */ |
From: <zw...@ma...> - 2009-06-16 02:22:36
|
Author: zwelch Date: 2009-06-16 02:22:12 +0200 (Tue, 16 Jun 2009) New Revision: 2243 Modified: trunk/doc/openocd.texi Log: David Brownell <da...@pa...>: Minor updates to the text about reset configuration: - Mention a new point that it interacts with JTAG routers; - Talk about a "user" config file not a "system" one; - Remove text from the "reset_config" description; instead, cross-reference the more extensive text earlier. Modified: trunk/doc/openocd.texi =================================================================== --- trunk/doc/openocd.texi 2009-06-15 23:54:09 UTC (rev 2242) +++ trunk/doc/openocd.texi 2009-06-16 00:22:12 UTC (rev 2243) @@ -1911,6 +1911,7 @@ Resets also interact with @var{reset-init} event handlers, which do things like setting up clocks and DRAM, and JTAG clock rates. (@xref{JTAG Speed}.) +They can also interact with JTAG routers. Please see the various board files for examples. @quotation Note @@ -1919,11 +1920,12 @@ Normally the board configuration file should define it and assume that the JTAG adapter supports everything that's wired up to the board's JTAG connector. + However, the target configuration file could also make note of something the silicon vendor has done inside the chip, which will be true for most (or all) boards using that chip. And when the JTAG adapter doesn't support everything, the -system configuration file will need to override parts of +user configuration file will need to override parts of the reset configuration provided by other files. @end quotation @@ -1967,6 +1969,7 @@ board-specific script might do things like setting up DRAM. (@xref{Reset Command}.) +@anchor{SRST and TRST Issues} @section SRST and TRST Issues Because SRST and TRST are hardware signals, they can have a @@ -1979,9 +1982,11 @@ SRST or TRST to the JTAG connector. Some JTAG adapters don't support such signals even if they are wired up. Use the @command{reset_config} @var{signals} options to say -when one of those signals is not connected. +when either of those signals is not connected. When SRST is not available, your code might not be able to rely on controllers having been fully reset during code startup. +Missing TRST is not a problem, since JTAG level resets can +be triggered using with TMS signaling. @item @emph{Signals shorted} ... Sometimes a chip, board, or adapter will connect SRST to TRST, instead of keeping them separate. @@ -2051,18 +2056,15 @@ of your combination of JTAG board and target in target configuration scripts. -If you have an interface that does not support SRST and -TRST(unlikely), then you may be able to work around that -problem by using a reset_config command to override any -settings in the target configuration script. +Information earlier in this section describes the kind of problems +the command is intended to address (@pxref{SRST and TRST Issues}). +As a rule this command belongs only in board config files, +describing issues like @emph{board doesn't connect TRST}; +or in user config files, addressing limitations derived +from a particular combination of interface and board. +(An unlikely example would be using a TRST-only adapter +with a board that only wires up SRST.) -SRST and TRST has a fairly well understood definition and -behaviour in the JTAG specification, but vendors take -liberties to achieve various more or less clearly understood -goals. Sometimes documentation is available, other times it -is not. OpenOCD has the reset_config command to allow OpenOCD -to deal with the various common cases. - The @var{mode_flag} options can be specified in any order, but only one of each type -- @var{signals}, @var{combination}, @var{trst_type}, and @var{srst_type} -- may be specified at a time. |
From: <zw...@ma...> - 2009-06-16 01:54:15
|
Author: zwelch Date: 2009-06-16 01:54:09 +0200 (Tue, 16 Jun 2009) New Revision: 2242 Added: trunk/tcl/board/omap2420_h4.cfg trunk/tcl/target/omap2420.cfg Log: David Brownell <da...@pa...>: Add another board ... OMAP2420 "H4" board. This won't be very widely used with OpenOCD, but with mainline support in both U-Boot and Linux it at least makes for a more complete set (and another testcase). This is incomplete support in several respects. The ARM11 support is not very deep yet; most registers aren't available, and the ETM can't be hooked up. Plus, there's no script for OMAP-specific stuff like setting up the SDRAM controller. Eventually the same NAND controller driver should work with OMAP2 and OMAP3. Added: trunk/tcl/board/omap2420_h4.cfg =================================================================== --- trunk/tcl/board/omap2420_h4.cfg 2009-06-15 14:22:13 UTC (rev 2241) +++ trunk/tcl/board/omap2420_h4.cfg 2009-06-15 23:54:09 UTC (rev 2242) @@ -0,0 +1,14 @@ +# OMAP2420 SDP board ("H4") + +source [find target/omap2420.cfg] + +# NOTE: this assumes you're *NOT* using a TI-14 connector. +reset_config trst_and_srst separate + +# Board configs can vary a *LOT* ... parts, jumpers, etc. +# This GP board boots from cs0 using NOR (2x32M), and also +# has 64M NAND on cs6. +flash bank cfi 0x04000000 0x02000000 2 2 $_TARGETNAME +flash bank cfi 0x06000000 0x02000000 2 2 $_TARGETNAME + +# vim:syntax tcl Property changes on: trunk/tcl/board/omap2420_h4.cfg ___________________________________________________________________ Name: svn:eol-style + native Added: trunk/tcl/target/omap2420.cfg =================================================================== --- trunk/tcl/target/omap2420.cfg 2009-06-15 14:22:13 UTC (rev 2241) +++ trunk/tcl/target/omap2420.cfg 2009-06-15 23:54:09 UTC (rev 2242) @@ -0,0 +1,61 @@ +# Texas Instruments OMAP 2420 +# http://www.ti.com/omap + +if { [info exists CHIPNAME] } { + set _CHIPNAME $CHIPNAME +} else { + set _CHIPNAME omap2420 +} +if { [info exists ENDIAN] } { + set _ENDIAN $ENDIAN +} else { + set _ENDIAN little +} + +# NOTE: likes slowish clock on reset (1.5 MBit/s or less) or use RCLK + +# Subsidiary TAP: ARM7TDMIr4 plus imaging ... must add via ICEpick (addr 6). +jtag newtap $_CHIPNAME iva -irlen 4 -ircapture 0x1 -irmask 0x3f -disable + +# Subsidiary TAP: C55x DSP ... must add via ICEpick (addr 2). +jtag newtap $_CHIPNAME dsp -irlen 38 -ircapture 0x1 -irmask 0x3f -disable + +# Subsidiary TAP: ARM ETB11, with scan chain for 4K of ETM trace buffer +if { [info exists ETB_TAPID ] } { + set _ETB_TAPID $ETB_TAPID +} else { + set _ETB_TAPID 0x2b900f0f +} +jtag newtap $_CHIPNAME etb -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_ETB_TAPID + +# Subsidiary TAP: ARM1136jf-s with scan chains for ARM Debug, EmbeddedICE-RT, ETM. +if { [info exists CPU_TAPID ] } { + set _CPU_TAPID $CPU_TAPID +} else { + set _CPU_TAPID 0x07b3602f +} +jtag newtap $_CHIPNAME arm -irlen 5 -ircapture 0x1 -irmask 0x1f -expected-id $_CPU_TAPID + +# Primary TAP: ICEpick-B (JTAG route controller) and boundary scan +if { [info exists JRC_TAPID ] } { + set _JRC_TAPID $JRC_TAPID +} else { + set _JRC_TAPID 0x01ce4801 +} +jtag newtap $_CHIPNAME jrc -irlen 2 -ircapture 0x1 -irmask 0x3 -expected-id $_JRC_TAPID + +# GDB target: the ARM. +set _TARGETNAME $_CHIPNAME.arm +target create $_TARGETNAME arm11 -endian $_ENDIAN -chain-position $_TARGETNAME + +# scratch: framebuffer, may be initially unavailable in some chips +$_TARGETNAME configure -work-area-phys 0x40210000 +$_TARGETNAME configure -work-area-size 0x00081000 +$_TARGETNAME configure -work-area-backup 0 + +# trace setup +# REVISIT ... as of 12-June-2009, OpenOCD's ETM code can't talk to ARM11 cores. +#etm config $_TARGETNAME 16 normal full etb +#etb config $_TARGETNAME $_CHIPNAME.etb + +# vim:syntax tcl Property changes on: trunk/tcl/target/omap2420.cfg ___________________________________________________________________ Name: svn:eol-style + native |
From: oharboe at B. <oh...@ma...> - 2009-06-15 16:22:14
|
Author: oharboe Date: 2009-06-15 16:22:13 +0200 (Mon, 15 Jun 2009) New Revision: 2241 Modified: trunk/src/helper/types.h Log: fix eCos build problems w/latest parse_ulong() stuff Modified: trunk/src/helper/types.h =================================================================== --- trunk/src/helper/types.h 2009-06-13 08:38:57 UTC (rev 2240) +++ trunk/src/helper/types.h 2009-06-15 14:22:13 UTC (rev 2241) @@ -137,22 +137,27 @@ } #ifdef __ECOS + /* eCos plain lacks this definition... */ typedef CYG_ADDRWORD intptr_t; typedef int64_t intmax_t; typedef uint64_t uintmax_t; #define INT8_MAX 0x7f #define INT8_MIN (-INT8_MAX - 1) -#define UINT8_MAX (__CONCAT(INT8_MAX, U) * 2U + 1U) +# define UINT8_MAX (255) #define INT16_MAX 0x7fff #define INT16_MIN (-INT16_MAX - 1) -#define UINT16_MAX (__CONCAT(INT16_MAX, U) * 2U + 1U) +# define UINT16_MAX (65535) #define INT32_MAX 0x7fffffffL #define INT32_MIN (-INT32_MAX - 1L) -#define UINT32_MAX (__CONCAT(INT32_MAX, U) * 2UL + 1UL) +# define UINT32_MAX (4294967295U) #define INT64_MAX 0x7fffffffffffffffLL #define INT64_MIN (-INT64_MAX - 1LL) #define UINT64_MAX (__CONCAT(INT64_MAX, U) * 2ULL + 1ULL) + + + + #endif #endif /* TYPES_H */ |
From: <zw...@ma...> - 2009-06-13 10:39:03
|
Author: zwelch Date: 2009-06-13 10:38:57 +0200 (Sat, 13 Jun 2009) New Revision: 2240 Modified: trunk/doc/openocd.texi trunk/src/server/gdb_server.c trunk/src/server/tcl_server.c trunk/src/server/telnet_server.c Log: David Brownell <da...@pa...>: OpenOCD doesn't actually *need* to be keeping all TCP ports active ... creating security issues in some network configs. Instead, let config file specify e.g. "tcl_port 0" (or gdb_port, telnet_port) to disable that particular remote access method. Modified: trunk/doc/openocd.texi =================================================================== --- trunk/doc/openocd.texi 2009-06-13 00:34:31 UTC (rev 2239) +++ trunk/doc/openocd.texi 2009-06-13 08:38:57 UTC (rev 2240) @@ -1422,10 +1422,17 @@ @cindex TCP port @cindex server @cindex port +@cindex security The OpenOCD server accepts remote commands in several syntaxes. Each syntax uses a different TCP/IP port, which you may specify only during configuration (before those ports are opened). +For reasons including security, you may wish to prevent remote +access using one or more of these ports. +In such cases, just specify the relevant port number as zero. +If you disable all access through TCP/IP, you will need to +use the command line @option{-pipe} option. + @deffn {Command} gdb_port (number) @cindex GDB server Specify or query the first port used for incoming GDB connections. @@ -1433,6 +1440,7 @@ first target will be gdb_port, the second target will listen on gdb_port + 1, and so on. When not specified during the configuration stage, the port @var{number} defaults to 3333. +When specified as zero, this port is not activated. @end deffn @deffn {Command} tcl_port (number) @@ -1442,6 +1450,7 @@ Intended as a machine interface. When not specified during the configuration stage, the port @var{number} defaults to 6666. +When specified as zero, this port is not activated. @end deffn @deffn {Command} telnet_port (number) @@ -1450,6 +1459,7 @@ This port is intended for interaction with one human through TCL commands. When not specified during the configuration stage, the port @var{number} defaults to 4444. +When specified as zero, this port is not activated. @end deffn @anchor{GDB Configuration} Modified: trunk/src/server/gdb_server.c =================================================================== --- trunk/src/server/gdb_server.c 2009-06-13 00:34:31 UTC (rev 2239) +++ trunk/src/server/gdb_server.c 2009-06-13 08:38:57 UTC (rev 2240) @@ -44,7 +44,7 @@ static enum breakpoint_type gdb_breakpoint_override_type; extern int gdb_error(connection_t *connection, int retval); -static unsigned short gdb_port; +static unsigned short gdb_port = 3333; static const char *DIGITS = "0123456789abcdef"; static void gdb_log_callback(void *priv, const char *file, int line, @@ -2198,8 +2198,8 @@ if (gdb_port == 0 && server_use_pipes == 0) { - LOG_DEBUG("no gdb port specified, using default port 3333"); - gdb_port = 3333; + LOG_INFO("gdb port disabled"); + return ERROR_OK; } if (server_use_pipes) Modified: trunk/src/server/tcl_server.c =================================================================== --- trunk/src/server/tcl_server.c 2009-06-13 00:34:31 UTC (rev 2239) +++ trunk/src/server/tcl_server.c 2009-06-13 08:38:57 UTC (rev 2240) @@ -34,7 +34,7 @@ int tc_outerror; /* flag an output error */ } tcl_connection_t; -static unsigned short tcl_port = 0; +static unsigned short tcl_port = 6666; /* commands */ static int handle_tcl_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); @@ -165,8 +165,8 @@ if (tcl_port == 0) { - LOG_DEBUG("no tcl port specified, using default port 6666"); - tcl_port = 6666; + LOG_INFO("tcl port disabled"); + return ERROR_OK; } retval = add_service("tcl", CONNECTION_TCP, tcl_port, 1, tcl_new_connection, tcl_input, tcl_closed, NULL); Modified: trunk/src/server/telnet_server.c =================================================================== --- trunk/src/server/telnet_server.c 2009-06-13 00:34:31 UTC (rev 2239) +++ trunk/src/server/telnet_server.c 2009-06-13 08:38:57 UTC (rev 2240) @@ -30,7 +30,7 @@ #include "telnet_server.h" #include "target_request.h" -static unsigned short telnet_port = 0; +static unsigned short telnet_port = 4444; int handle_exit_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int handle_telnet_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); @@ -596,8 +596,8 @@ if (telnet_port == 0) { - LOG_DEBUG("no telnet port specified, using default port 4444"); - telnet_port = 4444; + LOG_INFO("telnet port disabled"); + return ERROR_OK; } telnet_service->banner = banner; |
From: <zw...@ma...> - 2009-06-13 02:53:14
|
Author: zwelch Date: 2009-06-13 02:33:48 +0200 (Sat, 13 Jun 2009) New Revision: 2233 Modified: trunk/src/target/target.c Log: Improve handle_dump_image_command argument parsing: - Use parse_u32 to ensure address and size parse properly. Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-13 00:33:42 UTC (rev 2232) +++ trunk/src/target/target.c 2009-06-13 00:33:48 UTC (rev 2233) @@ -2266,10 +2266,8 @@ { fileio_t fileio; - u32 address; - u32 size; u8 buffer[560]; - int retval=ERROR_OK, retvaltemp; + int retvaltemp; duration_t duration; char *duration_text; @@ -2282,9 +2280,16 @@ return ERROR_OK; } - address = strtoul(args[1], NULL, 0); - size = strtoul(args[2], NULL, 0); + u32 address; + int retval = parse_u32(args[1], &address); + if (ERROR_OK != retval) + return retval; + u32 size; + retval = parse_u32(args[2], &size); + if (ERROR_OK != retval) + return retval; + if (fileio_open(&fileio, args[0], FILEIO_WRITE, FILEIO_BINARY) != ERROR_OK) { return ERROR_OK; |
From: <zw...@ma...> - 2009-06-13 02:35:56
|
Author: zwelch Date: 2009-06-13 02:33:42 +0200 (Sat, 13 Jun 2009) New Revision: 2232 Modified: trunk/src/target/target.c Log: Improve handle_load_image_command argument parsing: - Use parse_u32 to ensure base/min/max addresses parse properly. Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-13 00:33:34 UTC (rev 2231) +++ trunk/src/target/target.c 2009-06-13 00:33:42 UTC (rev 2232) @@ -2153,8 +2153,12 @@ /* a base address isn't always necessary, default to 0x0 (i.e. don't relocate) */ if (argc >= 2) { + u32 addr; + retval = parse_u32(args[1], &addr); + if (ERROR_OK != retval) + return ERROR_COMMAND_SYNTAX_ERROR; + image.base_address = addr; image.base_address_set = 1; - image.base_address = strtoul(args[1], NULL, 0); } else { @@ -2166,11 +2170,17 @@ if (argc>=4) { - min_address=strtoul(args[3], NULL, 0); + retval = parse_u32(args[3], &min_address); + if (ERROR_OK != retval) + return ERROR_COMMAND_SYNTAX_ERROR; } if (argc>=5) { - max_address=strtoul(args[4], NULL, 0)+min_address; + retval = parse_u32(args[4], &max_address); + if (ERROR_OK != retval) + return ERROR_COMMAND_SYNTAX_ERROR; + // use size (given) to find max (required) + max_address += min_address; } if (min_address>max_address) |
From: <zw...@ma...> - 2009-06-13 02:35:56
|
Author: zwelch Date: 2009-06-13 02:33:34 +0200 (Sat, 13 Jun 2009) New Revision: 2231 Modified: trunk/src/target/target.c Log: Improve handle_mw_command argument handling: - Change: All local variable types are now unsigned. - Use parse_u32 to ensure address and value parse properly. - Use parse_uint to ensure count parses properly. - Move variables to location of first use. Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-13 00:33:25 UTC (rev 2230) +++ trunk/src/target/target.c 2009-06-13 00:33:34 UTC (rev 2231) @@ -2074,22 +2074,30 @@ static int handle_mw_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - u32 address = 0; - u32 value = 0; - int count = 1; - int i; - int wordsize; - target_t *target = get_current_target(cmd_ctx); - u8 value_buf[4]; - if ((argc < 2) || (argc > 3)) return ERROR_COMMAND_SYNTAX_ERROR; - address = strtoul(args[0], NULL, 0); - value = strtoul(args[1], NULL, 0); + u32 address; + int retval = parse_u32(args[0], &address); + if (ERROR_OK != retval) + return retval; + + u32 value; + retval = parse_u32(args[1], &value); + if (ERROR_OK != retval) + return retval; + + unsigned count = 1; if (argc == 3) - count = strtoul(args[2], NULL, 0); + { + retval = parse_uint(args[2], &count); + if (ERROR_OK != retval) + return retval; + } + target_t *target = get_current_target(cmd_ctx); + unsigned wordsize; + u8 value_buf[4]; switch (cmd[2]) { case 'w': @@ -2107,9 +2115,9 @@ default: return ERROR_COMMAND_SYNTAX_ERROR; } - for (i=0; i<count; i++) + for (unsigned i = 0; i < count; i++) { - int retval = target_write_memory(target, + retval = target_write_memory(target, address + i * wordsize, wordsize, 1, value_buf); if (ERROR_OK != retval) return retval; |
From: <zw...@ma...> - 2009-06-13 02:35:54
|
Author: zwelch Date: 2009-06-13 02:34:10 +0200 (Sat, 13 Jun 2009) New Revision: 2236 Modified: trunk/src/target/target.c Log: Cleanup and improve handle_wp_command and handle_rwp_command: - Simplify argument parsing logic using switch statement. - Use parse_u32 to ensure all values parse properly. - Return syntax error when mode argument fails to parse. Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-13 00:34:03 UTC (rev 2235) +++ trunk/src/target/target.c 2009-06-13 00:34:10 UTC (rev 2236) @@ -2582,7 +2582,6 @@ static int handle_wp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { target_t *target = get_current_target(cmd_ctx); - int retval; if (argc == 0) { @@ -2593,52 +2592,65 @@ command_print(cmd_ctx, "address: 0x%8.8x, len: 0x%8.8x, r/w/a: %i, value: 0x%8.8x, mask: 0x%8.8x", watchpoint->address, watchpoint->length, watchpoint->rw, watchpoint->value, watchpoint->mask); watchpoint = watchpoint->next; } + return ERROR_OK; } - else if (argc >= 2) + + enum watchpoint_rw type = WPT_ACCESS; + u32 addr = 0; + u32 length = 0; + u32 data_value = 0x0; + u32 data_mask = 0xffffffff; + int retval; + + switch (argc) { - enum watchpoint_rw type = WPT_ACCESS; - u32 data_value = 0x0; - u32 data_mask = 0xffffffff; - - if (argc >= 3) + case 5: + retval = parse_u32(args[4], &data_mask); + if (ERROR_OK != retval) + return retval; + // fall through + case 4: + retval = parse_u32(args[3], &data_value); + if (ERROR_OK != retval) + return retval; + // fall through + case 3: + switch(args[2][0]) { - switch(args[2][0]) - { - case 'r': - type = WPT_READ; - break; - case 'w': - type = WPT_WRITE; - break; - case 'a': - type = WPT_ACCESS; - break; - default: - command_print(cmd_ctx, "usage: wp <address> <length> [r/w/a] [value] [mask]"); - return ERROR_OK; - } + case 'r': + type = WPT_READ; + break; + case 'w': + type = WPT_WRITE; + break; + case 'a': + type = WPT_ACCESS; + break; + default: + LOG_ERROR("invalid watchpoint mode ('%c')", args[2][0]); + return ERROR_COMMAND_SYNTAX_ERROR; } - if (argc >= 4) - { - data_value = strtoul(args[3], NULL, 0); - } - if (argc >= 5) - { - data_mask = strtoul(args[4], NULL, 0); - } + // fall through + case 2: + retval = parse_u32(args[1], &length); + if (ERROR_OK != retval) + return retval; + retval = parse_u32(args[0], &addr); + if (ERROR_OK != retval) + return retval; + break; - if ((retval = watchpoint_add(target, strtoul(args[0], NULL, 0), - strtoul(args[1], NULL, 0), type, data_value, data_mask)) != ERROR_OK) - { - LOG_ERROR("Failure setting breakpoints"); - } - } - else - { + default: command_print(cmd_ctx, "usage: wp <address> <length> [r/w/a] [value] [mask]"); + return ERROR_COMMAND_SYNTAX_ERROR; } - return ERROR_OK; + retval = watchpoint_add(target, addr, length, type, + data_value, data_mask); + if (ERROR_OK != retval) + LOG_ERROR("Failure setting watchpoints"); + + return retval; } static int handle_rwp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) @@ -2646,8 +2658,13 @@ if (argc != 1) return ERROR_COMMAND_SYNTAX_ERROR; + u32 addr; + int retval = parse_u32(args[0], &addr); + if (ERROR_OK != retval) + return retval; + target_t *target = get_current_target(cmd_ctx); - watchpoint_remove(target, strtoul(args[0], NULL, 0)); + watchpoint_remove(target, addr); return ERROR_OK; } |
From: <zw...@ma...> - 2009-06-13 02:35:16
|
Author: zwelch Date: 2009-06-13 02:33:55 +0200 (Sat, 13 Jun 2009) New Revision: 2234 Modified: trunk/src/target/target.c Log: Improve handle_verify_image_command_internal command argument handling: - Use parse_u32 to ensure address parses properly. Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-13 00:33:48 UTC (rev 2233) +++ trunk/src/target/target.c 2009-06-13 00:33:55 UTC (rev 2234) @@ -2366,8 +2366,12 @@ if (argc >= 2) { + u32 addr; + retval = parse_u32(args[1], &addr); + if (ERROR_OK != retval) + return ERROR_COMMAND_SYNTAX_ERROR; + image.base_address = addr; image.base_address_set = 1; - image.base_address = strtoul(args[1], NULL, 0); } else { |