diff options
-rw-r--r-- | core/cortex-m/ec.lds.S | 10 | ||||
-rw-r--r-- | include/link_defs.h | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S index dabdedf860..2a9a9b2fe0 100644 --- a/core/cortex-m/ec.lds.S +++ b/core/cortex-m/ec.lds.S @@ -59,8 +59,10 @@ MEMORY #ifdef CONFIG_CHIP_MEMORY_REGIONS #define REGION(name, attr, start, size) \ name(attr) : ORIGIN = (start), LENGTH = (size) +#define REGION_LOAD REGION #include "memory_regions.inc" #undef REGION +#undef REGION_LOAD #endif /* CONFIG_MEMORY_REGIONS */ } SECTIONS @@ -406,10 +408,18 @@ SECTIONS #define REGION(name, attr, start, size) \ .name(NOLOAD) : { \ __##name##_start = .; \ + KEEP(*(SORT(.name.keep.*))) \ + *(SORT(.name.*)) \ + } > name +#define REGION_LOAD(name, attr, start, size) \ + .name : { \ + __##name##_start = .; \ + KEEP(*(SORT(.name.keep.*))) \ *(SORT(.name.*)) \ } > name #include "memory_regions.inc" #undef REGION +#undef REGION_LOAD #endif /* CONFIG_CHIP_MEMORY_REGIONS */ #if !(defined(SECTION_IS_RO) && defined(CONFIG_FLASH)) diff --git a/include/link_defs.h b/include/link_defs.h index 61648baa0f..299cf54b75 100644 --- a/include/link_defs.h +++ b/include/link_defs.h @@ -111,8 +111,11 @@ extern const void *__data_end; /* Helper for special chip-specific memory sections */ #ifdef CONFIG_CHIP_MEMORY_REGIONS #define __SECTION(name) __attribute__((section("." STRINGIFY(name) ".50_auto"))) +#define __SECTION_KEEP(name) \ + __attribute__((section("." STRINGIFY(name) ".keep.50_auto"))) #else #define __SECTION(name) +#define __SECTION_KEEP(name) #endif /* CONFIG_MEMORY_REGIONS */ #ifdef CONFIG_CHIP_UNCACHED_REGION #define __uncached __SECTION(CONFIG_CHIP_UNCACHED_REGION) |