Constify struct flash_driver instances
Instances of struct flash_driver are never written to at runtime. For a small amount of memory saving and also robustness (fewer things for stray pointer writes to hit), mark them const. Change-Id: Iadbbbc2fac0976d892699200000c5f02856729f3 Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/4803 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
This commit is contained in:
parent
84a2cab596
commit
a7479fa89d
|
@ -378,7 +378,7 @@ static int aduc702x_check_flash_completion(struct target *target, unsigned int t
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
struct flash_driver aduc702x_flash = {
|
||||
const struct flash_driver aduc702x_flash = {
|
||||
.name = "aduc702x",
|
||||
.flash_bank_command = aduc702x_flash_bank_command,
|
||||
.erase = aduc702x_erase,
|
||||
|
|
|
@ -554,7 +554,7 @@ static int aducm360_check_flash_completion(struct target *target, unsigned int t
|
|||
}
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
struct flash_driver aducm360_flash = {
|
||||
const struct flash_driver aducm360_flash = {
|
||||
.name = "aducm360",
|
||||
.flash_bank_command = aducm360_flash_bank_command,
|
||||
.erase = aducm360_erase,
|
||||
|
|
|
@ -888,7 +888,7 @@ static const struct command_registration ambiqmicro_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver ambiqmicro_flash = {
|
||||
const struct flash_driver ambiqmicro_flash = {
|
||||
.name = "ambiqmicro",
|
||||
.commands = ambiqmicro_command_handlers,
|
||||
.flash_bank_command = ambiqmicro_flash_bank_command,
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
#define offset_EFC_FSR 8
|
||||
#define offset_EFC_FRR 12
|
||||
|
||||
extern struct flash_driver at91sam3_flash;
|
||||
extern const struct flash_driver at91sam3_flash;
|
||||
|
||||
static float _tomhz(uint32_t freq_hz)
|
||||
{
|
||||
|
@ -3753,7 +3753,7 @@ static const struct command_registration at91sam3_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver at91sam3_flash = {
|
||||
const struct flash_driver at91sam3_flash = {
|
||||
.name = "at91sam3",
|
||||
.commands = at91sam3_command_handlers,
|
||||
.flash_bank_command = sam3_flash_bank_command,
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
#define offset_EFC_FSR 8
|
||||
#define offset_EFC_FRR 12
|
||||
|
||||
extern struct flash_driver at91sam4_flash;
|
||||
extern const struct flash_driver at91sam4_flash;
|
||||
|
||||
static float _tomhz(uint32_t freq_hz)
|
||||
{
|
||||
|
@ -3234,7 +3234,7 @@ static const struct command_registration at91sam4_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver at91sam4_flash = {
|
||||
const struct flash_driver at91sam4_flash = {
|
||||
.name = "at91sam4",
|
||||
.commands = at91sam4_command_handlers,
|
||||
.flash_bank_command = sam4_flash_bank_command,
|
||||
|
|
|
@ -684,7 +684,7 @@ static const struct command_registration at91sam4l_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver at91sam4l_flash = {
|
||||
const struct flash_driver at91sam4l_flash = {
|
||||
.name = "at91sam4l",
|
||||
.commands = at91sam4l_command_handlers,
|
||||
.flash_bank_command = sam4l_flash_bank_command,
|
||||
|
|
|
@ -1140,7 +1140,7 @@ static const struct command_registration at91sam7_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver at91sam7_flash = {
|
||||
const struct flash_driver at91sam7_flash = {
|
||||
.name = "at91sam7",
|
||||
.usage = "gpnvm <bit> <set | clear>",
|
||||
.commands = at91sam7_command_handlers,
|
||||
|
|
|
@ -1287,7 +1287,7 @@ static const struct command_registration at91samd_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver at91samd_flash = {
|
||||
const struct flash_driver at91samd_flash = {
|
||||
.name = "at91samd",
|
||||
.commands = at91samd_command_handlers,
|
||||
.flash_bank_command = samd_flash_bank_command,
|
||||
|
|
|
@ -895,7 +895,7 @@ static int get_ath79_info(struct flash_bank *bank, char *buf, int buf_size)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
struct flash_driver ath79_flash = {
|
||||
const struct flash_driver ath79_flash = {
|
||||
.name = "ath79",
|
||||
.flash_bank_command = ath79_flash_bank_command,
|
||||
.erase = ath79_erase,
|
||||
|
|
|
@ -938,7 +938,7 @@ static const struct command_registration same5_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver atsame5_flash = {
|
||||
const struct flash_driver atsame5_flash = {
|
||||
.name = "atsame5",
|
||||
.commands = same5_command_handlers,
|
||||
.flash_bank_command = same5_flash_bank_command,
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
#define SAMV_PAGE_SIZE 512
|
||||
#define SAMV_FLASH_BASE 0x00400000
|
||||
|
||||
extern struct flash_driver atsamv_flash;
|
||||
extern const struct flash_driver atsamv_flash;
|
||||
|
||||
struct samv_flash_bank {
|
||||
int probed;
|
||||
|
@ -726,7 +726,7 @@ static const struct command_registration atsamv_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver atsamv_flash = {
|
||||
const struct flash_driver atsamv_flash = {
|
||||
.name = "atsamv",
|
||||
.commands = atsamv_command_handlers,
|
||||
.flash_bank_command = samv_flash_bank_command,
|
||||
|
|
|
@ -462,7 +462,7 @@ static const struct command_registration avrf_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver avr_flash = {
|
||||
const struct flash_driver avr_flash = {
|
||||
.name = "avr",
|
||||
.commands = avrf_command_handlers,
|
||||
.flash_bank_command = avrf_flash_bank_command,
|
||||
|
|
|
@ -539,7 +539,7 @@ static int bluenrgx_get_info(struct flash_bank *bank, char *buf, int buf_size)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
struct flash_driver bluenrgx_flash = {
|
||||
const struct flash_driver bluenrgx_flash = {
|
||||
.name = "bluenrg-x",
|
||||
.flash_bank_command = bluenrgx_flash_bank_command,
|
||||
.erase = bluenrgx_erase,
|
||||
|
|
|
@ -535,7 +535,7 @@ static int cc26xx_info(struct flash_bank *bank, char *buf, int buf_size)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
struct flash_driver cc26xx_flash = {
|
||||
const struct flash_driver cc26xx_flash = {
|
||||
.name = "cc26xx",
|
||||
.flash_bank_command = cc26xx_flash_bank_command,
|
||||
.erase = cc26xx_erase,
|
||||
|
|
|
@ -489,7 +489,7 @@ static int cc3220sf_info(struct flash_bank *bank, char *buf, int buf_size)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
struct flash_driver cc3220sf_flash = {
|
||||
const struct flash_driver cc3220sf_flash = {
|
||||
.name = "cc3220sf",
|
||||
.flash_bank_command = cc3220sf_flash_bank_command,
|
||||
.erase = cc3220sf_erase,
|
||||
|
|
|
@ -3112,7 +3112,7 @@ static void cfi_fixup_0002_write_buffer(struct flash_bank *bank, const void *par
|
|||
cfi_info->buf_write_timeout_typ = 0;
|
||||
}
|
||||
|
||||
struct flash_driver cfi_flash = {
|
||||
const struct flash_driver cfi_flash = {
|
||||
.name = "cfi",
|
||||
.flash_bank_command = cfi_flash_bank_command,
|
||||
.erase = cfi_erase,
|
||||
|
|
|
@ -87,7 +87,7 @@ struct flash_bank {
|
|||
|
||||
struct target *target; /**< Target to which this bank belongs. */
|
||||
|
||||
struct flash_driver *driver; /**< Driver for this bank. */
|
||||
const struct flash_driver *driver; /**< Driver for this bank. */
|
||||
void *driver_priv; /**< Private driver storage pointer */
|
||||
|
||||
int bank_number; /**< The 'bank' (or chip number) of this instance. */
|
||||
|
|
|
@ -231,6 +231,6 @@ struct flash_driver {
|
|||
* @param name The name of the requested driver.
|
||||
* @returns The flash_driver called @c name, or NULL if not found.
|
||||
*/
|
||||
struct flash_driver *flash_driver_find_by_name(const char *name);
|
||||
const struct flash_driver *flash_driver_find_by_name(const char *name);
|
||||
|
||||
#endif /* OPENOCD_FLASH_NOR_DRIVER_H */
|
||||
|
|
|
@ -20,75 +20,75 @@
|
|||
#endif
|
||||
#include "imp.h"
|
||||
|
||||
extern struct flash_driver aduc702x_flash;
|
||||
extern struct flash_driver aducm360_flash;
|
||||
extern struct flash_driver ambiqmicro_flash;
|
||||
extern struct flash_driver at91sam3_flash;
|
||||
extern struct flash_driver at91sam4_flash;
|
||||
extern struct flash_driver at91sam4l_flash;
|
||||
extern struct flash_driver at91sam7_flash;
|
||||
extern struct flash_driver at91samd_flash;
|
||||
extern struct flash_driver ath79_flash;
|
||||
extern struct flash_driver atsame5_flash;
|
||||
extern struct flash_driver atsamv_flash;
|
||||
extern struct flash_driver avr_flash;
|
||||
extern struct flash_driver bluenrgx_flash;
|
||||
extern struct flash_driver cc3220sf_flash;
|
||||
extern struct flash_driver cc26xx_flash;
|
||||
extern struct flash_driver cfi_flash;
|
||||
extern struct flash_driver dsp5680xx_flash;
|
||||
extern struct flash_driver efm32_flash;
|
||||
extern struct flash_driver em357_flash;
|
||||
extern struct flash_driver esirisc_flash;
|
||||
extern struct flash_driver faux_flash;
|
||||
extern struct flash_driver fm3_flash;
|
||||
extern struct flash_driver fm4_flash;
|
||||
extern struct flash_driver fespi_flash;
|
||||
extern struct flash_driver jtagspi_flash;
|
||||
extern struct flash_driver kinetis_flash;
|
||||
extern struct flash_driver kinetis_ke_flash;
|
||||
extern struct flash_driver lpc2000_flash;
|
||||
extern struct flash_driver lpc288x_flash;
|
||||
extern struct flash_driver lpc2900_flash;
|
||||
extern struct flash_driver lpcspifi_flash;
|
||||
extern struct flash_driver max32xxx_flash;
|
||||
extern struct flash_driver mdr_flash;
|
||||
extern struct flash_driver mrvlqspi_flash;
|
||||
extern struct flash_driver msp432_flash;
|
||||
extern struct flash_driver niietcm4_flash;
|
||||
extern struct flash_driver nrf5_flash;
|
||||
extern struct flash_driver nrf51_flash;
|
||||
extern struct flash_driver numicro_flash;
|
||||
extern struct flash_driver ocl_flash;
|
||||
extern struct flash_driver pic32mx_flash;
|
||||
extern struct flash_driver psoc4_flash;
|
||||
extern struct flash_driver psoc5lp_flash;
|
||||
extern struct flash_driver psoc5lp_eeprom_flash;
|
||||
extern struct flash_driver psoc5lp_nvl_flash;
|
||||
extern struct flash_driver psoc6_flash;
|
||||
extern struct flash_driver sim3x_flash;
|
||||
extern struct flash_driver stellaris_flash;
|
||||
extern struct flash_driver stm32f1x_flash;
|
||||
extern struct flash_driver stm32f2x_flash;
|
||||
extern struct flash_driver stm32lx_flash;
|
||||
extern struct flash_driver stm32l4x_flash;
|
||||
extern struct flash_driver stm32h7x_flash;
|
||||
extern struct flash_driver stmsmi_flash;
|
||||
extern struct flash_driver str7x_flash;
|
||||
extern struct flash_driver str9x_flash;
|
||||
extern struct flash_driver str9xpec_flash;
|
||||
extern struct flash_driver tms470_flash;
|
||||
extern struct flash_driver virtual_flash;
|
||||
extern struct flash_driver w600_flash;
|
||||
extern struct flash_driver xcf_flash;
|
||||
extern struct flash_driver xmc1xxx_flash;
|
||||
extern struct flash_driver xmc4xxx_flash;
|
||||
extern const struct flash_driver aduc702x_flash;
|
||||
extern const struct flash_driver aducm360_flash;
|
||||
extern const struct flash_driver ambiqmicro_flash;
|
||||
extern const struct flash_driver at91sam3_flash;
|
||||
extern const struct flash_driver at91sam4_flash;
|
||||
extern const struct flash_driver at91sam4l_flash;
|
||||
extern const struct flash_driver at91sam7_flash;
|
||||
extern const struct flash_driver at91samd_flash;
|
||||
extern const struct flash_driver ath79_flash;
|
||||
extern const struct flash_driver atsame5_flash;
|
||||
extern const struct flash_driver atsamv_flash;
|
||||
extern const struct flash_driver avr_flash;
|
||||
extern const struct flash_driver bluenrgx_flash;
|
||||
extern const struct flash_driver cc3220sf_flash;
|
||||
extern const struct flash_driver cc26xx_flash;
|
||||
extern const struct flash_driver cfi_flash;
|
||||
extern const struct flash_driver dsp5680xx_flash;
|
||||
extern const struct flash_driver efm32_flash;
|
||||
extern const struct flash_driver em357_flash;
|
||||
extern const struct flash_driver esirisc_flash;
|
||||
extern const struct flash_driver faux_flash;
|
||||
extern const struct flash_driver fm3_flash;
|
||||
extern const struct flash_driver fm4_flash;
|
||||
extern const struct flash_driver fespi_flash;
|
||||
extern const struct flash_driver jtagspi_flash;
|
||||
extern const struct flash_driver kinetis_flash;
|
||||
extern const struct flash_driver kinetis_ke_flash;
|
||||
extern const struct flash_driver lpc2000_flash;
|
||||
extern const struct flash_driver lpc288x_flash;
|
||||
extern const struct flash_driver lpc2900_flash;
|
||||
extern const struct flash_driver lpcspifi_flash;
|
||||
extern const struct flash_driver max32xxx_flash;
|
||||
extern const struct flash_driver mdr_flash;
|
||||
extern const struct flash_driver mrvlqspi_flash;
|
||||
extern const struct flash_driver msp432_flash;
|
||||
extern const struct flash_driver niietcm4_flash;
|
||||
extern const struct flash_driver nrf5_flash;
|
||||
extern const struct flash_driver nrf51_flash;
|
||||
extern const struct flash_driver numicro_flash;
|
||||
extern const struct flash_driver ocl_flash;
|
||||
extern const struct flash_driver pic32mx_flash;
|
||||
extern const struct flash_driver psoc4_flash;
|
||||
extern const struct flash_driver psoc5lp_flash;
|
||||
extern const struct flash_driver psoc5lp_eeprom_flash;
|
||||
extern const struct flash_driver psoc5lp_nvl_flash;
|
||||
extern const struct flash_driver psoc6_flash;
|
||||
extern const struct flash_driver sim3x_flash;
|
||||
extern const struct flash_driver stellaris_flash;
|
||||
extern const struct flash_driver stm32f1x_flash;
|
||||
extern const struct flash_driver stm32f2x_flash;
|
||||
extern const struct flash_driver stm32lx_flash;
|
||||
extern const struct flash_driver stm32l4x_flash;
|
||||
extern const struct flash_driver stm32h7x_flash;
|
||||
extern const struct flash_driver stmsmi_flash;
|
||||
extern const struct flash_driver str7x_flash;
|
||||
extern const struct flash_driver str9x_flash;
|
||||
extern const struct flash_driver str9xpec_flash;
|
||||
extern const struct flash_driver tms470_flash;
|
||||
extern const struct flash_driver virtual_flash;
|
||||
extern const struct flash_driver w600_flash;
|
||||
extern const struct flash_driver xcf_flash;
|
||||
extern const struct flash_driver xmc1xxx_flash;
|
||||
extern const struct flash_driver xmc4xxx_flash;
|
||||
|
||||
/**
|
||||
* The list of built-in flash drivers.
|
||||
* @todo Make this dynamically extendable with loadable modules.
|
||||
*/
|
||||
static struct flash_driver *flash_drivers[] = {
|
||||
static const struct flash_driver * const flash_drivers[] = {
|
||||
&aduc702x_flash,
|
||||
&aducm360_flash,
|
||||
&ambiqmicro_flash,
|
||||
|
@ -155,7 +155,7 @@ static struct flash_driver *flash_drivers[] = {
|
|||
NULL,
|
||||
};
|
||||
|
||||
struct flash_driver *flash_driver_find_by_name(const char *name)
|
||||
const struct flash_driver *flash_driver_find_by_name(const char *name)
|
||||
{
|
||||
for (unsigned i = 0; flash_drivers[i]; i++) {
|
||||
if (strcmp(name, flash_drivers[i]->name) == 0)
|
||||
|
|
|
@ -256,7 +256,7 @@ static int dsp5680xx_flash_erase_check(struct flash_bank *bank)
|
|||
return retval;
|
||||
}
|
||||
|
||||
struct flash_driver dsp5680xx_flash = {
|
||||
const struct flash_driver dsp5680xx_flash = {
|
||||
.name = "dsp5680xx_flash",
|
||||
.flash_bank_command = dsp5680xx_flash_bank_command,
|
||||
.erase = dsp5680xx_flash_erase,
|
||||
|
|
|
@ -1120,7 +1120,7 @@ static const struct command_registration efm32x_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver efm32_flash = {
|
||||
const struct flash_driver efm32_flash = {
|
||||
.name = "efm32",
|
||||
.commands = efm32x_command_handlers,
|
||||
.flash_bank_command = efm32x_flash_bank_command,
|
||||
|
|
|
@ -929,7 +929,7 @@ static const struct command_registration em357_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver em357_flash = {
|
||||
const struct flash_driver em357_flash = {
|
||||
.name = "em357",
|
||||
.commands = em357_command_handlers,
|
||||
.flash_bank_command = em357_flash_bank_command,
|
||||
|
|
|
@ -571,7 +571,7 @@ static const struct command_registration esirisc_flash_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver esirisc_flash = {
|
||||
const struct flash_driver esirisc_flash = {
|
||||
.name = "esirisc",
|
||||
.usage = "flash bank bank_id 'esirisc' base_address size_bytes 0 0 target "
|
||||
"cfg_address clock_hz wait_states",
|
||||
|
|
|
@ -113,7 +113,7 @@ static const struct command_registration faux_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver faux_flash = {
|
||||
const struct flash_driver faux_flash = {
|
||||
.name = "faux",
|
||||
.commands = faux_command_handlers,
|
||||
.flash_bank_command = faux_flash_bank_command,
|
||||
|
|
|
@ -1038,7 +1038,7 @@ static int get_fespi_info(struct flash_bank *bank, char *buf, int buf_size)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
struct flash_driver fespi_flash = {
|
||||
const struct flash_driver fespi_flash = {
|
||||
.name = "fespi",
|
||||
.flash_bank_command = fespi_flash_bank_command,
|
||||
.erase = fespi_erase,
|
||||
|
|
|
@ -988,7 +988,7 @@ static const struct command_registration fm3_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver fm3_flash = {
|
||||
const struct flash_driver fm3_flash = {
|
||||
.name = "fm3",
|
||||
.commands = fm3_command_handlers,
|
||||
.flash_bank_command = fm3_flash_bank_command,
|
||||
|
|
|
@ -702,7 +702,7 @@ static const struct command_registration fm4_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver fm4_flash = {
|
||||
const struct flash_driver fm4_flash = {
|
||||
.name = "fm4",
|
||||
.commands = fm4_command_handlers,
|
||||
.flash_bank_command = fm4_flash_bank_command,
|
||||
|
|
|
@ -427,7 +427,7 @@ static int jtagspi_info(struct flash_bank *bank, char *buf, int buf_size)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
struct flash_driver jtagspi_flash = {
|
||||
const struct flash_driver jtagspi_flash = {
|
||||
.name = "jtagspi",
|
||||
.flash_bank_command = jtagspi_flash_bank_command,
|
||||
.erase = jtagspi_erase,
|
||||
|
|
|
@ -393,7 +393,7 @@ static bool fcf_fopt_configured;
|
|||
static bool create_banks;
|
||||
|
||||
|
||||
struct flash_driver kinetis_flash;
|
||||
const struct flash_driver kinetis_flash;
|
||||
static int kinetis_write_inner(struct flash_bank *bank, const uint8_t *buffer,
|
||||
uint32_t offset, uint32_t count);
|
||||
static int kinetis_probe_chip(struct kinetis_chip *k_chip);
|
||||
|
@ -3143,7 +3143,7 @@ static const struct command_registration kinetis_command_handler[] = {
|
|||
|
||||
|
||||
|
||||
struct flash_driver kinetis_flash = {
|
||||
const struct flash_driver kinetis_flash = {
|
||||
.name = "kinetis",
|
||||
.commands = kinetis_command_handler,
|
||||
.flash_bank_command = kinetis_flash_bank_command,
|
||||
|
|
|
@ -1297,7 +1297,7 @@ static const struct command_registration kinetis_ke_command_handler[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver kinetis_ke_flash = {
|
||||
const struct flash_driver kinetis_ke_flash = {
|
||||
.name = "kinetis_ke",
|
||||
.commands = kinetis_ke_command_handler,
|
||||
.flash_bank_command = kinetis_ke_flash_bank_command,
|
||||
|
|
|
@ -1609,7 +1609,7 @@ static const struct command_registration lpc2000_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver lpc2000_flash = {
|
||||
const struct flash_driver lpc2000_flash = {
|
||||
.name = "lpc2000",
|
||||
.commands = lpc2000_command_handlers,
|
||||
.flash_bank_command = lpc2000_flash_bank_command,
|
||||
|
|
|
@ -412,7 +412,7 @@ static int lpc288x_protect(struct flash_bank *bank, int set, int first, int last
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
struct flash_driver lpc288x_flash = {
|
||||
const struct flash_driver lpc288x_flash = {
|
||||
.name = "lpc288x",
|
||||
.flash_bank_command = lpc288x_flash_bank_command,
|
||||
.erase = lpc288x_erase,
|
||||
|
|
|
@ -1581,7 +1581,7 @@ static int lpc2900_protect_check(struct flash_bank *bank)
|
|||
return lpc2900_read_security_status(bank);
|
||||
}
|
||||
|
||||
struct flash_driver lpc2900_flash = {
|
||||
const struct flash_driver lpc2900_flash = {
|
||||
.name = "lpc2900",
|
||||
.commands = lpc2900_command_handlers,
|
||||
.flash_bank_command = lpc2900_flash_bank_command,
|
||||
|
|
|
@ -946,7 +946,7 @@ static int get_lpcspifi_info(struct flash_bank *bank, char *buf, int buf_size)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
struct flash_driver lpcspifi_flash = {
|
||||
const struct flash_driver lpcspifi_flash = {
|
||||
.name = "lpcspifi",
|
||||
.flash_bank_command = lpcspifi_flash_bank_command,
|
||||
.erase = lpcspifi_erase,
|
||||
|
|
|
@ -981,7 +981,7 @@ static const struct command_registration max32xxx_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver max32xxx_flash = {
|
||||
const struct flash_driver max32xxx_flash = {
|
||||
.name = "max32xxx",
|
||||
.commands = max32xxx_command_handlers,
|
||||
.flash_bank_command = max32xxx_flash_bank_command,
|
||||
|
|
|
@ -609,7 +609,7 @@ static int get_mdr_info(struct flash_bank *bank, char *buf, int buf_size)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
struct flash_driver mdr_flash = {
|
||||
const struct flash_driver mdr_flash = {
|
||||
.name = "mdr",
|
||||
.usage = "flash bank <name> mdr <base> <size> 0 0 <target#> <type> <page_count> <sec_count>\n"
|
||||
"<type>: 0 for main memory, 1 for info memory",
|
||||
|
|
|
@ -953,7 +953,7 @@ FLASH_BANK_COMMAND_HANDLER(mrvlqspi_flash_bank_command)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
struct flash_driver mrvlqspi_flash = {
|
||||
const struct flash_driver mrvlqspi_flash = {
|
||||
.name = "mrvlqspi",
|
||||
.flash_bank_command = mrvlqspi_flash_bank_command,
|
||||
.erase = mrvlqspi_flash_erase,
|
||||
|
|
|
@ -1075,7 +1075,7 @@ static const struct command_registration msp432_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver msp432_flash = {
|
||||
const struct flash_driver msp432_flash = {
|
||||
.name = "msp432",
|
||||
.commands = msp432_command_handlers,
|
||||
.flash_bank_command = msp432_flash_bank_command,
|
||||
|
|
|
@ -1729,7 +1729,7 @@ static int get_niietcm4_info(struct flash_bank *bank, char *buf, int buf_size)
|
|||
}
|
||||
|
||||
|
||||
struct flash_driver niietcm4_flash = {
|
||||
const struct flash_driver niietcm4_flash = {
|
||||
.name = "niietcm4",
|
||||
.usage = "flash bank <name> niietcm4 <base> <size> 0 0 <target#>",
|
||||
.commands = niietcm4_command_handlers,
|
||||
|
|
|
@ -1140,7 +1140,7 @@ static const struct command_registration nrf5_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver nrf5_flash = {
|
||||
const struct flash_driver nrf5_flash = {
|
||||
.name = "nrf5",
|
||||
.commands = nrf5_command_handlers,
|
||||
.flash_bank_command = nrf5_flash_bank_command,
|
||||
|
@ -1158,7 +1158,7 @@ struct flash_driver nrf5_flash = {
|
|||
|
||||
/* We need to retain the flash-driver name as well as the commands
|
||||
* for backwards compatability */
|
||||
struct flash_driver nrf51_flash = {
|
||||
const struct flash_driver nrf51_flash = {
|
||||
.name = "nrf51",
|
||||
.commands = nrf5_command_handlers,
|
||||
.flash_bank_command = nrf5_flash_bank_command,
|
||||
|
|
|
@ -1871,7 +1871,7 @@ static const struct command_registration numicro_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver numicro_flash = {
|
||||
const struct flash_driver numicro_flash = {
|
||||
.name = "numicro",
|
||||
.commands = numicro_command_handlers,
|
||||
.flash_bank_command = numicro_flash_bank_command,
|
||||
|
|
|
@ -314,7 +314,7 @@ static int ocl_auto_probe(struct flash_bank *bank)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
struct flash_driver ocl_flash = {
|
||||
const struct flash_driver ocl_flash = {
|
||||
.name = "ocl",
|
||||
.flash_bank_command = ocl_flash_bank_command,
|
||||
.erase = ocl_erase,
|
||||
|
|
|
@ -967,7 +967,7 @@ static const struct command_registration pic32mx_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver pic32mx_flash = {
|
||||
const struct flash_driver pic32mx_flash = {
|
||||
.name = "pic32mx",
|
||||
.commands = pic32mx_command_handlers,
|
||||
.flash_bank_command = pic32mx_flash_bank_command,
|
||||
|
|
|
@ -950,7 +950,7 @@ static const struct command_registration psoc4_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver psoc4_flash = {
|
||||
const struct flash_driver psoc4_flash = {
|
||||
.name = "psoc4",
|
||||
.commands = psoc4_command_handlers,
|
||||
.flash_bank_command = psoc4_flash_bank_command,
|
||||
|
|
|
@ -838,7 +838,7 @@ static const struct command_registration psoc5lp_nvl_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver psoc5lp_nvl_flash = {
|
||||
const struct flash_driver psoc5lp_nvl_flash = {
|
||||
.name = "psoc5lp_nvl",
|
||||
.commands = psoc5lp_nvl_command_handlers,
|
||||
.flash_bank_command = psoc5lp_nvl_flash_bank_command,
|
||||
|
@ -1036,7 +1036,7 @@ static const struct command_registration psoc5lp_eeprom_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver psoc5lp_eeprom_flash = {
|
||||
const struct flash_driver psoc5lp_eeprom_flash = {
|
||||
.name = "psoc5lp_eeprom",
|
||||
.commands = psoc5lp_eeprom_command_handlers,
|
||||
.flash_bank_command = psoc5lp_eeprom_flash_bank_command,
|
||||
|
@ -1548,7 +1548,7 @@ static const struct command_registration psoc5lp_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver psoc5lp_flash = {
|
||||
const struct flash_driver psoc5lp_flash = {
|
||||
.name = "psoc5lp",
|
||||
.commands = psoc5lp_command_handlers,
|
||||
.flash_bank_command = psoc5lp_flash_bank_command,
|
||||
|
|
|
@ -1048,7 +1048,7 @@ static const struct command_registration psoc6_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver psoc6_flash = {
|
||||
const struct flash_driver psoc6_flash = {
|
||||
.name = "psoc6",
|
||||
.commands = psoc6_command_handlers,
|
||||
.flash_bank_command = psoc6_flash_bank_command,
|
||||
|
|
|
@ -1110,7 +1110,7 @@ static const struct command_registration sim3x_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver sim3x_flash = {
|
||||
const struct flash_driver sim3x_flash = {
|
||||
.name = "sim3x",
|
||||
.commands = sim3x_command_handlers,
|
||||
.flash_bank_command = sim3x_flash_bank_command,
|
||||
|
|
|
@ -1441,7 +1441,7 @@ static const struct command_registration stellaris_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver stellaris_flash = {
|
||||
const struct flash_driver stellaris_flash = {
|
||||
.name = "stellaris",
|
||||
.commands = stellaris_command_handlers,
|
||||
.flash_bank_command = stellaris_flash_bank_command,
|
||||
|
|
|
@ -1570,7 +1570,7 @@ static const struct command_registration stm32x_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver stm32f1x_flash = {
|
||||
const struct flash_driver stm32f1x_flash = {
|
||||
.name = "stm32f1x",
|
||||
.commands = stm32x_command_handlers,
|
||||
.flash_bank_command = stm32x_flash_bank_command,
|
||||
|
|
|
@ -1792,7 +1792,7 @@ static const struct command_registration stm32x_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver stm32f2x_flash = {
|
||||
const struct flash_driver stm32f2x_flash = {
|
||||
.name = "stm32f2x",
|
||||
.commands = stm32x_command_handlers,
|
||||
.flash_bank_command = stm32x_flash_bank_command,
|
||||
|
|
|
@ -1114,7 +1114,7 @@ static const struct command_registration stm32x_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver stm32h7x_flash = {
|
||||
const struct flash_driver stm32h7x_flash = {
|
||||
.name = "stm32h7x",
|
||||
.commands = stm32x_command_handlers,
|
||||
.flash_bank_command = stm32x_flash_bank_command,
|
||||
|
|
|
@ -1053,7 +1053,7 @@ static const struct command_registration stm32l4_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver stm32l4x_flash = {
|
||||
const struct flash_driver stm32l4x_flash = {
|
||||
.name = "stm32l4x",
|
||||
.commands = stm32l4_command_handlers,
|
||||
.flash_bank_command = stm32l4_flash_bank_command,
|
||||
|
|
|
@ -944,7 +944,7 @@ static const struct command_registration stm32lx_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver stm32lx_flash = {
|
||||
const struct flash_driver stm32lx_flash = {
|
||||
.name = "stm32lx",
|
||||
.commands = stm32lx_command_handlers,
|
||||
.flash_bank_command = stm32lx_flash_bank_command,
|
||||
|
|
|
@ -652,7 +652,7 @@ static int get_stmsmi_info(struct flash_bank *bank, char *buf, int buf_size)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
struct flash_driver stmsmi_flash = {
|
||||
const struct flash_driver stmsmi_flash = {
|
||||
.name = "stmsmi",
|
||||
.flash_bank_command = stmsmi_flash_bank_command,
|
||||
.erase = stmsmi_erase,
|
||||
|
|
|
@ -799,7 +799,7 @@ static const struct command_registration str7x_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver str7x_flash = {
|
||||
const struct flash_driver str7x_flash = {
|
||||
.name = "str7x",
|
||||
.commands = str7x_command_handlers,
|
||||
.flash_bank_command = str7x_flash_bank_command,
|
||||
|
|
|
@ -667,7 +667,7 @@ static const struct command_registration str9x_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver str9x_flash = {
|
||||
const struct flash_driver str9x_flash = {
|
||||
.name = "str9x",
|
||||
.commands = str9x_command_handlers,
|
||||
.flash_bank_command = str9x_flash_bank_command,
|
||||
|
|
|
@ -1195,7 +1195,7 @@ static const struct command_registration str9xpec_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver str9xpec_flash = {
|
||||
const struct flash_driver str9xpec_flash = {
|
||||
.name = "str9xpec",
|
||||
.commands = str9xpec_command_handlers,
|
||||
.flash_bank_command = str9xpec_flash_bank_command,
|
||||
|
|
|
@ -1107,7 +1107,7 @@ COMMAND_HANDLER(handle_flash_bank_command)
|
|||
}
|
||||
|
||||
const char *driver_name = CMD_ARGV[0];
|
||||
struct flash_driver *driver = flash_driver_find_by_name(driver_name);
|
||||
const struct flash_driver *driver = flash_driver_find_by_name(driver_name);
|
||||
if (NULL == driver) {
|
||||
/* no matching flash driver found */
|
||||
LOG_ERROR("flash driver '%s' not found", driver_name);
|
||||
|
|
|
@ -1162,7 +1162,7 @@ FLASH_BANK_COMMAND_HANDLER(tms470_flash_bank_command)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
struct flash_driver tms470_flash = {
|
||||
const struct flash_driver tms470_flash = {
|
||||
.name = "tms470",
|
||||
.commands = tms470_command_handlers,
|
||||
.flash_bank_command = tms470_flash_bank_command,
|
||||
|
|
|
@ -224,7 +224,7 @@ static int virtual_flash_read(struct flash_bank *bank,
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
struct flash_driver virtual_flash = {
|
||||
const struct flash_driver virtual_flash = {
|
||||
.name = "virtual",
|
||||
.flash_bank_command = virtual_flash_bank_command,
|
||||
.erase = virtual_erase,
|
||||
|
|
|
@ -376,7 +376,7 @@ static int get_w600_info(struct flash_bank *bank, char *buf, int buf_size)
|
|||
return ERROR_OK;
|
||||
}
|
||||
|
||||
struct flash_driver w600_flash = {
|
||||
const struct flash_driver w600_flash = {
|
||||
.name = "w600",
|
||||
.flash_bank_command = w600_flash_bank_command,
|
||||
.erase = w600_erase,
|
||||
|
|
|
@ -881,7 +881,7 @@ static const struct command_registration xcf_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver xcf_flash = {
|
||||
const struct flash_driver xcf_flash = {
|
||||
.name = "xcf",
|
||||
.usage = NULL,
|
||||
.commands = xcf_command_handlers,
|
||||
|
|
|
@ -534,7 +534,7 @@ static const struct command_registration xmc1xxx_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver xmc1xxx_flash = {
|
||||
const struct flash_driver xmc1xxx_flash = {
|
||||
.name = "xmc1xxx",
|
||||
.commands = xmc1xxx_command_handlers,
|
||||
.flash_bank_command = xmc1xxx_flash_bank_command,
|
||||
|
|
|
@ -1343,7 +1343,7 @@ static const struct command_registration xmc4xxx_command_handlers[] = {
|
|||
COMMAND_REGISTRATION_DONE
|
||||
};
|
||||
|
||||
struct flash_driver xmc4xxx_flash = {
|
||||
const struct flash_driver xmc4xxx_flash = {
|
||||
.name = "xmc4xxx",
|
||||
.commands = xmc4xxx_command_handlers,
|
||||
.flash_bank_command = xmc4xxx_flash_bank_command,
|
||||
|
|
Loading…
Reference in New Issue