zephyr/include/linker/common-rom.ld

138 lines
3.6 KiB
Text
Raw Normal View History

/* SPDX-License-Identifier: Apache-2.0 */
#if defined(CONFIG_GEN_ISR_TABLES) && !defined(CONFIG_DYNAMIC_INTERRUPTS)
SECTION_PROLOGUE(sw_isr_table,,)
{
*(SW_ISR_TABLE)
} GROUP_LINK_IN(ROMABLE_REGION)
#endif
#ifdef CONFIG_CPLUSPLUS
SECTION_PROLOGUE(_CTOR_SECTION_NAME,,)
{
/*
* The compiler fills the constructor pointers table below,
* hence symbol __CTOR_LIST__ must be aligned on 4 byte
* boundary. To align with the C++ standard, the first elment
* of the array contains the number of actual constructors. The
* last element is NULL.
*/
. = ALIGN(4);
__CTOR_LIST__ = .;
LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
KEEP(*(SORT_BY_NAME(".ctors*")))
LONG(0)
__CTOR_END__ = .;
} GROUP_LINK_IN(ROMABLE_REGION)
SECTION_PROLOGUE(init_array,,)
{
. = ALIGN(4);
__init_array_start = .;
KEEP(*(SORT_BY_NAME(".init_array*")))
__init_array_end = .;
} GROUP_LINK_IN(ROMABLE_REGION)
#endif
#ifdef CONFIG_USERSPACE
/* Build-time assignment of permissions to kernel objects to
* threads declared with K_THREAD_DEFINE()
*/
SECTION_PROLOGUE(object_access,,)
{
__k_object_assignment_list_start = .;
KEEP(*(".__k_object_assignment.*"))
__k_object_assignment_list_end = .;
} GROUP_LINK_IN(ROMABLE_REGION)
#endif
SECTION_PROLOGUE(app_shmem_regions,,)
{
__app_shmem_regions_start = .;
KEEP(*(SORT(".app_regions.*")));
__app_shmem_regions_end = .;
} GROUP_LINK_IN(ROMABLE_REGION)
SECTION_PROLOGUE (devconfig,,)
{
__devconfig_start = .;
*(".devconfig.*")
KEEP(*(SORT_BY_NAME(".devconfig*")))
__devconfig_end = .;
} GROUP_LINK_IN(ROMABLE_REGION)
SECTION_PROLOGUE(net_l2,,)
{
__net_l2_start = .;
*(".net_l2.init")
KEEP(*(SORT_BY_NAME(".net_l2.init*")))
__net_l2_end = .;
} GROUP_LINK_IN(ROMABLE_REGION)
#if defined(CONFIG_NET_SOCKETS)
SECTION_PROLOGUE(net_socket_register,,)
{
_net_socket_register_list_start = .;
KEEP(*(SORT_BY_NAME("._net_socket_register.*")))
_net_socket_register_list_end = .;
} GROUP_LINK_IN(ROMABLE_REGION)
#endif
SECTION_DATA_PROLOGUE(_bt_channels_area,,SUBALIGN(4))
{
_bt_channels_start = .;
KEEP(*(SORT_BY_NAME("._bt_channels.static.*")))
_bt_channels_end = .;
} GROUP_LINK_IN(ROMABLE_REGION)
#if defined(CONFIG_BT_BREDR)
SECTION_DATA_PROLOGUE(_bt_br_channels_area,,SUBALIGN(4))
{
_bt_br_channels_start = .;
KEEP(*(SORT_BY_NAME("._bt_br_channels.static.*")))
_bt_br_channels_end = .;
} GROUP_LINK_IN(ROMABLE_REGION)
#endif
SECTION_DATA_PROLOGUE(_bt_services_area,,SUBALIGN(4))
{
_bt_gatt_service_static_list_start = .;
KEEP(*(SORT_BY_NAME("._bt_gatt_service_static.static.*")))
_bt_gatt_service_static_list_end = .;
} GROUP_LINK_IN(ROMABLE_REGION)
subsys/settings: Enable handler ROM registration Add the possibility to register handles to ROM using a new macro SETTINGS_REGISTER_STATIC(handler), the handler is of type settings_handler_stat and has to be declared as const: ``` const struct settings_handler_stat test_handler = { .name = "test", /* this can also be "ps/data" .h_get = get, .h_set = set, .h_commit = NULL, /* NULL defines can be ommited */ .h_export = NULL /* NULL defines can be ommited */ }; SETTINGS_REGISTER_STATIC(test_handler); ``` To maintain support for handlers stored in RAM (dynamic handlers) `CONFIG_SETTINGS_DYNAMIC_HANDLERS`must be enabled, which is by default. When registering static handlers there is no check if this handler has been registered earlier, the latest registered static handler will be considered valid for any set/get routine, while the commit and export routines will be executed for both registered handlers. When a dynamic handler is registered a check is done to see if there was an earlier registration of the name as a static or dynamic handler registration will fail. To get to the lowest possible RAM usage it is advised to set `CONFIG_SETTINGS_DYNAMIC_HANDLERS=n`. Updates: a. Changed usage of RAM to DYNAMIC/dynamic, ROM to STATIC/static b. Updated settings.h to remove added #if defined() c. Make static handlers always enabled d. Corrected error introduced in common-rom.ld. e. Changed return value of settings_parse_and_lookup to settings_handler_stat type to reduce stack usage. f. Updated the name generated to store a handler item in ROM. It now uses the name used to register in combination with the line where SETTINGS_REGISTER_STATIC() is called. g. renamed settings_handler_stat type to settings_handler_static h. renamed SETTINGS_REGISTER_STATIC to SETTINGS_STATIC_HANDLER_DEFINE() Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2019-06-18 15:16:26 +02:00
#if defined(CONFIG_SETTINGS)
SECTION_DATA_PROLOGUE(_settings_handlers_area,,SUBALIGN(4))
{
_settings_handler_static_list_start = .;
KEEP(*(SORT_BY_NAME("._settings_handler_static.static.*")))
_settings_handler_static_list_end = .;
} GROUP_LINK_IN(ROMABLE_REGION)
#endif
SECTION_DATA_PROLOGUE(log_const_sections,,)
{
__log_const_start = .;
KEEP(*(SORT(.log_const_*)));
__log_const_end = .;
} GROUP_LINK_IN(ROMABLE_REGION)
SECTION_DATA_PROLOGUE(log_backends_sections,,)
{
__log_backends_start = .;
KEEP(*(".log_backends"));
__log_backends_end = .;
} GROUP_LINK_IN(ROMABLE_REGION)
SECTION_DATA_PROLOGUE(shell_root_cmds_sections,,)
{
__shell_root_cmds_start = .;
KEEP(*(SORT(.shell_root_cmd_*)));
__shell_root_cmds_end = .;
} GROUP_LINK_IN(ROMABLE_REGION)
SECTION_DATA_PROLOGUE(font_entry_sections,,)
{
__font_entry_start = .;
KEEP(*(SORT_BY_NAME(".font_entry.*")))
__font_entry_end = .;
} GROUP_LINK_IN(ROMABLE_REGION)