aboutsummaryrefslogtreecommitdiff
path: root/src/rtos
AgeCommit message (Collapse)AuthorFilesLines
2021-07-20openocd: manually fix Yoda conditionsAntonio Borneo2-101/+61
Fix the remaining Yoda conditions, detected by checkpatch but not fixed automatically. While there, apply minor style changes. Change-Id: I6e1978b89c4d56a20aceaeb2b52968eb6384432a Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6356 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de> Reviewed-by: Xiang W <wxjstz@126.com>
2021-07-20openocd: fix simple cases of Yoda conditionAntonio Borneo1-1/+1
There are ~900 Yoda conditions to be aligned to the coding style. For recurrent Yoda conditions it's preferable using a trivial script in order to minimize the review effort. E.g. comparison of uppercase macro/enum with lowercase variable: - ...(ERROR_OK == retval)... + ...(retval == ERROR_OK)... Patch generated automatically with the command: sed -i \ 's/(\([A-Z][A-Z0-9_]*\) \([=!]=\) \([a-z][a-z0-9_]*\))/(\3 \2 \1)/g' \ $(find src/ -type f) While there, remove the braces {} around a single statement block to prevent warning from checkpatch. Change-Id: If585b0a4b4578879c87b2dd74d9e0025e275ec6b Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6354 Tested-by: jenkins Reviewed-by: Xiang W <wxjstz@126.com>
2021-07-02Add RTOS memory read/write functions.Tim Newsome3-0/+63
If not implemented, these specify to regular target read/write. However, if individual threads in an RTOS can have different address translation configured then the RTOS support can use this to do the right thing. Use this in hwthread, where of course address translation can be set up differently for different real cores. Change-Id: I62c501cff1f863d855ee197dee7b73204ea8885a Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: http://openocd.zylin.com/6327 Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de> Reviewed-by: Jan Matyas <matyas@codasip.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-07-02rtos/eCos: rename CamelCase symbolsAntonio Borneo3-47/+47
Convert CamelCase enum in uppercase and the other symbols in lowercase. Change-Id: I141c55bdfe6ef2a2da28d1da15a283a644ae7cb2 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6306 Tested-by: jenkins
2021-07-02rtos: rename CamelCase symbolsAntonio Borneo17-257/+253
Only one exported symbol from eCos is included in this patch. The eCos code is left untouched to prevent conflicts with patches currently under review. While there, remove an unused camelcase macro Change-Id: I8d22dec6e243c00665d99a8b8ba00474b4f088db Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6305 Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de>
2021-07-02rtos: convert CamelCase enum in uppercaseAntonio Borneo6-93/+93
The eCos code is not part of this patch to prevent conflicts with patches currently under review. Change-Id: I71369165f2eef419b83a79ffcff50287f77949c6 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6304 Tested-by: jenkins
2021-06-18target/arm: optimize architecture flagsTarek BOCHKATI1-1/+1
In target/arm.h the struct arm do contain 3 flags to retain architecture version for some tweaks. The proposal is to have only one enumerated flag 'arch' for the same purpose. Change-Id: Ia5d5accfed8158ca21eb54af2fdea8e36f0266ae Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/6229 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-06-04helper/jim-nvp: comply with coding style [2/2]Antonio Borneo2-3/+3
With the API fixed to comply with OpenOCD coding style, fix all the references in the code. Patch generated automatically with the script below. The list is in reverse order to replace a common prefix after the replacement of the symbols with the same prefix. %<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<--- (cat << EOF Jim_SetResult_NvpUnknown jim_set_result_nvp_unknown Jim_Nvp_value2name_simple jim_nvp_value2name_simple Jim_Nvp_value2name_obj jim_nvp_value2name_obj Jim_Nvp_value2name jim_nvp_value2name Jim_Nvp_name2value_simple jim_nvp_name2value_simple Jim_Nvp_name2value_obj_nocase jim_nvp_name2value_obj_nocase Jim_Nvp_name2value_obj jim_nvp_name2value_obj Jim_Nvp_name2value_nocase_simple jim_nvp_name2value_nocase_simple Jim_Nvp_name2value_nocase jim_nvp_name2value_nocase Jim_Nvp_name2value jim_nvp_name2value Jim_Nvp struct jim_nvp Jim_GetOpt_Wide jim_getopt_wide Jim_GetOpt_String jim_getopt_string Jim_GetOpt_Setup jim_getopt_setup Jim_GetOpt_Obj jim_getopt_obj Jim_GetOpt_NvpUnknown jim_getopt_nvp_unknown Jim_GetOpt_Nvp jim_getopt_nvp Jim_GetOpt_Enum jim_getopt_enum Jim_GetOpt_Double jim_getopt_double Jim_GetOpt_Debug jim_getopt_debug Jim_GetOptInfo struct jim_getopt_info Jim_GetNvp jim_get_nvp Jim_Debug_ArgvString jim_debug_argv_string EOF ) | while read a b; do sed -i "s/$a/$b/g" $(find src -type f ! -name jim-nvp.\? ) done %<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<---%<--- Change-Id: I10a12bd64bb8b17575fd9150482c989c92b298a2 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6184 Reviewed-by: Marc Schink <dev@zapb.de> Tested-by: jenkins
2021-05-29rtos: use ARRAY_SIZE() and simplify rtos_type.create()Antonio Borneo4-59/+36
Use the existing macro ARRAY_SIZE(). Rewrite the functions rtos_type.create() to simplify the logic. Change-Id: I8833354767045d1642801d26944c9087a77add00 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6261 Tested-by: jenkins
2021-05-29openocd: use macro ARRAY_SIZE()Antonio Borneo2-6/+4
There are still few cases where the macro ARRAY_SIZE() should be used in place of custom code. Use ARRAY_SIZE() whenever possible. Change-Id: Iba0127a02357bc704fe639e08562a4f9aa7011df Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6260 Reviewed-by: Xiang W <wxjstz@126.com> Tested-by: jenkins
2021-05-22openocd: fix some minor typoAntonio Borneo1-1/+1
Minor typos found by the new checkpatch boosted by the dictionary provided by 'codespell'. Change-Id: I7b4cae1798ff5ea048fcbc671a397af763fdc605 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6218 Tested-by: jenkins
2021-05-11rtos: Add support for Zephyr RTOSEvgeniy Didin3-0/+791
With this patch, the Zephyr[1] RTOS is supported by OpenOCD. As usual with support for other RTOSes, Zephyr must be compiled with the DEBUG_THREAD_INFO option. This will generate some symbols with information needed in order to build the list of threads. The current implementation is limited to Zephyr running on ARM Cortex-M processors. This is the only ARM variant supported by Zephyr at the moment and is used on most of the officially supported boards. [1] https://www.zephyrproject.org/ Change-Id: I22afdbec91562f3a22cf5b88cd4ea3a7a59ba0b4 Signed-off-by: Evgeniy Didin <didin@synopsys.com> Signed-off-by: Leandro Pereira <leandro.pereira@intel.com> Signed-off-by: Daniel Glöckner <dg@emlix.com> Reviewed-on: http://openocd.zylin.com/4988 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-04-30target/armv7m: change FPv4_SP and FPv5_SP/DP identifiers to uppercaseTomas Vanek2-2/+2
Change-Id: Ia421a973e5fb4767715c9f95c91745f8ca1de1da Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/6177 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-03-10rtos: Remove typedef'd structMarc Schink14-41/+41
The C style guide forbids typedef'd structs, see 'Naming Rules'. Change-Id: Ia7c8218fb61ff0c74b6dd0d10fb51a77cf059c14 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/6028 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-12-26rtos/hwthread: fix register list for armv7aAntonio Borneo1-5/+17
The targets armv7a in file cortex_a.c inherit the register list from file armv4_5.c thus, depending on the core status, some register get marked as not existing. For HW threads other than current target, the registers in the list are not checked for existence and are all forwarded to GDB that in turns complains for too many data: Remote 'g' packet reply is too long (expected 68 bytes, got 104 bytes) Check all the attributes of the registers and pass to GDB only the valid registers. To test it, use a SMP cortex-a target (2 cores are enough) and add -rtos hwthread to all the cores. Connect GDB to OpenOCD and issue the GDB command info threads Change-Id: Ie66119fe83a3c8d53e9d18dda39e60fd97769669 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5981 Tested-by: jenkins
2020-11-04rtos: make private the API rtos_try_next()Antonio Borneo2-2/+3
The function rtos_try_next() is only used internally. Make it private. Change-Id: I68c6b8d8e6bbf3d674b0e0199e63bc02d358c04e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5899 Tested-by: jenkins
2020-11-04rtos: declare local symbols as staticAntonio Borneo4-21/+21
Functions and variables that are not used outside the file should be declared as static. Change-Id: I9731a35496cd1c7421563c8961da5fa0e3cc71c3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5894 Tested-by: jenkins Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
2020-10-03FreeRTOS: strip duplicate line returnsKarl Palsson1-10/+10
Log lines already print a new line, so these superfluous \r\n result in blank lines being printed in the log. Remove per review comment request. Change-Id: I8f5b20776634cf70ce4490fc4f732c916130928a Signed-off-by: Karl Palsson <karlp@etactica.com> Reviewed-on: http://openocd.zylin.com/5843 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2020-10-03FreeRTOS: properly read on big endian systems.Karl Palsson1-42/+41
Remember, don't cast your pointers between types of different sizes! While the FreeRTOS handlers attempt to account for different pointer and list widths, the types used are always fixed, so this will _remain_ broken if/when someone targets FreeRTOS on 8/16/64 bit targets. (Note that this patch does not _change_ that, it was fixed to 32bit before as well) In the meantime, this properly handles 32bit reads on a mips BE system (ath79) as well as remaining fully functional on x86_64. Change-Id: I677bb7130e25dccb7c1bee8fabaee27371494d00 Signed-off-by: Karl Palsson <karlp@etactica.com> Reviewed-on: http://openocd.zylin.com/5842 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2020-09-05openocd: use proper format with uint32_tAntonio Borneo3-4/+4
Modify the format strings to properly handle uint32_t data types. Change-Id: I4de49bf02c9e37b72240224c23fc83abe8a4fa83 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5819 Tested-by: jenkins
2020-09-05openocd: avoid checking for non NULL pointer to free itAntonio Borneo3-19/+10
The function free() can be called with a NULL pointer as argument, no need to check the argument before. If the pointer is NULL, no operation is performed by free(). Remove the occurrences of pattern: if (ptr) free(ptr); While there replace a sequence malloc(size)+memset(,0,size) with a calloc(1,size). Replace a pointer assignment to '0' with an assignment to NULL. In server/*, an error is logged if the ptr was already NULL. This cannot happen since the pointer was already referenced few lines before and openocd would have been already SIGSEGV in that case, so remove the log. Change-Id: I10822029fe8390b59edff4070575bf7f754e44ac Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5808 Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com> Tested-by: jenkins
2020-07-26rtos: fix minor typosAntonio Borneo5-5/+5
Change-Id: I9ed4e2150a0a057397538b608d4a72bc48d0d64f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5759 Tested-by: jenkins
2020-07-26rtos: add support for RIOTDaniel Krebs5-0/+561
Add threads support for RIOT (https://github.com/RIOT-OS/RIOT). Original code is from Daniel Krebs. Change-Id: I83fe3b91dd75949e800b5aea1015d8fa37b09c61 Signed-off-by: Daniel Krebs <github@daniel-krebs.net> Signed-off-by: Vincent Dupont <vincent@otakeys.com> Signed-off-by: Benjamin Valentin <benpicco@googlemail.com> Reviewed-on: http://openocd.zylin.com/4256 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-07-08coding style: fix space separationAntonio Borneo1-1/+1
The checkpatch script from Linux kernel v5.1 complains about using space before comma, before semicolon and between function name and open parenthesis. Fix them! Issue identified using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types SPACING -f {} \; The patch only changes amount and position of whitespace, thus the following commands show empty diff git diff -w git log -w -p git log -w --stat Change-Id: I1062051d7f97d59922847f5061c6d6811742d30e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5627 Tested-by: jenkins
2020-06-06coding style: fix multi-line dereferencingAntonio Borneo1-14/+7
Issue identified by checkpatch script from Linux kernel v5.1 using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types MULTILINE_DEREFERENCE -f {} \; Change-Id: Icba05613e22a72ecc3e6a0aad7cb6b479496146f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5629 Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de>
2020-05-24openocd: properly use jim data typesAntonio Borneo1-1/+1
The jim library exports all the data types through typedef, so there is no need to use the internal struct types. Fix the few remaining inconsistencies in the code. Change-Id: Id4ae0083563ea7a371833374e7b39f17158f66a4 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5662 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-05-24rtos/ChibiOS: Fix some coding stylesMarc Schink3-62/+62
Change-Id: I2648479df1a2dd95f8a57868c4ed4259e0fbbe11 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4989 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-05-09coding style: add missing space when split stringsAntonio Borneo2-3/+3
Long strings are split across few lines; usually split occurs at the white space between two words. Check that the space between the two words is still present. While there, adjust the amount of space between words. Issue identified by checkpatch script from Linux kernel v5.1 using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types MISSING_SPACE -f {} \; Change-Id: I28b9a65564195ba967051add53d1c848c7b8fb30 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5620 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-05-09coding style: avoid unnecessary line continuationsAntonio Borneo1-2/+2
Line continuation, adding a backslash as last char of the line, is requested in multi-line macro definition, but is not necessary in the rest of C code. Remove it where present. Identified by checkpatch script from Linux kernel v5.1 using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types LINE_CONTINUATIONS -f {} \; Change-Id: Id0c69e93456731717a7b290b16580e9f8ae741bc Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5619 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-05-07Add get_thread_reg() and set_reg() for hwthreadTim Newsome1-51/+90
get_thread_reg() allows gdb to request the register value of a specific "thread." set_reg() allows register writes without getting a giant list of registers first. Signed-off-by: Tim Newsome <tim@sifive.com> Change-Id: I87faa1c8793916b9ee476dd696f0695a07ca2b41 Reviewed-on: http://openocd.zylin.com/5324 Tested-by: jenkins
2020-05-02coding style: src: remove empty lines at end of text filesAntonio Borneo4-5/+0
Empty lines at end of text files are useless. Remove them. Change-Id: Ibac9b36682d58f81e34ca2b51e6260e7d472fb0e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5172 Tested-by: jenkins
2020-04-15Revert "rtos/FreeRTOS: Fix FreeRTOS thread list reading"Tomas Vanek1-16/+23
This reverts commit 6568d29cc1d0d94daafec5bdb73de7d4f17da257. The reverted change caused some tasks were missing in thread list. While on it add a comment explaining the relation of uxTopUsedPriority and configMAX_PRIORITIES, introduce config_max_priorities and change types to unsigned. Change-Id: I4371c8882470d13ee7360ef21b132c56ecb95af8 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5577 Tested-by: jenkins
2020-03-17rtos: Destroy RTOS and fix memory leakMarc Schink2-0/+6
The memory leak can be reproduced by using an arbitrary RTOS and valgrind: $ valgrind --leak-check=full --show-leak-kinds=all [...] ==9656== 224 (80 direct, 144 indirect) bytes in 1 blocks are definitely lost in loss record 3 of 3 ==9656== at 0x483CD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) ==9656== by 0x1C541A: os_alloc (rtos.c:79) ==9656== by 0x1C569E: os_alloc_create (rtos.c:111) ==9656== by 0x1C569E: rtos_create (rtos.c:153) ==9656== by 0x1AE332: target_configure (target.c:4899) ==9656== by 0x1AF228: jim_target_configure (target.c:4952) ==9656== by 0x1C9EF9: command_unknown (command.c:1066) ==9656== by 0x313284: JimInvokeCommand (jim.c:10364) ==9656== by 0x313FB6: Jim_EvalObj (jim.c:10814) ==9656== by 0x3154A3: Jim_EvalFile (jim.c:11207) ==9656== by 0x316015: Jim_SourceCoreCommand (jim.c:15230) ==9656== by 0x313284: JimInvokeCommand (jim.c:10364) ==9656== by 0x313B8B: JimEvalObjList (jim.c:10605) [...] Change-Id: I2cd41a154fb8570842601ff4e3e76502f5908f49 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5479 Tested-by: jenkins Reviewed-by: Moritz Fischer <moritzf@google.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2020-03-07rtos/linux: fix use of memory after it is freedTomas Vanek1-7/+9
Discovered by clang static analyzer Change-Id: I9f64a67f281b95562d8fd6e2ebb0ae3f79ae8039 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5371 Tested-by: jenkins Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2020-02-24coding style: fix space around pointer's asteriskAntonio Borneo2-2/+2
The script checkpatch available in new Linux kernel offers an experimental feature for automatically fix the code in place. While still experimental, the feature works quite well for simple fixes, like spacing. This patch has been created automatically with the script under review for inclusion in OpenOCD, using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types POINTER_LOCATION --fix-inplace -f {} \; then manually reviewed. OpenOCD coding style does not mention the space around pointer's asterisk, so no check is enforced. This patch only makes the style uniform across the files. The patch only changes amount and position of whitespace, thus the following commands show empty diff git diff -w git log -w -p git log -w --stat Change-Id: Iefb4998e69bebdfe0d1ae65cadfc8d2c4f166d13 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5197 Tested-by: jenkins
2020-01-02rtos/FreeRTOS: Fix FreeRTOS thread list readingRahul Masurkar1-2/+2
Change-Id: I749ae94ec7279907b1905c02ecc1e9661f43ef70 Signed-off-by: Rahul Masurkar <rahulgm@marvell.com> Reviewed-on: http://openocd.zylin.com/5273 Tested-by: jenkins Reviewed-by: Karl Palsson <karlp@tweak.net.au> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-08-28gdb_server, rtos: Fine-grained RTOS register accessTim Newsome2-9/+46
1. Add get_thread_reg() to rtos. It's used in rtos_get_gdb_reg() to read the value of a single register, instead of reading all register values by calling get_thread_reg_list(). 2. Add set_reg() to rtos. gdb_server uses this to change a single register value for a specific thread. 3. Add target_get_gdb_reg_list_noread() so it's possible for gdb to get a list of registers without attempting to read their contents. The clang static checker doesn't find any new problems with this change. Change-Id: I77f792d1238cb015b91527ca8cb99593ccc8870e Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: http://openocd.zylin.com/5114 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2019-06-12ARMv8: Update rtos_reg storage from 8 to 16 bytesDaniel Goehring1-1/+1
To support 128 bit registers, the rtos_reg structure value array needs to be updated from 8 to 16 bytes. Tested by reading ARMv8 NEON FP regs on an Ampere eMAG 8180 with GDB. Change-Id: I7f3fe1a5b2def599d021787fbe9cdd51f92859a4 Signed-off-by: Daniel Goehring <dgoehrin@os.amperecomputing.com> Reviewed-on: http://openocd.zylin.com/5209 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2019-06-04gdb_server: fix GDB_BUFFER_SIZE usage, fix unaligned access during bulk ↵Bohdan Tymkiv2-2/+2
transfers Currently size of the GDB buffer is 16384 bytes but it is treated as nul-terminated string in most of the code, so effective size of the buffer is actually 16383 bytes. OpenOCD responds with `PacketSize=3fff` to qSupported request. Result of GDB's `m` command is encoded in hex so each data byte uses two bytes in the buffer. As a result GDB will split bulk read requests into chunks 0x1fff bytes each. This causes troubles on targets (or memory regions) which support only aligned, word-sized access (such as MMIO buffers). Steps to reproduce (psoc6 target): gdb> dump binary memory dump.bin 0x040320000 (0x040320000 + 65536) OpenOCD: Error: Failed to read memory at 0x40321ffe Error: Failed to read memory at 0x40321000 Error: Failed to read memory at 0x40323000 Error: Failed to read memory at 0x40325ffe Error: Failed to read memory at 0x40329ffa Error: Failed to read memory at 0x40329ffc Error: Failed to read memory at 0x4032bffc Error: Failed to read memory at 0x4032dffa Consolidate GDB_BUFFER_SIZE usage: ensure size of each buffer is (GDB_BUFFER_SIZE + 1), add explicit comment that additional byte is used for nul-termination. Report correct size of the buffer to GDB (0x4000) as recommended in GDB's docummentation: `if the stub stores packets in a NUL-terminated format, it should allow an extra byte in its buffer for the NUL` Checked with clang-asan, clang-analyzer, valgrind - no new errors. Change-Id: I909e8a2c6b010c5d4a304641808d4a807a4ec18d Signed-off-by: Bohdan Tymkiv <bhdt@cypress.com> Reviewed-on: http://openocd.zylin.com/5109 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-03-08rtos/hwthread: add hardware-thread pseudo rtosMatthias Welwarsky3-0/+350
This patch adds "hwthread", a pseudo rtos that represents cpu cores in an SMP system as threads to gdb. This allows to debug SMP system kernels in a more sensible manner and removes the current atrocities of switching gdb manually between CPU cores to update the context. Change-Id: Ib781c6c34097689d21d9e02011e4d74a4a742379 Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com> Reviewed-on: http://openocd.zylin.com/3999 Tested-by: jenkins Reviewed-by: Tim Newsome <tim@sifive.com> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de> Reviewed-by: Graham Sanderson <graham.sanderson@gmail.com>
2019-01-23rtos: Add RTOS task awareness for Chromium-ECMoritz Fischer3-0/+390
Add RTOS task awareness for Chromium-EC. Currently only supports ARM Cortex-M0/M3/M4 based targets. No new Clang Analyzer warnings. Change-Id: Iea56fcb1be220e2437613922879b63d6e553703d Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com> Reviewed-on: http://openocd.zylin.com/4685 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-10-16rtos: check symbol list when updating uCOS-IIISteven Stallion1-0/+5
This patch corrects a crash in uCOS-III on a new GDB connection when RTOS autodetection is not used. The crash was caused by not checking if the symbol list had been loaded prior to updating threads. Change-Id: I64c5133e02fe22fc8d14584cc40d87b49c935b0b Signed-off-by: Steven Stallion <stallion@squareup.com> Reviewed-on: http://openocd.zylin.com/4719 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-10-16esirisc: support eSi-RISC targetsSteven Stallion3-0/+45
eSi-RISC is a highly configurable microprocessor architecture for embedded systems provided by EnSilica. This patch adds support for 32-bit targets and also includes an internal flash driver and uC/OS-III RTOS support. This is a non-traditional target and required a number of additional changes to support non-linear register numbers and the 'p' packet in RTOS support for proper integration into EnSilica's GDB port. Change-Id: I59d5c40b3bb2ace1b1a01b2538bfab211adf113f Signed-off-by: Steven Stallion <stallion@squareup.com> Reviewed-on: http://openocd.zylin.com/4660 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-10-16rtos: support gdb_get_register_packetSteven Stallion17-462/+458
This patch adds support for p packet responses by targets configured with RTOS support. This change required moving to a rtos_reg struct, which is similar to struct reg used by targets, which resulted in needing to update each stacking with register numbers. This patch also allows targets with non-linear register numbers to function with RTOSes as well. Change-Id: I5b189d74110d6b6f2fa851a67ab0762ae6b1832f Signed-off-by: Steven Stallion <stallion@squareup.com> Reviewed-on: http://openocd.zylin.com/4121 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-08-21rtos/linux.c: fix clang static analyzer warningTomas Vanek1-2/+2
Remove sizeof(int64_t) from string size computation. Change-Id: I029b394df5d62a2594a723c4c0e13608b3423b9b Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4640 Tested-by: jenkins
2018-08-01rtos: add support for NuttXMasatoshi Tateishi4-1/+481
This patch introduces RTOS support for NuttX. Currently, only ARM Cortex-M (both FPU and FPU-less) targets are supported. To use, add the following lines to ~/.gdbinit. define hookpost-file eval "monitor nuttx.pid_offset %d", &((struct tcb_s *)(0))->pid eval "monitor nuttx.xcpreg_offset %d", &((struct tcb_s *)(0))->xcp.regs eval "monitor nuttx.state_offset %d", &((struct tcb_s *)(0))->task_state eval "monitor nuttx.name_offset %d", &((struct tcb_s *)(0))->name eval "monitor nuttx.name_size %d", sizeof(((struct tcb_s *)(0))->name) end And please make sure the above values are the same as in src/rtos/nuttx_header.h Change-Id: I2aaf8644d24dfb84b500516a9685382d5d8fe48f Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com> Signed-off-by: Masatoshi Tateishi <Masatoshi.Tateishi@jp.sony.com> Signed-off-by: Nobuto Kobayashi <Nobuto.Kobayashi@sony.com> Reviewed-on: http://openocd.zylin.com/4103 Tested-by: jenkins Reviewed-by: Alan Carvalho de Assis <acassis@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-04-23ChibiOS thread states: Update thread state to label mappingFaisal Shah1-4/+3
Fixed style issue. Removed #define with list of strings, and just put the strings in the array initialization directly. Removed empty space at the start of line. Change-Id: I76580be203d7d69b8c5b5440f820156543e0d5cc Signed-off-by: Faisal Shah <faisal.shah@gmail.com> Reviewed-on: http://openocd.zylin.com/4488 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-04-07rtos: Fix XPSR_OFFSET for cortex_m4f stackingArmin van der Togt1-2/+21
Structures rtos_standard_Cortex_M4F_stacking and rtos_standard_Cortex_M4F_FPU_stacking in rtos_standard_stackings.c where using rtos_standard_Cortex_M3_stack_align for the stack-align function. This function calls rtos_Cortex_M_stack_align with XPSR_OFFSET = 0x3c. This offset is correct for cortex-M3 but not for cortex-M4F and cortex-M4F with fpu. This patch adds stack_align functions for M4F an M4F_FPU Change-Id: If6a90b1898fccbb85619a10f3aef5277dd88ce47 Signed-off-by: Armin van der Togt <armin@otheruse.nl> Reviewed-on: http://openocd.zylin.com/4037 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-03-07Fix ChibiOS FPU detection.Luca Dariz1-1/+1
This is needed for Cortex-M7 devices, which have newer FPU. This issue caused the registry integrity check to fail if FPU was enabled. Currently the code must use FPUv4_SP anyway, since other configurations are not supported by ChibiOS. Change-Id: Ie8a2cb8282ccff6c2a3eb0ffeaddaf149d55d685 Signed-off-by: Luca Dariz <luca.dariz@gmail.com> Reviewed-on: http://openocd.zylin.com/4398 Tested-by: jenkins Reviewed-by: Karl Palsson <karlp@tweak.net.au> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-03-03rtos: fix rtos no-auto configurationMatthias Welwarsky1-1/+1
A previous fix avoiding multiple calls to the rtos_create function had a side effect if rtos support was configured explicitly. It affected all rtos' that rely on symbol resolution from gdb. Change-Id: Id7f17c6ec5ce2450322d2748a4b2369aaa524a7b Fixes: 3aa8bd2d1704118ad9bbee2f21cbc15a848c8c5b Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com> Reviewed-on: http://openocd.zylin.com/4438 Tested-by: jenkins Reviewed-by: Richard Braun <rbraun@sceen.net> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>