X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fstellaris.c;h=10e4d559fc0653970101580f623fdb7ad5b7e2d9;hb=2a34cc8eb6a8431ecebad1279d19ce919978a778;hp=7351aed950726f38b8dd3bf403f4edf12ccb88cb;hpb=4668bd264cfe64c3e3ddd0f75cb5bf2e5e85f717;p=openocd.git diff --git a/src/flash/nor/stellaris.c b/src/flash/nor/stellaris.c index 7351aed950..10e4d559fc 100644 --- a/src/flash/nor/stellaris.c +++ b/src/flash/nor/stellaris.c @@ -438,8 +438,7 @@ FLASH_BANK_COMMAND_HANDLER(stellaris_flash_bank_command) if (CMD_ARGC < 6) { - LOG_WARNING("incomplete flash_bank stellaris configuration"); - return ERROR_FLASH_BANK_INVALID; + return ERROR_COMMAND_SYNTAX_ERROR; } stellaris_info = calloc(sizeof(struct stellaris_flash_bank), 1); @@ -1215,14 +1214,9 @@ static int stellaris_write(struct flash_bank *bank, uint8_t *buffer, uint32_t of if (bytes_remaining) { uint8_t last_word[4] = {0xff, 0xff, 0xff, 0xff}; - int i = 0; - while (bytes_remaining > 0) - { - last_word[i++] = *(buffer + bytes_written); - bytes_remaining--; - bytes_written++; - } + /* copy the last remaining bytes into the write buffer */ + memcpy(last_word, buffer+bytes_written, bytes_remaining); if (!(address & 0xff)) LOG_DEBUG("0x%" PRIx32 "", address); @@ -1351,8 +1345,7 @@ COMMAND_HANDLER(stellaris_handle_mass_erase_command) if (CMD_ARGC < 1) { - command_print(CMD_CTX, "stellaris mass_erase "); - return ERROR_OK; + return ERROR_COMMAND_SYNTAX_ERROR; } struct flash_bank *bank; @@ -1439,9 +1432,9 @@ done: static const struct command_registration stellaris_exec_command_handlers[] = { { .name = "mass_erase", + .usage = "", .handler = stellaris_handle_mass_erase_command, .mode = COMMAND_EXEC, - .usage = "bank_id", .help = "erase entire device", }, { @@ -1458,6 +1451,7 @@ static const struct command_registration stellaris_command_handlers[] = { .name = "stellaris", .mode = COMMAND_EXEC, .help = "Stellaris flash command group", + .usage = "", .chain = stellaris_exec_command_handlers, }, COMMAND_REGISTRATION_DONE