STM32 Memory Alignment unclear
The only thing that is not aligned is the #4 word in the right-hand diagram.

Everything else in both diagrams is aligned on natural boundaries &mdash; bytes on byte boundaries (by definition, since it's byte-addressable memory), halfwords on halfword boundaries, and words on word boundaries.



The thing that is really weird about the right-hand diagram is that #4 word does not occupy a contiguous set of bytes, and this may well be a drawing error. For some reason, bytes are numbered right-to-left, but the objects are packed left-to-right. I would have expected those diagrams to look more like this, in which the packing is in the same order as the byte addresses:

Aligned

     3        2        1        0
+--------+--------+--------+--------+
|              word 1               | 0x20000000
+--------+--------+--------+--------+
|////////| byte 3 |   halfword 2    | 0x20000004
+--------+--------+--------+--------+
|              word 4               | 0x20000008
+--------+--------+--------+--------+
|////////| byte 7 | byte 6 | byte 5 | 0x2000000C
+--------+--------+--------+--------+
|/////////////////|   halfword 8    | 0x20000010
+--------+--------+--------+--------+


Unaligned

     3        2        1        0
+--------+--------+--------+--------+
|              word 1               | 0x20000000
+--------+--------+--------+--------+
| word 4 | byte 3 |   halfword 2    | 0x20000004
+--------+--------+--------+--------+
| byte 5 |          word 4          | 0x20000008
+--------+--------+--------+--------+
|   halfword 8    | byte 7 | byte 6 | 0x2000000C
+--------+--------+--------+--------+
|///////////////////////////////////| 0x20000010
+--------+--------+--------+--------+