summaryrefslogtreecommitdiff
path: root/components/utilities
diff options
context:
space:
mode:
authorarmink <[email protected]>2019-03-14 20:37:30 +0800
committerarmink <[email protected]>2019-03-14 20:37:30 +0800
commitdba2b47d45d8b46a960110d1d7d0549d40d17abb (patch)
tree66b0104ff833d11ed24f1791a0939b6c5ae38527 /components/utilities
parent4a34b41dd682b2f3b0132713dff7bd61cc80def9 (diff)
Sync from master (fc5cfe0a5e5709878f50b904df7c3355078941dd)
Diffstat (limited to 'components/utilities')
-rw-r--r--components/utilities/Kconfig6
-rw-r--r--components/utilities/ulog/ulog.c5
-rw-r--r--components/utilities/ulog/ulog_def.h2
-rw-r--r--components/utilities/utest/utest.c4
-rw-r--r--components/utilities/utest/utest_log.h4
-rw-r--r--components/utilities/ymodem/ymodem.c14
6 files changed, 17 insertions, 18 deletions
diff --git a/components/utilities/Kconfig b/components/utilities/Kconfig
index 1175006a58..504a56691d 100644
--- a/components/utilities/Kconfig
+++ b/components/utilities/Kconfig
@@ -222,12 +222,6 @@ config RT_USING_ULOG
select ULOG_OUTPUT_TIME
select ULOG_USING_FILTER
default n
-
- config ULOG_SW_VERSION_NUM
- hex
- default 0x00101
- help
- sfotware module version number
endif
config RT_USING_UTEST
diff --git a/components/utilities/ulog/ulog.c b/components/utilities/ulog/ulog.c
index b813678ecd..87d0932506 100644
--- a/components/utilities/ulog/ulog.c
+++ b/components/utilities/ulog/ulog.c
@@ -315,7 +315,10 @@ RT_WEAK rt_size_t ulog_formater(char *log_buf, rt_uint32_t level, const char *ta
/* is not in interrupt context */
if (rt_interrupt_get_nest() == 0)
{
- log_len += ulog_strcpy(log_len, log_buf + log_len, rt_thread_self()->name);
+ rt_size_t name_len = rt_strnlen(rt_thread_self()->name, RT_NAME_MAX);
+
+ rt_strncpy(log_buf + log_len, rt_thread_self()->name, name_len);
+ log_len += name_len;
}
else
{
diff --git a/components/utilities/ulog/ulog_def.h b/components/utilities/ulog/ulog_def.h
index e7c033f71c..40b39de972 100644
--- a/components/utilities/ulog/ulog_def.h
+++ b/components/utilities/ulog/ulog_def.h
@@ -47,7 +47,7 @@ extern "C" {
#define DBG_INFO LOG_LVL_INFO
#define DBG_LOG LOG_LVL_DBG
#define dbg_log(level, ...) \
- if ((level) <= DBG_LEVEL) \
+ if ((level) <= LOG_LVL) \
{ \
ulog_output(level, LOG_TAG, RT_FALSE, __VA_ARGS__);\
}
diff --git a/components/utilities/utest/utest.c b/components/utilities/utest/utest.c
index f7348b3be4..7bc2c93656 100644
--- a/components/utilities/utest/utest.c
+++ b/components/utilities/utest/utest.c
@@ -17,17 +17,13 @@
#undef DBG_SECTION_NAME
#undef DBG_LEVEL
-#undef DBG_COLOR
-#undef DBG_ENABLE
-#define DBG_ENABLE
#define DBG_SECTION_NAME "utest"
#ifdef UTEST_DEBUG
#define DBG_LEVEL DBG_LOG
#else
#define DBG_LEVEL DBG_INFO
#endif
-#define DBG_COLOR
#include <rtdbg.h>
#if RT_CONSOLEBUF_SIZE < 256
diff --git a/components/utilities/utest/utest_log.h b/components/utilities/utest/utest_log.h
index 9f38d3f9c8..c4bd25a80b 100644
--- a/components/utilities/utest/utest_log.h
+++ b/components/utilities/utest/utest_log.h
@@ -17,17 +17,13 @@
#undef DBG_SECTION_NAME
#undef DBG_LEVEL
-#undef DBG_COLOR
-#undef DBG_ENABLE
-#define DBG_ENABLE
#define DBG_SECTION_NAME "testcase"
#ifdef UTEST_DEBUG
#define DBG_LEVEL DBG_LOG
#else
#define DBG_LEVEL DBG_INFO
#endif
-#define DBG_COLOR
#include <rtdbg.h>
#define UTEST_LOG_ALL (1u)
diff --git a/components/utilities/ymodem/ymodem.c b/components/utilities/ymodem/ymodem.c
index c98c7f6cb6..716c702328 100644
--- a/components/utilities/ymodem/ymodem.c
+++ b/components/utilities/ymodem/ymodem.c
@@ -125,6 +125,7 @@ static rt_err_t _rym_do_handshake(
rt_size_t i;
rt_uint16_t recv_crc, cal_crc;
rt_size_t data_sz;
+ rt_tick_t tick;
ctx->stage = RYM_STAGE_ESTABLISHING;
/* send C every second, so the sender could know we are waiting for it. */
@@ -149,8 +150,17 @@ static rt_err_t _rym_do_handshake(
return -RYM_ERR_TMO;
}
- i = _rym_read_data(ctx, data_sz-1);
- if (i != (data_sz-1))
+ /* receive all data */
+ i = 0;
+ /* automatic exit after receiving specified length data, timeout: 100ms */
+ tick = rt_tick_get();
+ while (rt_tick_get() <= (tick + rt_tick_from_millisecond(100)) && i < (data_sz-1))
+ {
+ i += _rym_read_data(ctx, data_sz - 1);
+ rt_thread_mdelay(5);
+ }
+
+ if (i != (data_sz - 1))
return -RYM_ERR_DSZ;
/* sanity check */