kernel: add early init routines for app RAM
Applications will have their own BSS and data sections which will need to be additionally copied. This covers the common C implementation of these functions. Arches which implement their own optimized versions will need to be updated. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
f1ae5d40b4
commit
bf5228ea56
2 changed files with 28 additions and 1 deletions
|
@ -145,16 +145,35 @@ GDATA(__data_num_words)
|
|||
|
||||
#include <zephyr/types.h>
|
||||
|
||||
#ifdef CONFIG_APPLICATION_MEMORY
|
||||
/* Application memory area bounds */
|
||||
extern char __app_ram_start[];
|
||||
extern char __app_ram_end[];
|
||||
#endif
|
||||
|
||||
/* Memory owned by the kernel */
|
||||
extern char __kernel_ram_start[];
|
||||
extern char __kernel_ram_end[];
|
||||
|
||||
/* Used by _bss_zero or arch-specific implementation */
|
||||
extern char __bss_start[];
|
||||
extern char __bss_end[];
|
||||
#ifdef CONFIG_APPLICATION_MEMORY
|
||||
extern char __app_bss_start[];
|
||||
extern char __app_bss_end[];
|
||||
#endif
|
||||
|
||||
/* Used by _data_copy() or arch-specific implementation */
|
||||
#ifdef CONFIG_XIP
|
||||
extern char __data_rom_start[];
|
||||
extern char __data_ram_start[];
|
||||
extern char __data_ram_end[];
|
||||
#endif
|
||||
#ifdef CONFIG_APPLICATION_MEMORY
|
||||
extern char __app_data_rom_start[];
|
||||
extern char __app_data_ram_start[];
|
||||
extern char __app_data_ram_end[];
|
||||
#endif /* CONFIG_APPLICATION_MEMORY */
|
||||
#endif /* CONFIG_XIP */
|
||||
|
||||
/* used by mem_safe subsystem */
|
||||
extern char _image_rom_start[];
|
||||
|
|
|
@ -143,6 +143,10 @@ void _bss_zero(void)
|
|||
{
|
||||
memset(&__bss_start, 0,
|
||||
((u32_t) &__bss_end - (u32_t) &__bss_start));
|
||||
#ifdef CONFIG_APPLICATION_MEMORY
|
||||
memset(&__app_bss_start, 0,
|
||||
((u32_t) &__app_bss_end - (u32_t) &__app_bss_start));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -159,6 +163,10 @@ void _data_copy(void)
|
|||
{
|
||||
memcpy(&__data_ram_start, &__data_rom_start,
|
||||
((u32_t) &__data_ram_end - (u32_t) &__data_ram_start));
|
||||
#ifdef CONFIG_APPLICATION_MEMORY
|
||||
memcpy(&__app_data_ram_start, &__app_data_rom_start,
|
||||
((u32_t) &__app_data_ram_end - (u32_t) &__app_data_ram_start));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue