aboutsummaryrefslogtreecommitdiff
path: root/src/rtos
AgeCommit message (Collapse)AuthorFilesLines
2022-08-15rtos: Support for "none" rtosAsier Llano1-1/+4
After a certain RTOS has been configured there is no mechanism to go back to no RTOS support. It may be useful for debugging purposes. With the provided modification, the "none" option of RTOS is provided as a valid option. It has been tested in two different board (Cortex M4 and Cortex M33). Documentation has also been updated. Signed-off-by: Asier Llano <allano@hubbell.com> Change-Id: I602210bff31ccadd41c41e9454c52b5fffa1671e Reviewed-on: https://review.openocd.org/c/openocd/+/7092 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-08-08FreeRTOS: Always show current execution before scheduler is startedFrank Dischner1-1/+16
Previously, if the target was halted before the FreeRTOS scheduler was started but after at least one thread was created, then the current thread would be set to whichever thread had the highest priority. In addition to being misleading, because that thread is not actually running, it can cause issues with gdb. For instance, breaking somewhere before the first thread is created will show the current execution as the current thread, but stepping over a line that creates a thread will cause the current thread to switch to the newly created thread and the current execution to disappear. The sudden disappearance of the current execution thread seems to confuse some versions of gdb. With this change, the value of xSchedulerRunning is checked to determine whether the scheduler has been started. If it hasn't, then a fake 'current execution' thread is always created and made the current thread. Signed-off-by: Frank Dischner <frank.dischner@gmail.com> Change-Id: Ide0fe7d9ffb9fac95cee4c805735f434c7c4934d Reviewed-on: https://review.openocd.org/c/openocd/+/6935 Tested-by: jenkins Reviewed-by: Asier Llano <asierllano@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-08-08FreeRTOS: Fix current thread ID when no threads are activeFrank Dischner1-1/+2
When there are no rtos threads or none are active, a fake thread with ID 1 is created for the current execution, but the current thread ID was never set to this new fake ID. This would lead to an incorrect attempt to read stacked registers for this fake thread. Explicitly setting the current thread ID to the fake ID ensures that the registers are read from the core instead of calling freertos_get_thread_reg_list. Signed-off-by: Frank Dischner <frank.dischner@gmail.com> Change-Id: I694509a0e01df089429b20ff1b879fc0592b532d Reviewed-on: https://review.openocd.org/c/openocd/+/6934 Tested-by: jenkins Reviewed-by: Asier Llano <asierllano@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-07-23openocd: src/rtos: replace the GPL-2.0-or-later license tagAntonio Borneo28-370/+53
Replace the FSF boilerplate with the SPDX tag. The SPDX tag on files *.c is incorrect, as it should use the C99 single line comment using '//'. But current checkpatch doesn't allow C99 comments, so keep using standard C comments, by now. Change-Id: If0194089baded7f58dc5d87a35d6e0aff9f43785 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7070 Tested-by: jenkins
2022-07-23openocd: src: fix incorrect SPDX tagsAntonio Borneo2-4/+4
The SPDX tag is aimed at machine handling and it's thus expected to be placed in the first line in specific format. Move the SPDX tag to the first line and fix it where needed. The SPDX tag on files *.c is incorrect, as it should use the C99 single line comment using '//'. But current checkpatch doesn't allow C99 comments, so keep using standard C comments, by now. Change-Id: Ie9a05f530009d482a4116eebd147fd7e1ee3d41e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7066 Tested-by: jenkins
2022-07-23openocd: src: add GPL license tag on files that miss itAntonio Borneo1-0/+2
Some file miss completely the license tag. Add the SPDX tag, using the same GPL-2.0-or-later license of the OpenOCD project. The SPDX tag on files *.c is incorrect, as it should use the C99 single line comment using '//'. But current checkpatch doesn't allow C99 comments, so keep using standard C comments, by now. Change-Id: I1fb51e722232d14f050458a820c3041de3dc9138 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7058 Tested-by: jenkins
2022-07-23openocd: build: add SPDX tagAntonio Borneo1-0/+2
Add the SPDX tag to makefiles, configuration scripts and tcl files present in the folders under src/ Change-Id: I1e4552aafe46ef4893d510da9d732c5f181784a4 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7051 Tested-by: jenkins
2022-04-23rtos: zephyr: do not use deprecated symbols nameJulien Massot1-3/+3
Zephyr plan to remove openocd specific symbols in favour of more generic one. These generic symbols has been introduced in Zephyr 2.6. Signed-off-by: Julien Massot <julien.massot@iot.bzh> Change-Id: I89418c9c378fb8b8baa29763fc6f1b6e652dc7ef Reviewed-on: https://review.openocd.org/c/openocd/+/6844 Tested-by: jenkins Reviewed-by: Stephanos Ioannidis <root@stephanos.io> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-03-26helper/bits: add BIT_ULL and GENMASK macrosAntonio Borneo1-1/+1
To support 64 bits bit and masks Replace local definition of BIT in rtos/chromium-ec Change-Id: I1f268d6e8790f1b07bf798680b797878ce81064b Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6857 Tested-by: jenkins
2022-03-26openocd: include config.h in every file .cAntonio Borneo1-0/+4
Including config.h as first is required for every C file. Add it to the C files that still miss it. Change-Id: I1a210e7d3a854958a85a290b086ad8a9f5176425 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6856 Tested-by: jenkins
2022-02-14rtos: threadx: Add hla_target support for ThreadXBen McMorran1-0/+12
Tested with an AZ3166 dev board (which uses the STM32F412ZGT6) running the Azure RTOS ThreadX demonstration system. Signed-off-by: Ben McMorran <bemcmorr@microsoft.com> Change-Id: I44c8f7701d9f1aaa872274166321cd7d34fb1855 Reviewed-on: https://review.openocd.org/c/openocd/+/6829 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-02-14target/smp: use a struct list_head to hold the smp targetsAntonio Borneo2-14/+10
Instead of reinventing a simply linked list, reuse the list helper for the list of targets in a smp cluster. Using the existing helper, that implements a double linked list, makes trivial going through the list in reverse order. Change-Id: Ib36ad2955f15cd2a601b0b9e36ca6d948b12d00f Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6783 Tested-by: jenkins
2021-11-05rtos: use struct member names instead of commentsTim Newsome9-90/+82
This is more readable, and as a bonus the compiler will help out if the definition of the struct changes. Change-Id: Ibf660134d9900173f6592407d5cc2203654a4a1b Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6659 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-10-02helper: Remove src/helper from include dirsYasushi SHOJI1-1/+1
The header files under src/helper/ can currently be included with either #include <bits.h> or #include <helper/bits.h> This is because we specify both "src/" and "src/helper/" directories as include directories. Some files name under "src/helper/", such as types.h, log.h, and util.h are too generic and could be ambiguous depending on the search path. This commit remove "src/helper/" from our include dir and make C files include explicitly. Change-Id: I38fc9b96ba01a513d4a72757d40007e21b502f25 Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6507 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-10-02uint64_t->target_addr_t for stack pointers.Tim Newsome6-28/+28
This might be incomplete. It's just a quick attempt to reduce some of the difference between riscv-openocd and mainline. Other stack pointers can be updated as I come across them. Change-Id: Id3311b8a1bb0667f309a26d36b67093bfeb8380a Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6586 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-09-18openocd: remove last NULL comparisonsAntonio Borneo2-9/+8
The NULL pointers preceded by cast where not detected by the scripting tools looking for NULL pointer comparison. Remove them and, while there, further simplify the code and apply the other coding style rules. Change-Id: Ia7406122e07ef56ef311579ab0ee7ddb22c8e4b5 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6539 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2021-08-30Makefile: drop warning suppression on win buildAntonio Borneo1-7/+0
Commit dcdf71c21b99 ("- fix signed/unsigned build errors under win32. Thanks Zach Welch <zw@superlucidity.net>") in 2009 prevents gcc warnings on sign/unsigned comparisons while building for Win on folders 'helper' and 'server'. In 2011, commit b69119668ed8 ("RTOS Thread awareness support wip") uses the same method on the new folder 'rtos'. In mean time, all the incorrect sign/unsigned comparisons has been fixed and no warning is present with the default -Wextra flag that implies -Wsign-compare. The comment: # FD_* macros are sloppy with their signs on MinGW32 platform seems linked to some old implementation of MinGW32 include file that doesn't apply on current versions. Remove the obsolete hacks to suppress the warnings. Change-Id: I76dba9e54a647d3b9fbf1b7e9ae1844e3d7adc9a Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6254 Tested-by: jenkins Reviewed-by: Xiaofan Chen <xiaofanc@gmail.com>
2021-08-22rtos/riot: fix out-of-bounds writes when target is corruptedSebastiaan de Schaetzen1-2/+9
This protects against out-of-bounds writes when the memory of RIOT's scheduler is corrupted. This memory can be corrupted because of: - Programming errors - The scheduler not yet having been initialised - An incorrect symbol file being used during debugging. This error can result in OpenOCD segfaulting. Valgrind was used to find the approximate location of the error. Change-Id: I60e7d7c245b8c4e38f4c98cb0c0347a9b5ec3177 Signed-off-by: Sebastiaan de Schaetzen <sebastiaan.de.schaetzen@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6381 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-08-22rtos/riot: fix out-of-bounds read of optional symbols arraySebastiaan de Schaetzen1-32/+26
This fixes an out-of-bounds read of the riot_optional_symbols array. Change-Id: I172ae182dd0c7dd68edaa66ac030030d9bc65401 Signed-off-by: Sebastiaan de Schaetzen <sebastiaan.de.schaetzen@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6428 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-08-14rtos: add debug prints for qSymbol lookupJan Matyas1-0/+11
- Added two debug prints that allow to inspect the symbol lookup process (carried out via the qSymbol packets). - Added a check for an edge situation when the debugger would send us different symbol than what we asked for (avoids NULL dereference). Change-Id: I84ae1b2b66473eab76a7966c678d2777b6ef48d6 Signed-off-by: Jan Matyas <matyas@codasip.com> Reviewed-on: http://openocd.zylin.com/6287 Tested-by: jenkins Reviewed-by: Tim Newsome <tim@sifive.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-07-31rtos: zephyr: add zephyr_params for cortex r4Julien Massot1-0/+8
Implementation for Cortex-M does works for Cortex-R too, it allows me to fetch thread list and their backtrace on a Cortex-R platforms. Change-Id: I23e6eb00879587ba36e0bfb560f7002a9653d39b Signed-off-by: Julien Massot <julien.massot@iot.bzh> Reviewed-on: http://openocd.zylin.com/6369 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-07-24openocd: fix Yoda conditions with checkpatchAntonio Borneo4-6/+6
The new checkpatch can automatically fix the code, but this feature is still error prone and not complete. Patch generated automatically through the new checkpatch with flags "--types CONSTANT_COMPARISON --fix-inplace". Some Yoda condition is detected by checkpatch but not fixed; it will be fixed manually in a following commit. Change-Id: Ifaaa1159e63dbd1db6aa3c017125df9874fa9703 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6355 Tested-by: jenkins
2021-07-24openocd: remove NULL comparisons with checkpatch [2/2]Antonio Borneo1-3/+3
Patch generated automatically through a modified checkpatch that detects the patterns if (NULL == symbol) if (NULL != symbol) and through flags "--types COMPARISON_TO_NULL --fix-inplace". The unmodified checkpatch detects this pattern as Yoda condition, but it's odd fixing it as Yoda condition and then again as NULL comparison. This triggered the modification to the script. Change-Id: I5fe984a85e9c4fc799f049211797aef891ebce18 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6352 Tested-by: jenkins
2021-07-24openocd: remove NULL comparisons with checkpatch [1/2]Antonio Borneo13-27/+27
Patch generated automatically through the new checkpatch with flags "--types COMPARISON_TO_NULL --fix-inplace". This only fixes the comparisons if (symbol == NULL) if (symbol != NULL) The case of NULL on the left side of the comparison is not tested. Some automatic fix is incorrect and has been massaged by hands: - if (*psig == NULL) + if (*!psig) changed as + if (!*psig) Change-Id: If4a1e2b4e547e223532e8e3d9da89bf9cb382ce6 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6351 Tested-by: jenkins
2021-07-24openocd: fix simple cases of NULL comparisonAntonio Borneo13-105/+105
There are more than 1000 NULL comparisons to be aligned to the coding style. For recurrent NULL comparison it's preferable using trivial scripts in order to minimize the review effort. Patch generated automatically with the command: sed -i PATTERN $(find src/ -type f) where PATTERN is in the list: 's/(\([a-z][a-z0-9_]*\) == NULL)/(!\1)/g' 's/(\([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\) == NULL)/(!\1)/g' 's/(\([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\) == NULL)/(!\1)/g' 's/(\([a-z][a-z0-9_]*\) != NULL)/(\1)/g' 's/(\([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\) != NULL)/(\1)/g' 's/(\([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\) != NULL)/(\1)/g' 's/(NULL == \([a-z][a-z0-9_]*\))/(!\1)/g' 's/(NULL == \([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\))/(!\1)/g' 's/(NULL == \([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\))/(!\1)/g' 's/(NULL != \([a-z][a-z0-9_]*\))/(\1)/g' 's/(NULL != \([a-z][a-z0-9_]*->[a-z][a-z0-9_]*\))/(\1)/g' 's/(NULL != \([a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\))/(\1)/g' Change-Id: Ida103e325d6d0600fb69c0b7a1557ee969db4417 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6350 Tested-by: jenkins
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>