zephyr/include/linker
Daniel Leung 212ec9a29a linker: sort app shared mem partition by alignment
If CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT is enabled,
the app shared memory partition may cause waste of memory
due to the need for padding.

For example, tests/subsys/jwt and board mps2_an385:

  z_test_mem_partition: addr 0x20000000, size 52
  z_libc_partition    : addr 0x20000040, size 4
  k_mbedtls_partition : addr 0x20008000, size 32736

    ending at 0x2000ffff, taking up 65536 bytes

With power-of-two size and alignment requirement,
k_mbedtls_partition takes up 32KB memory and needs to be
aligned on 32KB boundary. If the above partitions are
ordered as shown, there needs to be a lot of padding
after z_libc_partition before k_mbedtls_partition can
start. In order to minimize padding, these partitions
need to be sort by size in descending order.

After the changes here,	the partitions are:

  k_mbedtls_partition : addr 0x20000000, size 32736
  z_test_mem_partition: addr 0x20008000, size 52
  z_libc_partition    : addr 0x20008040, size 4

    ending at 0x2000805f, taking up 32864 bytes

With the above example, sorting results in a saving
of 32672 bytes of saving.

Fixes #14121

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-03-13 18:26:51 +01:00
..
app_smem.ld linker: sort app shared mem partition by alignment 2019-03-13 18:26:51 +01:00
app_smem_aligned.ld linker: sort app shared mem partition by alignment 2019-03-13 18:26:51 +01:00
app_smem_unaligned.ld linker: sort app shared mem partition by alignment 2019-03-13 18:26:51 +01:00
common-ram.ld linker: no need to sort by name for kernel object 2019-03-09 16:01:23 -05:00
common-rom.ld app_shmem: auto-initialize partitions 2019-01-30 23:15:51 -05:00
debug-sections.ld linker: x86: add orphan linker sections 2019-01-26 09:21:17 -05:00
intlist.ld gen_isr_tables: Delete the dead code accompanying .intList.num_isrs 2018-06-25 12:54:49 -07:00
kobject-rom.ld kernel: introduce object validation mechanism 2017-09-07 16:33:33 -07:00
kobject-text.ld all: Update reserved function names 2019-03-11 13:48:42 -04:00
kobject.ld kernel: threads: assign index no. to dynamically created threads 2018-08-09 09:20:14 -07:00
linker-defs.h all: Update reserved function names 2019-03-11 13:48:42 -04:00
linker-tool-gcc.h arch: add big endian support 2018-10-10 09:28:05 -04:00
linker-tool.h headers: Fix headers across the project 2018-09-17 15:49:26 -04:00
priv_stacks-noinit.ld linker: arm: place priv.noinit at the end of RAM 2018-10-19 16:11:34 -04:00
priv_stacks-rom.ld arm: Generate privileged stacks 2018-02-06 15:31:16 -08:00
priv_stacks-text.ld LD: Assert when CONFIG_PRIVILEGED_STACK_TEXT_AREA is too small 2019-02-12 10:28:38 -05:00
priv_stacks.ld arm: Generate privileged stacks 2018-02-06 15:31:16 -08:00
rel-sections.ld linker: warn about orphan sections 2018-10-19 16:11:34 -04:00
section_tags.h all: Update reserved function names 2019-03-11 13:48:42 -04:00
sections.h soc: nxp_imx: Add support for device configuration data (DCD) 2019-01-09 16:01:25 -06:00