aboutsummaryrefslogtreecommitdiff
path: root/src/helper
AgeCommit message (Collapse)AuthorFilesLines
2018-04-30Merge branch 'riscv' into notice_resetTim Newsome8-12/+73
2018-04-20Fix mingw32 build.Tim Newsome1-1/+2
Change-Id: If7a57749ba8c49385a4020ce8d2d8dbb94242122
2018-04-20Fix error messages for reset dmi timeouts.Tim Newsome1-0/+1
Change-Id: I00869ba20db6f27415af8e53e7b3e67741bf894d
2018-03-12helper/types: cast to uint32_t,uint16_t to avoid UB by shifting int too farCody P Schafer1-6/+6
Without this, we have some types promoted to `int` when they need to be `unsigned int`. Here's some ubsan output hitting this: Unfortunately, what happens is that things get promoted to `int`, but need to be `unsigned int`. Here's the ubsan output: src/helper/types.h:126:65: runtime error: left shift of 255 by 24 places cannot be represented in type 'int' #0 0x55978a612060 in le_to_h_u32 src/helper/types.h:126 #1 0x55978a61ff9e in stlink_usb_read_reg src/jtag/drivers/stlink_usb.c:1539 #2 0x55978a8cfd45 in adapter_load_core_reg_u32 src/target/hla_target.c:67 #3 0x55978a9f48e3 in armv7m_read_core_reg src/target/armv7m.c:236 #4 0x55978a8d24fc in adapter_load_context src/target/hla_target.c:372 #5 0x55978a8d261b in adapter_debug_entry src/target/hla_target.c:396 #6 0x55978a8d3123 in adapter_poll src/target/hla_target.c:457 #7 0x55978a528357 in target_poll src/target/target.c:535 #8 0x55978a539fd4 in target_wait_state src/target/target.c:2914 #9 0x55978a556e20 in jim_target_wait_state src/target/target.c:5256 #10 0x55978a5cca62 in command_unknown src/helper/command.c:1030 #11 0x55978aaed894 in JimInvokeCommand /home/cody/d/openocd-code/jimtcl/jim.c:10364 Change-Id: I24f6abfd26b6980100657397d69c84f2b80a005a Signed-off-by: Cody P Schafer <openocd@codyps.com> Reviewed-on: http://openocd.zylin.com/4455 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins Reviewed-by: Christopher Head <chead@zaber.com>
2018-03-07helper/configuration: free script_search_dirs and config_file_namesTomas Vanek2-0/+17
Although the leak is negligible, the clean heap on exit will ease valgrind testing. Change-Id: If43f02fe594c30ceb1bea3259ea3e098d4b2d239 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4408 Tested-by: jenkins Reviewed-by: Marc Schink <openocd-dev@marcschink.de>
2018-03-07helper/command.h: Add missing #include for target_addr_tMarc Schink1-0/+2
Change-Id: Ic406257c0da6e1889d4434cc98cf59c2b97aa30c Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4052 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-03-07helper/types.h: Add missing #includesMarc Schink1-0/+5
Change-Id: I02ae0fb9527c4b87308da9c2cab66c80d84579eb Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4050 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-03-07helper/command.h: Add missing #includesMarc Schink1-0/+2
Change-Id: I84650a51cdb015f5e8ae933a3288f6e87f9fb80b Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4049 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-03-07helper/replacements.h: Add missing #includeMarc Schink1-0/+2
Change-Id: Ic6c47f7fbc999d00ef3211c1fa44867e3aabc321 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4057 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-03-03target: use correct target in target-prefixed commands and event handlersTomas Vanek2-6/+33
This change contains an alternative to Matthias Welwarsky's #4130 (target-prefixed commands) and to #4293 (event handlers). get_current_target() must retrieve the target associated to the current command. If no target associated, the current target of the command context is used as a fallback. Many Tcl event handlers work with the current target as if it were the target issuing the event. current_target in command_context is a number and has to be converted to a pointer in every get_current_target() call. The solution: - Replace current_target in command_context by a target pointer - Add another target pointer current_target_override - get_current_target() returns current_target_override if set, otherwise current_target - Save, set and restore current_target_override to the current prefix in run_command() - Save, set and restore current_target_override to the event invoking target in target_handle_event() While on it use calloc when allocating a new command_context. Change-Id: I9a82102e94dcac063743834a1d28da861b2e74ea Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Suggested-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com> Reviewed-on: http://openocd.zylin.com/4295 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-02-14Handle improperly build image files gracefullyAndreas Bolsch2-0/+6
Images build improperly (by simply concatenating separate images) were accepted, but anything after the first end-of-file record *silently* ignored. Now emit warning for intel and motorola images upon non-whitespace after first end-of-file record but continue reading anyway. ST ships some images broken that way in their CubeMX packages ... Change-Id: I0c5d08fa90070fed11fb805c5f0dc39817048176 Signed-off-by: Andreas Bolsch <hyphen0break@gmail.com> Reviewed-on: http://openocd.zylin.com/4281 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-01-25Add read buffer to bitbang, improving performance.Tim Newsome1-0/+11
Previously for every bit scanned OpenOCD would write the bit, wait for that bit to be scanned, and then read the result. This involves at least 2 context switches. Most of the time the next bit scanned does not depend on the last bit we read, so with a buffer we now write a bunch of bits to be scanned all at once, and then we wait for them all to be scanned and have a result. This reduces the time for one testcase where OpenOCD connects to a simulator from 12.30s to 5.35s! Running all our tests went from 13m13s to 3m55s. Change-Id: Ie9fcea043ac1d7877a521125334ed47d4b3e1615 Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: http://openocd.zylin.com/4312 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2018-01-25Add timeval_compare helper functionChristopher Head2-0/+16
Change-Id: Id75727a150912ff778a4fa32ad56467da33a6324 Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/4379 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-01-17Fix Jim interpreter memory leakMarc Schink2-0/+17
Change-Id: I71d7d97e7dc315c42fc43b65cb5fcecd7bdfb581 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/2959 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2017-10-23Fix GCC7 warnings about switch-case fallthroughsFreddie Chopin1-1/+1
GCC7 with -Wextra warns about switch-case blocks which fallthrough with "this statement may fall through [-Werror=implicit-fallthrough=]". This can be fixed by adding "special" comments: "/* fallthrough */". See https://gcc.gnu.org/gcc-7/changes.html Change-Id: Iba0be791dbdd86984489b2d9a0592bb59828da1e Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-on: http://openocd.zylin.com/4174 Tested-by: jenkins
2017-10-03Fix typo in comment.Tim Newsome1-1/+1
Change-Id: I6567f85f399315e1dac98881765dfaa6eab5facb Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: http://openocd.zylin.com/4238 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2017-10-03helper/options: Add missing #include for MinGW and MSYS2Marc Schink1-0/+3
Change-Id: I3bb295f52706b641661241e3e047306811ca915e Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4201 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2017-08-10log: Add a new debug level (4) for verbose I/O debugAndreas Fritiofson2-6/+18
Change ftdi SWD driver and CMSIS-DAP to use it instead of LOG_DEBUG(). Change-Id: I17ba3de2086c7159209db61fba3faf067dfc5023 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3805 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2017-04-23help/log.c: better error handling for "log_output"Girts1-3/+9
* Close previous log file if one was opened before. * Return error if opening file fails. Change-Id: I103025cd86bcac785fe39e13bc7d5f79d78e38e7 Signed-off-by: Girts Folkmanis <opensource@girts.me> Reviewed-on: http://openocd.zylin.com/3878 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-04-23helper/options.c: fail if unexpected cmdline arguments are presentGirts1-0/+9
Previously openocd would silently ignore any incorrect arguments. Change-Id: Ibb40b57b8a9e07d191215486f3b3c4920a9963c7 Signed-off-by: Girts Folkmanis <opensource@girts.me> Reviewed-on: http://openocd.zylin.com/3879 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2017-04-23help/options.c: add error handling for -d argGirts1-2/+5
Fail if we fail to set debug level. Also, clarify in usage string that -d<n> doesn't accept spaces. Change-Id: I9ea9945dc068e3e7cfd18b16ffa2a29366d6e4d1 Signed-off-by: Girts Folkmanis <opensource@girts.me> Reviewed-on: http://openocd.zylin.com/3880 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2017-02-10target: Add 64-bit target address supportDongxue Zhang3-2/+36
Define a target_addr_t type to support 32-bit and 64-bit addresses at the same time. Also define matching TARGET_PRI*ADDR format macros as well as a convenient TARGET_ADDR_FMT. In targets that are 32-bit (avr32, nds32, arm7/9/11, fm4, xmc1000) be least invasive by leaving the formatting unchanged apart from the type; for generic code adopt TARGET_ADDR_FMT as unified address format. Don't silently change gdb formatting here, leave that to later. Add COMMAND_PARSE_ADDRESS() macro to abstract the address type. Implement it using its own parse_target_addr() function, in the hopes of catching pointer type mismatches better. Add '--disable-target64' configure option to revert to previous 32-bit target address behavior. Change-Id: I2e91d205862ceb14f94b3e72a7e99ee0373a85d5 Signed-off-by: Dongxue Zhang <elta.era@gmail.com> Signed-off-by: David Ung <david.ung.42@gmail.com> [AF: Default to enabling (Paul Fertser), rename macros, simplify] Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
2017-01-15helper,rtos,server: Restore missing warning flagsAndreas Fritiofson1-1/+1
These libraries override the used CFLAGS without adding the defaults. This didn't have any effect until change http://openocd.zylin.com/3870 (ef4c139). Restore by adding AM_CLAGS to the per-target CFLAGS. Interestingly, automake seems to clear the CFLAGS for the target even if the override variable is only mentioned within a non-active conditional branch, such as the IS_MINGW for the affected libraries. Change-Id: I805206865e59e3fa33a7ea3c0d3472e51219351c Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3927 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2016-12-25Search for scripts relative to the executable on all(?) platformsAndreas Fritiofson1-33/+122
Add a helper to hide the platform-dependent method to get a canonical, absolute, /-separated path to the executable. Use this and the relative path from BINDIR to PKGDATADIR to construct a search path that finds the scripts even if the installation dir is moved, as long as the structure below $prefix is maintained. This method should fully support all the tricks you can to with autotools to customize the installed layout such as overriding the default directories at configure-time and overriding the configured directories at build-time. The exe path detection methods are combined from http://openocd.zylin.com/3388 by Rick Foos and http://openocd.zylin.com/3537 by Steven Stallion, as well as tips found all over internet. Change-Id: Ifc9cc9dd0bf52fbd67b1b0f2383318cda0c422c4 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Signed-off-by: Steven Stallion <sstallion@gmail.com> Reviewed-on: http://openocd.zylin.com/3889 Tested-by: jenkins Reviewed-by: Rick Foos <rfoos@solengtech.com> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2016-12-08Convert to non-recursive makeAndreas Fritiofson1-47/+40
Change-Id: I11f8bc8553957e2ff083c09e72e16881e4d3bb6f Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3865 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2016-12-08helper: Code cleanup for hexify()Marc Schink2-9/+30
Simplify hexify() and do not longer use 0 as special case for the parameter 'count' to determine the string length of the binary input. Instead, use strlen() outside of the function if needed. Additionally, fix the return value and return the length of the converted string. The old function always returned 2 * count. Also, use more appropriate data types for the function parameters and add a small documentation. Change-Id: I133a8ab786b8f7c1296afcaf9c0a0b43881e5112 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3793 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2016-12-08helper: Update jep106 database to JEP106ATAndreas Fritiofson1-4/+41
Change-Id: I2dac416189d16938597c073fd35ad654bca7484c Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3871 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2016-10-17helper: Make unhexify() robust on invalid dataMarc Schink2-8/+33
The current implementation is not suitable for user provided data because it does not detect invalid inputs in many cases. For example, the string "aa0xbb" is successfully converted to the 3 bytes: 0xaa, 0x00 and 0xbb. An other example is "aabi" which is successfully converted to the 2 bytes: 0xaa and 0x0b. Both are obviously incorrect. Make unhexify() robust on invalid data and use more appropriate data types for its parameters. Also, add a small documentation for the function. Change-Id: Idb799beb86fc608b066c8a76365021ed44c7f890 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3792 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2016-10-07helper/log: Add log_vprintf_lf()Marc Schink2-14/+27
Add log_vprintf_lf() to enable the possibility to output log messages with a variable argument list. Change-Id: I7fd6e93db63a7d98f662df2881a42e4d923c3848 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3709 Tested-by: jenkins Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2016-07-19Fix usage of timeval_ms()Andreas Färber3-10/+10
First, fix the timeval_ms() implementation to not have K&R but ANSI argument semantics by adding a missing void. timeval_ms() returns an int64_t, not uint64_t or long long. Consistently use int64_t for variables and PRI*64 as format string. While at it, change a few related variables to bool for clarity. Note that timeval_ms() may return a negative error code, but not a single caller checks for that. Change-Id: I27cf83e75b3e9a8913f6c43e98a281bea77aac13 Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-on: http://openocd.zylin.com/3499 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2016-05-24Make #include guard naming consistentMarc Schink14-42/+43
Change-Id: Ie13e8af0bb74ed290f811dcad64ad06c9d8cb4fa Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/2956 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2016-05-24Remove FSF address from GPL noticesMarc Schink25-69/+29
Also make GPL notices consistent according to: https://www.gnu.org/licenses/gpl-howto.html Change-Id: I84c9df40a774958a7ed91460c5d931cfab9f45ba Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3488 Tested-by: jenkins Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2016-05-08Helper ioutil: cleanup: removing dead codeAlexander Kurz1-111/+0
The ioutil helper functions copyfile and copydir were last and only used in ecosboard.c which has been removed with commit 39650e22. Removing the dead code. Change-Id: I36c7c4c5009d755b4513a14a9f9e214d1ee500e8 Signed-off-by: Alexander Kurz <akurz@blala.de> Reviewed-on: http://openocd.zylin.com/3240 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2016-02-29helper/fileio: Remove nested structMarc Schink2-68/+70
Change-Id: I1a3afbddcf950689da58e0df8850a05f558d7879 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3222 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2016-02-29jim-nvp: Make Jim_GetOpt_String const-correctAndreas Fritiofson2-4/+3
Change-Id: Iae9824f6ff47a1944e674e59bfaa970904645082 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3178 Tested-by: jenkins
2016-02-13Helper time_support: const function argumentsAlexander Kurz2-4/+4
duration_elapsed and duration_kbps will not modify the struct duration passed as function argument, hence it should be declared const. Change-Id: I459c396952c78e907257e2c2f2c630abde92aaa8 Signed-off-by: Alexander Kurz <akurz@blala.de> Reviewed-on: http://openocd.zylin.com/3232 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2016-01-22helper: Add converter from JEP106 ID to manufacturer nameAndreas Fritiofson5-0/+1228
Use it to print the manufacturer of detected TAPs Change-Id: Ic4384c61c7f6f7ae2a9b860a805a5997542f72cc Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3177 Tested-by: jenkins Reviewed-by: Jiri Kastner <cz172638@gmail.com> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2015-11-03helper/options: Use OPENOCD_SCRIPTS dir if set.Jonathan Larmour1-0/+6
This makes it easier to relocate the install tree of OpenOCD from where it was originally built (for example, if put onto a different machine), without having to change scripts or add something to the command line every time. Change-Id: Ia5edf0eba166f7a999f267bd6a92402dab9b399e Signed-off-by: Jonathan Larmour <jifl@eCosCentric.com> Reviewed-on: http://openocd.zylin.com/3004 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-11-03helper/options: Cleanup #includes.Marc Schink1-2/+2
Change-Id: I1c05cf6bb68049176cdd1b3bcff4dcb8b9ae963e Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/2995 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-11-03helper/log: Cleanup #includes.Marc Schink1-2/+2
Change-Id: Ie343524dd843d518086a86866391b5a34556082b Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/2996 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-11-03helper/ioutil: Rename MixedCaps function.Marc Schink1-3/+3
Change-Id: I10075d4d5f45a7105d5a007631510236dbb9b08b Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/2957 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-11-03helper/fileio: Fix memory leak.Marc Schink1-4/+12
The memory leak occurs when opening a file fails. It can be reproduced by using the "flash verify_bank" command with a filename that does not exist. Change-Id: I60b7b545c18793d750ff75d08124fde3f0aa6f64 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/2998 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-11-03helper/fileio: Use size_t for file size.Marc Schink2-7/+12
Change-Id: Ie116b44ba15e8ae41ca9ed4a354a82b2c4a92233 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/2997 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-11-03Change from sys/poll.h to standard poll.h locationPaul Fertser1-2/+2
According to "man 2 poll" the correct header to include is poll.h, not sys/poll.h. Reported by a build against musl. Change-Id: I5298b49dc947d1a368e423104c0c0c7b9bdd1a10 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-on: http://openocd.zylin.com/2947 Tested-by: jenkins
2015-04-14Tcl exception codes cleanup, shutdown command amendmentsPaul Fertser2-21/+21
This patch might influence openocd Tcl commands behaviour in subtle ways, please give it a nice testing. The idea is that if an OpenOCD Tcl command returns an error, an exception is raised, and then the return code is propogated all the way up (or to the "catch" if present). This allows to detect "shutdown" which is not actually an error but has to raise an exception to stop execution of the commands that follow it in the script. openocd_thread special-cases shutdown because it should then terminate OpenOCD with a success error code, unless shutdown was called with an optional "error" argument which means terminate with a non-zero exit code. Change-Id: I7b6fa8a2e24c947dc45d8def0008b4b007c478b3 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2600 Tested-by: jenkins Reviewed-by: Juha Niskanen <juha.niskanen@haltian.com> Reviewed-by: Jens Bauer <jens@gpio.dk> Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2015-04-14helper: shutdown command should return with 0 exit statusJuha Niskanen1-1/+4
Commit a35712a85c42 caused a regression where command openocd -c "echo a1; shutdown; echo a2" always returned non-zero exit status to operating system, even when commands before shutdown all succeeded. This patch attempt to fix this. Change-Id: I3f478c2c51d100af810ea0171d2fd4c8fcc657f3 Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com> Reviewed-on: http://openocd.zylin.com/2589 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2015-02-04configure: define WIN32_LEAN_AND_MEAN early to make it effectivePaul Fertser1-1/+0
This macro makes windows builds faster and helps with the old "#define interface struct" issue as the word "interface" is part of libusb-0.1 API. However, defining it in replacements.h is too late, as windows.h gets included by that time from somewhere else. This solution is provided by Ray Donnelly from the MSYS2 team. Change-Id: I376a5fb3d106786515d7e1ba44dbd751e4dcdb1b Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2486 Tested-by: jenkins Reviewed-by: Xiaofan <xiaofanc@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-01-30Use (uint8_t *) for buf_(set|get)_u(32|64) instead of (void *)Paul Fertser1-4/+4
This helps to uncover incorrect usage when a pointer to uint32_t is passed to those functions which leads to subtle bugs on BE systems. The reason is that it's normally assumed that any uint32_t variable holds its value in host byte order, but using but_set_u32 on it silently does implicit pointer conversion to (void *) and the assumption ends up broken without any indication. Change-Id: I48ffd190583d8aa32ec1fef8f1cdc0b4184e4546 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2467 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-10-06helper: constify log_stringsSpencer Oliver2-2/+2
Change-Id: I5bdd8958e79b754d56bb7aee2892856e557eed76 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/2296 Tested-by: jenkins
2014-09-22command: Fix confusing syntax error messageAndreas Fritiofson2-2/+4
If the user executes a command with an invalid subcommand, the error message is extremely unhelpful: > flash write test.elf flash write test.elf: command requires more arguments This is because any command line that starts with a valid command group is classified as a group, triggering ocd_bouncer to print the confusing message. Fix by requiring that to be a command group, the command line must not contain any unknown tokens after the last valid (sub-)command group. That is OK because command groups don't have handlers defined and thus can't take any parameters. Also fix the error message for "unknown" type to be similar to the error message that is printed (by Jim) for non-existent primary commands. Change-Id: I26950349f0909fd3961c4f9ab9b198c221cea9fc Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/2285 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>