Refine how to specify iob and ramlog data section

1.Remove the default value(.bss)
2.Remove !ARCH_SIM dependence

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-08-22 15:51:31 +08:00 committed by Petro Karashchenko
parent 9bc47ecdce
commit 130b196876
6 changed files with 22 additions and 21 deletions

View File

@ -250,8 +250,6 @@ if RAMLOG_SYSLOG
config RAMLOG_BUFFER_SECTION
string "The section where ramlog buffer is located"
default ".bss"
depends on !ARCH_SIM
---help---
The section where ramlog buffer is located.
The section shall not be initialized on system boot.

View File

@ -36,6 +36,10 @@ endif
ifeq ($(CONFIG_RAMLOG),y)
CSRCS += ramlog.c
ifneq ($(CONFIG_RAMLOG_BUFFER_SECTION),"")
CFLAGS += ${shell $(DEFINE) "$(CC)" RAMLOG_BUFFER_SECTION=CONFIG_RAMLOG_BUFFER_SECTION}
endif
endif
############################################################################

View File

@ -124,11 +124,12 @@ static const struct file_operations g_ramlogfops =
*/
#ifdef CONFIG_RAMLOG_SYSLOG
# ifdef RAMLOG_BUFFER_SECTION
static char g_sysbuffer[CONFIG_RAMLOG_BUFSIZE]
#ifdef CONFIG_RAMLOG_BUFFER_SECTION
locate_data(CONFIG_RAMLOG_BUFFER_SECTION)
#endif
;
locate_data(RAMLOG_BUFFER_SECTION);
# else
static char g_sysbuffer[CONFIG_RAMLOG_BUFSIZE];
# endif
/* This is the device structure for the console or syslogging function. It
* must be statically initialized because the RAMLOG ramlog_putc function
@ -137,15 +138,15 @@ static char g_sysbuffer[CONFIG_RAMLOG_BUFSIZE]
static struct ramlog_dev_s g_sysdev =
{
#ifndef CONFIG_RAMLOG_NONBLOCKING
# ifndef CONFIG_RAMLOG_NONBLOCKING
0, /* rl_nwaiters */
#endif
# endif
CONFIG_RAMLOG_BUFSIZE, /* rl_head */
CONFIG_RAMLOG_BUFSIZE, /* rl_tail */
SEM_INITIALIZER(1), /* rl_exclsem */
#ifndef CONFIG_RAMLOG_NONBLOCKING
# ifndef CONFIG_RAMLOG_NONBLOCKING
SEM_INITIALIZER(0), /* rl_waitsem */
#endif
# endif
CONFIG_RAMLOG_BUFSIZE, /* rl_bufsize */
g_sysbuffer /* rl_buffer */
};

View File

@ -48,8 +48,6 @@ config IOB_ALIGNMENT
config IOB_SECTION
string "The section where iob buffer is located"
default ".bss"
depends on !ARCH_SIM
---help---
The section where iob buffer is located.
The section must be zero-initialized on system boot.

View File

@ -38,6 +38,10 @@ ifeq ($(CONFIG_DEBUG_FEATURES),y)
CSRCS += iob_dump.c
endif
ifneq ($(CONFIG_IOB_SECTION),"")
CFLAGS += ${shell $(DEFINE) "$(CC)" IOB_SECTION=CONFIG_IOB_SECTION}
endif
# Include iob build support
DEPPATH += --dep-path iob

View File

@ -42,14 +42,6 @@
#define IOB_BUFFER_SIZE (IOB_ALIGN_SIZE * CONFIG_IOB_NBUFFERS + \
CONFIG_IOB_ALIGNMENT - 1)
/* Improve Flexibility */
#ifdef CONFIG_IOB_SECTION
# define IOB_SECTION locate_data(CONFIG_IOB_SECTION)
#else
# define IOB_SECTION
#endif
/****************************************************************************
* Private Data
****************************************************************************/
@ -59,7 +51,11 @@
* to the CONFIG_IOB_ALIGNMENT memory boundary.
*/
static uint8_t g_iob_buffer[IOB_BUFFER_SIZE] IOB_SECTION;
#ifdef IOB_SECTION
static uint8_t g_iob_buffer[IOB_BUFFER_SIZE] locate_data(IOB_SECTION);
#else
static uint8_t g_iob_buffer[IOB_BUFFER_SIZE];
#endif
#if CONFIG_IOB_NCHAINS > 0
/* This is a pool of pre-allocated iob_qentry_s buffers */