arch: make __ramfunc support transparent

Instead of having to enable ramfunc support manually, just make it
transparently available to users, keeping the MPU region disabled if not
used to not waste a MPU region. This however wastes 24 bytes of code
area when the MPU is disabled and 48 bytes when it is enabled, and
probably a dozen of CPU cycles during boot. I believe it is something
acceptable.

Note that when XIP is used, code is already in RAM, so the __ramfunc
keyword does nothing, but does not generate an error.

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
commit 992f29a1bc
8 changed files with 22 additions and 20 deletions

View file

@ -243,12 +243,14 @@ extern char _nocache_ram_size[];
* management/protection hardware for the target architecture.
*
* All the functions with '__ramfunc' keyword will be placed into this
* sections.
* section, stored in RAM instead of FLASH.
*/
#ifdef CONFIG_ARCH_HAS_RAMFUNC_SUPPORT
extern char _ramfunc_ram_start[];
extern char _ramfunc_ram_end[];
extern char _ramfunc_ram_size[];
extern char _ramfunc_rom_start[];
#endif /* CONFIG_ARCH_HAS_RAMFUNC_SUPPORT */
#endif /* ! _ASMLANGUAGE */