diff options
author | Damien Le Moal <damien.lemoal@wdc.com> | 2019-01-14 11:17:25 +0900 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2019-01-21 09:58:33 +0530 |
commit | ac3041f4e906ee75d423ac788803218db51ef343 (patch) | |
tree | 3e096ccc8f91d44ff440ca9259eed25d62954166 /firmware | |
parent | ebfe23125666a11fd3dc14b85f5ca58b7f40276b (diff) |
build: Introduce FW_PAYLOAD_ALIGN
The firmware payload offset defined by FW_PAYLOAD_OFFSET must
specify a value large enough so the the payload does not overlap
with the base firmware data, bss and text. For platforms without
any strong requirement on the payload address, introduce the
FW_PAYLOAD_ALIGN build parameter to automatically place the payload
right after the base firmware at an address aligned with the defined
value.
Either FW_PAYLOAD_OFFSET or FW_PAYLOAD_ALIGN should be defined by a
platform configuration. If both FW_PAYLOAD_OFFSET and FW_PAYLOAD_ALIGN
are defined by a platform, FW_PAYLOAD_OFFSET has precedence and is
used for building the final firmawre image.
Using FW_PAYLOAD_ALIGN=4096 with the Kendryte platform rather than
the abitrary FW_PAYLOAD_OFFSET=0x10000 value reduces the final
firmware image size by about 20KB.
Add a description of the FW_PAYLOAD_ALIGN configuration parameter in the
fw_payload documentation file as well. And while at it, also fix
various grammar and style issues in that file..
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/fw_payload.elf.ldS | 4 | ||||
-rw-r--r-- | firmware/objects.mk | 4 | ||||
-rw-r--r-- | firmware/payloads/dummy.elf.ldS | 4 |
3 files changed, 12 insertions, 0 deletions
diff --git a/firmware/fw_payload.elf.ldS b/firmware/fw_payload.elf.ldS index 0713f43..7106005 100644 --- a/firmware/fw_payload.elf.ldS +++ b/firmware/fw_payload.elf.ldS @@ -14,7 +14,11 @@ SECTIONS { #include "fw_base.ldS" +#ifdef FW_PAYLOAD_OFFSET . = FW_TEXT_START + FW_PAYLOAD_OFFSET; +#else + . = ALIGN(FW_PAYLOAD_ALIGN); +#endif .payload : { diff --git a/firmware/objects.mk b/firmware/objects.mk index 18a1fbc..b579ba6 100644 --- a/firmware/objects.mk +++ b/firmware/objects.mk @@ -35,6 +35,10 @@ firmware-genflags-$(FW_PAYLOAD) += -DFW_PAYLOAD_PATH=$(FW_PAYLOAD_PATH_FINAL) ifdef FW_PAYLOAD_OFFSET firmware-genflags-$(FW_PAYLOAD) += -DFW_PAYLOAD_OFFSET=$(FW_PAYLOAD_OFFSET) endif +ifdef FW_PAYLOAD_ALIGN +firmware-genflags-$(FW_PAYLOAD) += -DFW_PAYLOAD_ALIGN=$(FW_PAYLOAD_ALIGN) +endif + ifdef FW_PAYLOAD_FDT_PATH firmware-genflags-$(FW_PAYLOAD) += -DFW_PAYLOAD_FDT_PATH=$(FW_PAYLOAD_FDT_PATH) endif diff --git a/firmware/payloads/dummy.elf.ldS b/firmware/payloads/dummy.elf.ldS index b4d9f75..d0854d5 100644 --- a/firmware/payloads/dummy.elf.ldS +++ b/firmware/payloads/dummy.elf.ldS @@ -12,7 +12,11 @@ ENTRY(_start) SECTIONS { +#ifdef FW_PAYLOAD_OFFSET . = FW_TEXT_START + FW_PAYLOAD_OFFSET; +#else + . = ALIGN(FW_PAYLOAD_ALIGN); +#endif PROVIDE(_payload_start = .); |