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);
{
LOG_ERROR("Hardware doesn't support page-level unprotect. "
"Try the 'recover' command.");
- return ERROR_INVALID_ARGUMENTS;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if (stellaris_info->did1 == 0)
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);
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "stellaris mass_erase <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
static const struct command_registration stellaris_exec_command_handlers[] = {
{
.name = "mass_erase",
+ .usage = "<bank>",
.handler = stellaris_handle_mass_erase_command,
.mode = COMMAND_EXEC,
- .usage = "bank_id",
.help = "erase entire device",
},
{