toolchain: change section macro to support external c libraries

rename the sections macro to avoid conflicts with the same
macro being defined in sys/cdefs.h of an external libc.

Change-Id: I4d9e060eeff788ca4112c0ad3e98f0bea135f145
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2015-10-08 10:21:57 -04:00
commit db13998741
5 changed files with 26 additions and 26 deletions

View file

@ -133,13 +133,13 @@ extern int task_mem_map_used_get(kmemory_map_t map);
* @param block_size Size of each blocks (in bytes).
*/
#define DEFINE_MEM_MAP(name, blocks, block_size) \
char __noinit __mem_map_buffer_##name[(blocks * block_size)]; \
struct _k_mem_map_struct _k_mem_map_obj_##name = \
__K_MEM_MAP_INITIALIZER(blocks, block_size, \
__mem_map_buffer_##name); \
const kmemory_map_t name \
__section(_k_mem_map_ptr, private, mem_map) = \
(kmemory_map_t)&_k_mem_map_obj_##name;
char __noinit __mem_map_buffer_##name[(blocks * block_size)]; \
struct _k_mem_map_struct _k_mem_map_obj_##name = \
__K_MEM_MAP_INITIALIZER(blocks, block_size, \
__mem_map_buffer_##name); \
const kmemory_map_t name \
__in_section(_k_mem_map_ptr, private, mem_map) = \
(kmemory_map_t)&_k_mem_map_obj_##name;
#ifdef __cplusplus
}

View file

@ -205,7 +205,7 @@ extern int _task_pipe_block_put(kpipe_t id,
struct _k_pipe_struct _k_pipe_obj_##name = \
__K_PIPE_INITIALIZER(size, __pipe_buffer_##name); \
const kpipe_t name \
__section(_k_pipe_ptr, private, pipe) = \
__in_section(_k_pipe_ptr, private, pipe) = \
(kpipe_t)&_k_pipe_obj_##name;
/**

View file

@ -319,13 +319,13 @@ extern void task_group_leave(uint32_t groups);
extern void entry(void); \
char __noinit __stack __stack_##name[stack_size]; \
struct k_task _k_task_obj_##name \
__section(_k_task_list, private, task) = \
__in_section(_k_task_list, private, task) = \
__K_TASK_INITIALIZER( \
(ktask_t)&_k_task_obj_##name, \
priority, 0x00000001, groups, \
entry, &__stack_##name[0], stack_size, NULL); \
const ktask_t name \
__section(_k_task_ptr, private, task) = \
__in_section(_k_task_ptr, private, task) = \
(ktask_t)&_k_task_obj_##name;
#ifdef __cplusplus

View file

@ -21,38 +21,38 @@
#if !defined(_ASMLANGUAGE)
#define __section(seg, hash, line) \
#define __in_section(seg, hash, line) \
__attribute__((section("." _STRINGIFY(seg) \
"." _STRINGIFY(hash) \
"." _STRINGIFY(line))))
#define __noinit __section(NOINIT, _FILE_PATH_HASH, __COUNTER__)
#define __noinit __in_section(NOINIT, _FILE_PATH_HASH, __COUNTER__)
#if defined(CONFIG_ARM)
#define __scs_section __section(SCS_SECTION, _FILE_PATH_HASH, __COUNTER__)
#define __scp_section __section(SCP_SECTION, _FILE_PATH_HASH, __COUNTER__)
#define __scs_section __in_section(SCS_SECTION, _FILE_PATH_HASH, __COUNTER__)
#define __scp_section __in_section(SCP_SECTION, _FILE_PATH_HASH, __COUNTER__)
#define __isr_table_section __section(ISR_TABLE_SECTION, _FILE_PATH_HASH, \
#define __isr_table_section __in_section(ISR_TABLE_SECTION, _FILE_PATH_HASH, \
__COUNTER__)
#define __irq_vector_table __section(IRQ_VECTOR_TABLE, _FILE_PATH_HASH, \
#define __irq_vector_table __in_section(IRQ_VECTOR_TABLE, _FILE_PATH_HASH, \
__COUNTER__)
#define __security_frdm_k64f_section __section(SECURITY_FRDM_K64F, \
#define __security_frdm_k64f_section __in_section(SECURITY_FRDM_K64F, \
_FILE_PATH_HASH, __COUNTER__)
#if defined(CONFIG_GDB_INFO) && !defined(CONFIG_SW_ISR_TABLE)
#define __gdb_stub_irq_vector_table __section(GDB_STUB_IRQ_VECTOR_TABLE, \
#define __gdb_stub_irq_vector_table __in_section(GDB_STUB_IRQ_VECTOR_TABLE, \
_FILE_PATH_HASH, __COUNTER__)
#endif /* CONFIG_GDB_INFO && !CONFIG_SW_ISR_TABLE */
#elif defined(CONFIG_ARC)
#define __irq_vector_table \
__section(IRQ_VECTOR_TABLE, _FILE_PATH_HASH, __COUNTER__)
__in_section(IRQ_VECTOR_TABLE, _FILE_PATH_HASH, __COUNTER__)
#define __isr_table_section \
__section(ISR_TABLE_SECTION, _FILE_PATH_HASH, __COUNTER__)
__in_section(ISR_TABLE_SECTION, _FILE_PATH_HASH, __COUNTER__)
#endif /* CONFIG_ARC */

View file

@ -356,25 +356,25 @@ def kernel_main_c_tasks():
kernel_main_c_out(
"struct k_task %s " % (obj_name)+
"__section(_k_task_list, public, task) =\n" +
"__in_section(_k_task_list, public, task) =\n" +
" {NULL, NULL, %d, (ktask_t)&%s,\n" % (prio, obj_name) +
" 0x00000001, %#010x,\n" % (group_bitmask) +
" %s, %s, %d,\n" % (entry, stack, size) +
" (taskabortfunction)NULL, NULL};\n" +
"ktask_t _k_task_ptr_%s " % (name) +
" __section(_k_task_ptr, public, task) = " +
" __in_section(_k_task_ptr, public, task) = " +
" (ktask_t)&%s;\n" % (obj_name))
kernel_main_c_out(
"struct k_task _k_task_idle " +
"__section(_k_task_list, idle, task) =\n" +
"__in_section(_k_task_list, idle, task) =\n" +
" {NULL, NULL, %d, 0x00000000,\n" % (num_prios - 1) +
" 0x00000000, 0x00000000,\n" +
" (taskstartfunction)NULL, main_task_stack,\n"
" CONFIG_MAIN_STACK_SIZE,\n" +
" (taskabortfunction)NULL, NULL};\n" +
"ktask_t _k_task_ptr_idle " +
" __section(_k_task_ptr, idle, task) = " +
" __in_section(_k_task_ptr, idle, task) = " +
" (ktask_t)&_k_task_idle;\n")
# currently scheduled task (idle task)
@ -555,7 +555,7 @@ def kernel_main_c_pipes():
kernel_main_c_out("struct _k_pipe_struct _k_pipe_obj_%s = " % (name) +
" __K_PIPE_INITIALIZER(%d, %s);\n" % (size, buffer) +
"kpipe_t _k_pipe_ptr_%s " % (name) +
" __section(_k_pipe_ptr, public, pipe) =\n" +
" __in_section(_k_pipe_ptr, public, pipe) =\n" +
" (kpipe_t)&_k_pipe_obj_%s;\n" % (name))
@ -606,7 +606,7 @@ def kernel_main_c_maps():
" __K_MEM_MAP_INITIALIZER(%d, %d, __MAP_%s_buffer);\n" %
(blocks, block_size, map[0]) +
"kmemory_map_t _k_mem_map_ptr_%s " % (name) +
" __section(_k_mem_map_ptr, public, mem_map) =\n" +
" __in_section(_k_mem_map_ptr, public, mem_map) =\n" +
" (kmemory_map_t)&_k_mem_map_obj_%s;\n" % (name))