4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-01-31 04:20:26 +08:00

finsh: add CCS support

This commit is contained in:
Grissiom 2013-05-29 23:37:43 +08:00
parent 810311b624
commit 27ee5b627b
2 changed files with 164 additions and 91 deletions

View File

@ -176,6 +176,13 @@ extern struct finsh_sysvar_item* global_sysvar_list;
struct finsh_sysvar* finsh_sysvar_lookup(const char* name); struct finsh_sysvar* finsh_sysvar_lookup(const char* name);
#ifdef FINSH_USING_SYMTAB #ifdef FINSH_USING_SYMTAB
#ifdef __TI_COMPILER_VERSION__
#define _EMIT_PRAGMA(x) _Pragma(#x)
#define __TI_FINSH_EXPORT_FUNCTION(f) _EMIT_PRAGMA(DATA_SECTION(f,"FSymTab"))
#define __TI_FINSH_EXPORT_VAR(v) _EMIT_PRAGMA(DATA_SECTION(v,"VSymTab"))
#endif
#ifdef FINSH_USING_DESCRIPTION #ifdef FINSH_USING_DESCRIPTION
/** /**
* @ingroup finsh * @ingroup finsh
@ -196,6 +203,17 @@ struct finsh_sysvar* finsh_sysvar_lookup(const char* name);
(syscall_func)&name \ (syscall_func)&name \
}; };
#pragma comment(linker, "/merge:FSymTab=mytext") #pragma comment(linker, "/merge:FSymTab=mytext")
#elif defined(__TI_COMPILER_VERSION__)
#define FINSH_FUNCTION_EXPORT(name, desc) \
__TI_FINSH_EXPORT_FUNCTION(__fsym_##name); \
const char __fsym_##name##_name[] = #name; \
const char __fsym_##name##_desc[] = #desc; \
const struct finsh_syscall __fsym_##name = \
{ \
__fsym_##name##_name, \
__fsym_##name##_desc, \
(syscall_func)&name \
};
#else #else
#define FINSH_FUNCTION_EXPORT(name, desc) \ #define FINSH_FUNCTION_EXPORT(name, desc) \
const char __fsym_##name##_name[] = #name; \ const char __fsym_##name##_name[] = #name; \
@ -206,7 +224,7 @@ struct finsh_sysvar* finsh_sysvar_lookup(const char* name);
__fsym_##name##_desc, \ __fsym_##name##_desc, \
(syscall_func)&name \ (syscall_func)&name \
}; };
#endif #endif /* FINSH_FUNCTION_EXPORT defines */
/** /**
* @ingroup finsh * @ingroup finsh
@ -227,6 +245,17 @@ struct finsh_sysvar* finsh_sysvar_lookup(const char* name);
__fsym_##name##_desc, \ __fsym_##name##_desc, \
(syscall_func)&name \ (syscall_func)&name \
}; };
#elif defined(__TI_COMPILER_VERSION__)
#define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc) \
__TI_FINSH_EXPORT_FUNCTION(__fsym_##name); \
const char __fsym_##name##_name[] = #alias; \
const char __fsym_##name##_desc[] = #desc; \
const struct finsh_syscall __fsym_##name = \
{ \
__fsym_##name##_name, \
__fsym_##name##_desc, \
(syscall_func)&name \
};
#else #else
#define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc) \ #define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc) \
const char __fsym_##name##_name[] = #alias; \ const char __fsym_##name##_name[] = #alias; \
@ -237,7 +266,7 @@ struct finsh_sysvar* finsh_sysvar_lookup(const char* name);
__fsym_##name##_desc, \ __fsym_##name##_desc, \
(syscall_func)&name \ (syscall_func)&name \
}; };
#endif #endif /* FINSH_FUNCTION_EXPORT_ALIAS defines */
/** /**
* @ingroup finsh * @ingroup finsh
* *
@ -258,6 +287,18 @@ struct finsh_sysvar* finsh_sysvar_lookup(const char* name);
type, \ type, \
(void*)&name \ (void*)&name \
}; };
#elif defined(__TI_COMPILER_VERSION__)
#define FINSH_VAR_EXPORT(name, type, desc) \
__TI_FINSH_EXPORT_VAR(__vsym_##name); \
const char __vsym_##name##_name[] = #name; \
const char __vsym_##name##_desc[] = #desc; \
const struct finsh_sysvar __vsym_##name = \
{ \
__vsym_##name##_name, \
__vsym_##name##_desc, \
type, \
(void*)&name \
};
#else #else
#define FINSH_VAR_EXPORT(name, type, desc) \ #define FINSH_VAR_EXPORT(name, type, desc) \
const char __vsym_##name##_name[] = #name; \ const char __vsym_##name##_name[] = #name; \
@ -269,7 +310,37 @@ struct finsh_sysvar* finsh_sysvar_lookup(const char* name);
type, \ type, \
(void*)&name \ (void*)&name \
}; };
#endif #endif /* FINSH_VAR_EXPORT defines */
#else /* FINSH_USING_DESCRIPTION */
#if defined(__TI_COMPILER_VERSION__)
#define FINSH_FUNCTION_EXPORT(name, desc) \
__TI_FINSH_EXPORT_FUNCTION(__fsym_##name); \
const char __fsym_##name##_name[] = #name; \
const char __fsym_##name##_desc[] = #desc; \
const struct finsh_syscall __fsym_##name = \
{ \
__fsym_##name##_name, \
__fsym_##name##_desc, \
(syscall_func)&name \
};
#define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc) \
const char __fsym_##name##_name[] = #alias; \
__TI_FINSH_EXPORT_FUNCTION(__fsym_##name); \
const struct finsh_syscall __fsym_##name = \
{ \
__fsym_##name##_name, \
(syscall_func)&name \
};
#define FINSH_VAR_EXPORT(name, type, desc) \
__TI_FINSH_EXPORT_VAR(__vsym_##name); \
const char __vsym_##name##_name[] = #name; \
const struct finsh_sysvar __vsym_##name = \
{ \
__vsym_##name##_name, \
type, \
(void*)&name \
};
#else #else
#define FINSH_FUNCTION_EXPORT(name, desc) \ #define FINSH_FUNCTION_EXPORT(name, desc) \
const char __fsym_##name##_name[] = #name; \ const char __fsym_##name##_name[] = #name; \
@ -295,7 +366,8 @@ struct finsh_sysvar* finsh_sysvar_lookup(const char* name);
type, \ type, \
(void*)&name \ (void*)&name \
}; };
#endif #endif /* __TI_COMPILER_VERSION__ */
#endif /* FINSH_USING_DESCRIPTION */
#else #else
#define FINSH_FUNCTION_EXPORT(name, desc) #define FINSH_FUNCTION_EXPORT(name, desc)
#define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc) #define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc)

View File

@ -528,7 +528,8 @@ void finsh_system_init(void)
__section_end("FSymTab")); __section_end("FSymTab"));
finsh_system_var_init(__section_begin("VSymTab"), finsh_system_var_init(__section_begin("VSymTab"),
__section_end("VSymTab")); __section_end("VSymTab"));
#elif defined (__GNUC__) /* GNU GCC Compiler */ #elif defined (__GNUC__) || defined(__TI_COMPILER_VERSION__)
/* GNU GCC Compiler and TI CCS */
extern const int __fsymtab_start; extern const int __fsymtab_start;
extern const int __fsymtab_end; extern const int __fsymtab_end;
extern const int __vsymtab_start; extern const int __vsymtab_start;