linker: un-abstract some definitions

These made sense before we had the common-rom/common-ram
files, as the same boilerplate was repeated for every arch's
linker script, but this is no longer necessary.

Move these inline for simplicity.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2020-05-23 15:08:07 -07:00 committed by Anas Nashif
commit 02df2a4f96
3 changed files with 55 additions and 75 deletions

View file

@ -36,26 +36,6 @@
#endif
#ifdef _LINKER
/*
* Space for storing per device busy bitmap. Since we do not know beforehand
* the number of devices, we go through the below mechanism to allocate the
* required space.
*/
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
#define DEVICE_COUNT \
((__device_end - __device_start) / _DEVICE_STRUCT_SIZEOF)
#define DEV_BUSY_SZ (((DEVICE_COUNT + 31) / 32) * 4)
#define DEVICE_BUSY_BITFIELD() \
FILL(0x00) ; \
__device_busy_start = .; \
. = . + DEV_BUSY_SZ; \
__device_busy_end = .;
#else
#define DEVICE_BUSY_BITFIELD()
#endif
/*
* generate a symbol to mark the start of the objects array for
* the specified object and level, then link all of those objects
@ -65,57 +45,7 @@
#define CREATE_OBJ_LEVEL(object, level) \
__##object##_##level##_start = .; \
KEEP(*(SORT(.##object##_##level[0-9]))); \
KEEP(*(SORT(.##object##_##level[1-9][0-9]))); \
/*
* link in initialization objects for all objects that are automatically
* initialized by the kernel; the objects are sorted in the order they will be
* initialized (i.e. ordered by level, sorted by priority within a level)
*/
#define INIT_SECTIONS() \
__init_start = .; \
CREATE_OBJ_LEVEL(init, PRE_KERNEL_1) \
CREATE_OBJ_LEVEL(init, PRE_KERNEL_2) \
CREATE_OBJ_LEVEL(init, POST_KERNEL) \
CREATE_OBJ_LEVEL(init, APPLICATION) \
CREATE_OBJ_LEVEL(init, SMP) \
__init_end = .; \
/* define a section for undefined device initialization levels */
#define INIT_UNDEFINED_SECTION() \
KEEP(*(SORT(.init_[_A-Z0-9]*))) \
/*
* 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
*/
#define DEVICE_SECTIONS() \
__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 = .; \
DEVICE_BUSY_BITFIELD() \
/*
* link in shell initialization objects for all modules that use shell and
* their shell commands are automatically initialized by the kernel.
*/
#define SHELL_INIT_SECTIONS() \
__shell_module_start = .; \
KEEP(*(".shell_module_*")); \
__shell_module_end = .; \
__shell_cmd_start = .; \
KEEP(*(".shell_cmd_*")); \
__shell_cmd_end = .; \
KEEP(*(SORT(.##object##_##level[1-9][0-9])));
/*
* link in shell initialization objects for all modules that use shell and