From 88eda6f77d6fff76d854db30696eb80d1be58907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Mon, 7 Jun 2021 16:09:43 -0700 Subject: [PATCH] linker: allocate devices in ROM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pull request https://github.com/zephyrproject-rtos/zephyr/pull/24873 marked all the struct devices const. However, the linker scripts were never updated to actually allocate the struct devices in ROM. They're still in RAM, so the main benefit of this work has not been realized. Fix it. Signed-off-by: Martí Bolívar --- include/linker/common-ram.ld | 15 --------------- include/linker/common-rom.ld | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/linker/common-ram.ld b/include/linker/common-ram.ld index e8754cf851c..9fb4292a21b 100644 --- a/include/linker/common-ram.ld +++ b/include/linker/common-ram.ld @@ -22,21 +22,6 @@ } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) #endif - SECTION_DATA_PROLOGUE(devices,,) - { - /* link in devices objects, which are tied to the init ones; - * the objects are thus sorted the same way as their init - * object parent see include/device.h - */ - __device_start = .; - CREATE_OBJ_LEVEL(device, PRE_KERNEL_1) - CREATE_OBJ_LEVEL(device, PRE_KERNEL_2) - CREATE_OBJ_LEVEL(device, POST_KERNEL) - CREATE_OBJ_LEVEL(device, APPLICATION) - CREATE_OBJ_LEVEL(device, SMP) - __device_end = .; - } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) - #if CONFIG_PM_DEVICE SECTION_DATA_PROLOGUE(pm_device_slots, (NOLOAD),) { diff --git a/include/linker/common-rom.ld b/include/linker/common-rom.ld index 9efd49c0fbf..dd2cfce43d0 100644 --- a/include/linker/common-rom.ld +++ b/include/linker/common-rom.ld @@ -17,6 +17,21 @@ __init_end = .; } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) + SECTION_PROLOGUE(devices,,) + { + /* Link in devices objects, which are tied to the init ones; + * the objects are thus sorted the same way as their init + * object parent. See above and include/device.h. + */ + __device_start = .; + CREATE_OBJ_LEVEL(device, PRE_KERNEL_1) + CREATE_OBJ_LEVEL(device, PRE_KERNEL_2) + CREATE_OBJ_LEVEL(device, POST_KERNEL) + CREATE_OBJ_LEVEL(device, APPLICATION) + CREATE_OBJ_LEVEL(device, SMP) + __device_end = .; + } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) + #if defined(CONFIG_GEN_SW_ISR_TABLE) && !defined(CONFIG_DYNAMIC_INTERRUPTS) SECTION_PROLOGUE(sw_isr_table,,) {