diff options
author | Keith Packard <keithp@keithp.com> | 2012-08-28 18:02:25 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-08-28 23:00:22 -0700 |
commit | ac5d053e6d766d243b7a425ae19779810c350125 (patch) | |
tree | a2b78783388f481b35f378d98aa61538e6f3985b /ao-tools | |
parent | 68df2b1173e82d48f7857ad2e9325e6a9cbbedfd (diff) |
ao-stmload: Always round up load amount to 4 byte boundary
The flashing code doesn't deal with partial writes.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools')
-rw-r--r-- | ao-tools/ao-stmload/ao-stmload.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ao-tools/ao-stmload/ao-stmload.c b/ao-tools/ao-stmload/ao-stmload.c index e689539b..a471dcc4 100644 --- a/ao-tools/ao-stmload/ao-stmload.c +++ b/ao-tools/ao-stmload/ao-stmload.c @@ -112,10 +112,17 @@ struct load { uint8_t buf[0]; }; +uint32_t round4(uint32_t a) { + return (a + 3) & ~3; +} + struct load * new_load (uint32_t addr, uint32_t len) { - struct load *new = calloc (1, sizeof (struct load) + len); + struct load *new; + + len = round4(len); + new = calloc (1, sizeof (struct load) + len); if (!new) abort(); |