aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSpencer Oliver <spen@spen-soft.co.uk>2014-09-11 22:07:10 +0100
committerSpencer Oliver <spen@spen-soft.co.uk>2014-10-06 11:57:29 +0000
commit03410e92dae6efbb2dc474fb7556117cc60c3f82 (patch)
tree04a55ac0bd302e71f229f568a4301b8bae47d392 /src
parent40815bd39a7ee9f93a95a89e978fdace081c3563 (diff)
downloadriscv-openocd-03410e92dae6efbb2dc474fb7556117cc60c3f82.zip
riscv-openocd-03410e92dae6efbb2dc474fb7556117cc60c3f82.tar.gz
riscv-openocd-03410e92dae6efbb2dc474fb7556117cc60c3f82.tar.bz2
rtos: constify symbol names and lists
Change-Id: I72f3cd50fc6a33a178e72e169c9660e707751524 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/2292 Tested-by: jenkins
Diffstat (limited to 'src')
-rw-r--r--src/rtos/ChibiOS.c9
-rw-r--r--src/rtos/FreeRTOS.c4
-rw-r--r--src/rtos/ThreadX.c13
-rw-r--r--src/rtos/eCos.c12
-rw-r--r--src/rtos/embKernel.c6
-rw-r--r--src/rtos/linux.c4
-rw-r--r--src/rtos/rtos.c5
-rw-r--r--src/rtos/rtos.h4
8 files changed, 28 insertions, 29 deletions
diff --git a/src/rtos/ChibiOS.c b/src/rtos/ChibiOS.c
index 85da6f8..46fdca3 100644
--- a/src/rtos/ChibiOS.c
+++ b/src/rtos/ChibiOS.c
@@ -36,7 +36,6 @@
#include "helper/types.h"
#include "rtos_chibios_stackings.h"
-
/**
* @brief ChibiOS/RT memory signature record.
*
@@ -72,7 +71,7 @@ struct ChibiOS_chdebug {
/**
* @brief ChibiOS thread states.
*/
-const char *ChibiOS_thread_states[] = {
+static const char * const ChibiOS_thread_states[] = {
"READY", "CURRENT", "SUSPENDED", "WTSEM", "WTMTX", "WTCOND", "SLEEPING",
"WTEXIT", "WTOREVT", "WTANDEVT", "SNDMSGQ", "SNDMSG", "WTMSG", "WTQUEUE",
"FINAL"
@@ -92,7 +91,7 @@ struct ChibiOS_params {
const struct rtos_register_stacking *stacking_info;
};
-struct ChibiOS_params ChibiOS_params_list[] = {
+static const struct ChibiOS_params ChibiOS_params_list[] = {
{
"cortex_m", /* target_name */
0,
@@ -128,7 +127,7 @@ enum ChibiOS_symbol_values {
ChibiOS_VAL_chSysInit = 2
};
-static char *ChibiOS_symbol_list[] = {
+static const char * const ChibiOS_symbol_list[] = {
"rlist", /* Thread ready list*/
"ch_debug", /* Memory Signatur containing offsets of fields in rlist*/
"chSysInit", /* Necessary part of API, used for ChibiOS detection*/
@@ -539,6 +538,6 @@ static int ChibiOS_create(struct target *target)
return -1;
}
- target->rtos->rtos_specific_params = &ChibiOS_params_list[i];
+ target->rtos->rtos_specific_params = (void *) &ChibiOS_params_list[i];
return 0;
}
diff --git a/src/rtos/FreeRTOS.c b/src/rtos/FreeRTOS.c
index 57307d5..1e699c6 100644
--- a/src/rtos/FreeRTOS.c
+++ b/src/rtos/FreeRTOS.c
@@ -48,7 +48,7 @@ struct FreeRTOS_params {
const struct rtos_register_stacking *stacking_info;
};
-const struct FreeRTOS_params FreeRTOS_params_list[] = {
+static const struct FreeRTOS_params FreeRTOS_params_list[] = {
{
"cortex_m", /* target_name */
4, /* thread_count_width; */
@@ -119,7 +119,7 @@ enum FreeRTOS_symbol_values {
FreeRTOS_VAL_uxTopUsedPriority = 10,
};
-static char *FreeRTOS_symbol_list[] = {
+static const char * const FreeRTOS_symbol_list[] = {
"pxCurrentTCB",
"pxReadyTasksLists",
"xDelayedTaskList1",
diff --git a/src/rtos/ThreadX.c b/src/rtos/ThreadX.c
index 50df9ec..88470b6 100644
--- a/src/rtos/ThreadX.c
+++ b/src/rtos/ThreadX.c
@@ -39,10 +39,10 @@ static int ThreadX_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
struct ThreadX_thread_state {
int value;
- char *desc;
+ const char *desc;
};
-struct ThreadX_thread_state ThreadX_thread_states[] = {
+static const struct ThreadX_thread_state ThreadX_thread_states[] = {
{ 0, "Ready" },
{ 1, "Completed" },
{ 2, "Terminated" },
@@ -62,7 +62,7 @@ struct ThreadX_thread_state ThreadX_thread_states[] = {
#define THREADX_NUM_STATES (sizeof(ThreadX_thread_states)/sizeof(struct ThreadX_thread_state))
struct ThreadX_params {
- char *target_name;
+ const char *target_name;
unsigned char pointer_width;
unsigned char thread_stack_offset;
unsigned char thread_name_offset;
@@ -71,7 +71,7 @@ struct ThreadX_params {
const struct rtos_register_stacking *stacking_info;
};
-const struct ThreadX_params ThreadX_params_list[] = {
+static const struct ThreadX_params ThreadX_params_list[] = {
{
"cortex_m", /* target_name */
4, /* pointer_width; */
@@ -100,7 +100,7 @@ enum ThreadX_symbol_values {
ThreadX_VAL_tx_thread_created_count = 2,
};
-static char *ThreadX_symbol_list[] = {
+static const char * const ThreadX_symbol_list[] = {
"_tx_thread_current_ptr",
"_tx_thread_created_ptr",
"_tx_thread_created_count",
@@ -115,7 +115,6 @@ const struct rtos_type ThreadX_rtos = {
.update_threads = ThreadX_update_threads,
.get_thread_reg_list = ThreadX_get_thread_reg_list,
.get_symbol_list_to_lookup = ThreadX_get_symbol_list_to_lookup,
-
};
static int ThreadX_update_threads(struct rtos *rtos)
@@ -262,7 +261,7 @@ static int ThreadX_update_threads(struct rtos *rtos)
/* empty */
}
- char *state_desc;
+ const char *state_desc;
if (i < THREADX_NUM_STATES)
state_desc = ThreadX_thread_states[i].desc;
else
diff --git a/src/rtos/eCos.c b/src/rtos/eCos.c
index 742437b..62fb3b7 100644
--- a/src/rtos/eCos.c
+++ b/src/rtos/eCos.c
@@ -37,10 +37,10 @@ static int eCos_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[]);
struct eCos_thread_state {
int value;
- char *desc;
+ const char *desc;
};
-struct eCos_thread_state eCos_thread_states[] = {
+static const struct eCos_thread_state eCos_thread_states[] = {
{ 0, "Ready" },
{ 1, "Sleeping" },
{ 2, "Countsleep" },
@@ -52,7 +52,7 @@ struct eCos_thread_state eCos_thread_states[] = {
#define ECOS_NUM_STATES (sizeof(eCos_thread_states)/sizeof(struct eCos_thread_state))
struct eCos_params {
- char *target_name;
+ const char *target_name;
unsigned char pointer_width;
unsigned char thread_stack_offset;
unsigned char thread_name_offset;
@@ -62,7 +62,7 @@ struct eCos_params {
const struct rtos_register_stacking *stacking_info;
};
-const struct eCos_params eCos_params_list[] = {
+static const struct eCos_params eCos_params_list[] = {
{
"cortex_m", /* target_name */
4, /* pointer_width; */
@@ -82,7 +82,7 @@ enum eCos_symbol_values {
eCos_VAL_current_thread_ptr = 1
};
-static char *eCos_symbol_list[] = {
+static const char * const eCos_symbol_list[] = {
"Cyg_Thread::thread_list",
"Cyg_Scheduler_Base::current_thread",
NULL
@@ -257,7 +257,7 @@ static int eCos_update_threads(struct rtos *rtos)
*/
}
- char *state_desc;
+ const char *state_desc;
if (i < ECOS_NUM_STATES)
state_desc = eCos_thread_states[i].desc;
else
diff --git a/src/rtos/embKernel.c b/src/rtos/embKernel.c
index 9f5fa50..6cb42d1 100644
--- a/src/rtos/embKernel.c
+++ b/src/rtos/embKernel.c
@@ -58,7 +58,7 @@ enum {
SYMBOL_ID_sCurrentTaskCount = 5,
};
-static char *embKernel_symbol_list[] = {
+static const char * const embKernel_symbol_list[] = {
"Rtos::sCurrentTask",
"Rtos::sListReady",
"Rtos::sListSleep",
@@ -81,7 +81,7 @@ struct embKernel_params {
const struct rtos_register_stacking *stacking_info;
};
-struct embKernel_params embKernel_params_list[] = {
+static const struct embKernel_params embKernel_params_list[] = {
{
"cortex_m", /* target_name */
4, /* pointer_width */
@@ -131,7 +131,7 @@ static int embKernel_create(struct target *target)
return -1;
}
- target->rtos->rtos_specific_params = &embKernel_params_list[i];
+ target->rtos->rtos_specific_params = (void *) &embKernel_params_list[i];
return 0;
}
diff --git a/src/rtos/linux.c b/src/rtos/linux.c
index f2a48a2..9021d8c 100644
--- a/src/rtos/linux.c
+++ b/src/rtos/linux.c
@@ -40,7 +40,7 @@
#define MAX_THREADS 200
/* specific task */
struct linux_os {
- char *name;
+ const char *name;
uint32_t init_task_addr;
int thread_count;
int threadid_count;
@@ -320,7 +320,7 @@ static int linux_os_detect(struct target *target)
static int linux_os_smp_init(struct target *target);
static int linux_os_clean(struct target *target);
#define INIT_TASK 0
-static char *linux_symbol_list[] = {
+static const char * const linux_symbol_list[] = {
"init_task",
NULL
};
diff --git a/src/rtos/rtos.c b/src/rtos/rtos.c
index 9ceeb26..735c106 100644
--- a/src/rtos/rtos.c
+++ b/src/rtos/rtos.c
@@ -147,7 +147,7 @@ int gdb_thread_packet(struct connection *connection, char const *packet, int pac
return target->rtos->gdb_thread_packet(connection, packet, packet_size);
}
-static char *next_symbol(struct rtos *os, char *cur_symbol, uint64_t cur_addr)
+static const char *next_symbol(struct rtos *os, char *cur_symbol, uint64_t cur_addr)
{
symbol_table_elem_t *s;
@@ -191,7 +191,8 @@ int rtos_qsymbol(struct connection *connection, char const *packet, int packet_s
int rtos_detected = 0;
uint64_t addr = 0;
size_t reply_len;
- char reply[GDB_BUFFER_SIZE], cur_sym[GDB_BUFFER_SIZE / 2] = "", *next_sym;
+ char reply[GDB_BUFFER_SIZE], cur_sym[GDB_BUFFER_SIZE / 2] = "";
+ const char *next_sym;
struct target *target = get_target_from_connection(connection);
struct rtos *os = target->rtos;
diff --git a/src/rtos/rtos.h b/src/rtos/rtos.h
index a81f67e..980d95d 100644
--- a/src/rtos/rtos.h
+++ b/src/rtos/rtos.h
@@ -33,7 +33,7 @@ struct reg;
* Table should be terminated by an element with NULL in symbol_name
*/
typedef struct symbol_table_elem_struct {
- char *symbol_name;
+ const char *symbol_name;
symbol_address_t address;
} symbol_table_elem_t;
@@ -61,7 +61,7 @@ struct rtos {
};
struct rtos_type {
- char *name;
+ const char *name;
int (*detect_rtos)(struct target *target);
int (*create)(struct target *target);
int (*smp_init)(struct target *target);