Use ARRAY_SIZE in helper/types.h to determine the size of the
symbol list.
Change-Id: Icc9838323510f8602efa5d0162a4daed33f863b9
Signed-off-by: Matthias Blaicher <matthias@blaicher.com>
Reviewed-on: http://openocd.zylin.com/935
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
#include "target/target_type.h"
#include "rtos.h"
#include "helper/log.h"
#include "target/target_type.h"
#include "rtos.h"
#include "helper/log.h"
+#include "helper/types.h"
#include "rtos_chibios_stackings.h"
#include "rtos_chibios_stackings.h"
-#define CHIBIOS_NUM_SYMBOLS (sizeof(ChibiOS_symbol_list)/sizeof(char *))
-
static int ChibiOS_update_memory_signature(struct rtos *rtos)
{
int retval;
static int ChibiOS_update_memory_signature(struct rtos *rtos)
{
int retval;
{
unsigned int i;
*symbol_list = (symbol_table_elem_t *) malloc(
{
unsigned int i;
*symbol_list = (symbol_table_elem_t *) malloc(
- sizeof(symbol_table_elem_t) * CHIBIOS_NUM_SYMBOLS);
+ sizeof(symbol_table_elem_t) * ARRAY_SIZE(ChibiOS_symbol_list));
- for (i = 0; i < CHIBIOS_NUM_SYMBOLS; i++)
+ for (i = 0; i < ARRAY_SIZE(ChibiOS_symbol_list); i++)
(*symbol_list)[i].symbol_name = ChibiOS_symbol_list[i];
return 0;
(*symbol_list)[i].symbol_name = ChibiOS_symbol_list[i];
return 0;
#include "target/target_type.h"
#include "rtos.h"
#include "helper/log.h"
#include "target/target_type.h"
#include "rtos.h"
#include "helper/log.h"
+#include "helper/types.h"
#include "rtos_standard_stackings.h"
#define FREERTOS_MAX_PRIORITIES 63
#include "rtos_standard_stackings.h"
#define FREERTOS_MAX_PRIORITIES 63
-#define FREERTOS_NUM_SYMBOLS (sizeof(FreeRTOS_symbol_list)/sizeof(char *))
-
/* TODO: */
/* this is not safe for little endian yet */
/* may be problems reading if sizes are not 32 bit long integers. */
/* TODO: */
/* this is not safe for little endian yet */
/* may be problems reading if sizes are not 32 bit long integers. */
{
unsigned int i;
*symbol_list = (symbol_table_elem_t *) malloc(
{
unsigned int i;
*symbol_list = (symbol_table_elem_t *) malloc(
- sizeof(symbol_table_elem_t) * FREERTOS_NUM_SYMBOLS);
+ sizeof(symbol_table_elem_t) * ARRAY_SIZE(FreeRTOS_symbol_list));
- for (i = 0; i < FREERTOS_NUM_SYMBOLS; i++)
+ for (i = 0; i < ARRAY_SIZE(FreeRTOS_symbol_list); i++)
(*symbol_list)[i].symbol_name = FreeRTOS_symbol_list[i];
return 0;
(*symbol_list)[i].symbol_name = FreeRTOS_symbol_list[i];
return 0;
#include "target/target_type.h"
#include "rtos.h"
#include "helper/log.h"
#include "target/target_type.h"
#include "rtos.h"
#include "helper/log.h"
+#include "helper/types.h"
#include "rtos_standard_stackings.h"
static int ThreadX_detect_rtos(struct target *target);
#include "rtos_standard_stackings.h"
static int ThreadX_detect_rtos(struct target *target);
-#define THREADX_NUM_SYMBOLS (sizeof(ThreadX_symbol_list)/sizeof(char *))
-
const struct rtos_type ThreadX_rtos = {
.name = "ThreadX",
const struct rtos_type ThreadX_rtos = {
.name = "ThreadX",
{
unsigned int i;
*symbol_list = (symbol_table_elem_t *) malloc(
{
unsigned int i;
*symbol_list = (symbol_table_elem_t *) malloc(
- sizeof(symbol_table_elem_t) * THREADX_NUM_SYMBOLS);
+ sizeof(symbol_table_elem_t) * ARRAY_SIZE(ThreadX_symbol_list));
- for (i = 0; i < THREADX_NUM_SYMBOLS; i++)
+ for (i = 0; i < ARRAY_SIZE(ThreadX_symbol_list); i++)
(*symbol_list)[i].symbol_name = ThreadX_symbol_list[i];
return 0;
(*symbol_list)[i].symbol_name = ThreadX_symbol_list[i];
return 0;
#include "target/target_type.h"
#include "rtos.h"
#include "helper/log.h"
#include "target/target_type.h"
#include "rtos.h"
#include "helper/log.h"
+#include "helper/types.h"
#include "rtos_ecos_stackings.h"
static int eCos_detect_rtos(struct target *target);
#include "rtos_ecos_stackings.h"
static int eCos_detect_rtos(struct target *target);
-#define ECOS_NUM_SYMBOLS (sizeof(eCos_symbol_list)/sizeof(char *))
-
const struct rtos_type eCos_rtos = {
.name = "eCos",
const struct rtos_type eCos_rtos = {
.name = "eCos",
{
unsigned int i;
*symbol_list = (symbol_table_elem_t *) malloc(
{
unsigned int i;
*symbol_list = (symbol_table_elem_t *) malloc(
- sizeof(symbol_table_elem_t) * ECOS_NUM_SYMBOLS);
+ sizeof(symbol_table_elem_t) * ARRAY_SIZE(eCos_symbol_list));
- for (i = 0; i < ECOS_NUM_SYMBOLS; i++)
+ for (i = 0; i < ARRAY_SIZE(eCos_symbol_list); i++)
(*symbol_list)[i].symbol_name = eCos_symbol_list[i];
return 0;
(*symbol_list)[i].symbol_name = eCos_symbol_list[i];
return 0;