summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2013-06-03 06:38:51 +0800
committerBernard Xiong <[email protected]>2013-06-03 06:38:51 +0800
commit3c04d0b0a06f6984829d682dbef4de280a139480 (patch)
tree885fbea1d200aabf499869fe69cd36526c86339f /components
parent84da2a4dcc0a00ee02a83870990a3a27e5c1c344 (diff)
parent8238f850369b82843e6d2cef050a412d9218436c (diff)
Merge branch 'master' of https://github.com/RT-Thread/rt-thread
Diffstat (limited to 'components')
-rw-r--r--components/drivers/include/drivers/mmcsd_core.h31
-rw-r--r--components/drivers/include/drivers/usb_device.h1
-rw-r--r--components/drivers/sdio/mmcsd_core.c2
-rw-r--r--components/drivers/usb/usbdevice/class/cdc_vcom.c49
-rw-r--r--components/drivers/usb/usbdevice/core/core.c59
-rw-r--r--components/finsh/finsh.h252
-rw-r--r--components/finsh/shell.c3
7 files changed, 256 insertions, 141 deletions
diff --git a/components/drivers/include/drivers/mmcsd_core.h b/components/drivers/include/drivers/mmcsd_core.h
index 1f7b38795c..5326425bfd 100644
--- a/components/drivers/include/drivers/mmcsd_core.h
+++ b/components/drivers/include/drivers/mmcsd_core.h
@@ -210,37 +210,6 @@ rt_inline rt_uint32_t fls(rt_uint32_t val)
return bit;
}
-#if !defined(__GNUC__) || defined(__CC_ARM)
-rt_inline rt_uint32_t ffs(rt_uint32_t x)
-{
- int r = 1;
-
- if (!x)
- return 0;
- if (!(x & 0xffff)) {
- x >>= 16;
- r += 16;
- }
- if (!(x & 0xff)) {
- x >>= 8;
- r += 8;
- }
- if (!(x & 0xf)) {
- x >>= 4;
- r += 4;
- }
- if (!(x & 3)) {
- x >>= 2;
- r += 2;
- }
- if (!(x & 1)) {
- x >>= 1;
- r += 1;
- }
- return r;
-}
-#endif
-
void mmcsd_host_lock(struct rt_mmcsd_host *host);
void mmcsd_host_unlock(struct rt_mmcsd_host *host);
void mmcsd_req_complete(struct rt_mmcsd_host *host);
diff --git a/components/drivers/include/drivers/usb_device.h b/components/drivers/include/drivers/usb_device.h
index 95dd962a3a..f0e0989ce5 100644
--- a/components/drivers/include/drivers/usb_device.h
+++ b/components/drivers/include/drivers/usb_device.h
@@ -145,6 +145,7 @@ enum udev_msg_type
USB_MSG_SETUP_NOTIFY,
USB_MSG_DATA_NOTIFY,
USB_MSG_SOF,
+ USB_MSG_RESET,
};
typedef enum udev_msg_type udev_msg_type;
diff --git a/components/drivers/sdio/mmcsd_core.c b/components/drivers/sdio/mmcsd_core.c
index e9a2e49115..db93cdb10c 100644
--- a/components/drivers/sdio/mmcsd_core.c
+++ b/components/drivers/sdio/mmcsd_core.c
@@ -493,7 +493,7 @@ rt_uint32_t mmcsd_select_voltage(struct rt_mmcsd_host *host, rt_uint32_t ocr)
ocr &= host->valid_ocr;
- bit = ffs(ocr);
+ bit = __rt_ffs(ocr);
if (bit)
{
bit -= 1;
diff --git a/components/drivers/usb/usbdevice/class/cdc_vcom.c b/components/drivers/usb/usbdevice/class/cdc_vcom.c
index 44e905f317..13df7f598e 100644
--- a/components/drivers/usb/usbdevice/class/cdc_vcom.c
+++ b/components/drivers/usb/usbdevice/class/cdc_vcom.c
@@ -36,8 +36,8 @@ static rt_uint8_t rx_buf[CDC_RX_BUFSIZE];
ALIGN(RT_ALIGN_SIZE)
static rt_uint8_t tx_buf[CDC_TX_BUFSIZE];
-static rt_bool_t vcom_connected = RT_FALSE;
-static rt_bool_t vcom_in_sending = RT_FALSE;
+volatile static rt_bool_t vcom_connected = RT_FALSE;
+volatile static rt_bool_t vcom_in_sending = RT_FALSE;
static struct udevice_descriptor dev_desc =
{
@@ -151,6 +151,17 @@ const static char* _ustring[] =
"Interface",
};
+static void _vcom_reset_state(void)
+{
+ int lvl = rt_hw_interrupt_disable();
+ tx_ringbuffer.read_mirror = tx_ringbuffer.read_index = 0;
+ tx_ringbuffer.write_mirror = tx_ringbuffer.write_index = 0;
+ vcom_connected = RT_FALSE;
+ vcom_in_sending = RT_FALSE;
+ /*rt_kprintf("reset USB serial\n", cnt);*/
+ rt_hw_interrupt_enable(lvl);
+}
+
/**
* This function will handle cdc bulk in endpoint request.
*
@@ -170,7 +181,21 @@ static rt_err_t _ep_in_handler(udevice_t device, uclass_t cls, rt_size_t size)
remain = RT_RINGBUFFER_SIZE(&tx_ringbuffer);
if (remain != 0)
{
-
+ /* although vcom_in_sending is set in SOF handler in the very
+ * beginning, we have to guarantee the state is right when start
+ * sending. There is at least one extreme case where we have finished the
+ * last IN transaction but the vcom_in_sending is RT_FALSE.
+ *
+ * Ok, what the extreme case is: pour data into vcom in loop. Open
+ * terminal on the PC, you will see the data. Then close it. So the
+ * data will be sent to the PC in the back. When the buffer of the PC
+ * driver is full. It will not send IN packet to the board and you will
+ * have no chance to clear vcom_in_sending in this function. The data
+ * will fill into the ringbuffer until it is full, and we will reset
+ * the state machine and clear vcom_in_sending. When you open the
+ * terminal on the PC again. The IN packet will appear on the line and
+ * we will, eventually, reach here with vcom_in_sending is clear.
+ */
vcom_in_sending = RT_TRUE;
rt_ringbuffer_get(&tx_ringbuffer, eps->ep_in->buffer, remain);
rt_hw_interrupt_enable(level);
@@ -369,6 +394,8 @@ static rt_err_t _class_run(udevice_t device, uclass_t cls)
eps->ep_in->buffer = tx_buf;
eps->ep_out->buffer = rx_buf;
+ _vcom_reset_state();
+
dcd_ep_read(device->dcd, eps->ep_out, eps->ep_out->buffer,
eps->ep_out->ep_desc->wMaxPacketSize);
@@ -388,6 +415,8 @@ static rt_err_t _class_stop(udevice_t device, uclass_t cls)
RT_DEBUG_LOG(RT_DEBUG_USB, ("cdc class stop\n"));
+ _vcom_reset_state();
+
return RT_EOK;
}
@@ -408,7 +437,9 @@ static rt_err_t _class_sof_handler(udevice_t device, uclass_t cls)
return -RT_ERROR;
if (vcom_in_sending)
+ {
return RT_EOK;
+ }
eps = (cdc_eps_t)cls->eps;
@@ -559,10 +590,12 @@ static rt_err_t _vcom_control(struct rt_serial_device *serial,
static int _vcom_putc(struct rt_serial_device *serial, char c)
{
rt_uint32_t level;
- int cnt = 500;
+ int cnt;
if (vcom_connected != RT_TRUE)
+ {
return 0;
+ }
/* if the buffer is full, there is a chance that the host would pull some
* data out soon. But we cannot rely on that and if we wait to long, just
@@ -571,12 +604,18 @@ static int _vcom_putc(struct rt_serial_device *serial, char c)
RT_RINGBUFFER_EMPTY(&tx_ringbuffer) == 0 && cnt;
cnt--)
{
- rt_kprintf("wait for %d\n", cnt);
+ /*rt_kprintf("wait for %d\n", cnt);*/
if (vcom_connected != RT_TRUE)
return 0;
}
if (cnt == 0)
+ {
+ /* OK, we believe that the connection is lost. So don't send any more
+ * data and act as the USB cable is not plugged in. Reset the VCOM
+ * state machine */
+ _vcom_reset_state();
return 0;
+ }
level = rt_hw_interrupt_disable();
if (RT_RINGBUFFER_EMPTY(&tx_ringbuffer))
diff --git a/components/drivers/usb/usbdevice/core/core.c b/components/drivers/usb/usbdevice/core/core.c
index f228a1a2bf..45264033a9 100644
--- a/components/drivers/usb/usbdevice/core/core.c
+++ b/components/drivers/usb/usbdevice/core/core.c
@@ -100,13 +100,13 @@ static rt_err_t _get_string_descriptor(struct udevice* device, ureq_t setup)
str_desc.type = USB_DESC_TYPE_STRING;
index = setup->value & 0xFF;
- if(index > USB_STRING_INTERFACE_INDEX)
+ if (index > USB_STRING_INTERFACE_INDEX)
{
rt_kprintf("unknown string index\n");
dcd_ep_stall(device->dcd, 0);
return -RT_ERROR;
}
- if(index == 0)
+ if (index == 0)
{
str_desc.bLength = 4;
str_desc.String[0] = 0x09;
@@ -117,14 +117,14 @@ static rt_err_t _get_string_descriptor(struct udevice* device, ureq_t setup)
len = rt_strlen(device->str[index]);
str_desc.bLength = len*2 + 2;
- for(i=0; i<len; i++)
+ for (i=0; i<len; i++)
{
str_desc.String[i*2] = device->str[index][i];
str_desc.String[i*2 + 1] = 0;
}
}
- if(setup->length > len)
+ if (setup->length > str_desc.bLength)
len = str_desc.bLength;
else
len = setup->length;
@@ -149,7 +149,7 @@ static rt_err_t _get_descriptor(struct udevice* device, ureq_t setup)
RT_ASSERT(device != RT_NULL);
RT_ASSERT(setup != RT_NULL);
- if(setup->request_type == USB_REQ_TYPE_DIR_IN)
+ if (setup->request_type == USB_REQ_TYPE_DIR_IN)
{
switch(setup->value >> 8)
{
@@ -241,7 +241,7 @@ static rt_err_t _set_interface(struct udevice* device, ureq_t setup)
dcd_ep_stall(device->dcd, 0);
return -RT_ERROR;
}
-
+
/* find the specified interface */
intf = rt_usbd_find_interface(device, setup->index & 0xFF, RT_NULL);
@@ -250,7 +250,7 @@ static rt_err_t _set_interface(struct udevice* device, ureq_t setup)
setting = intf->curr_setting;
/* start all endpoints of the interface alternate setting */
- for(i=setting->ep_list.next; i != &setting->ep_list; i=i->next)
+ for (i=setting->ep_list.next; i != &setting->ep_list; i=i->next)
{
ep = (uep_t)rt_list_entry(i, struct uendpoint, list);
dcd_ep_stop(device->dcd, ep);
@@ -279,7 +279,7 @@ static rt_err_t _get_config(struct udevice* device, ureq_t setup)
RT_ASSERT(device->curr_cfg != RT_NULL);
RT_DEBUG_LOG(RT_DEBUG_USB, ("_get_config\n"));
-
+
if (device->state == USB_STATE_CONFIGURED)
{
/* get current configuration */
@@ -319,7 +319,7 @@ static rt_err_t _set_config(struct udevice* device, ureq_t setup)
if (setup->value > device->dev_desc.bNumConfigurations)
{
- dcd_ep_stall(device->dcd, 0);
+ dcd_ep_stall(device->dcd, 0);
return -RT_ERROR;
}
@@ -384,9 +384,9 @@ static rt_err_t _set_address(struct udevice* device, ureq_t setup)
/* set address in device control driver */
dcd_set_address(device->dcd, setup->value);
-
+
device->state = USB_STATE_ADDRESS;
-
+
/* issue status stage */
dcd_send_status(device->dcd);
@@ -413,7 +413,7 @@ static rt_err_t _request_interface(struct udevice* device, ureq_t setup)
RT_ASSERT(setup != RT_NULL);
RT_DEBUG_LOG(RT_DEBUG_USB, ("_request_interface\n"));
-
+
intf = rt_usbd_find_interface(device, setup->index & 0xFF, &cls);
if (intf != RT_NULL)
{
@@ -423,7 +423,7 @@ static rt_err_t _request_interface(struct udevice* device, ureq_t setup)
{
ret = -RT_ERROR;
}
-
+
return ret;
}
@@ -667,6 +667,35 @@ rt_err_t _sof_notify(udevice_t device)
}
/**
+ * This function will reset all class.
+ *
+ * @param device the usb device object.
+ *
+ * @return RT_EOK.
+ */
+rt_err_t _reset_notify(udevice_t device)
+{
+ struct rt_list_node *i;
+ uclass_t cls;
+
+ RT_ASSERT(device != RT_NULL);
+
+ /* to notity every class that sof event comes */
+ for (i=device->curr_cfg->cls_list.next;
+ i!=&device->curr_cfg->cls_list; i=i->next)
+ {
+ cls = (uclass_t)rt_list_entry(i, struct uclass, list);
+ if(cls->ops->stop != RT_NULL)
+ cls->ops->stop(device, cls);
+
+ if(cls->ops->run != RT_NULL)
+ cls->ops->run(device, cls);
+ }
+
+ return RT_EOK;
+}
+
+/**
* This function will create an usb device object.
*
* @param ustring the usb string array to contain string descriptor.
@@ -1382,6 +1411,10 @@ static void rt_usbd_thread_entry(void* parameter)
case USB_MSG_SETUP_NOTIFY:
_setup_request(device, (ureq_t)msg.content.setup_msg.packet);
break;
+ case USB_MSG_RESET:
+ if (device->state == USB_STATE_ADDRESS)
+ _reset_notify(device);
+ break;
default:
rt_kprintf("unknown msg type\n");
break;
diff --git a/components/finsh/finsh.h b/components/finsh/finsh.h
index adb2f09625..99851e8d36 100644
--- a/components/finsh/finsh.h
+++ b/components/finsh/finsh.h
@@ -176,6 +176,13 @@ extern struct finsh_sysvar_item* global_sysvar_list;
struct finsh_sysvar* finsh_sysvar_lookup(const char* name);
#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
/**
* @ingroup finsh
@@ -185,28 +192,39 @@ struct finsh_sysvar* finsh_sysvar_lookup(const char* name);
* @param name the name of function.
* @param desc the description of function, which will show in help.
*/
-#ifdef _MSC_VER
- #define FINSH_FUNCTION_EXPORT(name, desc) \
- const char __fsym_##name##_name[] = #name; \
- const char __fsym_##name##_desc[] = #desc; \
- __declspec(allocate("FSymTab$f")) const struct finsh_syscall __fsym_##name = \
- { \
- __fsym_##name##_name, \
- __fsym_##name##_desc, \
- (syscall_func)&name \
- };
- #pragma comment(linker, "/merge:FSymTab=mytext")
-#else
- #define FINSH_FUNCTION_EXPORT(name, desc) \
- const char __fsym_##name##_name[] = #name; \
- const char __fsym_##name##_desc[] = #desc; \
- const struct finsh_syscall __fsym_##name SECTION("FSymTab")= \
- { \
- __fsym_##name##_name, \
- __fsym_##name##_desc, \
- (syscall_func)&name \
- };
-#endif
+ #ifdef _MSC_VER
+ #define FINSH_FUNCTION_EXPORT(name, desc) \
+ const char __fsym_##name##_name[] = #name; \
+ const char __fsym_##name##_desc[] = #desc; \
+ __declspec(allocate("FSymTab$f")) const struct finsh_syscall __fsym_##name = \
+ { \
+ __fsym_##name##_name, \
+ __fsym_##name##_desc, \
+ (syscall_func)&name \
+ };
+ #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
+ #define FINSH_FUNCTION_EXPORT(name, desc) \
+ const char __fsym_##name##_name[] = #name; \
+ const char __fsym_##name##_desc[] = #desc; \
+ const struct finsh_syscall __fsym_##name SECTION("FSymTab")= \
+ { \
+ __fsym_##name##_name, \
+ __fsym_##name##_desc, \
+ (syscall_func)&name \
+ };
+ #endif /* FINSH_FUNCTION_EXPORT defines */
/**
* @ingroup finsh
@@ -217,27 +235,38 @@ struct finsh_sysvar* finsh_sysvar_lookup(const char* name);
* @param alias the alias name of function.
* @param desc the description of function, which will show in help.
*/
-#ifdef _MSC_VER
- #define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc) \
- const char __fsym_##name##_name[] = #alias; \
- const char __fsym_##name##_desc[] = #desc; \
- __declspec(allocate("FSymTab$f")) const struct finsh_syscall __fsym_##name = \
- { \
- __fsym_##name##_name, \
- __fsym_##name##_desc, \
- (syscall_func)&name \
- };
-#else
- #define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc) \
- const char __fsym_##name##_name[] = #alias; \
- const char __fsym_##name##_desc[] = #desc; \
- const struct finsh_syscall __fsym_##name SECTION("FSymTab")= \
- { \
- __fsym_##name##_name, \
- __fsym_##name##_desc, \
- (syscall_func)&name \
- };
-#endif
+ #ifdef _MSC_VER
+ #define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc) \
+ const char __fsym_##name##_name[] = #alias; \
+ const char __fsym_##name##_desc[] = #desc; \
+ __declspec(allocate("FSymTab$f")) const struct finsh_syscall __fsym_##name = \
+ { \
+ __fsym_##name##_name, \
+ __fsym_##name##_desc, \
+ (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
+ #define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc) \
+ const char __fsym_##name##_name[] = #alias; \
+ const char __fsym_##name##_desc[] = #desc; \
+ const struct finsh_syscall __fsym_##name SECTION("FSymTab")= \
+ { \
+ __fsym_##name##_name, \
+ __fsym_##name##_desc, \
+ (syscall_func)&name \
+ };
+ #endif /* FINSH_FUNCTION_EXPORT_ALIAS defines */
/**
* @ingroup finsh
*
@@ -247,55 +276,98 @@ struct finsh_sysvar* finsh_sysvar_lookup(const char* name);
* @param type the type of variable.
* @param desc the description of function, which will show in help.
*/
-#ifdef _MSC_VER
- #define FINSH_VAR_EXPORT(name, type, desc) \
- const char __vsym_##name##_name[] = #name; \
- const char __vsym_##name##_desc[] = #desc; \
- __declspec(allocate("VSymTab")) const struct finsh_sysvar __vsym_##name = \
- { \
- __vsym_##name##_name, \
- __vsym_##name##_desc, \
- type, \
- (void*)&name \
- };
-#else
- #define FINSH_VAR_EXPORT(name, type, desc) \
- const char __vsym_##name##_name[] = #name; \
- const char __vsym_##name##_desc[] = #desc; \
- const struct finsh_sysvar __vsym_##name SECTION("VSymTab")= \
- { \
- __vsym_##name##_name, \
- __vsym_##name##_desc, \
- type, \
- (void*)&name \
- };
-#endif
- #else
- #define FINSH_FUNCTION_EXPORT(name, desc) \
- const char __fsym_##name##_name[] = #name; \
- const struct finsh_syscall __fsym_##name SECTION("FSymTab")= \
- { \
- __fsym_##name##_name, \
- (syscall_func)&name \
- };
+ #ifdef _MSC_VER
+ #define FINSH_VAR_EXPORT(name, type, desc) \
+ const char __vsym_##name##_name[] = #name; \
+ const char __vsym_##name##_desc[] = #desc; \
+ __declspec(allocate("VSymTab")) const struct finsh_sysvar __vsym_##name = \
+ { \
+ __vsym_##name##_name, \
+ __vsym_##name##_desc, \
+ type, \
+ (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
+ #define FINSH_VAR_EXPORT(name, type, desc) \
+ const char __vsym_##name##_name[] = #name; \
+ const char __vsym_##name##_desc[] = #desc; \
+ const struct finsh_sysvar __vsym_##name SECTION("VSymTab")= \
+ { \
+ __vsym_##name##_name, \
+ __vsym_##name##_desc, \
+ type, \
+ (void*)&name \
+ };
+ #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
+ #define FINSH_FUNCTION_EXPORT(name, desc) \
+ const char __fsym_##name##_name[] = #name; \
+ const struct finsh_syscall __fsym_##name SECTION("FSymTab")= \
+ { \
+ __fsym_##name##_name, \
+ (syscall_func)&name \
+ };
- #define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc) \
- const char __fsym_##name##_name[] = #alias; \
- const struct finsh_syscall __fsym_##name SECTION("FSymTab")= \
- { \
- __fsym_##name##_name, \
- (syscall_func)&name \
- };
+ #define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc) \
+ const char __fsym_##name##_name[] = #alias; \
+ const struct finsh_syscall __fsym_##name SECTION("FSymTab")= \
+ { \
+ __fsym_##name##_name, \
+ (syscall_func)&name \
+ };
- #define FINSH_VAR_EXPORT(name, type, desc) \
- const char __vsym_##name##_name[] = #name; \
- const struct finsh_sysvar __vsym_##name SECTION("VSymTab")= \
- { \
- __vsym_##name##_name, \
- type, \
- (void*)&name \
- };
- #endif
+ #define FINSH_VAR_EXPORT(name, type, desc) \
+ const char __vsym_##name##_name[] = #name; \
+ const struct finsh_sysvar __vsym_##name SECTION("VSymTab")= \
+ { \
+ __vsym_##name##_name, \
+ type, \
+ (void*)&name \
+ };
+ #endif /* __TI_COMPILER_VERSION__ */
+ #endif /* FINSH_USING_DESCRIPTION */
#else
#define FINSH_FUNCTION_EXPORT(name, desc)
#define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc)
diff --git a/components/finsh/shell.c b/components/finsh/shell.c
index de6132c1ab..08dfc2b21a 100644
--- a/components/finsh/shell.c
+++ b/components/finsh/shell.c
@@ -528,7 +528,8 @@ void finsh_system_init(void)
__section_end("FSymTab"));
finsh_system_var_init(__section_begin("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_end;
extern const int __vsymtab_start;