aboutsummaryrefslogtreecommitdiff
path: root/src/rtos/FreeRTOS.c
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2023-03-16 17:52:48 -0700
committerTim Newsome <tim@sifive.com>2023-03-16 18:02:35 -0700
commit868ebdd89ca75a73bffe335395aa1ed522dda660 (patch)
tree95ead6f4982b85a6cc90d5832712523a8ee7b77a /src/rtos/FreeRTOS.c
parent3387015af01f18cc350c4764fbd533068ed15f3d (diff)
parent1293ddd65713d6551775b67169387622ada477c1 (diff)
downloadriscv-openocd-868ebdd89ca75a73bffe335395aa1ed522dda660.zip
riscv-openocd-868ebdd89ca75a73bffe335395aa1ed522dda660.tar.gz
riscv-openocd-868ebdd89ca75a73bffe335395aa1ed522dda660.tar.bz2
Merge commit '1293ddd65713d6551775b67169387622ada477c1' into from_upstream
This includes https://sourceforge.net/p/openocd/mailman/message/37710818/, which should fix #814. Conflicts: .travis.yml contrib/loaders/flash/stm32/stm32f1x.S contrib/loaders/flash/stm32/stm32f2x.S doc/openocd.texi src/rtos/FreeRTOS.c src/server/gdb_server.c src/target/riscv/riscv-013.c src/target/riscv/riscv.c src/target/riscv/riscv.h src/target/riscv/riscv_semihosting.c tcl/target/esp_common.cfg tcl/target/gd32vf103.cfg tools/scripts/checkpatch.pl Change-Id: I1986c13298ca0dafbe3aecaf1b0b35626525e4eb
Diffstat (limited to 'src/rtos/FreeRTOS.c')
-rw-r--r--src/rtos/FreeRTOS.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/rtos/FreeRTOS.c b/src/rtos/FreeRTOS.c
index 2e468c7..5038b09 100644
--- a/src/rtos/FreeRTOS.c
+++ b/src/rtos/FreeRTOS.c
@@ -1,19 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
/***************************************************************************
* Copyright (C) 2011 by Broadcom Corporation *
* Evan Hunter - ehunter@broadcom.com *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
@@ -83,7 +72,8 @@ static int cortex_m_stacking(struct rtos *rtos, const struct rtos_register_stack
int cm4_fpu_enabled = 0;
struct armv7m_common *armv7m_target = target_to_armv7m(rtos->target);
if (is_armv7m(armv7m_target)) {
- if (armv7m_target->fp_feature == FPV4_SP) {
+ if ((armv7m_target->fp_feature == FPV4_SP) || (armv7m_target->fp_feature == FPV5_SP) ||
+ (armv7m_target->fp_feature == FPV5_DP)) {
/* Found ARM v7m target which includes a FPU */
uint32_t cpacr;
@@ -280,6 +270,7 @@ enum freertos_symbol_values {
FREERTOS_VAL_X_SUSPENDED_TASK_LIST = 8,
FREERTOS_VAL_UX_CURRENT_NUMBER_OF_TASKS = 9,
FREERTOS_VAL_UX_TOP_USED_PRIORITY = 10,
+ FREERTOS_VAL_X_SCHEDULER_RUNNING = 11,
};
struct symbols {
@@ -299,6 +290,7 @@ static const struct symbols freertos_symbol_list[] = {
{ "xSuspendedTaskList", true }, /* Only if INCLUDE_vTaskSuspend */
{ "uxCurrentNumberOfTasks", false },
{ "uxTopUsedPriority", true }, /* Unavailable since v7.5.3 */
+ { "xSchedulerRunning", false },
{ NULL, false }
};
@@ -529,7 +521,20 @@ static int freertos_update_threads(struct rtos *rtos)
rtos->symbols[FREERTOS_VAL_PX_CURRENT_TCB].address,
pxCurrentTCB);
- if ((thread_list_size == 0) || (pxCurrentTCB == 0)) {
+ /* read scheduler running */
+ uint32_t scheduler_running;
+ retval = target_read_u32(rtos->target,
+ rtos->symbols[FREERTOS_VAL_X_SCHEDULER_RUNNING].address,
+ &scheduler_running);
+ if (retval != ERROR_OK) {
+ LOG_ERROR("Error reading FreeRTOS scheduler state");
+ return retval;
+ }
+ LOG_DEBUG("FreeRTOS: Read xSchedulerRunning at 0x%" PRIx64 ", value 0x%" PRIx32,
+ rtos->symbols[FREERTOS_VAL_X_SCHEDULER_RUNNING].address,
+ scheduler_running);
+
+ if ((thread_list_size == 0) || (rtos->current_thread == 0) || (scheduler_running != 1)) {
/* Either : No RTOS threads - there is always at least the current execution though */
/* OR : No current thread - all threads suspended - show the current execution
* of idling */