summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
222b5c1)
int flash_register_commands(struct command_context_s *cmd_ctx)
{
flash_cmd = register_command(cmd_ctx, NULL, "flash", NULL, COMMAND_ANY, NULL);
int flash_register_commands(struct command_context_s *cmd_ctx)
{
flash_cmd = register_command(cmd_ctx, NULL, "flash", NULL, COMMAND_ANY, NULL);
int section;
u32 section_offset;
flash_bank_t *c;
int section;
u32 section_offset;
flash_bank_t *c;
section = 0;
section_offset = 0;
section = 0;
section_offset = 0;
+
+ /* allocate padding array */
+ padding = malloc(image->num_sections * sizeof(padding));
+
/* loop until we reach end of the image */
while (section < image->num_sections)
{
/* loop until we reach end of the image */
while (section < image->num_sections)
{
int section_last;
u32 run_address = image->sections[section].base_address + section_offset;
u32 run_size = image->sections[section].size - section_offset;
int section_last;
u32 run_address = image->sections[section].base_address + section_offset;
u32 run_size = image->sections[section].size - section_offset;
if (image->sections[section].size == 0)
{
LOG_WARNING("empty section %d", section);
if (image->sections[section].size == 0)
{
LOG_WARNING("empty section %d", section);
/* collect consecutive sections which fall into the same bank */
section_first = section;
section_last = section;
/* collect consecutive sections which fall into the same bank */
section_first = section;
section_last = section;
while ((run_address + run_size < c->base + c->size)
&& (section_last + 1 < image->num_sections))
{
while ((run_address + run_size < c->base + c->size)
&& (section_last + 1 < image->num_sections))
{
LOG_DEBUG("section %d out of order(very slightly surprising, but supported)", section_last + 1);
break;
}
LOG_DEBUG("section %d out of order(very slightly surprising, but supported)", section_last + 1);
break;
}
- if (image->sections[section_last + 1].base_address != (run_address + run_size))
+ /* if we have multiple sections within our image, flash programming could fail due to alignment issues
+ * attempt to rebuild a consecutive buffer for the flash loader */
+ pad_bytes = (image->sections[section_last + 1].base_address) - (run_address + run_size);
+ if ((run_address + run_size + pad_bytes) > (c->base + c->size))
+ padding[section_last] = pad_bytes;
run_size += image->sections[++section_last].size;
run_size += image->sections[++section_last].size;
+ run_size += pad_bytes;
+ padding[section_last] = 0;
+
+ LOG_INFO("Padding image section %d with %d bytes", section_last-1, pad_bytes );
}
/* fit the run into bank constraints */
}
/* fit the run into bank constraints */
size_read, buffer + buffer_size, &size_read)) != ERROR_OK || size_read == 0)
{
free(buffer);
size_read, buffer + buffer_size, &size_read)) != ERROR_OK || size_read == 0)
{
free(buffer);
+
+ /* see if we need to pad the section */
+ while (padding[section]--)
+ buffer[size_read++] = 0xff;
+
buffer_size += size_read;
section_offset += size_read;
buffer_size += size_read;
section_offset += size_read;
if (retval != ERROR_OK)
{
if (retval != ERROR_OK)
{
return retval; /* abort operation */
}
if (written != NULL)
*written += run_size; /* add run size to total written counter */
}
return retval; /* abort operation */
}
if (written != NULL)
*written += run_size; /* add run size to total written counter */
}
Linking to existing account procedure
If you already have an account and want to add another login method
you
MUST first sign in with your existing account and
then change URL to read
https://review.openocd.org/login/?link
to get to this page again but this time it'll work for linking. Thank you.
SSH host keys fingerprints
1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=.. |
|+o.. . |
|*.o . . |
|+B . . . |
|Bo. = o S |
|Oo.+ + = |
|oB=.* = . o |
| =+=.+ + E |
|. .=o . o |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)