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-12 03:40:15
|
Author: zwelch Date: 2009-06-12 03:40:03 +0200 (Fri, 12 Jun 2009) New Revision: 2209 Modified: trunk/src/jtag/parport.c Log: Simplify and improve parport_handle_parport_port_command: - Show the port number to the user when asking for it or setting it. - Print an error if the parport_port has already been set. - Use parse_u16 helper to ensure the parport_port string parses correctly. Modified: trunk/src/jtag/parport.c =================================================================== --- trunk/src/jtag/parport.c 2009-06-12 01:39:57 UTC (rev 2208) +++ trunk/src/jtag/parport.c 2009-06-12 01:40:03 UTC (rev 2209) @@ -429,12 +429,23 @@ static int parport_handle_parport_port_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - if (argc == 0) - return ERROR_OK; + if (argc == 1) + { + /* only if the port wasn't overwritten by cmdline */ + if (parport_port == 0) + { + int retval = parse_u16(args[0], &parport_port); + if (ERROR_OK != retval) + return retval; + } + else + { + LOG_ERROR("The parport port was already configured!"); + return ERROR_FAIL; + } + } - /* only if the port wasn't overwritten by cmdline */ - if (parport_port == 0) - parport_port = strtoul(args[0], NULL, 0); + command_print(cmd_ctx, "parport port = %u", parport_port); return ERROR_OK; } |
From: <zw...@ma...> - 2009-06-12 03:40:01
|
Author: zwelch Date: 2009-06-12 03:39:57 +0200 (Fri, 12 Jun 2009) New Revision: 2208 Modified: trunk/src/helper/log.c Log: Simplify and improve handle_debug_level_comamnd: - Bug fix: Return a syntax error if more than one argument is given. - Bug fix: Use new parse_uint helper ensure debug_level parses correctly. - Change: Display the debug_level after it has been set. - Simplify bounds checking of debug_level. Modified: trunk/src/helper/log.c =================================================================== --- trunk/src/helper/log.c 2009-06-12 01:39:51 UTC (rev 2207) +++ trunk/src/helper/log.c 2009-06-12 01:39:57 UTC (rev 2208) @@ -194,18 +194,19 @@ */ int handle_debug_level_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - if (argc == 0) - command_print(cmd_ctx, "debug_level: %i", debug_level); + if (argc == 1) + { + unsigned new_level; + int retval = parse_uint(args[0], &new_level); + if (ERROR_OK != retval) + return retval; + debug_level = MIN(new_level, LOG_LVL_DEBUG); + } + else if (argc > 1) + return ERROR_COMMAND_SYNTAX_ERROR; - if (argc > 0) - debug_level = strtoul(args[0], NULL, 0); + command_print(cmd_ctx, "debug_level: %i", debug_level); - if (debug_level < 0) - debug_level = 0; - - if (debug_level > 3) - debug_level = 3; - if (debug_level >= LOG_LVL_DEBUG && server_use_pipes == 1) { /* if we are enabling debug info then we need to write to a log file |
From: <zw...@ma...> - 2009-06-12 03:39:55
|
Author: zwelch Date: 2009-06-12 03:39:51 +0200 (Fri, 12 Jun 2009) New Revision: 2207 Modified: trunk/src/helper/command.c Log: Simplify handle_sleep_command: - Use new parse_ulong to ensure duration parses as a valid number. - Rework logic to improve readability and seliminate uperfluous braces. - Change whitespace to improve style. Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2009-06-12 01:39:44 UTC (rev 2206) +++ trunk/src/helper/command.c 2009-06-12 01:39:51 UTC (rev 2207) @@ -757,38 +757,36 @@ /* sleep command sleeps for <n> miliseconds * this is useful in target startup scripts */ -int handle_sleep_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +int handle_sleep_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) { - unsigned long duration = 0; - int busy = 0; - - if (argc==1) + bool busy = false; + if (argc == 2) { - - } else if (argc==2) - { - if (strcmp(args[1], "busy")!=0) + if (strcmp(args[1], "busy") == 0) + busy = true; + else return ERROR_COMMAND_SYNTAX_ERROR; - busy = 1; - } else - { - return ERROR_COMMAND_SYNTAX_ERROR; } + else if (argc < 1 || argc > 2) + return ERROR_COMMAND_SYNTAX_ERROR; - duration = strtoul(args[0], NULL, 0); + unsigned long duration = 0; + int retval = parse_ulong(args[0], &duration); + if (ERROR_OK != retval) + return retval; - if (busy) + if (!busy) { - busy_sleep(duration); - } else - { - long long then=timeval_ms(); - while ((timeval_ms()-then)<(long long)duration) + long long then = timeval_ms(); + while (timeval_ms() - then < (long long)duration) { target_call_timer_callbacks_now(); usleep(1000); } } + else + busy_sleep(duration); return ERROR_OK; } |
From: <zw...@ma...> - 2009-06-12 03:39:49
|
Author: zwelch Date: 2009-06-12 03:39:44 +0200 (Fri, 12 Jun 2009) New Revision: 2206 Modified: trunk/src/helper/command.c trunk/src/helper/command.h Log: Add new parse_uinttype wrappers for strtoul in src/helper/command.[ch]. - Used to improve command argument parsing of unsigned integers values. Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2009-06-11 21:55:43 UTC (rev 2205) +++ trunk/src/helper/command.c 2009-06-12 01:39:44 UTC (rev 2206) @@ -848,3 +848,18 @@ } 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; +} Modified: trunk/src/helper/command.h =================================================================== --- trunk/src/helper/command.h 2009-06-11 21:55:43 UTC (rev 2205) +++ trunk/src/helper/command.h 2009-06-12 01:39:44 UTC (rev 2206) @@ -107,4 +107,20 @@ long jim_global_long(const char *variable); +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) \ + static inline int parse_##name(const char *str, type *ul) \ + { \ + unsigned long n; \ + int retval = parse_ulong(str, &n); \ + *ul = n; \ + return n > (max) ? ERROR_COMMAND_SYNTAX_ERROR : retval; \ + } +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) + #endif /* COMMAND_H */ |
From: <zw...@ma...> - 2009-06-11 23:55:48
|
Author: zwelch Date: 2009-06-11 23:55:43 +0200 (Thu, 11 Jun 2009) New Revision: 2205 Modified: trunk/src/helper/command.c trunk/src/helper/command.h Log: David Brownell <da...@pa...>: Minor bugfix: command_print_sameline() is what the headers declare; make the code match. Minor improvement: make the printf format params always be const. Modified: trunk/src/helper/command.c =================================================================== --- trunk/src/helper/command.c 2009-06-11 21:48:36 UTC (rev 2204) +++ trunk/src/helper/command.c 2009-06-11 21:55:43 UTC (rev 2205) @@ -337,7 +337,7 @@ } } -void command_print_n(command_context_t *context, char *format, ...) +void command_print_sameline(command_context_t *context, const char *format, ...) { char *string; @@ -361,7 +361,7 @@ va_end(ap); } -void command_print(command_context_t *context, char *format, ...) +void command_print(command_context_t *context, const char *format, ...) { char *string; @@ -497,7 +497,7 @@ return retval; } -int command_run_linef(command_context_t *context, char *format, ...) +int command_run_linef(command_context_t *context, const char *format, ...) { int retval=ERROR_FAIL; char *string; Modified: trunk/src/helper/command.h =================================================================== --- trunk/src/helper/command.h 2009-06-11 21:48:36 UTC (rev 2204) +++ trunk/src/helper/command.h 2009-06-11 21:55:43 UTC (rev 2205) @@ -84,12 +84,12 @@ extern command_context_t* command_init(void); extern int command_done(command_context_t *context); -extern void command_print(command_context_t *context, char *format, ...) +extern void command_print(command_context_t *context, const char *format, ...) __attribute__ ((format (printf, 2, 3))); -extern void command_print_sameline(command_context_t *context, char *format, ...) +extern void command_print_sameline(command_context_t *context, const char *format, ...) __attribute__ ((format (printf, 2, 3))); extern int command_run_line(command_context_t *context, char *line); -extern int command_run_linef(command_context_t *context, char *format, ...) +extern int command_run_linef(command_context_t *context, const char *format, ...) __attribute__ ((format (printf, 2, 3))); extern void command_output_text(command_context_t *context, const char *data); |
From: <zw...@ma...> - 2009-06-11 23:48:42
|
Author: zwelch Date: 2009-06-11 23:48:36 +0200 (Thu, 11 Jun 2009) New Revision: 2204 Modified: trunk/doc/openocd.texi Log: David Brownell <da...@pa...>: Rework the "Simple Configuration Files" chapter so it's more of a quick-start "how to set up your project" tutorial: - Say how to hook up the JTAG adapter. This will help new users, and in any case is worth spelling out somewhere. - Streamline the previous rather haphazard presentation, filling in some missing holes along the way: * Suggest "project directory" structure * Introduce new term, "user config" file (openocd.cfg) * Talk about more options for openocd.cfg contents * ... and about creating new config files * Add new topic, project-specific utilities (+examples) - Remove too-short, yet duplicative, chapter 19 Nudge packagers a bit more strongly to send patches (including config files) upstream. Modified: trunk/doc/openocd.texi =================================================================== --- trunk/doc/openocd.texi 2009-06-11 21:23:24 UTC (rev 2203) +++ trunk/doc/openocd.texi 2009-06-11 21:48:36 UTC (rev 2204) @@ -63,7 +63,7 @@ * Building OpenOCD:: Building OpenOCD From SVN * JTAG Hardware Dongles:: JTAG Hardware Dongles * Running:: Running OpenOCD -* Simple Configuration Files:: Simple Configuration Files +* OpenOCD Project Setup:: OpenOCD Project Setup * Config File Guidelines:: Config File Guidelines * About JIM-Tcl:: About JIM-Tcl * Daemon Configuration:: Daemon Configuration @@ -76,7 +76,6 @@ * General Commands:: General Commands * Architecture and Core Commands:: Architecture and Core Commands * JTAG Commands:: JTAG Commands -* Sample Scripts:: Sample Target Scripts * TFTP:: TFTP * GDB and OpenOCD:: Using GDB and OpenOCD * Tcl Scripting API:: Tcl Scripting API @@ -239,6 +238,7 @@ 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.} @end enumerate @@ -718,29 +718,115 @@ the JTAG controller to be unresponsive until the target is set up correctly via e.g. GDB monitor commands in a GDB init script. -@node Simple Configuration Files -@chapter Simple Configuration Files -@cindex configuration +@node OpenOCD Project Setup +@chapter OpenOCD Project Setup -@section Outline -There are 4 basic ways of ``configurating'' OpenOCD to run, they are: +To use OpenOCD with your development projects, you need to do more than +just connecting the JTAG adapter hardware (dongle) to your development board +and then starting the OpenOCD server. +You also need to configure that server so that it knows +about that adapter and board, and helps your work. +@section Hooking up the JTAG Adapter + +Today's most common case is a dongle with a JTAG cable on one side +(such as a ribbon cable with a 10-pin or 20-pin IDC connector) +and a USB cable on the other. +Instead of USB, some cables use Ethernet; +older ones may use a PC parallel port, or even a serial port. + @enumerate -@item A small openocd.cfg file which ``sources'' other configuration files -@item A monolithic openocd.cfg file -@item Many -f filename options on the command line -@item Your Mixed Solution +@item @emph{Start with power to your target board turned off}, +and nothing connected to your JTAG adapter. +If you're particularly paranoid, unplug power to the board. +It's important to have the ground signal properly set up, +unless you are using a JTAG adapter which provides +galvanic isolation between the target board and the +debugging host. + +@item @emph{Be sure it's the right kind of JTAG connector.} +If your dongle has a 20-pin ARM connector, you need some kind +of adapter (or octopus, see below) to hook it up to +boards using 14-pin or 10-pin connectors ... or to 20-pin +connectors which don't use ARM's pinout. + +In the same vein, make sure the voltage levels are compatible. +Not all JTAG adapters have the level shifters needed to work +with 1.2 Volt boards. + +@item @emph{Be certain the cable is properly oriented} or you might +damage your board. In most cases there are only two possible +ways to connect the cable. +Connect the JTAG cable from your adapter to the board. +Be sure it's firmly connected. + +In the best case, the connector is keyed to physically +prevent you from inserting it wrong. +This is most often done using a slot on the board's male connector +housing, which must match a key on the JTAG cable's female connector. +If there's no housing, then you must look carefully and +make sure pin 1 on the cable hooks up to pin 1 on the board. +Ribbon cables are frequently all grey except for a wire on one +edge, which is red. The red wire is pin 1. + +Sometimes dongles provide cables where one end is an ``octopus'' of +color coded single-wire connectors, instead of a connector block. +These are great when converting from one JTAG pinout to another, +but are tedious to set up. +Use these with connector pinout diagrams to help you match up the +adapter signals to the right board pins. + +@item @emph{Connect the adapter's other end} once the JTAG cable is connected. +A USB, parallel, or serial port connector will go to the host which +you are using to run OpenOCD. +For Ethernet, consult the documentation and your network administrator. + +For USB based JTAG adapters you have an easy sanity check at this point: +does the host operating system see the JTAG adapter? + +@item @emph{Connect the adapter's power supply, if needed.} +This step is primarily for non-USB adapters, +but sometimes USB adapters need extra power. + +@item @emph{Power up the target board.} +Unless you just let the magic smoke escape, +you're now ready to set up the OpenOCD server +so you can use JTAG to work with that board. + @end enumerate -@section Small configuration file method +Talk with the OpenOCD server using +telnet (@code{telnet localhost 4444} on many systems) or GDB. +@xref{GDB and OpenOCD}. -This is the preferred method. It is simple and works well for many -people. The developers of OpenOCD would encourage you to use this -method. If you create a new configuration please email new -configurations to the development list. +@section Project Directory -Here is an example of an openocd.cfg file for an ATMEL at91sam7x256 +There are many ways you can configure OpenOCD and start it up. +A simple way to organize them all involves keeping a +single directory for your work with a given board. +When you start OpenOCD from that directory, +it searches there first for configuration files +and for code you upload to the target board. +It is also be the natural place to write files, +such as log files and data you download from the board. + +@section Configuration Basics + +There are two basic ways of configuring OpenOCD, and +a variety of ways you can mix them. +Think of the difference as just being how you start the server: + +@itemize +@item Many @option{-f file} or @option{-c command} options on the command line +@item No options, but a @dfn{user config file} +in the current directory named @file{openocd.cfg} +@end itemize + +Here is an example @file{openocd.cfg} file for a setup +using a Signalyzer FT2232-based JTAG adapter to talk to +a board with an Atmel AT91SAM7X256 microcontroller: + @example source [find interface/signalyzer.cfg] @@ -751,68 +837,174 @@ source [find target/sam7x256.cfg] @end example -There are many example configuration scripts you can work with. You -should look in the directory: @t{$(INSTALLDIR)/lib/openocd}. You -should find: +Here is the command line equivalent of that configuration: +@example +openocd -f interface/signalyzer.cfg \ + -c "gdb_memory_map enable" \ + -c "gdb_flash_program enable" \ + -f target/sam7x256.cfg +@end example + +You could wrap such long command lines in shell scripts, +each supporting a different development task. +One might re-flash the board with specific firmware version. +Another might set up a particular debugging or run-time environment. + +Here we will focus on the simpler solution: one user config +file, including basic configuration plus any TCL procedures +to simplify your work. + +@section User Config Files +@cindex config file +@cindex user config file + +A user configuration file ties together all the parts of a project +in one place. +One of the following will match your situation best: + +@itemize +@item Ideally almost everything comes from configuration files +provided by someone else. +For example, OpenOCD distributes a @file{scripts} directory +(probably in @file{/usr/share/openocd/scripts} on Linux); +board and tool vendors can provide these too. +The AT91SAM7X256 example above works this way. + +Three main types of non-user configuration file each have their +own subdirectory in the @file{scripts} directory: + @enumerate -@item @b{board} - eval board level configurations -@item @b{interface} - specific dongle configurations -@item @b{target} - the target chips -@item @b{tcl} - helper scripts -@item @b{xscale} - things specific to the xscale. +@item @b{interface} -- one for each kind of JTAG adapter/dongle +@item @b{board} -- one for each different board +@item @b{target} -- the chips which integrate CPUs and other JTAG TAPs @end enumerate -Look first in the ``boards'' area, then the ``targets'' area. Often a board -configuration is a good example to work from. +Best case: include just two files, and they handle everything else. +The first is an interface config file. +The second is board-specific, and it sets up the JTAG TAPs and +their GDB targets (by deferring to some @file{target.cfg} file), +declares all flash memory, and leaves you nothing to do except +meet your deadline: -@section Many -f filename options -Some believe this is a wonderful solution, others find it painful. +@example +source [find interface/olimex-jtag-tiny.cfg] +source [find board/csb337.cfg] +@end example -You can use a series of ``-f filename'' options on the command line, -OpenOCD will read each filename in sequence, for example: +Boards with a single microcontroller often won't need more +than the target config file, as in the AT91SAM7X256 example. +That's because there is no external memory (flash, DDR RAM), and +the board differences are encapsulated by application code. +@item You can often reuse some standard config files but +need to write a few new ones, probably a @file{board.cfg} file. +You will be using commands described later in this User's Guide, +and working with the guidelines in the next chapter. + +For example, there may be configuration files for your JTAG adapter +and target chip, but you need a new board-specific config file +giving access to your particular flash chips. +Or you might need to write another target chip configuration file +for a new chip built around the Cortex M3 core. + +@quotation Note +When you write new configuration files, please submit +them for inclusion in the next OpenOCD release. +For example, a @file{board/newboard.cfg} file will help the +next users of that board, and a @file{target/newcpu.cfg} +will help support users of any board using that chip. +@end quotation + +@item +You may may need to write some C code. +It may be as simple as a supporting a new new ft2232 or parport +based dongle; a bit more involved, like a NAND or NOR flash +controller driver; or a big piece of work like supporting +a new chip architecture. +@end itemize + +Reuse the existing config files when you can. +Look first in the @file{scripts/boards} area, then @file{scripts/targets}. +You may find a board configuration that's a good example to follow. + +When you write config files, separate the reusable parts +(things every user of that interface, chip, or board needs) +from ones specific to your environment and debugging approach. + +For example, a @code{gdb-attach} event handler that invokes +the @command{reset init} command will interfere with debugging +early boot code, which performs some of the same actions +that the @code{reset-init} event handler does. +Likewise, the @command{arm9tdmi vector_catch} command (or +its @command{xscale vector_catch} sibling) can be a timesaver +during some debug sessions, but don't make everyone use that either. +Keep those kinds of debugging aids in your user config file. + +@section Project-Specific Utilities + +A few project-specific utility +routines may well speed up your work. +Write them, and keep them in your project's user config file. + +For example, if you are making a boot loader work on a +board, it's nice to be able to debug the ``after it's +loaded to RAM'' parts separately from the finicky early +code which sets up the DDR RAM controller and clocks. +A script like this one, or a more GDB-aware sibling, +may help: + @example -openocd -f file1.cfg -f file2.cfg -f file2.cfg -@end example +proc ramboot @{ @} @{ + # Reset, running the target's "reset-init" scripts + # to initialize clocks and the DDR RAM controller. + # Leave the CPU halted. + reset init -You can also intermix various commands with the ``-c'' command line -option. + # Load CONFIG_SKIP_LOWLEVEL_INIT version into DDR RAM. + load_image u-boot.bin 0x20000000 -@section Monolithic file -The ``Monolithic File'' dispenses with all ``source'' statements and -puts everything in one self contained (monolithic) file. This is not -encouraged. + # Start running. + resume 0x20000000 +@} +@end example -Please try to ``source'' various files or use the multiple -f -technique. +Then once that code is working you will need to make it +boot from NOR flash; a different utility would help. +Alternatively, some developers write to flash using GDB. +(You might use a similar script if you're working with a flash +based microcontroller application instead of a boot loader.) -@section Advice for you -Often, one uses a ``mixed approach''. Where possible, please try to -``source'' common things, and if needed cut/paste parts of the -standard distribution configuration files as needed. +@example +proc newboot @{ @} @{ + # Reset, leaving the CPU halted. The "reset-init" event + # proc gives faster access to the CPU and to NOR flash; + # "reset halt" would be slower. + reset init -@b{REMEMBER:} The ``important parts'' of your configuration file are: + # Write standard version of U-Boot into the first two + # sectors of NOR flash ... the standard version should + # do the same lowlevel init as "reset-init". + flash protect 0 0 1 off + flash erase_sector 0 0 1 + flash write_bank 0 u-boot.bin 0x0 + flash protect 0 0 1 on -@enumerate -@item @b{Interface} - Defines the dongle -@item @b{Taps} - Defines the JTAG Taps -@item @b{GDB Targets} - What GDB talks to -@item @b{Flash Programing} - Very Helpful -@end enumerate + # Reboot from scratch using that new boot loader. + reset run +@} +@end example -Some key things you should look at and understand are: +You may need more complicated utility procedures when booting +from NAND. +That often involves an extra bootloader stage, +running from on-chip SRAM to perform DDR RAM setup so it can load +the main bootloader code (which won't fit into that SRAM). -@enumerate -@item The reset configuration of your debug environment as a whole -@item Is there a ``work area'' that OpenOCD can use? -@* For ARM - work areas mean up to 10x faster downloads. -@item For MMU/MPU based ARM chips (i.e.: ARM9 and later) will that work area still be available? -@item For complex targets (multiple chips) the JTAG SPEED becomes an issue. -@end enumerate +Other helper scripts might be used to write production system images, +involving considerably more than just a three stage bootloader. - @node Config File Guidelines @chapter Config File Guidelines @@ -852,6 +1044,7 @@ various commands specific to their situation. @section Interface Config Files +@cindex config file The user should be able to source one of these files via a command like this: @@ -868,6 +1061,7 @@ Interface files should be found in @t{$(INSTALLDIR)/lib/openocd/interface} @section Board Config Files +@cindex config file @b{Note: BOARD directory NEW as of 28/nov/2008} @@ -896,6 +1090,7 @@ @end enumerate @section Target Config Files +@cindex config file The user should be able to source one of these files via a command like this: @@ -1113,13 +1308,6 @@ If the chip has a DCC, enable it. If the chip is an ARM9 with some special high speed download features - enable it. -If the chip supports the @command{arm9tdmi vector_catch}, -@command{xscale vector_catch}, or similar features, -consider enabling it in your user-specific configuration file. -Experience has shown the ``vector_catch'' can be -helpful for catching programming errors -like Undefined Instructions, Data Abort, and Prefetch Abort. - If present, the MMU, the MPU and the CACHE should be disabled. Some ARM cores are equipped with trace support, which permits @@ -4885,33 +5073,6 @@ are numerous TFTP servers out there (free and commercial) and you will have to do a bit of googling to find something that fits your requirements. -@node Sample Scripts -@chapter Sample Scripts -@cindex scripts - -This page shows how to use the Target Library. - -The configuration script can be divided into the following sections: -@itemize @bullet -@item Daemon configuration -@item Interface -@item JTAG scan chain -@item Target configuration -@item Flash configuration -@end itemize - -Detailed information about each section can be found at OpenOCD configuration. - -@section AT91R40008 example -@cindex AT91R40008 example -To start OpenOCD with a target script for the AT91R40008 CPU and reset -the CPU upon startup of the OpenOCD daemon. -@example -openocd -f interface/parport.cfg -f target/at91r40008.cfg \ - -c "init" -c "reset" -@end example - - @node GDB and OpenOCD @chapter GDB and OpenOCD @cindex GDB |
From: <zw...@ma...> - 2009-06-11 23:23:29
|
Author: zwelch Date: 2009-06-11 23:23:24 +0200 (Thu, 11 Jun 2009) New Revision: 2203 Modified: trunk/doc/openocd.texi Log: David Brownell <da...@pa...>: Update "arm9tdmi vector_catch" command description to highlight both use cases (display configuration, or first change that config) and to explain a bit more about what this is: an alternative to using hardware breakpoint resources. Note that I tried this on an arm920t, but it didn't work. Set bits, then examined them and they weren't set. And it didn't seem to act as if vector triggering was noticed, either. Also some minor unrelated tweaks: @ignore some unused or don't-use event names; fix a few typos; tweak chip-specific reset descriptions. Modified: trunk/doc/openocd.texi =================================================================== --- trunk/doc/openocd.texi 2009-06-11 19:32:10 UTC (rev 2202) +++ trunk/doc/openocd.texi 2009-06-11 21:23:24 UTC (rev 2203) @@ -1091,7 +1091,7 @@ -work-area-size 0x4000 -work-area-backup 0 @end example -@subsection Reset Configuration +@subsection Chip Reset Setup As a rule, you should put the @command{reset_config} command into the board file. Most things you think you know about a @@ -1101,16 +1101,24 @@ managed. In the unusual case that these are @emph{chip specific} and can never be changed by board wiring, they could go here. +Some chips need special attention during reset handling if +they're going to be used with JTAG. +An example might be needing to send some commands right +after the target's TAP has been reset, providing a +@code{reset-deassert-post} event handler that writes a chip +register to report that JTAG debugging is being done. + @subsection ARM Core Specific Hacks If the chip has a DCC, enable it. If the chip is an ARM9 with some special high speed download features - enable it. -If the chip has an ARM ``vector catch'' feature - by default enable -it for Undefined Instructions, Data Abort, and Prefetch Abort, if the -user is really writing a handler for those situations - they can -easily disable it. Experiance has shown the ``vector catch'' is -helpful - for common programing errors. +If the chip supports the @command{arm9tdmi vector_catch}, +@command{xscale vector_catch}, or similar features, +consider enabling it in your user-specific configuration file. +Experience has shown the ``vector_catch'' can be +helpful for catching programming errors +like Undefined Instructions, Data Abort, and Prefetch Abort. If present, the MMU, the MPU and the CACHE should be disabled. @@ -2636,16 +2644,18 @@ @* The target has resumed (i.e.: gdb said run) @item @b{early-halted} @* Occurs early in the halt process +@ignore @item @b{examine-end} @* Currently not used (goal: when JTAG examine completes) @item @b{examine-start} @* Currently not used (goal: when JTAG examine starts) +@end ignore @item @b{gdb-attach} @* When GDB connects @item @b{gdb-detach} @* When GDB disconnects @item @b{gdb-end} -@* When the taret has halted and GDB is not doing anything (see early halt) +@* When the target has halted and GDB is not doing anything (see early halt) @item @b{gdb-flash-erase-start} @* Before the GDB flash process tries to erase the flash @item @b{gdb-flash-erase-end} @@ -2655,13 +2665,15 @@ @item @b{gdb-flash-write-end} @* After GDB writes to the flash @item @b{gdb-start} -@* Before the taret steps, gdb is trying to start/resume the target +@* Before the target steps, gdb is trying to start/resume the target @item @b{halted} @* The target has halted +@ignore @item @b{old-gdb_program_config} @* DO NOT USE THIS: Used internally @item @b{old-pre_resume} @* DO NOT USE THIS: Used internally +@end ignore @item @b{reset-assert-pre} @* Issued as part of @command{reset} processing after SRST and/or TRST were activated and deactivated, @@ -2681,10 +2693,12 @@ when reset has been released on the tap. @item @b{reset-end} @* Issued as the final step in @command{reset} processing. +@ignore @item @b{reset-halt-post} -@* Currently not usd +@* Currently not used @item @b{reset-halt-pre} @* Currently not used +@end ignore @item @b{reset-init} @* Used by @b{reset init} command for board-specific initialization. This event fires after @emph{reset-deassert-post}. @@ -2695,10 +2709,12 @@ @item @b{reset-start} @* Issued as part of @command{reset} processing before either SRST or TRST are activated. +@ignore @item @b{reset-wait-pos} @* Currently not used @item @b{reset-wait-pre} @* Currently not used +@end ignore @item @b{resume-start} @* Before any target is resumed @item @b{resume-end} @@ -3992,6 +4008,9 @@ at @var{address} for @var{length} bytes. This is a software breakpoint, unless @option{hw} is specified in which case it will be a hardware breakpoint. + +(@xref{arm9tdmi vector_catch}, or @pxref{xscale vector_catch}, +for similar mechanisms that do not consume hardware breakpoints.) @end deffn @deffn Command {rbp} address @@ -4348,8 +4367,22 @@ or processors resembling ARM9TDMI, and can use these commands. Such cores include the ARM920T, ARM926EJ-S, and ARM966. -@deffn Command {arm9tdmi vector_catch} (@option{all}|@option{none}|list) -Catch arm9 interrupt vectors, can be @option{all}, @option{none}, +@c 9-june-2009: tried this on arm920t, it didn't work. +@c no-params always lists nothing caught, and that's how it acts. + +@anchor{arm9tdmi vector_catch} +@deffn Command {arm9tdmi vector_catch} [@option{all}|@option{none}|list] +Vector Catch hardware provides a sort of dedicated breakpoint +for hardware events such as reset, interrupt, and abort. +You can use this to conserve normal breakpoint resources, +so long as you're not concerned with code that branches directly +to those hardware vectors. + +This always finishes by listing the current configuration. +If parameters are provided, it first reconfigures the +vector catch hardware to intercept +@option{all} of the hardware vectors, +@option{none} of them, or a list with one or more of the following: @option{reset} @option{undef} @option{swi} @option{pabt} @option{dabt} @option{reserved} @option{irq} @option{fiq}. @@ -4526,8 +4559,10 @@ @option{mem}, or @option{builder}. @end deffn -@deffn Command {xscale vector_catch} mask -Provide a bitmask showing the vectors to catch. +@anchor{xscale vector_catch} +@deffn Command {xscale vector_catch} [mask] +Display a bitmask showing the hardware vectors to catch. +If the optional parameter is provided, first set the bitmask to that value. @end deffn @section ARMv6 Architecture |
From: ntfreak at B. <nt...@ma...> - 2009-06-11 21:32:12
|
Author: ntfreak Date: 2009-06-11 21:32:10 +0200 (Thu, 11 Jun 2009) New Revision: 2202 Modified: trunk/src/target/mips32.c Log: - fix bug introduced during r1962 - Original patch submitted by David Claffey [dnc...@gm...]. Modified: trunk/src/target/mips32.c =================================================================== --- trunk/src/target/mips32.c 2009-06-11 13:07:20 UTC (rev 2201) +++ trunk/src/target/mips32.c 2009-06-11 19:32:10 UTC (rev 2202) @@ -346,7 +346,7 @@ { mips32_common_t *mips32 = target->arch_info; - if (target_was_examined(target)) + if (!target_was_examined(target)) { target_set_examined(target); |
From: oharboe at B. <oh...@ma...> - 2009-06-11 15:08:33
|
Author: oharboe Date: 2009-06-11 15:07:20 +0200 (Thu, 11 Jun 2009) New Revision: 2201 Modified: zy1000/trunk/build/openocd.ecm zy1000/trunk/snapshots/athttpd.zip zy1000/trunk/snapshots/discover.zip zy1000/trunk/snapshots/jimtcl.zip zy1000/trunk/snapshots/repository.zip Log: update eCos to CVS HEAD Modified: zy1000/trunk/build/openocd.ecm =================================================================== --- zy1000/trunk/build/openocd.ecm 2009-06-11 13:04:30 UTC (rev 2200) +++ zy1000/trunk/build/openocd.ecm 2009-06-11 13:07:20 UTC (rev 2201) @@ -62,9 +62,13 @@ }; cdl_option CYGBLD_GLOBAL_CFLAGS { - user_value "-mlong-calls -mcpu=arm7tdmi -Wall -Wpointer-arith -Winline -Wundef -g -O3 -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti " + user_value "-mlong-calls -mcpu=arm7tdmi -Wall -Wpointer-arith -Winline -Wundef -g -O3 -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti -mno-thumb-interwork " }; +cdl_option CYGBLD_GLOBAL_LDFLAGS { + inferred_value "-mcpu=arm7tdmi -Wl,--gc-sections -Wl,-static -g -nostdlib -mlong-calls -mno-thumb-interwork " +}; + cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { user_value 16384 }; @@ -435,6 +439,27 @@ inferred_value 1 }; +cdl_component CYGOPT_FS_JFFS2_COMPRESS { + user_value 0 +}; + +cdl_option CYGOPT_FS_JFFS2_COMPRESS_ZLIB { + user_value 0 + inferred_value 0 +}; + +cdl_option CYGOPT_FS_JFFS2_COMPRESS_RTIME { + user_value 0 +}; + +cdl_option CYGOPT_FS_JFFS2_COMPRESS_CMODE { + user_value NONE +}; + +cdl_option CYGBLD_FS_ROMFS_MK_ROMFS { + user_value 0 +}; + cdl_component CYGPKG_NET_TFTPD_CLIENT_BIG_PACKET { user_value 1 }; @@ -475,27 +500,14 @@ user_value 64 }; -cdl_component CYGOPT_FS_JFFS2_COMPRESS { - user_value 0 +cdl_component CYGPKG_IO_FLASH_BLOCK_DEVICE { + inferred_value 1 }; -cdl_option CYGOPT_FS_JFFS2_COMPRESS_ZLIB { - user_value 0 - inferred_value 0 +cdl_component CYGPKG_IO_FLASH_BLOCK_DEVICE_LEGACY { + user_value 1 }; -cdl_option CYGOPT_FS_JFFS2_COMPRESS_RTIME { - user_value 0 -}; - -cdl_option CYGOPT_FS_JFFS2_COMPRESS_CMODE { - user_value NONE -}; - -cdl_component CYGPKG_IO_FLASH_BLOCK_DEVICE { - inferred_value 1 -}; - cdl_option CYGNUM_IO_FLASH_BLOCK_OFFSET_1 { user_value 0x00040000 }; @@ -552,10 +564,6 @@ user_value 1 }; -cdl_option CYGBLD_FS_ROMFS_MK_ROMFS { - user_value 0 -}; - cdl_option CYGDAT_NET_DISCOVER_MESSAGE { user_value "\"ZY1000 Zylin JTAG debugger\"" }; Modified: zy1000/trunk/snapshots/athttpd.zip =================================================================== (Binary files differ) Modified: zy1000/trunk/snapshots/discover.zip =================================================================== (Binary files differ) Modified: zy1000/trunk/snapshots/jimtcl.zip =================================================================== (Binary files differ) Modified: zy1000/trunk/snapshots/repository.zip =================================================================== (Binary files differ) |
From: oharboe at B. <oh...@ma...> - 2009-06-11 15:04:30
|
Author: oharboe Date: 2009-06-11 15:04:30 +0200 (Thu, 11 Jun 2009) New Revision: 2200 Modified: zy1000/trunk/build/buildocd.sh Log: embedded host: use --enable-maintainer-mode in configure Modified: zy1000/trunk/build/buildocd.sh =================================================================== --- zy1000/trunk/build/buildocd.sh 2009-06-11 13:04:00 UTC (rev 2199) +++ zy1000/trunk/build/buildocd.sh 2009-06-11 13:04:30 UTC (rev 2200) @@ -19,7 +19,7 @@ rm -rf /tmp/ecosboard/build mkdir /tmp/ecosboard/build cd /tmp/ecosboard/build -$OPENOCD/../../openocd/configure --disable-bitbang --disable-werror --enable-ioutil --host=arm-elf --includedir=/tmp/ecosboard/ecos/install/include/ --enable-ecosboard --prefix=/tmp/ecosboard/ocdinstall +$OPENOCD/../../openocd/configure --enable-maintainer-mode --disable-bitbang --disable-werror --enable-ioutil --host=arm-elf --includedir=/tmp/ecosboard/ecos/install/include/ --enable-ecosboard --prefix=/tmp/ecosboard/ocdinstall echo >makephi.sh sh $OPENOCD/makephi.sh echo >>makephi.sh sh $OPENOCD/makefw.sh make |
From: oharboe at B. <oh...@ma...> - 2009-06-11 15:04:01
|
Author: oharboe Date: 2009-06-11 15:04:00 +0200 (Thu, 11 Jun 2009) New Revision: 2199 Modified: zy1000/trunk/build/makephi.sh Log: keep up with moving script files Modified: zy1000/trunk/build/makephi.sh =================================================================== --- zy1000/trunk/build/makephi.sh 2009-06-11 13:03:32 UTC (rev 2198) +++ zy1000/trunk/build/makephi.sh 2009-06-11 13:04:00 UTC (rev 2199) @@ -9,6 +9,7 @@ # copy over installed stuff cp -r /tmp/ecosboard/ocdinstall/lib/openocd/* tclconvert/ +cp -r /tmp/ecosboard/ocdinstall/share/openocd/scripts/* tclconvert/ # Create rom filing system if [ `uname` = Linux ] ;then $OPENOCD/mk_romfs tclconvert rom.bin |
From: oharboe at B. <oh...@ma...> - 2009-06-11 15:03:32
|
Author: oharboe Date: 2009-06-11 15:03:32 +0200 (Thu, 11 Jun 2009) New Revision: 2198 Modified: trunk/src/ecosboard.c zy1000/trunk/build/tcl/openocd.cfg Log: embedded host: launch telnet server even if configuration fails Modified: trunk/src/ecosboard.c =================================================================== --- trunk/src/ecosboard.c 2009-06-11 13:00:08 UTC (rev 2197) +++ trunk/src/ecosboard.c 2009-06-11 13:03:32 UTC (rev 2198) @@ -1046,6 +1046,9 @@ command_run_linef(cmd_ctx, "script /rom/openocd.cfg"); + /* we MUST always run the init command as it will launch telnet sessions */ + command_run_line(cmd_ctx, "init"); + // FIX!!! Yuk! // diag_printf() is really invoked from many more places than we trust it // not to cause instabilities(e.g. invoking fputc() from an interrupt is *BAD*). Modified: zy1000/trunk/build/tcl/openocd.cfg =================================================================== --- zy1000/trunk/build/tcl/openocd.cfg 2009-06-11 13:00:08 UTC (rev 2197) +++ zy1000/trunk/build/tcl/openocd.cfg 2009-06-11 13:03:32 UTC (rev 2198) @@ -124,7 +124,9 @@ # Here we do *not* catch the error since we want the file & line number to appear # in the log script /config/settings/openocd.cfg -init + # Startup was OK set startup_status 1 +# init is run from C code so we can propagate any exception in this +# script easily. \ No newline at end of file |
From: oharboe at B. <oh...@ma...> - 2009-06-11 15:00:16
|
Author: oharboe Date: 2009-06-11 15:00:08 +0200 (Thu, 11 Jun 2009) New Revision: 2197 Modified: trunk/src/helper/ioutil.c trunk/src/target/target.c Log: fix ordering of arguments to fwrite() Modified: trunk/src/helper/ioutil.c =================================================================== --- trunk/src/helper/ioutil.c 2009-06-11 11:43:07 UTC (rev 2196) +++ trunk/src/helper/ioutil.c 2009-06-11 13:00:08 UTC (rev 2197) @@ -225,7 +225,7 @@ for (i = 1; i < argc; i++) { - if (fwrite(args[i], strlen(args[i]), 1, config_file)!=strlen(args[i])) + if (fwrite(args[i], 1, strlen(args[i]), config_file)!=strlen(args[i])) break; if (i != argc - 1) { Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-11 11:43:07 UTC (rev 2196) +++ trunk/src/target/target.c 2009-06-11 13:00:08 UTC (rev 2197) @@ -2623,7 +2623,7 @@ static void writeData(FILE *f, const void *data, size_t len) { - size_t written = fwrite(data, len, 1, f); + size_t written = fwrite(data, 1, len, f); if (written != len) LOG_ERROR("failed to write %zu bytes: %s", len, strerror(errno)); } |
From: <zw...@ma...> - 2009-06-11 13:43:10
|
Author: zwelch Date: 2009-06-11 13:43:07 +0200 (Thu, 11 Jun 2009) New Revision: 2196 Modified: trunk/src/target/target.c Log: Factor handle_bp_command into pieces: - Bug fix: return a syntax error if the wrong number of arguments are given. - Add handle_bp_command_list() and handle_bp_command_set(). - Use temporary addr variable to eliminate redundant strtoul() calls. - Place variable declarations at their point of first use. Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-11 11:43:00 UTC (rev 2195) +++ trunk/src/target/target.c 2009-06-11 11:43:07 UTC (rev 2196) @@ -2449,57 +2449,69 @@ return handle_verify_image_command_internal(cmd_ctx, cmd, args, argc, 0); } -static int handle_bp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +static int handle_bp_command_list(struct command_context_s *cmd_ctx) { - int retval; target_t *target = get_current_target(cmd_ctx); - - if (argc == 0) + breakpoint_t *breakpoint = target->breakpoints; + while (breakpoint) { - breakpoint_t *breakpoint = target->breakpoints; - - while (breakpoint) + if (breakpoint->type == BKPT_SOFT) { - if (breakpoint->type == BKPT_SOFT) - { - char* buf = buf_to_str(breakpoint->orig_instr, breakpoint->length, 16); - command_print(cmd_ctx, "0x%8.8x, 0x%x, %i, 0x%s", breakpoint->address, breakpoint->length, breakpoint->set, buf); - free(buf); - } - else - { - command_print(cmd_ctx, "0x%8.8x, 0x%x, %i", breakpoint->address, breakpoint->length, breakpoint->set); - } - breakpoint = breakpoint->next; + char* buf = buf_to_str(breakpoint->orig_instr, + breakpoint->length, 16); + command_print(cmd_ctx, "0x%8.8x, 0x%x, %i, 0x%s", + breakpoint->address, breakpoint->length, + breakpoint->set, buf); + free(buf); } - } - else if (argc >= 2) - { - int hw = BKPT_SOFT; - u32 length = 0; - - length = strtoul(args[1], NULL, 0); - - if (argc >= 3) - if (strcmp(args[2], "hw") == 0) - hw = BKPT_HARD; - - if ((retval = breakpoint_add(target, strtoul(args[0], NULL, 0), length, hw)) != ERROR_OK) - { - LOG_ERROR("Failure setting breakpoints"); - } else { - command_print(cmd_ctx, "breakpoint added at address 0x%8.8lx", - strtoul(args[0], NULL, 0)); + command_print(cmd_ctx, "0x%8.8x, 0x%x, %i", + breakpoint->address, breakpoint->length, breakpoint->set); } + + breakpoint = breakpoint->next; } + return ERROR_OK; +} + +static int handle_bp_command_set(struct command_context_s *cmd_ctx, + u32 addr, u32 length, int hw) +{ + target_t *target = get_current_target(cmd_ctx); + int retval = breakpoint_add(target, addr, length, hw); + if (ERROR_OK == retval) + command_print(cmd_ctx, "breakpoint set at 0x%8.8x", addr); else + LOG_ERROR("Failure setting breakpoint"); + return retval; +} + +static int handle_bp_command(struct command_context_s *cmd_ctx, + char *cmd, char **args, int argc) +{ + if (argc == 0) + return handle_bp_command_list(cmd_ctx); + + if (argc < 2 || argc > 3) { command_print(cmd_ctx, "usage: bp <address> <length> ['hw']"); + return ERROR_COMMAND_SYNTAX_ERROR; } - return ERROR_OK; + u32 addr = strtoul(args[0], NULL, 0); + u32 length = strtoul(args[1], NULL, 0); + + int hw = BKPT_SOFT; + if (argc == 3) + { + if (strcmp(args[2], "hw") == 0) + hw = BKPT_HARD; + else + return ERROR_COMMAND_SYNTAX_ERROR; + } + + return handle_bp_command_set(cmd_ctx, addr, length, hw); } static int handle_rbp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) |
From: <zw...@ma...> - 2009-06-11 13:43:03
|
Author: zwelch Date: 2009-06-11 13:43:00 +0200 (Thu, 11 Jun 2009) New Revision: 2195 Modified: trunk/src/target/target.c Log: Factor target_timer_callbacks_check_time into pieces: - Add target_timer_callback_periodic_restart and target_call_timer_callback. - Clean up and simplify logic that determines whether to call each callback. - Move variable declarations to location of first use. Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-11 11:42:54 UTC (rev 2194) +++ trunk/src/target/target.c 2009-06-11 11:43:00 UTC (rev 2195) @@ -821,46 +821,56 @@ return ERROR_OK; } +static int target_timer_callback_periodic_restart( + target_timer_callback_t *cb, struct timeval *now) +{ + int time_ms = cb->time_ms; + cb->when.tv_usec = now->tv_usec + (time_ms % 1000) * 1000; + time_ms -= (time_ms % 1000); + cb->when.tv_sec = now->tv_sec + time_ms / 1000; + if (cb->when.tv_usec > 1000000) + { + cb->when.tv_usec = cb->when.tv_usec - 1000000; + cb->when.tv_sec += 1; + } + return ERROR_OK; +} + +static int target_call_timer_callback(target_timer_callback_t *cb, + struct timeval *now) +{ + cb->callback(cb->priv); + + if (cb->periodic) + return target_timer_callback_periodic_restart(cb, now); + + return target_unregister_timer_callback(cb->callback, cb->priv); +} + static int target_call_timer_callbacks_check_time(int checktime) { - target_timer_callback_t *callback = target_timer_callbacks; - target_timer_callback_t *next_callback; - struct timeval now; - keep_alive(); + struct timeval now; gettimeofday(&now, NULL); + target_timer_callback_t *callback = target_timer_callbacks; while (callback) { - next_callback = callback->next; + // cleaning up may unregister and free this callback + target_timer_callback_t *next_callback = callback->next; - if ((!checktime&&callback->periodic)|| - (((now.tv_sec >= callback->when.tv_sec) && (now.tv_usec >= callback->when.tv_usec)) - || (now.tv_sec > callback->when.tv_sec))) + bool call_it = callback->callback && + ((!checktime && callback->periodic) || + now.tv_sec > callback->when.tv_sec || + (now.tv_sec == callback->when.tv_sec && + now.tv_usec >= callback->when.tv_usec)); + + if (call_it) { - if(callback->callback != NULL) - { - callback->callback(callback->priv); - if (callback->periodic) - { - int time_ms = callback->time_ms; - callback->when.tv_usec = now.tv_usec + (time_ms % 1000) * 1000; - time_ms -= (time_ms % 1000); - callback->when.tv_sec = now.tv_sec + time_ms / 1000; - if (callback->when.tv_usec > 1000000) - { - callback->when.tv_usec = callback->when.tv_usec - 1000000; - callback->when.tv_sec += 1; - } - } - else - { - int retval; - if((retval = target_unregister_timer_callback(callback->callback, callback->priv)) != ERROR_OK) - return retval; - } - } + int retval = target_call_timer_callback(callback, &now); + if (retval != ERROR_OK) + return retval; } callback = next_callback; |
From: <zw...@ma...> - 2009-06-11 13:42:57
|
Author: zwelch Date: 2009-06-11 13:42:54 +0200 (Thu, 11 Jun 2009) New Revision: 2194 Modified: trunk/src/target/target.c Log: Simplify and clean handle_virt2phys_command: - Add a doxygen block to simplify logic. - Move declarations to point of first use. Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-11 11:42:47 UTC (rev 2193) +++ trunk/src/target/target.c 2009-06-11 11:42:54 UTC (rev 2194) @@ -2575,30 +2575,27 @@ return ERROR_OK; } -static int handle_virt2phys_command(command_context_t *cmd_ctx, char *cmd, char **args, int argc) -{ - int retval; - target_t *target = get_current_target(cmd_ctx); - u32 va; - u32 pa; +/** + * Translate a virtual address to a physical address. + * + * The low-level target implementation must have logged a detailed error + * which is forwarded to telnet/GDB session. + */ +static int handle_virt2phys_command(command_context_t *cmd_ctx, + char *cmd, char **args, int argc) +{ if (argc != 1) - { return ERROR_COMMAND_SYNTAX_ERROR; - } - va = strtoul(args[0], NULL, 0); - retval = target->type->virt2phys(target, va, &pa); + target_t *target = get_current_target(cmd_ctx); + u32 va = strtoul(args[0], NULL, 0); + u32 pa; + + int retval = target->type->virt2phys(target, va, &pa); if (retval == ERROR_OK) - { command_print(cmd_ctx, "Physical address 0x%08x", pa); - } - else - { - /* lower levels will have logged a detailed error which is - * forwarded to telnet/GDB session. - */ - } + return retval; } |
From: <zw...@ma...> - 2009-06-11 13:42:51
|
Author: zwelch Date: 2009-06-11 13:42:47 +0200 (Thu, 11 Jun 2009) New Revision: 2193 Modified: trunk/src/target/target.c Log: Simplify and fix target handle_rwp_command routine: - Return syntax error unless exactly one argument is passed. - Move variable declaration to point of first use. Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-11 11:42:40 UTC (rev 2192) +++ trunk/src/target/target.c 2009-06-11 11:42:47 UTC (rev 2193) @@ -2566,11 +2566,12 @@ static int handle_rwp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { + if (argc != 1) + return ERROR_COMMAND_SYNTAX_ERROR; + target_t *target = get_current_target(cmd_ctx); + watchpoint_remove(target, strtoul(args[0], NULL, 0)); - if (argc > 0) - watchpoint_remove(target, strtoul(args[0], NULL, 0)); - return ERROR_OK; } |
From: <zw...@ma...> - 2009-06-11 13:42:45
|
Author: zwelch Date: 2009-06-11 13:42:40 +0200 (Thu, 11 Jun 2009) New Revision: 2192 Modified: trunk/src/target/target.c Log: Simplify and fix handle_reset_command: - Return syntax error if more than one argument is given. - Move variables to location of first use. Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-11 11:42:33 UTC (rev 2191) +++ trunk/src/target/target.c 2009-06-11 11:42:40 UTC (rev 2192) @@ -1912,11 +1912,13 @@ static int handle_reset_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - const Jim_Nvp *n; + if (argc > 1) + return ERROR_COMMAND_SYNTAX_ERROR; + enum target_reset_mode reset_mode = RESET_RUN; - - if (argc >= 1) + if (argc == 1) { + const Jim_Nvp *n; n = Jim_Nvp_name2value_simple( nvp_reset_modes, args[0] ); if( (n->name == NULL) || (n->value == RESET_UNKNOWN) ){ return ERROR_COMMAND_SYNTAX_ERROR; |
From: <zw...@ma...> - 2009-06-11 13:42:37
|
Author: zwelch Date: 2009-06-11 13:42:33 +0200 (Thu, 11 Jun 2009) New Revision: 2191 Modified: trunk/src/target/target.c Log: Simplify handle_resume_command: - Eliminate redundant calls to target_resume with addr temp variable. - Place variables at location of first use. - Fix minor whitespace issues. Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-11 11:42:26 UTC (rev 2190) +++ trunk/src/target/target.c 2009-06-11 11:42:33 UTC (rev 2191) @@ -1931,21 +1931,20 @@ static int handle_resume_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - int retval; + if (argc > 1) + return ERROR_COMMAND_SYNTAX_ERROR; + target_t *target = get_current_target(cmd_ctx); + target_handle_event(target, TARGET_EVENT_OLD_pre_resume); - target_handle_event( target, TARGET_EVENT_OLD_pre_resume ); + /* with no args, resume from current pc, addr = 0, + * with one arguments, addr = args[0], + * handle breakpoints, not debugging */ + u32 addr = 0; + if (argc == 1) + addr = strtoul(args[0], NULL, 0); - if (argc == 0) - retval = target_resume(target, 1, 0, 1, 0); /* current pc, addr = 0, handle breakpoints, not debugging */ - else if (argc == 1) - retval = target_resume(target, 0, strtoul(args[0], NULL, 0), 1, 0); /* addr = args[0], handle breakpoints, not debugging */ - else - { - retval = ERROR_COMMAND_SYNTAX_ERROR; - } - - return retval; + return target_resume(target, 0, addr, 1, 0); } static int handle_step_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) |
From: <zw...@ma...> - 2009-06-11 13:42:31
|
Author: zwelch Date: 2009-06-11 13:42:26 +0200 (Thu, 11 Jun 2009) New Revision: 2190 Modified: trunk/src/target/target.c Log: Simplify and fix handle_step_command: - Bug fix: return syntax error when more than one argument is given. - Eliminate redundant calls to step callback with addr temp variable. - Place variables at location of first use. Modified: trunk/src/target/target.c =================================================================== --- trunk/src/target/target.c 2009-06-11 07:08:45 UTC (rev 2189) +++ trunk/src/target/target.c 2009-06-11 11:42:26 UTC (rev 2190) @@ -1950,17 +1950,20 @@ static int handle_step_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - target_t *target = get_current_target(cmd_ctx); + if (argc > 1) + return ERROR_COMMAND_SYNTAX_ERROR; LOG_DEBUG("-"); - if (argc == 0) - return target->type->step(target, 1, 0, 1); /* current pc, addr = 0, handle breakpoints */ - + /* with no args, step from current pc, addr = 0, + * with one argument addr = args[0], + * handle breakpoints, debugging */ + u32 addr = 0; if (argc == 1) - return target->type->step(target, 0, strtoul(args[0], NULL, 0), 1); /* addr = args[0], handle breakpoints */ + addr = strtoul(args[0], NULL, 0); - return ERROR_OK; + target_t *target = get_current_target(cmd_ctx); + return target->type->step(target, 0, addr, 1); } static void handle_md_output(struct command_context_s *cmd_ctx, |
From: <zw...@ma...> - 2009-06-11 09:08:48
|
Author: zwelch Date: 2009-06-11 09:08:45 +0200 (Thu, 11 Jun 2009) New Revision: 2189 Modified: trunk/src/jtag/jtag.h Log: Move jtag_get_flush_queue_count near jtag_execute_queue (fix its docs). Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-11 07:08:34 UTC (rev 2188) +++ trunk/src/jtag/jtag.h 2009-06-11 07:08:45 UTC (rev 2189) @@ -621,9 +621,13 @@ */ extern int jtag_execute_queue(void); -/* same as jtag_execute_queue() but does not clear the error flag */ +/// same as jtag_execute_queue() but does not clear the error flag extern void jtag_execute_queue_noclear(void); +/// @returns the number of times the scan queue has been flushed +int jtag_get_flush_queue_count(void); + + /* can be implemented by hw+sw */ extern int jtag_power_dropout(int* dropout); extern int jtag_srst_asserted(int* srst_asserted); @@ -686,9 +690,6 @@ tap_state_t end_state); -/// @returns the number of times the scan queue has been flushed -int jtag_get_flush_queue_count(void); - /** * Set the current JTAG core execution error, unless one was set * by a previous call previously. Driver or application code must |
From: <zw...@ma...> - 2009-06-11 09:08:40
|
Author: zwelch Date: 2009-06-11 09:08:34 +0200 (Thu, 11 Jun 2009) New Revision: 2188 Modified: trunk/src/jtag/jtag.h Log: Improve grouping of JTAG KHz and verification accessors in header file. Add some quick Doxygen comments for these routines. Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-11 07:08:28 UTC (rev 2187) +++ trunk/src/jtag/jtag.h 2009-06-11 07:08:34 UTC (rev 2188) @@ -250,6 +250,15 @@ */ int jtag_set_speed(int speed); + +/// Attempt to configure the interface for the specified KHz. +int jtag_config_khz(unsigned khz); +/// Set the clock speed of the JTAG interface in KHz. +void jtag_set_speed_khz(unsigned speed); +/// Retreives the clock speed of the JTAG interface in KHz. +unsigned jtag_get_speed_khz(void); + + enum reset_types { RESET_NONE = 0x0, RESET_HAS_TRST = 0x1, @@ -275,7 +284,15 @@ /// @returns The current state of SRST. int jtag_get_srst(void); +/// Enable or disable data scan verification checking. +void jtag_set_verify(bool enable); +/// @returns True if data scan verification will be performed. +bool jtag_will_verify(void); +/// Enable or disable verification of IR scan checking. +void jtag_set_verify_capture_ir(bool enable); +/// @returns True if IR scan verification will be performed. +bool jtag_will_verify_capture_ir(void); /** * Initialize interface upon startup. Return a successful no-op upon @@ -672,16 +689,6 @@ /// @returns the number of times the scan queue has been flushed int jtag_get_flush_queue_count(void); -int jtag_config_khz(unsigned khz); -void jtag_set_speed_khz(unsigned speed); -unsigned jtag_get_speed_khz(void); - -void jtag_set_verify(bool enable); -bool jtag_will_verify(void); - -void jtag_set_verify_capture_ir(bool enable); -bool jtag_will_verify_capture_ir(void); - /** * Set the current JTAG core execution error, unless one was set * by a previous call previously. Driver or application code must |
From: <zw...@ma...> - 2009-06-11 09:08:31
|
Author: zwelch Date: 2009-06-11 09:08:28 +0200 (Thu, 11 Jun 2009) New Revision: 2187 Modified: trunk/src/jtag/jtag.h Log: Group JTAG reset configuration and accessor APIs together in header file. Remove unused reset_line_mode enumerated type. Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-11 07:08:21 UTC (rev 2186) +++ trunk/src/jtag/jtag.h 2009-06-11 07:08:28 UTC (rev 2187) @@ -185,11 +185,6 @@ extern unsigned jtag_tap_count(void); -enum reset_line_mode { - LINE_OPEN_DRAIN = 0x0, - LINE_PUSH_PULL = 0x1, -}; - /* * 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 @@ -217,11 +212,6 @@ jtag_tap_event_action_t* next; }; -/// @returns The current state of TRST. -int jtag_get_trst(void); -/// @returns The current state of SRST. -int jtag_get_srst(void); - /** * Defines the function signature requide for JTAG event callback * functions, which are added with jtag_register_event_callback() @@ -274,6 +264,19 @@ enum reset_types jtag_get_reset_config(void); void jtag_set_reset_config(enum reset_types type); +void jtag_set_nsrst_delay(unsigned delay); +unsigned jtag_get_nsrst_delay(void); + +void jtag_set_ntrst_delay(unsigned delay); +unsigned jtag_get_ntrst_delay(void); + +/// @returns The current state of TRST. +int jtag_get_trst(void); +/// @returns The current state of SRST. +int jtag_get_srst(void); + + + /** * Initialize interface upon startup. Return a successful no-op upon * subsequent invocations. @@ -669,12 +672,6 @@ /// @returns the number of times the scan queue has been flushed int jtag_get_flush_queue_count(void); -void jtag_set_nsrst_delay(unsigned delay); -unsigned jtag_get_nsrst_delay(void); - -void jtag_set_ntrst_delay(unsigned delay); -unsigned jtag_get_ntrst_delay(void); - int jtag_config_khz(unsigned khz); void jtag_set_speed_khz(unsigned speed); unsigned jtag_get_speed_khz(void); |
From: <zw...@ma...> - 2009-06-11 09:08:24
|
Author: zwelch Date: 2009-06-11 09:08:21 +0200 (Thu, 11 Jun 2009) New Revision: 2186 Modified: trunk/src/jtag/jtag.h Log: Move jtag_error helper declarations to the end of the header. Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-11 07:08:14 UTC (rev 2185) +++ trunk/src/jtag/jtag.h 2009-06-11 07:08:21 UTC (rev 2186) @@ -604,21 +604,6 @@ /* same as jtag_execute_queue() but does not clear the error flag */ extern void jtag_execute_queue_noclear(void); -/** - * Set the current JTAG core execution error, unless one was set - * by a previous call previously. Driver or application code must - * use jtag_error_clear to reset jtag_error once this routine has been - * called with a non-zero error code. - */ -void jtag_set_error(int error); -/// @returns The current value of jtag_error -int jtag_get_error(void); -/** - * Resets jtag_error to ERROR_OK, returning its previous value. - * @returns The previous value of @c jtag_error. - */ -int jtag_error_clear(void); - /* can be implemented by hw+sw */ extern int jtag_power_dropout(int* dropout); extern int jtag_srst_asserted(int* srst_asserted); @@ -700,4 +685,19 @@ void jtag_set_verify_capture_ir(bool enable); bool jtag_will_verify_capture_ir(void); +/** + * Set the current JTAG core execution error, unless one was set + * by a previous call previously. Driver or application code must + * use jtag_error_clear to reset jtag_error once this routine has been + * called with a non-zero error code. + */ +void jtag_set_error(int error); +/// @returns The current value of jtag_error +int jtag_get_error(void); +/** + * Resets jtag_error to ERROR_OK, returning its previous value. + * @returns The previous value of @c jtag_error. + */ +int jtag_error_clear(void); + #endif /* JTAG_H */ |
From: <zw...@ma...> - 2009-06-11 09:08:18
|
Author: zwelch Date: 2009-06-11 09:08:14 +0200 (Thu, 11 Jun 2009) New Revision: 2185 Modified: trunk/src/jtag/core.c trunk/src/jtag/jtag.h Log: Out-of-line jtag_tap_next_enabled and simplify its logic. Modified: trunk/src/jtag/core.c =================================================================== --- trunk/src/jtag/core.c 2009-06-11 07:08:03 UTC (rev 2184) +++ trunk/src/jtag/core.c 2009-06-11 07:08:14 UTC (rev 2185) @@ -202,6 +202,18 @@ return t; } +jtag_tap_t* jtag_tap_next_enabled(jtag_tap_t* p) +{ + p = p ? p->next_tap : jtag_all_taps(); + while (p) + { + if (p->enabled) + return p; + p = p->next_tap; + } + return NULL; +} + const char *jtag_tap_name(const jtag_tap_t *tap) { return (tap == NULL) ? "(unknown)" : tap->dotted_name; Modified: trunk/src/jtag/jtag.h =================================================================== --- trunk/src/jtag/jtag.h 2009-06-11 07:08:03 UTC (rev 2184) +++ trunk/src/jtag/jtag.h 2009-06-11 07:08:14 UTC (rev 2185) @@ -180,37 +180,11 @@ extern jtag_tap_t* jtag_tap_by_string(const char* dotted_name); extern jtag_tap_t* jtag_tap_by_jim_obj(Jim_Interp* interp, Jim_Obj* obj); extern jtag_tap_t* jtag_tap_by_position(unsigned abs_position); +extern jtag_tap_t* jtag_tap_next_enabled(jtag_tap_t* p); extern unsigned jtag_tap_count_enabled(void); extern unsigned jtag_tap_count(void); -static __inline__ jtag_tap_t* jtag_tap_next_enabled(jtag_tap_t* p) -{ - if (p == NULL) - { - /* start at the head of list */ - p = jtag_all_taps(); - } - else - { - /* start *after* this one */ - p = p->next_tap; - } - while (p) - { - if (p->enabled) - { - break; - } - else - { - p = p->next_tap; - } - } - return p; -} - - enum reset_line_mode { LINE_OPEN_DRAIN = 0x0, LINE_PUSH_PULL = 0x1, |