arch: arm: mpu: get the __ramfunc region size from the linker

The linker file defines the __ramfunc_ram_size symbols to get the size
of the __ramfunc_ram section. Use that instead of computing the value at
runtime from the start and end symbols. This saves 16 bytes of code with
CONFIG_RAM_FUNCTION=y.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
This commit is contained in:
Aurelien Jarno 2019-02-10 11:05:51 +01:00 committed by Andrew Boie
parent e1cc657941
commit eb097bd095
3 changed files with 3 additions and 2 deletions

View file

@ -82,7 +82,7 @@ void _arch_configure_static_mpu_regions(void)
#if defined(CONFIG_RAM_FUNCTION)
{
.start = (u32_t)&_ramfunc_ram_start,
.size = (u32_t)&_ramfunc_ram_start - (u32_t)&_ramfunc_ram_end,
.size = (u32_t)&_ramfunc_ram_size,
.attr = K_MEM_PARTITION_P_RX_U_RX,
}
#endif /* CONFIG_RAM_FUNCTION */

View file

@ -247,6 +247,7 @@ extern char _nocache_ram_size[];
*/
extern char _ramfunc_ram_start[];
extern char _ramfunc_ram_end[];
extern char _ramfunc_ram_size[];
extern char _ramfunc_rom_start[];
#endif /* ! _ASMLANGUAGE */

View file

@ -175,7 +175,7 @@ void _data_copy(void)
((u32_t) &__data_ram_end - (u32_t) &__data_ram_start));
#ifdef CONFIG_RAM_FUNCTION
(void)memcpy(&_ramfunc_ram_start, &_ramfunc_rom_start,
((u32_t) &_ramfunc_ram_end - (u32_t) &_ramfunc_ram_start));
((u32_t) &_ramfunc_ram_size));
#endif
#ifdef DT_CCM_BASE_ADDRESS
(void)memcpy(&__ccm_data_start, &__ccm_data_rom_start,