aboutsummaryrefslogtreecommitdiff
path: root/src/rtos
AgeCommit message (Collapse)AuthorFilesLines
2023-05-18rtos: uCOS-III: split struct ucos_iii_paramsAntonio Borneo1-47/+35
The static analyser 'sparse' complains about using sizeof() on a struct that has variable size: src/rtos/uCOS-III.c:267:32: warning: using sizeof on a flexible structure src/rtos/uCOS-III.c:269:41: warning: using sizeof on a flexible structure src/rtos/uCOS-III.c:275:66: warning: using sizeof on a flexible structure The struct ucos_iii_params contains either constants values for different target type and variable fields. The last field is an variable size array, always allocated to UCOS_III_MAX_THREADS items. It's not practical to fix this size because we would get too huge initialization in data segment. Split away from struct ucos_iii_params all the variable fields and put them in struct ucos_iii_private. Add in the new struct a pointer to the selected element of ucos_iii_params_list[] and fix the size of array threads[] to its maximum value; this would be allocated at run-time, avoiding impacts to data segment. Change-Id: I569011a257783d35a8795adbda06e942b4157f2a Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7678 Tested-by: jenkins
2023-05-18rtos: move prototype of rtos_thread_packet() in rtos.hAntonio Borneo4-7/+1
The function rtos_thread_packet() is used across rtos and declared locally as extern. Move the prototype of the function in common include rtos.h Change-Id: I50d311b583148a2de628de0997ef1afc9103a70e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7677 Tested-by: jenkins
2023-05-18rtos: move in rtos.h the rtos_type's declarationAntonio Borneo2-16/+15
The static analyser 'sparse' complains, while compiling a rtos' file, that the struct rtos_type is declared in the file as non static, but it is not exposed through an include file. The message is: warning: symbol 'XXX' was not declared. Should it be static? Move the list of rtos_type's declaration in rtos.h Change-Id: Ia96dff077407a6653b11920519c1724e4c1167a3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7660 Tested-by: jenkins
2023-05-05rtos: with pointers, use NULL instead of 0Antonio Borneo1-4/+4
Don't compare pointers with 0, use NULL when needed. Don't assign pointer to 0, use NULL. Detected through 'sparse' tool. Change-Id: Ifa81ba961c0d490cc74880b4a46b620e6358f779 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7598 Tested-by: jenkins
2023-04-14rtos/linux.c: Fix Linux user space border checkpanciyan1-1/+1
Linux kernel and user space border is 0xc0000000 not 0xc000000 Signed-off-by: panciyan <panciyan@eswincomputing.com> Change-Id: I6b487cce62ac31737deca97d5f5f7bbc081280f4 Reviewed-on: https://review.openocd.org/c/openocd/+/7570 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-04-07rtos/FreeRTOS: some optimization of freertos_update_threads()Chao Du1-2/+1
1. update the rtos->thread_count in time, to make sure the allocated thread_name_str and extra_info_str could be freed by rtos_free_threadlist(). Otherwise the abnormal return may cause a memory leak. 2. remove a redundant assignment to threadid. Signed-off-by: Chao Du <duchao@eswincomputing.com> Change-Id: Ifabc59d501c925b3d6aec8b04b2856d2c31cc4e2 Reviewed-on: https://review.openocd.org/c/openocd/+/7549 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-03-25rtos/nuttx: add Espressif target support and refactoringErhan Kurubas4-278/+329
Almost written from the beginning in a modern OpenOCD way. - Endiannes support - Proper variable types - Align with the other rtos implementations Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I0868a22da2ed2ab664c82b17c171dc59ede78d10 Reviewed-on: https://review.openocd.org/c/openocd/+/7444 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28rtos: remove config.h includes from stackings headersErhan Kurubas14-37/+13
And add its own header to the rtos_xxx_stackings.c Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I084130fde7ee8645129a7cf60bb7bf59448e2f39 Reviewed-on: https://review.openocd.org/c/openocd/+/7441 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28rtos: Fix constness of struct rtos_typeAndreas Fritiofson7-25/+25
Change-Id: Iaa89f2ff4036c23f944ffb4f37fe0c7afaf5069b Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6680 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28rtos: Support rt-kernelAndreas Fritiofson3-0/+387
Works for the proprietary rt-kernel from rt-labs. See: https://rt-labs.com/product/rt-kernel/ Change-Id: Id2c2e292c15fb17eab25e3d07db05014daa2a2b0 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/6668 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28rtos/nuttx: add stacking info for Espressif Xtensa chipsErhan Kurubas1-0/+358
ESP32, ESP32-S2 and ESP32-S3 stack register offsets added Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: Ic6215c1d0152853fd08f82cbd3c138c7d62dbc46 Reviewed-on: https://review.openocd.org/c/openocd/+/7443 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28rtos: add custom stack read functionErhan Kurubas2-1/+11
This is optional field for the targets which has to implement their custom stack read function. Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: Icbc9ed66a052fc2cc0ef67e3ec4d85ab0c2c1b94 Reviewed-on: https://review.openocd.org/c/openocd/+/7442 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28rtos/nuttx: add riscv stacking infoErhan Kurubas2-0/+47
Tested with Espressif ESP32-C3 MCU Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: Ia71ace4909f2dc93ddc07a2ec5524cf374f1937c Reviewed-on: https://review.openocd.org/c/openocd/+/7251 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-28rtos/nuttx: move stacking info to the new nuttx stackings fileErhan Kurubas4-57/+78
Other OSes have separate files to keep stack register offsets. Adding them for NuttX as well will provide a clearer way to expand. Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com> Change-Id: I1428fefefa199a95431f2073c0279dd7028ad8da Reviewed-on: https://review.openocd.org/c/openocd/+/7250 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2023-01-15src/rtos/eCos : Support per-build configuration specific structure layoutsJames G. Smith2-90/+950
Extended feature. This is a large patch, but is self-contained to the eCos support and does not affect any other openocd functionality. It does NOT affect existing eCos RTOS plugin users where their applications do not provide the extended symbolic helper information. If the helper symbols are not available the rtos support code will behave as before. This "dynamic" functionality is *required* because eCos does NOT have a fixed/hardwired, known, layout for the thread descriptor structure. The per-application build eCos configuration can affect the shape of the thread descriptor structure (field presence, and hence offsets of subsequent fields) such that constant values cannot be used to consistently interpret all possible eCos application configurations. For historical reasons, there is not yet a consistent namespace for the helper symbols across eCos HALs hence the support is currently limited to specific architectures (Cortex-M and ARM/Cortex-A). No new Clang analyser warnings are raised by this changeset. Change-Id: Ib3a36877326eeb56595cbca55e21b9e59a59c98a Signed-off-by: James G. Smith <jsmith@rallysmith.co.uk> Reviewed-on: https://review.openocd.org/c/openocd/+/6275 Reviewed-by: Alex Schuilenburg <alex.schuilenburg@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2023-01-15nds32: drop it, together with aice adapter driverAntonio Borneo3-62/+0
The target nds32 and its companion adapter aice have not received any real improvement since 2013. It has been hard to keep them aligned during the evolution of OpenOCD code, with no way for maintainers to really check if they are still working. No real documentation is present for them in OpenOCD. The nds32 code triggers ~50 errors/warnings with scan-build. The arch nds32 has been dropped from Linux kernel v5.18-rc1. For all the reasons above, this code has been deprecated with commit 2e5df83de7f2 ("nds32: deprecate it, together with aice adapter driver") and tagged to be dropped before v0.13.0. Let it r.i.p. in OpenOCD git history. While there, drop from checkpatch list the camelcase symbols that where only used in this code. Change-Id: Ide52a217f2228e9da2f1cc5036c48f3536f26952 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7382 Tested-by: jenkins
2022-12-03hwthread: Restore current_threadid in hwthread_update_threadsKoudai Iwahori1-0/+10
When OpenOCD receives a step-execution command from GDB and the target is configured as rtos=hwthread, OpenOCD reconstructs the thread-info. However, OpenOCD does not restore the thread id which is currently selected by GDB. Due to this issue, OpenOCD sends the information of wrong thread to GDB after the step execution. This commit fixes the above issue by adding a code to save/restore the thread id selected by GDB. Signed-off-by: Koudai Iwahori <koudai@google.com> Change-Id: I761a1141c04d48f1290e4f09baa7c7024f86f36a Reviewed-on: https://review.openocd.org/c/openocd/+/7358 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-12-03hwthread: Add register validity check in get_thread_reg_listKoudai Iwahori1-0/+9
When OpenOCD receives 'g' packet (read general registers) from GDB and target is configured as rtos=hwthread, hwthread_get_thread_reg_list is called. However, it does not check if the register valid or not. Due to this issue, OpenOCD returns invalid register values to GDB. This commit adds a validity check to hwthread_get_thread_reg_list. If the register is not valid, it tries to read the register from the target. Signed-off-by: Koudai Iwahori <koudai@google.com> Change-Id: Iad6424b62124271ec411b1dfc044b57dfc460280 Reviewed-on: https://review.openocd.org/c/openocd/+/7357 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-11-15rtos/ThreadX: added check for NULL-named tasksGiulio Fieramosca1-9/+14
Thread name loading was not correctly handled if a ThreadX task has a NULL name. Signed-off-by: Giulio Fieramosca <giulio@glgprograms.it> Change-Id: I03071930182bc2585b61ce5d8c67491710883dd6 Reviewed-on: https://review.openocd.org/c/openocd/+/7328 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-11-11rtos: hwthread: fix clang error core.NullDereferenceAntonio Borneo1-4/+4
Clang spots a potential NULL pointer dereferencing that is instead an incorrect use of an array of pointers: src/rtos/hwthread.c:254:32: warning: Dereference of null pointer [core.NullDereference] (*rtos_reg_list)[j].number = (*reg_list)[i].number; ^~~~~~~~~~~~~~~~~~~~~ The error has not been spotted before because: - this function is not called for the first core of the SMP node, - for the other cores on Cortex-A it still returns valid register value for the first 12 ARM registers, then it diverges. Also Valgrind does not spot any issue at runtime. Address the array correctly. While there, use DIV_ROUND_UP() macro for the computation. Change-Id: Ib87e60e0edfd9671091f5dcfa9aedaf1aed800d1 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7337 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-11-11Revert "Remove duplicate of a counter in hwthread_update_threads"Tomas Vanek1-3/+7
Commit 0cedf10f8fd6 ("Remove duplicate of a counter in hwthread_update_threads") introduced a code bug. In the second foreach_smp_target() loop, variable "threads_found" gets passed to routine hwthread_fill_thread(). By removing the counting of threads_found from the second loop, the incorrect thread counter value gets passed to hwthread_fill_thread(). Change-Id: Ie89e53ccd28bb72b6838ef2f12106a1fe8d00994 Suggested-by: Daniel Goehring <dgoehrin@os.amperecomputing.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: https://review.openocd.org/c/openocd/+/7307 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-11-04ThreadX: set current_thread for kernel executionBen McMorran1-0/+6
If we just invented thread 1 to represent the current execution, we need to make sure the RTOS object also claims it's the current thread so that threadx_get_thread_reg_list() doesn't attempt to read a thread control block at 0x00000001. Signed-off-by: Ben McMorran <bemcmorr@microsoft.com> Change-Id: I7f71e730d047858898297e4cb31db8e47e0c371c Reviewed-on: https://review.openocd.org/c/openocd/+/7280 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-10-08Remove duplicate of a counter in hwthread_update_threadsEvgeniy Naydanov1-7/+3
There is no need to count number of examined threads twice. Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com> Change-Id: Id32ead853d1ddcd4e67062d6f795700feb20cb4b Reviewed-on: https://review.openocd.org/c/openocd/+/7223 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2022-09-18openocd: fix SPDX tag format for files .cAntonio Borneo21-21/+21
With the old checkpatch we cannot use the correct format for the SPDX tags in the file .c, in fact the C99 comments are not allowed and we had to use the block comment. With the new checkpatch, let's switch to the correct SPDX format. Change created automatically through the command: sed -i \ 's,^/\* *\(SPDX-License-Identifier: .*[^ ]\) *\*/$,// \1,' \ $(find src/ contrib/ -name \*.c) Change-Id: I6da16506baa7af718947562505dd49606d124171 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7153 Tested-by: jenkins
2022-09-17rtos: Support looking up .lto_priv.0 appended to symbol nameTim Nordell1-8/+47
When FreeRTOS (at least) is compiled with -flto, this leaves certain static symbols with .lto_priv.0 appended to their name. Arguably this could be considered to be a gdb or gcc bug, but one place to resolve it for OpenOCD usage is here at symbol lookup time. Note that the ".0" is for the first such instance of the variable as a static; additional ones would end up as ".1", ".2", etc, and are not considered here. Signed-off-by: Tim Nordell <tnordell@airgain.com> Change-Id: I03580b45e8ea364392ef4e05c96276416b390cb0 Reviewed-on: https://review.openocd.org/c/openocd/+/7179 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-09-17rtos: Fold is_symbol_mandatory into rtos_qsymbol(..)Tim Nordell1-20/+15
This is in preparation for a future commit that looks for an optional suffix of .lto_priv.0 on the symbol name. Signed-off-by: Tim Nordell <tnordell@airgain.com> Change-Id: If803332373825b73bc986bd4ea7dfaee9c625c0a Reviewed-on: https://review.openocd.org/c/openocd/+/7178 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-09-17rtos: Create a new helper function find_symbol(...)Tim Nordell1-13/+18
This will be utilized for an upcoming refactorization to support -flto compiled programs. Signed-off-by: Tim Nordell <tnordell@airgain.com> Change-Id: Id523c0b3ac2dad8b248ea0d2cac7b4dd2f83d293 Reviewed-on: https://review.openocd.org/c/openocd/+/7177 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-09-13FreeRTOS: Fix thread reg list for Cortex-M7Frank Dischner1-1/+2
This updates the FreeRTOS module to use the M4F FPU stacking also for the FPV5_SP and FPV5_DP FPUs, which are found on the Cortex-M7. The FPUs are in fact different than the FPV4_SP found on the M4, but the register stacking is the same. Signed-off-by: Frank Dischner <frank.dischner@gmail.com> Change-Id: I74c45d2cfb55f55e6c557f2450068ad3c2fe9497 Reviewed-on: https://review.openocd.org/c/openocd/+/6939 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2022-09-13openocd: remove CamelCase symbols *xPSR*Antonio Borneo9-14/+14
We have left the camelcase symbols *xPSR* for some time, to avoid any conflict with possibly pending patches in gerrit. With the approaching v0.12.0-rc1, it's time to revisit it. The patches in gerrit that conflict with this rename are all not merge-able due to conflicts or due to negative review. Drop these CamelCase symbols. Change-Id: Ifbac4c1df9cc55994e024971a2aaebeed2ea4ed3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7155 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
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>