diff options
author | Anton Staaf <robotboy@chromium.org> | 2016-03-29 11:27:53 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-04-19 12:23:52 -0700 |
commit | 95858f385c35fbe6a95f0bad72ade9290b2a2d41 (patch) | |
tree | 1b856056c3eca8180839383c863f6ea6b55f7b4c /core | |
parent | 69668a04436700071bc2a26400f5f52f0e499020 (diff) | |
download | chrome-ec-95858f385c35fbe6a95f0bad72ade9290b2a2d41.tar.gz |
Deferred: Remove hard coded number of deferreds
Previously the maximum number of deferred routines was specified by the
the default maximum number of deferred routines you had to override
this, and if you wanted fewer, you still payed the price of having the
defer_until array statically allocated to be the maximum size.
This change removes that define and instead creates the RAM state of
the deferred routine (the time to wait until to call the deferred) when
the deferred is declared.
Signed-off-by: Anton Staaf <robotboy@chromium.org>
BRANCH=None
BUG=None
TEST=make buildall -j
manually test on discovery-stm32f072
Change-Id: Id3db84ee1795226b7818c57f68c1f637567831dc
Reviewed-on: https://chromium-review.googlesource.com/335597
Commit-Ready: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/cortex-m/ec.lds.S | 16 | ||||
-rw-r--r-- | core/cortex-m0/ec.lds.S | 16 | ||||
-rw-r--r-- | core/host/host_exe.lds | 11 | ||||
-rw-r--r-- | core/nds32/ec.lds.S | 17 |
4 files changed, 44 insertions, 16 deletions
diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S index 24f3030354..6beb007dba 100644 --- a/core/cortex-m/ec.lds.S +++ b/core/cortex-m/ec.lds.S @@ -225,11 +225,6 @@ SECTIONS #endif __ro_end = . ; - __deferred_funcs_count = - (__deferred_funcs_end - __deferred_funcs) / 4; - ASSERT(__deferred_funcs_count <= DEFERRABLE_MAX_COUNT, - "Increase DEFERRABLE_MAX_COUNT") - .bss : { /* * Align to 512 bytes. This is convenient when some memory block @@ -244,6 +239,17 @@ SECTIONS *(.bss.system_stack) /* Rest of .bss takes care of its own alignment */ *(.bss) + + /* + * Reserve space for deferred function firing times. Each time is a + * uint64_t, each func is a 32-bit pointer, thus the scaling factor of + * two. The 8 byte alignment of uint64_t is required by the ARM ABI. + */ + . = ALIGN(8); + __deferred_until = .; + . += (__deferred_funcs_end - __deferred_funcs) * (8 / 4); + __deferred_until_end = .; + #ifdef CONFIG_REPLACE_LOADER_WITH_BSS_SLOW . = ALIGN(4); __bss_end = .; diff --git a/core/cortex-m0/ec.lds.S b/core/cortex-m0/ec.lds.S index 6596b5e05d..602374404a 100644 --- a/core/cortex-m0/ec.lds.S +++ b/core/cortex-m0/ec.lds.S @@ -174,11 +174,6 @@ SECTIONS } > FLASH __ro_end = . ; - __deferred_funcs_count = - (__deferred_funcs_end - __deferred_funcs) / 4; - ASSERT(__deferred_funcs_count <= DEFERRABLE_MAX_COUNT, - "Increase DEFERRABLE_MAX_COUNT") - .bss : { /* * Vector table must be at the beginning of bss section. The vector @@ -194,6 +189,17 @@ SECTIONS /* Rest of .bss takes care of its own alignment */ *(.bss) *(.bss.slow) + + /* + * Reserve space for deferred function firing times. Each time is a + * uint64_t, each func is a 32-bit pointer, thus the scaling factor of + * two. The 8 byte alignment of uint64_t is required by the ARM ABI. + */ + . = ALIGN(8); + __deferred_until = .; + . += (__deferred_funcs_end - __deferred_funcs) * (8 / 4); + __deferred_until_end = .; + . = ALIGN(4); __bss_end = .; } > IRAM diff --git a/core/host/host_exe.lds b/core/host/host_exe.lds index 1f508e5795..3ea0a706e4 100644 --- a/core/host/host_exe.lds +++ b/core/host/host_exe.lds @@ -98,3 +98,14 @@ SECTIONS { } } INSERT BEFORE .rodata; + +SECTIONS { + .bss.ec_sections : { + /* Symbols defined here are declared in link_defs.h */ + . = ALIGN(8); + __deferred_until = .; + . += (__deferred_funcs_end - __deferred_funcs) * (8 / 4); + __deferred_until_end = .; + } +} +INSERT BEFORE .bss; diff --git a/core/nds32/ec.lds.S b/core/nds32/ec.lds.S index eaf5510ceb..4f217d66b3 100644 --- a/core/nds32/ec.lds.S +++ b/core/nds32/ec.lds.S @@ -174,12 +174,6 @@ SECTIONS } > IRAM AT>FLASH - - __deferred_funcs_count = - (__deferred_funcs_end - __deferred_funcs) / 4; - ASSERT(__deferred_funcs_count <= DEFERRABLE_MAX_COUNT, - "Increase DEFERRABLE_MAX_COUNT") - .bss : { /* Stacks must be 64-bit aligned */ . = ALIGN(8); @@ -191,6 +185,17 @@ SECTIONS /* Rest of .bss takes care of its own alignment */ *(.bss) *(.bss.slow) + + /* + * Reserve space for deferred function firing times. Each time is a + * uint64_t, each func is a 32-bit pointer, thus the scaling factor of + * two. + */ + . = ALIGN(8); + __deferred_until = .; + . += (__deferred_funcs_end - __deferred_funcs) * (8 / 4); + __deferred_until_end = .; + . = ALIGN(4); __bss_end = .; |