]> git.sur5r.net Git - openocd/commitdiff
target: constify structures
authorSpencer Oliver <spen@spen-soft.co.uk>
Thu, 11 Sep 2014 21:14:31 +0000 (22:14 +0100)
committerSpencer Oliver <spen@spen-soft.co.uk>
Mon, 6 Oct 2014 11:57:40 +0000 (11:57 +0000)
Change-Id: I875cfab8dec4ade72ed9c9cd7d52baaca182a1ef
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2295
Tested-by: jenkins
16 files changed:
src/target/arm_adi_v5.c
src/target/arm_semihosting.c
src/target/armv7m.c
src/target/armv7m.h
src/target/avr32_ap7k.c
src/target/breakpoints.c
src/target/dsp563xx.c
src/target/dsp563xx_once.h
src/target/embeddedice.c
src/target/etb.c
src/target/etm.c
src/target/nds32_reg.c
src/target/openrisc/jsp_server.c
src/target/openrisc/or1k.c
src/target/openrisc/or1k_tap_vjtag.c
src/target/xscale.c

index 9f66070204a6d7ddf61ad71d6001d5a9d1cf0093..a059531534750c3027ae3a24958bfd624131ac31 100644 (file)
@@ -987,7 +987,7 @@ static int dap_rom_display(struct command_context *cmd_ctx,
                        uint32_t c_pid0, c_pid1, c_pid2, c_pid3, c_pid4;
                        uint32_t component_base;
                        unsigned part_num;
-                       char *type, *full;
+                       const char *type, *full;
 
                        component_base = (dbgbase & 0xFFFFF000) + (romentry & 0xFFFFF000);
 
@@ -1046,7 +1046,7 @@ static int dap_rom_display(struct command_context *cmd_ctx,
                        if (((c_cid1 >> 4) & 0x0f) == 9) {
                                uint32_t devtype;
                                unsigned minor;
-                               char *major = "Reserved", *subtype = "Reserved";
+                               const char *major = "Reserved", *subtype = "Reserved";
 
                                retval = mem_ap_read_atomic_u32(dap,
                                                (component_base & 0xfffff000) | 0xfcc,
index 06a433f22b7233e96d08f3d7c3e19ad421f84c30..21b7809c285b04d09294df1c8606e6cfdec67e00 100644 (file)
@@ -48,7 +48,7 @@
 #include <helper/log.h>
 #include <sys/stat.h>
 
-static int open_modeflags[12] = {
+static const int open_modeflags[12] = {
        O_RDONLY,
        O_RDONLY | O_BINARY,
        O_RDWR,
index 58cec58875d9225033eec22358715f70500b76da..99af3a8777e6703954dd9ee5507517d5e8940815 100644 (file)
@@ -44,7 +44,7 @@
 #define _DEBUG_INSTRUCTION_EXECUTION_
 #endif
 
-static char *armv7m_exception_strings[] = {
+static const char * const armv7m_exception_strings[] = {
        "", "Reset", "NMI", "HardFault",
        "MemManage", "BusFault", "UsageFault", "RESERVED",
        "RESERVED", "RESERVED", "RESERVED", "SVCall",
@@ -148,7 +148,7 @@ int armv7m_restore_context(struct target *target)
  * They are assigned by vendors, which generally assign different numbers to
  * peripherals (such as UART0 or a USB peripheral controller).
  */
-char *armv7m_exception_string(int number)
+const char *armv7m_exception_string(int number)
 {
        static char enamebuf[32];
 
index 575912fc9a136894a0e8f0054e8974f6b2415a9b..86c9aee2218f0da1dfa72bad5d20802fece8ea52 100644 (file)
@@ -33,7 +33,7 @@
 extern const int armv7m_psp_reg_map[];
 extern const int armv7m_msp_reg_map[];
 
-char *armv7m_exception_string(int number);
+const char *armv7m_exception_string(int number);
 
 /* offsets into armv7m core register cache */
 enum {
index e1812eccb049dfdd47d1a698ee24c817aac84c3b..55d1efb4cc302beb60425c6af426c9a4b5f2e85c 100644 (file)
 #include "avr32_regs.h"
 #include "avr32_ap7k.h"
 
-static char *avr32_core_reg_list[] = {
+static const char * const avr32_core_reg_list[] = {
        "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",
        "r9", "r10", "r11", "r12", "sp", "lr", "pc", "sr"
 };
 
-static struct avr32_core_reg
+static const struct avr32_core_reg
        avr32_core_reg_list_arch_info[AVR32NUMCOREREGS] = {
        {0, NULL, NULL},
        {1, NULL, NULL},
index 5143afb7bca46f9d7a9995fe182900710d635a3a..b854f1f05b26b761f682b48c5ff0af3e63aef6a4 100644 (file)
 #include <helper/log.h>
 #include "breakpoints.h"
 
-static char *breakpoint_type_strings[] = {
+static const char * const breakpoint_type_strings[] = {
        "hardware",
        "software"
 };
 
-static char *watchpoint_rw_strings[] = {
+static const char * const watchpoint_rw_strings[] = {
        "read",
        "write",
        "access"
@@ -50,7 +50,7 @@ int breakpoint_add_internal(struct target *target,
 {
        struct breakpoint *breakpoint = target->breakpoints;
        struct breakpoint **breakpoint_p = &target->breakpoints;
-       char *reason;
+       const char *reason;
        int retval;
        int n;
 
@@ -396,7 +396,7 @@ int watchpoint_add(struct target *target, uint32_t address, uint32_t length,
        struct watchpoint *watchpoint = target->watchpoints;
        struct watchpoint **watchpoint_p = &target->watchpoints;
        int retval;
-       char *reason;
+       const char *reason;
 
        while (watchpoint) {
                if (watchpoint->address == address) {
index 2e7ac9612617bdd56c6805ac79f09a1e7763f59a..1cb18cf11dcde5963f0f6110084bf4697e5f8e13 100644 (file)
@@ -335,7 +335,7 @@ enum watchpoint_condition {
        ((s & 1) << 16) | ((w & 1) << 15) | ((d & 0x3f) << 8) | (p & 0x3f))
 
 /* the gdb register list is send in this order */
-static uint8_t gdb_reg_list_idx[] = {
+static const uint8_t gdb_reg_list_idx[] = {
        DSP563XX_REG_IDX_X1, DSP563XX_REG_IDX_X0, DSP563XX_REG_IDX_Y1, DSP563XX_REG_IDX_Y0,
        DSP563XX_REG_IDX_A2, DSP563XX_REG_IDX_A1, DSP563XX_REG_IDX_A0, DSP563XX_REG_IDX_B2,
        DSP563XX_REG_IDX_B1, DSP563XX_REG_IDX_B0, DSP563XX_REG_IDX_PC, DSP563XX_REG_IDX_SR,
index b0be95bd153cfee902631ae70d18afa16061d58c..8835d553dc2ac3e48668d738d0a61816e489b2a3 100644 (file)
@@ -63,9 +63,9 @@
 #define DSP563XX_ONCE_NOREG    0x01F   /* no register selected */
 
 struct once_reg {
-       uint8_t num;
-       uint8_t addr;
-       uint8_t len;
+       const uint8_t num;
+       const uint8_t addr;
+       const uint8_t len;
        const char *name;
        uint32_t reg;
 };
index 016883086c835c94c1bc3e8c72ba5500fcdf1aa1..2d32c83a516ab262eff93c7d984df9f22ededdea 100644 (file)
@@ -54,9 +54,9 @@ static int embeddedice_set_reg_w_exec(struct reg *reg, uint8_t *buf);
  * From:  ARM9E-S TRM, DDI 0165, table C-4 (and similar, for other cores)
  */
 static const struct {
-       char            *name;
-       unsigned short  addr;
-       unsigned short  width;
+       const char     *name;
+       unsigned short addr;
+       unsigned short width;
 } eice_regs[] = {
        [EICE_DBG_CTRL] = {
                .name =         "debug_ctrl",
index 2ab35027169f4701dd81af97f01fd9c766b7021a..370c181a99c8be0c6aff84326d2f33dd85c776e8 100644 (file)
@@ -27,7 +27,7 @@
 #include "etb.h"
 #include "register.h"
 
-static char *etb_reg_list[] = {
+static const char * const etb_reg_list[] = {
        "ETB_identification",
        "ETB_ram_depth",
        "ETB_ram_width",
index 17516e9cbfa8b84e714ef1d22fc5d84d460caff2..0c27bc3dc6efbe46876608bb13f4c7cdd469c6eb 100644 (file)
@@ -67,7 +67,7 @@ struct etm_reg_info {
        uint8_t size;                   /* low-N of 32 bits */
        uint8_t mode;                   /* RO, WO, RW */
        uint8_t bcd_vers;               /* 1.0, 2.0, etc */
-       char *name;
+       const char *name;
 };
 
 /*
index 997f4ed39073e46b2f31260ac5c26374d68cdd03..f82ffbfc4e31de9f037d565561a02c028253a042 100644 (file)
@@ -26,7 +26,7 @@
 
 static bool nds32_reg_init_done;
 static struct nds32_reg_s nds32_regs[TOTAL_REG_NUM];
-static struct nds32_reg_exception_s nds32_ex_reg_values[] = {
+static const struct nds32_reg_exception_s nds32_ex_reg_values[] = {
        {IR0, 3, 0x3, 2},
        {IR0, 3, 0x3, 3},
        {IR1, 3, 0x3, 2},
@@ -358,7 +358,7 @@ const char *nds32_reg_symbolic_name(uint32_t number)
 bool nds32_reg_exception(uint32_t number, uint32_t value)
 {
        int i;
-       struct nds32_reg_exception_s *ex_reg_value;
+       const struct nds32_reg_exception_s *ex_reg_value;
        uint32_t field_value;
 
        i = 0;
index 597bfcb64f252a90de8e38cdcb48047ce1e8813e..83e03ae3e2d0eb59fa4d45591312aa84a4a01a67 100644 (file)
@@ -37,7 +37,7 @@ static char *jsp_port;
  * the client should be forced into character mode. However it doesn't make any difference.
  */
 
-static char *negotiate =
+static const char * const negotiate =
        "\xFF\xFB\x03"                  /* IAC WILL Suppress Go Ahead */
        "\xFF\xFB\x01"                  /* IAC WILL Echo */
        "\xFF\xFD\x03"                  /* IAC DO Suppress Go Ahead */
index bd373a7fff47c48c9657e84051e4bdccd9cc925b..aeef0a56544815594be7b04e65f42607bb1e5c7a 100644 (file)
@@ -50,7 +50,7 @@ static int or1k_write_core_reg(struct target *target, int num);
 
 static struct or1k_core_reg *or1k_core_reg_list_arch_info;
 
-struct or1k_core_reg_init or1k_init_reg_list[] = {
+static const struct or1k_core_reg_init or1k_init_reg_list[] = {
        {"r0"       , GROUP0 + 1024, "org.gnu.gdb.or1k.group0", NULL},
        {"r1"       , GROUP0 + 1025, "org.gnu.gdb.or1k.group0", NULL},
        {"r2"       , GROUP0 + 1026, "org.gnu.gdb.or1k.group0", NULL},
index 513d8a74cf273ab7d1f9c49897815fc63c704af1..fcc832aa97181c2cbcd89862bc605a9739302069 100644 (file)
@@ -61,7 +61,7 @@
 #define OR1K_TAP_INST_IDCODE 0x2
 #define OR1K_TAP_INST_DEBUG 0x8
 
-static char *id_to_string(unsigned char id)
+static const char *id_to_string(unsigned char id)
 {
        switch (id) {
        case VJTAG_NODE_ID:
index b64a1bff2a51795c5aee477e0e5087979a018c6c..8d97a89fbed059e8391820f358d464ed254b5618 100644 (file)
@@ -78,7 +78,7 @@ static const uint8_t xscale_debug_handler[] = {
 #include "xscale_debug.inc"
 };
 
-static char *const xscale_reg_list[] = {
+static const char *const xscale_reg_list[] = {
        "XSCALE_MAINID",                /* 0 */
        "XSCALE_CACHETYPE",
        "XSCALE_CTRL",