net/xx/wrbuffer: Do not use SEM_INITIALIZER for buffers

Using the macro places the buffers into .data section which means they
will consume the full buffer size of flash / read only memory as well.

Place the buffers into .bss to avoid this case.
This commit is contained in:
Ville Juven
2023-08-24 15:50:27 +03:00
committed by Xiang Xiao
parent 48d95b8d82
commit 9cd8ea32d1
2 changed files with 8 additions and 8 deletions

View File

@@ -73,10 +73,7 @@ struct wrbuffer_s
/* This is the state of the global write buffer resource */
static struct wrbuffer_s g_wrbuffer =
{
SEM_INITIALIZER(CONFIG_NET_TCP_NWRBCHAINS),
};
static struct wrbuffer_s g_wrbuffer;
/****************************************************************************
* Public Functions
@@ -97,6 +94,10 @@ void tcp_wrbuffer_initialize(void)
{
int i;
sq_init(&g_wrbuffer.freebuffers);
nxsem_init(&g_wrbuffer.sem, 0, CONFIG_NET_TCP_NWRBCHAINS);
for (i = 0; i < CONFIG_NET_TCP_NWRBCHAINS; i++)
{
sq_addfirst(&g_wrbuffer.buffers[i].wb_node, &g_wrbuffer.freebuffers);

View File

@@ -72,10 +72,7 @@ struct wrbuffer_s
/* This is the state of the global write buffer resource */
static struct wrbuffer_s g_wrbuffer =
{
SEM_INITIALIZER(CONFIG_NET_UDP_NWRBCHAINS)
};
static struct wrbuffer_s g_wrbuffer;
/****************************************************************************
* Public Functions
@@ -98,6 +95,8 @@ void udp_wrbuffer_initialize(void)
sq_init(&g_wrbuffer.freebuffers);
nxsem_init(&g_wrbuffer.sem, 0, CONFIG_NET_UDP_NWRBCHAINS);
for (i = 0; i < CONFIG_NET_UDP_NWRBCHAINS; i++)
{
sq_addfirst(&g_wrbuffer.buffers[i].wb_node, &g_wrbuffer.freebuffers);