target: declare local symbols as static

Functions and variables that are not used outside the file should
be declared as static.

Change-Id: I9f97571a528f0cb3c3c26f873577ab16fdec3cdc
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5895
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
Antonio Borneo 2020-10-29 00:23:13 +01:00
parent d3bff4e5c4
commit 5ca2301743
19 changed files with 48 additions and 51 deletions

View File

@ -723,7 +723,7 @@ static int arm926ejs_target_create(struct target *target, Jim_Interp *interp)
return arm926ejs_init_arch_info(target, arm926ejs, target->tap); return arm926ejs_init_arch_info(target, arm926ejs, target->tap);
} }
void arm926ejs_deinit_target(struct target *target) static void arm926ejs_deinit_target(struct target *target)
{ {
struct arm *arm = target_to_arm(target); struct arm *arm = target_to_arm(target);
struct arm926ejs_common *arm926ejs = target_to_arm926(target); struct arm926ejs_common *arm926ejs = target_to_arm926(target);

View File

@ -51,8 +51,8 @@
*/ */
static uint8_t arm946e_preserve_cache; static uint8_t arm946e_preserve_cache;
int arm946e_post_debug_entry(struct target *target); static int arm946e_post_debug_entry(struct target *target);
void arm946e_pre_restore_context(struct target *target); static void arm946e_pre_restore_context(struct target *target);
static int arm946e_read_cp15(struct target *target, int reg_addr, uint32_t *value); static int arm946e_read_cp15(struct target *target, int reg_addr, uint32_t *value);
int arm946e_init_arch_info(struct target *target, int arm946e_init_arch_info(struct target *target,
@ -250,7 +250,7 @@ static uint32_t arm946e_cp15_get_csize(struct target *target, int idsel)
return csize ? 1 << (12 + (csize-3)) : 0; return csize ? 1 << (12 + (csize-3)) : 0;
} }
uint32_t arm946e_invalidate_whole_dcache(struct target *target) static uint32_t arm946e_invalidate_whole_dcache(struct target *target)
{ {
uint32_t csize = arm946e_cp15_get_csize(target, GET_DCACHE_SIZE); uint32_t csize = arm946e_cp15_get_csize(target, GET_DCACHE_SIZE);
if (csize == 0) if (csize == 0)
@ -306,7 +306,7 @@ uint32_t arm946e_invalidate_whole_dcache(struct target *target)
return ERROR_OK; return ERROR_OK;
} }
uint32_t arm946e_invalidate_whole_icache(struct target *target) static uint32_t arm946e_invalidate_whole_icache(struct target *target)
{ {
/* Check cache presence before flushing - avoid undefined behavior */ /* Check cache presence before flushing - avoid undefined behavior */
uint32_t csize = arm946e_cp15_get_csize(target, GET_ICACHE_SIZE); uint32_t csize = arm946e_cp15_get_csize(target, GET_ICACHE_SIZE);
@ -327,7 +327,7 @@ uint32_t arm946e_invalidate_whole_icache(struct target *target)
return ERROR_OK; return ERROR_OK;
} }
int arm946e_post_debug_entry(struct target *target) static int arm946e_post_debug_entry(struct target *target)
{ {
uint32_t ctr_reg = 0x0; uint32_t ctr_reg = 0x0;
uint32_t retval = ERROR_OK; uint32_t retval = ERROR_OK;
@ -368,7 +368,7 @@ int arm946e_post_debug_entry(struct target *target)
return ERROR_OK; return ERROR_OK;
} }
void arm946e_pre_restore_context(struct target *target) static void arm946e_pre_restore_context(struct target *target)
{ {
uint32_t ctr_reg = 0x0; uint32_t ctr_reg = 0x0;
uint32_t retval; uint32_t retval;
@ -393,7 +393,7 @@ void arm946e_pre_restore_context(struct target *target)
} /* if preserve_cache */ } /* if preserve_cache */
} }
uint32_t arm946e_invalidate_dcache(struct target *target, uint32_t address, static uint32_t arm946e_invalidate_dcache(struct target *target, uint32_t address,
uint32_t size, uint32_t count) uint32_t size, uint32_t count)
{ {
uint32_t cur_addr = 0x0; uint32_t cur_addr = 0x0;
@ -458,7 +458,7 @@ uint32_t arm946e_invalidate_dcache(struct target *target, uint32_t address,
return ERROR_OK; return ERROR_OK;
} }
uint32_t arm946e_invalidate_icache(struct target *target, uint32_t address, static uint32_t arm946e_invalidate_icache(struct target *target, uint32_t address,
uint32_t size, uint32_t count) uint32_t size, uint32_t count)
{ {
uint32_t cur_addr = 0x0; uint32_t cur_addr = 0x0;
@ -509,7 +509,7 @@ uint32_t arm946e_invalidate_icache(struct target *target, uint32_t address,
} }
/** Writes a buffer, in the specified word size, with current MMU settings. */ /** Writes a buffer, in the specified word size, with current MMU settings. */
int arm946e_write_memory(struct target *target, target_addr_t address, static int arm946e_write_memory(struct target *target, target_addr_t address,
uint32_t size, uint32_t count, const uint8_t *buffer) uint32_t size, uint32_t count, const uint8_t *buffer)
{ {
int retval; int retval;
@ -557,7 +557,7 @@ int arm946e_write_memory(struct target *target, target_addr_t address,
} }
int arm946e_read_memory(struct target *target, target_addr_t address, static int arm946e_read_memory(struct target *target, target_addr_t address,
uint32_t size, uint32_t count, uint8_t *buffer) uint32_t size, uint32_t count, uint8_t *buffer)
{ {
int retval; int retval;

View File

@ -589,7 +589,7 @@ static const struct command_registration l2_cache_commands[] = {
}; };
const struct command_registration l2x_cache_command_handlers[] = { static const struct command_registration l2x_cache_command_handlers[] = {
{ {
.name = "cache_config", .name = "cache_config",
.mode = COMMAND_EXEC, .mode = COMMAND_EXEC,

View File

@ -572,7 +572,7 @@ static const struct command_registration arm7a_l1_i_cache_commands[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
const struct command_registration arm7a_l1_di_cache_group_handlers[] = { static const struct command_registration arm7a_l1_di_cache_group_handlers[] = {
{ {
.name = "info", .name = "info",
.handler = arm7a_l1_cache_info_cmd, .handler = arm7a_l1_cache_info_cmd,
@ -597,7 +597,7 @@ const struct command_registration arm7a_l1_di_cache_group_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
const struct command_registration arm7a_cache_group_handlers[] = { static const struct command_registration arm7a_cache_group_handlers[] = {
{ {
.name = "auto", .name = "auto",
.handler = arm7a_cache_disable_auto_cmd, .handler = arm7a_cache_disable_auto_cmd,

View File

@ -1126,7 +1126,7 @@ int armv8_init_arch_info(struct target *target, struct armv8_common *armv8)
return ERROR_OK; return ERROR_OK;
} }
int armv8_aarch64_state(struct target *target) static int armv8_aarch64_state(struct target *target)
{ {
struct arm *arm = target_to_arm(target); struct arm *arm = target_to_arm(target);

View File

@ -63,7 +63,7 @@ static const struct avr32_core_reg
static int avr32_read_core_reg(struct target *target, int num); static int avr32_read_core_reg(struct target *target, int num);
static int avr32_write_core_reg(struct target *target, int num); static int avr32_write_core_reg(struct target *target, int num);
int avr32_ap7k_save_context(struct target *target) static int avr32_ap7k_save_context(struct target *target)
{ {
int retval, i; int retval, i;
struct avr32_ap7k_common *ap7k = target_to_ap7k(target); struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
@ -80,7 +80,7 @@ int avr32_ap7k_save_context(struct target *target)
return ERROR_OK; return ERROR_OK;
} }
int avr32_ap7k_restore_context(struct target *target) static int avr32_ap7k_restore_context(struct target *target)
{ {
int i; int i;
@ -555,7 +555,7 @@ static int avr32_ap7k_examine(struct target *target)
return ERROR_OK; return ERROR_OK;
} }
int avr32_ap7k_arch_state(struct target *target) static int avr32_ap7k_arch_state(struct target *target)
{ {
struct avr32_ap7k_common *ap7k = target_to_ap7k(target); struct avr32_ap7k_common *ap7k = target_to_ap7k(target);
@ -565,7 +565,7 @@ int avr32_ap7k_arch_state(struct target *target)
return ERROR_OK; return ERROR_OK;
} }
int avr32_ap7k_get_gdb_reg_list(struct target *target, struct reg **reg_list[], static int avr32_ap7k_get_gdb_reg_list(struct target *target, struct reg **reg_list[],
int *reg_list_size, enum target_register_class reg_class) int *reg_list_size, enum target_register_class reg_class)
{ {
#if 0 #if 0

View File

@ -55,7 +55,7 @@ static int avr32_jtag_set_instr(struct avr32_jtag *jtag_info, int new_instr)
return ERROR_OK; return ERROR_OK;
} }
int avr32_jtag_nexus_set_address(struct avr32_jtag *jtag_info, static int avr32_jtag_nexus_set_address(struct avr32_jtag *jtag_info,
uint32_t addr, int mode) uint32_t addr, int mode)
{ {
struct scan_field fields[2]; struct scan_field fields[2];
@ -92,7 +92,7 @@ int avr32_jtag_nexus_set_address(struct avr32_jtag *jtag_info,
} }
int avr32_jtag_nexus_read_data(struct avr32_jtag *jtag_info, static int avr32_jtag_nexus_read_data(struct avr32_jtag *jtag_info,
uint32_t *pdata) uint32_t *pdata)
{ {
@ -129,7 +129,7 @@ int avr32_jtag_nexus_read_data(struct avr32_jtag *jtag_info,
return ERROR_OK; return ERROR_OK;
} }
int avr32_jtag_nexus_write_data(struct avr32_jtag *jtag_info, static int avr32_jtag_nexus_write_data(struct avr32_jtag *jtag_info,
uint32_t data) uint32_t data)
{ {
@ -184,7 +184,7 @@ int avr32_jtag_nexus_write(struct avr32_jtag *jtag_info,
return avr32_jtag_nexus_write_data(jtag_info, value); return avr32_jtag_nexus_write_data(jtag_info, value);
} }
int avr32_jtag_mwa_set_address(struct avr32_jtag *jtag_info, int slave, static int avr32_jtag_mwa_set_address(struct avr32_jtag *jtag_info, int slave,
uint32_t addr, int mode) uint32_t addr, int mode)
{ {
struct scan_field fields[2]; struct scan_field fields[2];
@ -223,7 +223,7 @@ int avr32_jtag_mwa_set_address(struct avr32_jtag *jtag_info, int slave,
return ERROR_OK; return ERROR_OK;
} }
int avr32_jtag_mwa_read_data(struct avr32_jtag *jtag_info, static int avr32_jtag_mwa_read_data(struct avr32_jtag *jtag_info,
uint32_t *pdata) uint32_t *pdata)
{ {
@ -260,7 +260,7 @@ int avr32_jtag_mwa_read_data(struct avr32_jtag *jtag_info,
return ERROR_OK; return ERROR_OK;
} }
int avr32_jtag_mwa_write_data(struct avr32_jtag *jtag_info, static int avr32_jtag_mwa_write_data(struct avr32_jtag *jtag_info,
uint32_t data) uint32_t data)
{ {

View File

@ -1115,7 +1115,8 @@ static int cortex_a_post_debug_entry(struct target *target)
return ERROR_OK; return ERROR_OK;
} }
int cortex_a_set_dscr_bits(struct target *target, unsigned long bit_mask, unsigned long value) static int cortex_a_set_dscr_bits(struct target *target,
unsigned long bit_mask, unsigned long value)
{ {
struct armv7a_common *armv7a = target_to_armv7a(target); struct armv7a_common *armv7a = target_to_armv7a(target);
uint32_t dscr; uint32_t dscr;

View File

@ -40,7 +40,7 @@ struct dsp5680xx_common dsp5680xx_context;
#define CHECK_HALT(target) if (target->state != TARGET_HALTED) HALT_FAIL #define CHECK_HALT(target) if (target->state != TARGET_HALTED) HALT_FAIL
#define check_halt_and_debug(target) { CHECK_HALT(target); CHECK_DBG; } #define check_halt_and_debug(target) { CHECK_HALT(target); CHECK_DBG; }
int dsp5680xx_execute_queue(void) static int dsp5680xx_execute_queue(void)
{ {
int retval; int retval;
@ -892,12 +892,6 @@ static int dsp5680xx_arch_state(struct target *target)
return ERROR_OK; return ERROR_OK;
} }
int dsp5680xx_target_status(struct target *target, uint8_t *jtag_st,
uint16_t *eonce_st)
{
return target->state;
}
static int dsp5680xx_assert_reset(struct target *target) static int dsp5680xx_assert_reset(struct target *target)
{ {
target->state = TARGET_RESET; target->state = TARGET_RESET;
@ -1555,7 +1549,7 @@ static int perl_crc(const uint8_t *buff8, uint32_t word_count)
* *
* @return * @return
*/ */
int dsp5680xx_f_SIM_reset(struct target *target) static int dsp5680xx_f_SIM_reset(struct target *target)
{ {
int retval = ERROR_OK; int retval = ERROR_OK;
@ -1978,7 +1972,8 @@ int dsp5680xx_f_erase(struct target *target, int first, int last)
* 0x0000001E 0xA961 bra *-30 * 0x0000001E 0xA961 bra *-30
*/ */
const uint16_t pgm_write_pflash[] = { 0x8A46, 0x0013, 0x807D, 0xE700, static const uint16_t pgm_write_pflash[] = {
0x8A46, 0x0013, 0x807D, 0xE700,
0xE700, 0x8A44, 0xFFFE, 0x017B, 0xE700, 0x8A44, 0xFFFE, 0x017B,
0xE700, 0xF514, 0x8563, 0x8646, 0xE700, 0xF514, 0x8563, 0x8646,
0x0020, 0x0014, 0x8646, 0x0080, 0x0020, 0x0014, 0x8646, 0x0080,
@ -1988,7 +1983,7 @@ const uint16_t pgm_write_pflash[] = { 0x8A46, 0x0013, 0x807D, 0xE700,
0x0013, 0x0010, 0xA961 0x0013, 0x0010, 0xA961
}; };
const uint32_t pgm_write_pflash_length = 31; static const uint32_t pgm_write_pflash_length = 31;
int dsp5680xx_f_wr(struct target *t, const uint8_t *b, uint32_t a, uint32_t count, int dsp5680xx_f_wr(struct target *t, const uint8_t *b, uint32_t a, uint32_t count,
int is_flash_lock) int is_flash_lock)

View File

@ -120,7 +120,7 @@ static void mips32_pracc_finish(struct mips_ejtag *ejtag_info)
mips_ejtag_drscan_32_out(ejtag_info, ctrl); mips_ejtag_drscan_32_out(ejtag_info, ctrl);
} }
int mips32_pracc_clean_text_jump(struct mips_ejtag *ejtag_info) static int mips32_pracc_clean_text_jump(struct mips_ejtag *ejtag_info)
{ {
uint32_t jt_code = MIPS32_J(ejtag_info->isa, MIPS32_PRACC_TEXT); uint32_t jt_code = MIPS32_J(ejtag_info->isa, MIPS32_PRACC_TEXT);
pracc_swap16_array(ejtag_info, &jt_code, 1); pracc_swap16_array(ejtag_info, &jt_code, 1);
@ -453,7 +453,7 @@ exit:
return retval; return retval;
} }
int mips32_pracc_read_u32(struct mips_ejtag *ejtag_info, uint32_t addr, uint32_t *buf) static int mips32_pracc_read_u32(struct mips_ejtag *ejtag_info, uint32_t addr, uint32_t *buf)
{ {
struct pracc_queue_info ctx = {.ejtag_info = ejtag_info}; struct pracc_queue_info ctx = {.ejtag_info = ejtag_info};
pracc_queue_init(&ctx); pracc_queue_init(&ctx);

View File

@ -58,7 +58,7 @@ int mips_ejtag_get_idcode(struct mips_ejtag *ejtag_info)
return mips_ejtag_drscan_32(ejtag_info, &ejtag_info->idcode); return mips_ejtag_drscan_32(ejtag_info, &ejtag_info->idcode);
} }
int mips_ejtag_get_impcode(struct mips_ejtag *ejtag_info) static int mips_ejtag_get_impcode(struct mips_ejtag *ejtag_info)
{ {
mips_ejtag_set_instr(ejtag_info, EJTAG_INST_IMPCODE); mips_ejtag_set_instr(ejtag_info, EJTAG_INST_IMPCODE);
@ -119,7 +119,8 @@ int mips_ejtag_drscan_64(struct mips_ejtag *ejtag_info, uint64_t *data)
return ERROR_OK; return ERROR_OK;
} }
void mips_ejtag_drscan_32_queued(struct mips_ejtag *ejtag_info, uint32_t data_out, uint8_t *data_in) static void mips_ejtag_drscan_32_queued(struct mips_ejtag *ejtag_info,
uint32_t data_out, uint8_t *data_in)
{ {
assert(ejtag_info->tap != NULL); assert(ejtag_info->tap != NULL);
struct jtag_tap *tap = ejtag_info->tap; struct jtag_tap *tap = ejtag_info->tap;

View File

@ -31,7 +31,7 @@ int nds32_probe_tlb(struct nds32 *nds32, const target_addr_t virtual_address,
return aice_read_tlb(aice, virtual_address, physical_address); return aice_read_tlb(aice, virtual_address, physical_address);
} }
struct page_table_walker_info_s page_table_info[PAGE_SIZE_NUM] = { static struct page_table_walker_info_s page_table_info[PAGE_SIZE_NUM] = {
/* 4K page */ /* 4K page */
{0xFFC00000, 20, 0x003FF000, 10, 0x00000FFF, 0xFFFFF000, 0xFFFFF000, 0xFFFFF000}, {0xFFC00000, 20, 0x003FF000, 10, 0x00000FFF, 0xFFFFF000, 0xFFFFF000, 0xFFFFF000},
/* 8K page */ /* 8K page */

View File

@ -404,7 +404,7 @@ static int nds32_v3_remove_watchpoint(struct target *target,
return ERROR_OK; return ERROR_OK;
} }
struct nds32_v3_common_callback nds32_v3_common_callback = { static struct nds32_v3_common_callback nds32_v3_common_callback = {
.check_interrupt_stack = nds32_v3_check_interrupt_stack, .check_interrupt_stack = nds32_v3_check_interrupt_stack,
.restore_interrupt_stack = nds32_v3_restore_interrupt_stack, .restore_interrupt_stack = nds32_v3_restore_interrupt_stack,
.activate_hardware_breakpoint = nds32_v3_activate_hardware_breakpoint, .activate_hardware_breakpoint = nds32_v3_activate_hardware_breakpoint,

View File

@ -379,7 +379,7 @@ static int nds32_v3m_remove_watchpoint(struct target *target,
return ERROR_OK; return ERROR_OK;
} }
struct nds32_v3_common_callback nds32_v3m_common_callback = { static struct nds32_v3_common_callback nds32_v3m_common_callback = {
.check_interrupt_stack = nds32_v3m_check_interrupt_stack, .check_interrupt_stack = nds32_v3m_check_interrupt_stack,
.restore_interrupt_stack = nds32_v3m_restore_interrupt_stack, .restore_interrupt_stack = nds32_v3m_restore_interrupt_stack,
.activate_hardware_breakpoint = nds32_v3m_activate_hardware_breakpoint, .activate_hardware_breakpoint = nds32_v3m_activate_hardware_breakpoint,

View File

@ -57,7 +57,7 @@ static int telnet_write(struct connection *connection, const void *data, int len
return ERROR_SERVER_REMOTE_CLOSED; return ERROR_SERVER_REMOTE_CLOSED;
} }
int jsp_poll_read(void *priv) static int jsp_poll_read(void *priv)
{ {
struct jsp_service *jsp_service = (struct jsp_service *)priv; struct jsp_service *jsp_service = (struct jsp_service *)priv;
unsigned char out_buffer[10]; unsigned char out_buffer[10];

View File

@ -1200,7 +1200,7 @@ static int or1k_get_gdb_reg_list(struct target *target, struct reg **reg_list[],
} }
int or1k_get_gdb_fileio_info(struct target *target, struct gdb_fileio_info *fileio_info) static int or1k_get_gdb_fileio_info(struct target *target, struct gdb_fileio_info *fileio_info)
{ {
return ERROR_FAIL; return ERROR_FAIL;
} }

View File

@ -43,7 +43,7 @@
#include "lakemont.h" #include "lakemont.h"
#include "x86_32_common.h" #include "x86_32_common.h"
int quark_d20xx_target_create(struct target *t, Jim_Interp *interp) static int quark_d20xx_target_create(struct target *t, Jim_Interp *interp)
{ {
struct x86_32_common *x86_32 = calloc(1, sizeof(struct x86_32_common)); struct x86_32_common *x86_32 = calloc(1, sizeof(struct x86_32_common));
if (x86_32 == NULL) { if (x86_32 == NULL) {
@ -56,7 +56,7 @@ int quark_d20xx_target_create(struct target *t, Jim_Interp *interp)
return ERROR_OK; return ERROR_OK;
} }
int quark_d20xx_init_target(struct command_context *cmd_ctx, struct target *t) static int quark_d20xx_init_target(struct command_context *cmd_ctx, struct target *t)
{ {
return lakemont_init_target(cmd_ctx, t); return lakemont_init_target(cmd_ctx, t);
} }

View File

@ -1945,7 +1945,7 @@ static int stm8_run_algorithm(struct target *target, int num_mem_params,
return ERROR_OK; return ERROR_OK;
} }
int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi) static int stm8_jim_configure(struct target *target, Jim_GetOptInfo *goi)
{ {
struct stm8_common *stm8 = target_to_stm8(target); struct stm8_common *stm8 = target_to_stm8(target);
jim_wide w; jim_wide w;

View File

@ -154,8 +154,8 @@ static struct target_type *target_types[] = {
struct target *all_targets; struct target *all_targets;
static struct target_event_callback *target_event_callbacks; static struct target_event_callback *target_event_callbacks;
static struct target_timer_callback *target_timer_callbacks; static struct target_timer_callback *target_timer_callbacks;
LIST_HEAD(target_reset_callback_list); static LIST_HEAD(target_reset_callback_list);
LIST_HEAD(target_trace_callback_list); static LIST_HEAD(target_trace_callback_list);
static const int polling_interval = 100; static const int polling_interval = 100;
static const Jim_Nvp nvp_assert[] = { static const Jim_Nvp nvp_assert[] = {
@ -1319,7 +1319,7 @@ unsigned target_address_bits(struct target *target)
return 32; return 32;
} }
int target_profiling(struct target *target, uint32_t *samples, static int target_profiling(struct target *target, uint32_t *samples,
uint32_t max_num_samples, uint32_t *num_samples, uint32_t seconds) uint32_t max_num_samples, uint32_t *num_samples, uint32_t seconds)
{ {
return target->type->profiling(target, samples, max_num_samples, return target->type->profiling(target, samples, max_num_samples,