From 792cf1b3f297d5b78e39aeec7c5c3a2f31dc0255 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 15 Jun 2010 03:28:23 +0000 Subject: [PATCH] constify more driver lists and related structures to cut down on .data size git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1788 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- urjtag/ChangeLog | 12 ++++++++++++ urjtag/include/urjtag/bfin.h | 2 +- urjtag/include/urjtag/bus.h | 2 +- urjtag/include/urjtag/cable.h | 2 +- urjtag/include/urjtag/flash.h | 2 +- urjtag/include/urjtag/params.h | 4 ++-- urjtag/include/urjtag/parport.h | 2 +- urjtag/include/urjtag/usbconn.h | 2 +- urjtag/src/bfin/bfin.c | 2 +- urjtag/src/bus/buses.c | 4 ++-- urjtag/src/flash/flash.c | 2 +- urjtag/src/tap/cable.c | 4 ++-- urjtag/src/tap/cable/generic_usbconn.c | 2 +- urjtag/src/tap/parport.c | 2 +- urjtag/src/tap/usbconn.c | 2 +- 15 files changed, 29 insertions(+), 17 deletions(-) diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 6449de45..a7ade046 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -14,6 +14,18 @@ fix local types so we don't mismatch signs, and avoid leaking register allocations with the error handling. + * include/urjtag/bfin.h (scans), include/urjtag/bus.h (urj_bus_drivers), + include/urjtag/cable.h (urj_tap_cable_drivers), include/urjtag/flash.h + (urj_flash_flash_drivers), include/urjtag/params.h (urj_param_list_t.list), + include/urjtag/parport.h (urj_tap_parport_drivers), + include/urjtag/usbconn.h (urj_tap_usbconn_drivers), src/bfin/bfin.c + (scans), src/bus/buses.c (urj_bus_drivers, bus_param), src/flash/flash.c + (urj_flash_flash_drivers), src/tap/cable.c (urj_tap_cable_drivers), + src/tap/cable/generic_usbconn.c (urj_tap_cable_usbconn_cables), + src/tap/parport.c (urj_tap_parport_drivers), src/tap/usbconn.c + (urj_tap_usbconn_drivers): Constify drivers lists and a few related + structures to share more unmutable data in .rodata. + 2010-05-19 Arnim Laeuger * src/flash/amd.c, doc/UrJTAG.txt: [ 2996919 ] Support for MX29LV320C diff --git a/urjtag/include/urjtag/bfin.h b/urjtag/include/urjtag/bfin.h index af339386..af84ec62 100644 --- a/urjtag/include/urjtag/bfin.h +++ b/urjtag/include/urjtag/bfin.h @@ -170,7 +170,7 @@ extern struct emu_oab bfin_emu_oab; #define EMUIR64_SCAN 7 #define NUM_SCANS 8 -extern const char *scans[]; +extern const char * const scans[]; #define INSN_NOP 0x0000 #define INSN_RTE 0x0014 diff --git a/urjtag/include/urjtag/bus.h b/urjtag/include/urjtag/bus.h index fbcad01c..d08157ce 100644 --- a/urjtag/include/urjtag/bus.h +++ b/urjtag/include/urjtag/bus.h @@ -46,7 +46,7 @@ typedef struct urj_buses_t; extern urj_buses_t urj_buses; -extern const urj_bus_driver_t *urj_bus_drivers[]; +extern const urj_bus_driver_t * const urj_bus_drivers[]; void urj_bus_buses_free (void); int urj_bus_buses_add (urj_bus_t *abus); diff --git a/urjtag/include/urjtag/cable.h b/urjtag/include/urjtag/cable.h index a536e807..9731f4d6 100644 --- a/urjtag/include/urjtag/cable.h +++ b/urjtag/include/urjtag/cable.h @@ -238,7 +238,7 @@ urj_cable_t *urj_tap_cable_other_connect (urj_chain_t *chain, const urj_cable_driver_t *driver, const urj_param_t *params[]); -extern const urj_cable_driver_t *urj_tap_cable_drivers[]; +extern const urj_cable_driver_t * const urj_tap_cable_drivers[]; /** The list of recognized parameters */ extern const urj_param_list_t urj_cable_param_list; diff --git a/urjtag/include/urjtag/flash.h b/urjtag/include/urjtag/flash.h index a497f8d5..985c53b4 100644 --- a/urjtag/include/urjtag/flash.h +++ b/urjtag/include/urjtag/flash.h @@ -60,7 +60,7 @@ typedef struct } urj_flash_driver_t; -extern const urj_flash_driver_t *urj_flash_flash_drivers[]; +extern const urj_flash_driver_t * const urj_flash_flash_drivers[]; /** @return URJ_STATUS_OK on success; URJ_STATUS_FAIL on error */ int urj_flash_detectflash (urj_log_level_t ll, urj_bus_t *bus, uint32_t adr); diff --git a/urjtag/include/urjtag/params.h b/urjtag/include/urjtag/params.h index 5b2d9374..7ee1afa8 100644 --- a/urjtag/include/urjtag/params.h +++ b/urjtag/include/urjtag/params.h @@ -81,8 +81,8 @@ urj_param_descr_t; */ typedef struct URJ_PARAM_LIST { - urj_param_descr_t *list; - size_t n; + const urj_param_descr_t *list; + size_t n; } urj_param_list_t; diff --git a/urjtag/include/urjtag/parport.h b/urjtag/include/urjtag/parport.h index 385eaf52..6fec8bdf 100644 --- a/urjtag/include/urjtag/parport.h +++ b/urjtag/include/urjtag/parport.h @@ -78,6 +78,6 @@ int urj_tap_parport_set_control (urj_parport_t *port, const unsigned char data); const char *urj_cable_parport_devtype_string(urj_cable_parport_devtype_t dt); -extern const urj_parport_driver_t *urj_tap_parport_drivers[]; +extern const urj_parport_driver_t * const urj_tap_parport_drivers[]; #endif /* URJ_PARPORT_H */ diff --git a/urjtag/include/urjtag/usbconn.h b/urjtag/include/urjtag/usbconn.h index bf18d169..c938dc67 100644 --- a/urjtag/include/urjtag/usbconn.h +++ b/urjtag/include/urjtag/usbconn.h @@ -70,6 +70,6 @@ int urj_tap_usbconn_close (urj_usbconn_t *conn); int urj_tap_usbconn_read (urj_usbconn_t *conn, uint8_t *buf, int len); int urj_tap_usbconn_write (urj_usbconn_t *conn, uint8_t *buf, int len, int recv); -extern const urj_usbconn_driver_t *urj_tap_usbconn_drivers[]; +extern const urj_usbconn_driver_t * const urj_tap_usbconn_drivers[]; #endif /* URJ_USBCONN_H */ diff --git a/urjtag/src/bfin/bfin.c b/urjtag/src/bfin/bfin.c index c9baa992..3fa5bd53 100644 --- a/urjtag/src/bfin/bfin.c +++ b/urjtag/src/bfin/bfin.c @@ -32,7 +32,7 @@ #include #include "bfin-part.h" -const char *scans[] = { +const char * const scans[] = { "IDCODE", "DBGSTAT_SCAN", "DBGCTL_SCAN", diff --git a/urjtag/src/bus/buses.c b/urjtag/src/bus/buses.c index b9acf168..0e42fb47 100644 --- a/urjtag/src/bus/buses.c +++ b/urjtag/src/bus/buses.c @@ -35,7 +35,7 @@ #include "buses.h" -const urj_bus_driver_t *urj_bus_drivers[] = { +const urj_bus_driver_t * const urj_bus_drivers[] = { #define _URJ_BUS(bus) &urj_bus_##bus##_bus, #include "buses_list.h" NULL /* last must be NULL */ @@ -180,7 +180,7 @@ urj_bus_init_bus (urj_chain_t *chain, const urj_bus_driver_t *bus_driver, return abus; } -static urj_param_descr_t bus_param[] = +static const urj_param_descr_t bus_param[] = { { URJ_BUS_PARAM_KEY_MUX, URJ_PARAM_TYPE_BOOL, "MUX", }, { URJ_BUS_PARAM_KEY_OCD, URJ_PARAM_TYPE_BOOL, "OCD", }, diff --git a/urjtag/src/flash/flash.c b/urjtag/src/flash/flash.c index 93a22647..2500b0a7 100644 --- a/urjtag/src/flash/flash.c +++ b/urjtag/src/flash/flash.c @@ -51,7 +51,7 @@ #include "intel.h" #include "amd.h" -const urj_flash_driver_t *urj_flash_flash_drivers[] = { +const urj_flash_driver_t * const urj_flash_flash_drivers[] = { &urj_flash_amd_32_flash_driver, &urj_flash_amd_16_flash_driver, &urj_flash_amd_8_flash_driver, diff --git a/urjtag/src/tap/cable.c b/urjtag/src/tap/cable.c index 0e5e0341..de4d1e78 100644 --- a/urjtag/src/tap/cable.c +++ b/urjtag/src/tap/cable.c @@ -45,7 +45,7 @@ #include "cable.h" -const urj_cable_driver_t *urj_tap_cable_drivers[] = { +const urj_cable_driver_t * const urj_tap_cable_drivers[] = { #define _URJ_CABLE(cable) &urj_tap_cable_##cable##_driver, #include "cable_list.h" NULL /* last must be NULL */ @@ -664,7 +664,7 @@ urj_tap_cable_other_connect (urj_chain_t *chain, const urj_cable_driver_t *drive return cable; } -static urj_param_descr_t cable_param[] = +static const urj_param_descr_t cable_param[] = { { URJ_CABLE_PARAM_KEY_PID, URJ_PARAM_TYPE_LU, "pid", }, { URJ_CABLE_PARAM_KEY_VID, URJ_PARAM_TYPE_LU, "vid", }, diff --git a/urjtag/src/tap/cable/generic_usbconn.c b/urjtag/src/tap/cable/generic_usbconn.c index d65ee298..60cfbac8 100644 --- a/urjtag/src/tap/cable/generic_usbconn.c +++ b/urjtag/src/tap/cable/generic_usbconn.c @@ -35,7 +35,7 @@ #include -const urj_usbconn_cable_t *urj_tap_cable_usbconn_cables[] = { +static const urj_usbconn_cable_t * const urj_tap_cable_usbconn_cables[] = { #define _URJ_USB(usb) &urj_tap_cable_usbconn_##usb, #include "generic_usbconn_list.h" NULL diff --git a/urjtag/src/tap/parport.c b/urjtag/src/tap/parport.c index ba4de4db..34773a74 100644 --- a/urjtag/src/tap/parport.c +++ b/urjtag/src/tap/parport.c @@ -30,7 +30,7 @@ #include "parport.h" -const urj_parport_driver_t *urj_tap_parport_drivers[] = { +const urj_parport_driver_t *const urj_tap_parport_drivers[] = { #define _URJ_LIST(item) &urj_tap_parport_##item##_driver, #include "parport_list.h" NULL /* last must be NULL */ diff --git a/urjtag/src/tap/usbconn.c b/urjtag/src/tap/usbconn.c index e4a6474f..fc1bc962 100644 --- a/urjtag/src/tap/usbconn.c +++ b/urjtag/src/tap/usbconn.c @@ -31,7 +31,7 @@ #include "usbconn.h" -const urj_usbconn_driver_t *urj_tap_usbconn_drivers[] = { +const urj_usbconn_driver_t * const urj_tap_usbconn_drivers[] = { #define _URJ_LIST(item) &urj_tap_usbconn_##item##_driver, #include "usbconn_list.h" NULL /* last must be NULL */