X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fnumicro.c;h=9e18136fad19a55fc884c0d8c37ce698f76fc35d;hb=066aa24e85532b555e1fd34850327e7f7a570bf8;hp=8d8ed6ebbec538f7e0e22f82823c5e8c5716e13a;hpb=33e406824c5d522703829189bb0f55967b887ec5;p=fw%2Fopenocd diff --git a/src/flash/nor/numicro.c b/src/flash/nor/numicro.c index 8d8ed6ebb..9e18136fa 100644 --- a/src/flash/nor/numicro.c +++ b/src/flash/nor/numicro.c @@ -20,6 +20,9 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * ***************************************************************************/ #ifdef HAVE_CONFIG_H @@ -1493,7 +1496,8 @@ static int numicro_erase(struct flash_bank *bank, int first, int last) return retval; for (i = first; i <= last; i++) { - LOG_DEBUG("erasing sector %d at address 0x%" PRIx32 "", i, bank->base + bank->sectors[i].offset); + LOG_DEBUG("erasing sector %d at address " TARGET_ADDR_FMT, i, + bank->base + bank->sectors[i].offset); retval = target_write_u32(target, NUMICRO_FLASH_ISPADR, bank->base + bank->sectors[i].offset); if (retval != ERROR_OK) return retval; @@ -1659,7 +1663,7 @@ static int numicro_get_cpu_type(struct target *target, const struct numicro_cpu_ LOG_INFO("Device ID: 0x%08" PRIx32 "", part_id); /* search part numbers */ - for (size_t i = 0; i < sizeof(NuMicroParts)/sizeof(NuMicroParts[0]); i++) { + for (size_t i = 0; i < ARRAY_SIZE(NuMicroParts); i++) { if (part_id == NuMicroParts[i].partid) { *cpu = &NuMicroParts[i]; LOG_INFO("Device Name: %s", (*cpu)->partname); @@ -1675,7 +1679,8 @@ static int numicro_get_flash_size(struct flash_bank *bank, const struct numicro_ for (size_t i = 0; i < cpu->n_banks; i++) { if (bank->base == cpu->bank[i].base) { *flash_size = cpu->bank[i].size; - LOG_INFO("bank base = 0x%08" PRIx32 ", size = 0x%08" PRIx32 "", bank->base, *flash_size); + LOG_INFO("bank base = " TARGET_ADDR_FMT ", size = 0x%08" + PRIx32, bank->base, *flash_size); return ERROR_OK; } } @@ -1822,11 +1827,11 @@ COMMAND_HANDLER(numicro_handle_chip_erase_command) retval = numicro_fmc_cmd(target, ISPCMD_CHIPERASE, 0, 0, &rdat); if (retval != ERROR_OK) { - command_print(CMD_CTX, "numicro chip_erase failed"); + command_print(CMD, "numicro chip_erase failed"); return retval; } - command_print(CMD_CTX, "numicro chip_erase complete"); + command_print(CMD, "numicro chip_erase complete"); return ERROR_OK; } @@ -1851,6 +1856,7 @@ static const struct command_registration numicro_exec_command_handlers[] = { .handler = numicro_handle_chip_erase_command, .mode = COMMAND_EXEC, .help = "chip erase through ISP.", + .usage = "", }, COMMAND_REGISTRATION_DONE }; @@ -1866,7 +1872,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, @@ -1877,4 +1883,5 @@ struct flash_driver numicro_flash = { .auto_probe = numicro_auto_probe, .erase_check = default_flash_blank_check, .protect_check = numicro_protect_check, + .free_driver_priv = default_flash_free_driver_priv, };