Skip to content

Commit

Permalink
net: Add tags to network iterable ROM sections
Browse files Browse the repository at this point in the history
Add __iterable_section_rom to network struct types and remove ld/cmake
entries.

Signed-off-by: Pieter De Gendt <[email protected]>
  • Loading branch information
pdgendt committed Dec 16, 2024
1 parent ae4087f commit 5e78385
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 65 deletions.
25 changes: 0 additions & 25 deletions cmake/linker_script/common/common-rom.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,6 @@ zephyr_linker_section_configure(
KEEP SORT NAME
)

if(CONFIG_NET_SOCKETS)
zephyr_iterable_section(NAME net_socket_register KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN})
endif()


if(CONFIG_NET_L2_PPP)
zephyr_iterable_section(NAME ppp_protocol_handler KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN})
endif()

zephyr_iterable_section(NAME bt_l2cap_fixed_chan KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN})

if(CONFIG_BT_CLASSIC)
Expand Down Expand Up @@ -161,10 +152,6 @@ if(CONFIG_EMUL)
zephyr_iterable_section(NAME emul KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN})
endif()

if(CONFIG_DNS_SD)
zephyr_iterable_section(NAME dns_sd_rec KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN})
endif()

if(CONFIG_PCIE)
zephyr_iterable_section(NAME irq_alloc KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN})
endif()
Expand Down Expand Up @@ -214,18 +201,6 @@ if (CONFIG_MULTI_LEVEL_INTERRUPTS)
zephyr_iterable_section(NAME intc_table KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4)
endif()

if (CONFIG_HTTP_SERVER)
zephyr_iterable_section(NAME http_service_desc KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN})
endif()

if (CONFIG_COAP_SERVER)
zephyr_iterable_section(NAME coap_service KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN})
endif()

if (CONFIG_NET_MGMT)
zephyr_iterable_section(NAME net_mgmt_event_static_handler KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN})
endif()

if(CONFIG_INPUT)
zephyr_iterable_section(NAME input_callback KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN})
endif()
Expand Down
2 changes: 0 additions & 2 deletions include/zephyr/linker/common-rom.ld
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

#include <zephyr/linker/common-rom/common-rom-init.ld>

#include <zephyr/linker/common-rom/common-rom-net.ld>

#include <zephyr/linker/common-rom/common-rom-bt.ld>

#include <zephyr/linker/common-rom/common-rom-logging.ld>
Expand Down
31 changes: 0 additions & 31 deletions include/zephyr/linker/common-rom/common-rom-net.ld

This file was deleted.

2 changes: 1 addition & 1 deletion include/zephyr/net/coap_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct coap_service_data {
struct coap_pending pending[CONFIG_COAP_SERVICE_PENDING_MESSAGES];
};

struct coap_service {
__iterable_section_rom struct coap_service {
const char *name;
const char *host;
uint16_t *port;
Expand Down
2 changes: 1 addition & 1 deletion include/zephyr/net/dns_sd.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ extern "C" {
*
* @see <a href="https://tools.ietf.org/html/rfc6763">RFC 6763</a>
*/
struct dns_sd_rec {
__iterable_section_rom struct dns_sd_rec {
/** "<Instance>" - e.g. "My HTTP Server" */
const char *instance;
/** Top half of the "<Service>" such as "_http" */
Expand Down
2 changes: 1 addition & 1 deletion include/zephyr/net/http/service.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct http_resource_desc {

/** @cond INTERNAL_HIDDEN */

struct http_service_desc {
__iterable_section_rom struct http_service_desc {
const char *host;
uint16_t *port;
void *detail;
Expand Down
2 changes: 1 addition & 1 deletion include/zephyr/net/net_mgmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ typedef void (*net_mgmt_event_static_handler_t)(uint32_t mgmt_event,
/** @cond INTERNAL_HIDDEN */

/* Structure for event handler registered at compile time */
struct net_mgmt_event_static_handler {
__iterable_section_rom struct net_mgmt_event_static_handler {
uint32_t event_mask;
net_mgmt_event_static_handler_t handler;
void *user_data;
Expand Down
2 changes: 1 addition & 1 deletion include/zephyr/net/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ struct in6_pktinfo {
/**
* @brief Registration information for a given BSD socket family.
*/
struct net_socket_register {
__iterable_section_rom struct net_socket_register {
int family;
bool is_offloaded;
bool (*is_supported)(int family, int type, int proto);
Expand Down
2 changes: 1 addition & 1 deletion include/zephyr/net/socket_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct net_socket_service_event {
* User should create needed sockets and then setup the poll struct and
* then register the sockets to be monitored at runtime.
*/
struct net_socket_service_desc {
__iterable_section_rom struct net_socket_service_desc {
#if CONFIG_NET_SOCKETS_LOG_LEVEL >= LOG_LEVEL_DBG
/**
* Owner name. This can be used in debugging to see who has
Expand Down
3 changes: 3 additions & 0 deletions include/zephyr/toolchain/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@
/* Indicates this is a network socket object */
#define __net_socket __zpp(struct("__net_socket"))

/* Indicates a struct iterable section should be added in ROM */
#define __iterable_section_rom __zpp(struct("__iterable_section_rom"))

#ifndef BUILD_ASSERT
/* Compile-time assertion that makes the build to fail.
* Common implementation swallows the message.
Expand Down
2 changes: 1 addition & 1 deletion subsys/net/l2/ppp/ppp_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct ppp_packet {
#define PPP_BUF_ALLOC_TIMEOUT K_MSEC(100)

/** Protocol handler information. */
struct ppp_protocol_handler {
__iterable_section_rom struct ppp_protocol_handler {
/** Protocol init function */
void (*init)(struct ppp_context *ctx);

Expand Down

0 comments on commit 5e78385

Please sign in to comment.