+// SPDX-License-Identifier: GPL-2.0-or-later
+
/***************************************************************************
* Copyright (C) 2015 by Daniel Krebs *
* Daniel Krebs - github@daniel-krebs.net *
- * *
- * 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
#include <helper/time_support.h>
#include <jtag/jtag.h>
#include "target/target.h"
-#include "target/target_type.h"
#include "rtos.h"
#include "helper/log.h"
#include "helper/types.h"
static int riot_update_threads(struct rtos *rtos)
{
int retval;
- unsigned int tasks_found = 0;
+ int tasks_found = 0;
const struct riot_params *param;
if (!rtos)
riot_symbol_list[RIOT_NUM_THREADS].name);
return retval;
}
- rtos->thread_count = thread_count;
/* read the maximum number of threads */
uint8_t max_threads = 0;
riot_symbol_list[RIOT_MAX_THREADS].name);
return retval;
}
+ if (thread_count > max_threads) {
+ LOG_ERROR("Thread count is invalid");
+ return ERROR_FAIL;
+ }
+ rtos->thread_count = thread_count;
/* Base address of thread array */
uint32_t threads_base = rtos->symbols[RIOT_THREADS_BASE].address;
char buffer[32];
for (unsigned int i = 0; i < max_threads; i++) {
+ if (tasks_found == rtos->thread_count)
+ break;
+
/* get pointer to tcb_t */
uint32_t tcb_pointer = 0;
retval = target_read_u32(rtos->target,
/* lookup if target is supported by RIOT */
while ((i < RIOT_NUM_PARAMS) &&
- (strcmp(riot_params_list[i].target_name, target->type->name) != 0)) {
+ (strcmp(riot_params_list[i].target_name, target_type_name(target)) != 0)) {
i++;
}
if (i >= RIOT_NUM_PARAMS) {