Skip to content

Commit 370ce60

Browse files
Flavio Ceolinmbolivar-nordic
authored andcommitted
linker: Re-use device handle logic
Add a new file with the device handles logic that is included in both ram and ROM Signed-off-by: Flavio Ceolin <[email protected]>
1 parent d02a1e9 commit 370ce60

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

include/zephyr/linker/common-ram.ld

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,7 @@
4848
#if defined(CONFIG_HAS_DYNAMIC_DEVICE_HANDLES)
4949
SECTION_DATA_PROLOGUE(device_handles,,)
5050
{
51-
__device_handles_start = .;
52-
#ifdef LINKER_DEVICE_HANDLES_PASS1
53-
KEEP(*(SORT(.__device_handles_pass1*)));
54-
#else
55-
KEEP(*(SORT(.__device_handles_pass2*)));
56-
#endif /* LINKER_DEVICE_HANDLES_PASS1 */
57-
__device_handles_end = .;
51+
#include "device-handles.ld"
5852
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
5953
#endif /* CONFIG_HAS_DYNAMIC_DEVICE_HANDLES */
6054

include/zephyr/linker/common-rom.ld

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,6 @@
223223
#if !defined(CONFIG_HAS_DYNAMIC_DEVICE_HANDLES)
224224
SECTION_DATA_PROLOGUE(device_handles,,)
225225
{
226-
__device_handles_start = .;
227-
#ifdef LINKER_DEVICE_HANDLES_PASS1
228-
KEEP(*(SORT(.__device_handles_pass1*)));
229-
#else
230-
KEEP(*(SORT(.__device_handles_pass2*)));
231-
#endif /* LINKER_DEVICE_HANDLES_PASS1 */
232-
__device_handles_end = .;
226+
#include "device-handles.ld"
233227
} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
234228
#endif /* !CONFIG_HAS_DYNAMIC_DEVICE_HANDLES */
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright (c) 2021 Intel Corporation.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
__device_handles_start = .;
8+
#ifdef LINKER_DEVICE_HANDLES_PASS1
9+
KEEP(*(SORT(.__device_handles_pass1*)));
10+
#else
11+
KEEP(*(SORT(.__device_handles_pass2*)));
12+
#endif /* LINKER_DEVICE_HANDLES_PASS1 */
13+
__device_handles_end = .;

0 commit comments

Comments
 (0)