Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Commit

Permalink
pad .bss and .data so their sizes are always multiple of 4 bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
japaric committed Jul 17, 2017
1 parent f9ba9dc commit 2b08758
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
will go into Flash memory will be 4 byte aligned at the start and at the
end. Which seems to be required (?) by Cortex-M0 devices.

- .bss and .data are now padded so their sizes are multiple of 4 bytes. This
improves the output of `objdump`; before, the output showed "Address
0x20000004 is out of bounds".

## [v0.3.3] - 2017-07-14

### Changed
Expand Down
11 changes: 6 additions & 5 deletions link.x
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ PROVIDE(_stack_start = ORIGIN(RAM) + LENGTH(RAM));

SECTIONS
{
.vector_table ORIGIN(FLASH) :
.vector_table ORIGIN(FLASH) : ALIGN(4)
{
/* Vector table */
_svector_table = .;
Expand Down Expand Up @@ -45,18 +45,19 @@ SECTIONS
{
_sbss = .;
*(.bss .bss.*);
_ebss = ALIGN(4);
. = ALIGN(4);
_ebss = .;
} > RAM

.data : ALIGN(4)
{
_sidata = LOADADDR(.data);
_sdata = .;
*(.data .data.*);
_edata = ALIGN(4);
. = ALIGN(4);
_edata = .;
} > RAM AT > FLASH

_sidata = LOADADDR(.data);

/* The heap starts right after the .bss + .data section ends */
_sheap = _edata;

Expand Down

0 comments on commit 2b08758

Please sign in to comment.