diff options
| author | Bernard Xiong <[email protected]> | 2019-03-17 09:33:47 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-03-17 09:33:47 +0800 |
| commit | d778c9df25cbbd8e202a0133453e4c8b8e179eff (patch) | |
| tree | 6dd97c1487eacf0a6d858b7541866f865b9203de /components/utilities | |
| parent | 2d69172ad39a52e574a22b4374ee89848d832fe8 (diff) | |
| parent | 94e3f77f25249b52c6f72921a2d2564f68bcd6ff (diff) | |
Merge pull request #2455 from armink/lts-v3.1.x
Lts v3.1.x
Diffstat (limited to 'components/utilities')
| -rw-r--r-- | components/utilities/Kconfig | 6 | ||||
| -rw-r--r-- | components/utilities/ulog/ulog.c | 5 | ||||
| -rw-r--r-- | components/utilities/ulog/ulog_def.h | 2 | ||||
| -rw-r--r-- | components/utilities/utest/utest.c | 4 | ||||
| -rw-r--r-- | components/utilities/utest/utest_log.h | 4 | ||||
| -rw-r--r-- | components/utilities/ymodem/ymodem.c | 14 |
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 */ |
