summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWayne Lin <[email protected]>2021-05-12 18:39:35 +0800
committerWayne Lin <[email protected]>2021-05-12 18:39:35 +0800
commitf068908728afbcf2ab69b5949c286891150f3aca (patch)
treead931747ed4df603de13176697daf6cdfbbd2e98 /src
parent0e9054f7952d5e521268df3919067f62f0e2724d (diff)
parent1c823b3fc07111e3ce46d09574ff9bcda87a4d7f (diff)
Merge branch 'master' of https://github.com/RT-Thread/rt-thread into nuvoton
Diffstat (limited to 'src')
-rw-r--r--src/Kconfig14
-rw-r--r--src/device.c14
-rw-r--r--src/irq.c8
-rw-r--r--src/kservice.c15
4 files changed, 28 insertions, 23 deletions
diff --git a/src/Kconfig b/src/Kconfig
index aa8e514e5c..9a49146dff 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -116,6 +116,18 @@ config RT_TIMER_THREAD_STACK_SIZE
endif
+menu "kservice optimization"
+
+config RT_KSERVICE_USING_STDLIB
+ bool "Enable kservice to use standard C library"
+ default n
+
+config RT_KSERVICE_USING_TINY_SIZE
+ bool "Enable kservice to use tiny size"
+ default n
+
+endmenu
+
menuconfig RT_DEBUG
bool "Enable debugging features"
default y
@@ -341,7 +353,7 @@ endmenu
config RT_VER_NUM
hex
- default 0x40003
+ default 0x40004
help
RT-Thread version number
diff --git a/src/device.c b/src/device.c
index 388c2ecf12..50b83c7692 100644
--- a/src/device.c
+++ b/src/device.c
@@ -12,6 +12,7 @@
* 2012-12-25 Bernard return RT_EOK if the device interface not exist.
* 2013-07-09 Grissiom add ref_count support
* 2016-04-02 Bernard fix the open_flag initialization issue.
+ * 2021-03-19 Meco Man remove rt_device_init_all()
*/
#include <rtthread.h>
@@ -90,19 +91,6 @@ rt_err_t rt_device_unregister(rt_device_t dev)
RTM_EXPORT(rt_device_unregister);
/**
- * This function initializes all registered device driver
- *
- * @return the error code, RT_EOK on successfully.
- *
- * @deprecated since 1.2.x, this function is not needed because the initialization
- * of a device is performed when application opens it.
- */
-rt_err_t rt_device_init_all(void)
-{
- return RT_EOK;
-}
-
-/**
* This function finds a device driver by specified name.
*
* @param name the device driver's name
diff --git a/src/irq.c b/src/irq.c
index 177c1a9ff5..65fc2ea5e0 100644
--- a/src/irq.c
+++ b/src/irq.c
@@ -66,13 +66,13 @@ void rt_interrupt_enter(void)
{
rt_base_t level;
- RT_DEBUG_LOG(RT_DEBUG_IRQ, ("irq coming..., irq nest:%d\n",
- rt_interrupt_nest));
-
level = rt_hw_interrupt_disable();
rt_interrupt_nest ++;
RT_OBJECT_HOOK_CALL(rt_interrupt_enter_hook,());
rt_hw_interrupt_enable(level);
+
+ RT_DEBUG_LOG(RT_DEBUG_IRQ, ("irq has come..., irq current nest:%d\n",
+ rt_interrupt_nest));
}
RTM_EXPORT(rt_interrupt_enter);
@@ -87,7 +87,7 @@ void rt_interrupt_leave(void)
{
rt_base_t level;
- RT_DEBUG_LOG(RT_DEBUG_IRQ, ("irq leave, irq nest:%d\n",
+ RT_DEBUG_LOG(RT_DEBUG_IRQ, ("irq is going to leave, irq current nest:%d\n",
rt_interrupt_nest));
level = rt_hw_interrupt_disable();
diff --git a/src/kservice.c b/src/kservice.c
index 79ee4c2b9d..7ed05b6651 100644
--- a/src/kservice.c
+++ b/src/kservice.c
@@ -17,6 +17,7 @@
* 2013-06-24 Bernard remove rt_kprintf if RT_USING_CONSOLE is not defined.
* 2013-09-24 aozima make sure the device is in STREAM mode when used by rt_kprintf.
* 2015-07-06 Bernard Add rt_assert_handler routine.
+ * 2021-02-28 Meco Man add RT_KSERVICE_USING_STDLIB
*/
#include <rtthread.h>
@@ -125,7 +126,7 @@ RTM_EXPORT(_rt_errno);
*/
RT_WEAK void *rt_memset(void *s, int c, rt_ubase_t count)
{
-#ifdef RT_USING_TINY_SIZE
+#ifdef RT_KSERVICE_USING_TINY_SIZE
char *xs = (char *)s;
while (count--)
@@ -146,10 +147,10 @@ RT_WEAK void *rt_memset(void *s, int c, rt_ubase_t count)
if (!TOO_SMALL(count) && !UNALIGNED(s))
{
- /* If we get this far, we know that n is large and m is word-aligned. */
+ /* If we get this far, we know that count is large and s is word-aligned. */
aligned_addr = (unsigned long *)s;
- /* Store D into each char sized location in BUFFER so that
+ /* Store d into each char sized location in buffer so that
* we can set large blocks quickly.
*/
if (LBLOCKSIZE == 4)
@@ -209,7 +210,7 @@ RTM_EXPORT(rt_memset);
*/
RT_WEAK void *rt_memcpy(void *dst, const void *src, rt_ubase_t count)
{
-#ifdef RT_USING_TINY_SIZE
+#ifdef RT_KSERVICE_USING_TINY_SIZE
char *tmp = (char *)dst, *s = (char *)src;
rt_ubase_t len;
@@ -280,6 +281,8 @@ RT_WEAK void *rt_memcpy(void *dst, const void *src, rt_ubase_t count)
}
RTM_EXPORT(rt_memcpy);
+#ifndef RT_KSERVICE_USING_STDLIB
+
/**
* This function will move memory content from source address to destination
* address.
@@ -506,6 +509,8 @@ rt_size_t rt_strlen(const char *s)
}
RTM_EXPORT(rt_strlen);
+#endif /*RT_KSERVICE_USING_STDLIB*/
+
#ifdef RT_USING_HEAP
/**
* This function will duplicate a string.
@@ -917,7 +922,7 @@ rt_int32_t rt_vsnprintf(char *buf,
s = va_arg(args, char *);
if (!s) s = "(NULL)";
- len = rt_strlen(s);
+ for (len = 0; (len != field_width) && (s[len] != '\0'); len++);
#ifdef RT_PRINTF_PRECISION
if (precision > 0 && len > precision) len = precision;
#endif