X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fflash%2Fstellaris.c;h=b482ce2e10c4b41b044c8c73b8cdfd3cdd39e78f;hb=2689f58f2a0afa296a29ab301a4c1665b914caab;hp=f479af04127047fcad23ad60117d4a99cddfa951;hpb=a5354ff5cb76cc2a6ebd809474cd69951336c50d;p=openocd diff --git a/src/flash/stellaris.c b/src/flash/stellaris.c index f479af04..b482ce2e 100644 --- a/src/flash/stellaris.c +++ b/src/flash/stellaris.c @@ -581,7 +581,7 @@ static int stellaris_read_part_info(struct flash_bank_s *bank) * Parts before rev C0 used 15 MHz; some C0 parts use 15 MHz * (LM3S618), but some other C0 parts are 12 MHz (LM3S811). */ - if (((did0 >> 16) & 0xff) <= 2) { + if (((did0 >> 8) & 0xff) < 2) { stellaris_info->iosc_freq = 15000000; stellaris_info->iosc_desc = " (±50%)"; } @@ -917,8 +917,8 @@ static int stellaris_write_block(struct flash_bank_s *bank, uint8_t *buffer, uin buf_set_u32(reg_params[0].value, 0, 32, source->address); buf_set_u32(reg_params[1].value, 0, 32, address); buf_set_u32(reg_params[2].value, 0, 32, 4*thisrun_count); - LOG_INFO("Algorithm flash write %" PRIi32 " words to 0x%" PRIx32 ", %" PRIi32 " remaining", thisrun_count, address, wcount); - LOG_DEBUG("Algorithm flash write %" PRIi32 " words to 0x%" PRIx32 ", %" PRIi32 " remaining", thisrun_count, address, wcount); + LOG_INFO("Algorithm flash write %" PRIi32 " words to 0x%" PRIx32 ", %" PRIi32 " remaining", thisrun_count, address, (wcount - thisrun_count)); + LOG_DEBUG("Algorithm flash write %" PRIi32 " words to 0x%" PRIx32 ", %" PRIi32 " remaining", thisrun_count, address, (wcount - thisrun_count)); if ((retval = target_run_algorithm(target, 0, NULL, 3, reg_params, write_algorithm->address, write_algorithm->address + sizeof(stellaris_write_code)-10, 10000, &armv7m_info)) != ERROR_OK) { LOG_ERROR("error executing stellaris flash write algorithm"); @@ -1162,7 +1162,6 @@ static int stellaris_mass_erase(struct flash_bank_s *bank) static int stellaris_handle_mass_erase_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { - flash_bank_t *bank; int i; if (argc < 1) @@ -1171,12 +1170,10 @@ static int stellaris_handle_mass_erase_command(struct command_context_s *cmd_ctx return ERROR_OK; } - bank = get_flash_bank_by_num(strtoul(args[0], NULL, 0)); - if (!bank) - { - command_print(cmd_ctx, "flash bank '#%s' is out of bounds", args[0]); - return ERROR_OK; - } + flash_bank_t *bank; + int retval = flash_command_get_bank_by_num(cmd_ctx, args[0], &bank); + if (ERROR_OK != retval) + return retval; if (stellaris_mass_erase(bank) == ERROR_OK) {