diff options
author | Tomek CEDRO <cederom@tlen.pl> | 2011-09-11 00:56:26 +0000 |
---|---|---|
committer | Tomek CEDRO <cederom@tlen.pl> | 2011-09-11 00:56:26 +0000 |
commit | 7fafb0add5d07540964cde734f41aff650eafefc (patch) | |
tree | 497701cee758c0fa16a6962c325c1f882cbd28fc /src/transport/swd_core.c | |
parent | 7206efdd9e7aa79666ce599116872a5244d32d9e (diff) | |
download | openocd+libswd-7fafb0add5d07540964cde734f41aff650eafefc.tar.gz openocd+libswd-7fafb0add5d07540964cde734f41aff650eafefc.tar.bz2 openocd+libswd-7fafb0add5d07540964cde734f41aff650eafefc.tar.xz openocd+libswd-7fafb0add5d07540964cde734f41aff650eafefc.zip |
transport/swd: Changes in logging mechanism: 1. LogLevel is inherited during transport initialization and only if context is created. 2. swd_log() use vprintf as using openocd logging mechanisms caused program crash by va recurrence. 3. Fixed tcl interface to use/update loglevel configuration parameter from swdctx stored within dap.
Diffstat (limited to 'src/transport/swd_core.c')
-rw-r--r-- | src/transport/swd_core.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/transport/swd_core.c b/src/transport/swd_core.c index 834810c3..383199f2 100644 --- a/src/transport/swd_core.c +++ b/src/transport/swd_core.c @@ -47,8 +47,6 @@ #endif #include <transport/swd.h> -#include <jtag/interface.h> //we want this here to use extern global *interface -#include <unistd.h> ///Unfortunalety OpenOCD use globals to pass information so we need to use it too. extern struct jtag_interface *jtag_interface; @@ -144,18 +142,15 @@ int oocd_swd_transport_init(struct command_context *ctx){ return ERROR_FAIL; } LOG_INFO("New SWD context initialized at 0x%p", (void *)dap->ctx); + /* Now inherit the log level from OpenOCD settings. */ + if (swd_log_level_inherit((swd_ctx_t *)dap->ctx, debug_level)<0){ + LOG_ERROR("Unable to set log level: %s", swd_error_string(retval)); + return ERROR_FAIL; + } } else LOG_INFO("Working on existing transport context at 0x%p...", (void *)dap->ctx); - retval=swd_log_level_inherit((swd_ctx_t *)dap->ctx, debug_level); - if (retval<0){ - LOG_ERROR("Unable to set log level: %s", swd_error_string(retval)); - return ERROR_FAIL; - } - - - /** - * Initialize the driver to work with selected transport. + * Initialize driver and detect target working with selected transport. * Because we can work on existing context there is no need to destroy it, * as it can be used on next try. */ |