[debug] 整理debug宏并增加RT_DEBUGING_CONTEXT (#7805)

This commit is contained in:
Man, Jianting (Meco) 2023-07-21 22:36:42 -04:00 committed by GitHub
parent 52d3637fba
commit 244b903e5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 92 additions and 102 deletions

View File

@ -269,7 +269,7 @@ jobs:
- "microchip/same70" - "microchip/same70"
- "smartfusion2" - "smartfusion2"
- "maxim/max32660-evsys" - "maxim/max32660-evsys"
- "efm32" # - "efm32"
- RTT_BSP: "mips" - RTT_BSP: "mips"
RTT_TOOL_CHAIN: "sourcery-mips" RTT_TOOL_CHAIN: "sourcery-mips"
SUB_RTT_BSP: SUB_RTT_BSP:

View File

@ -385,7 +385,7 @@ PSOC6 BSP 的制作规范主要分为 3 个方面工程配置ENV 配置和
#### 4.1.2 ENV 配置 #### 4.1.2 ENV 配置
- 系统心跳统一设置为 1000RT_TICK_PER_SECOND - 系统心跳统一设置为 1000RT_TICK_PER_SECOND
- BSP 中需要打开调试选项中的断言RT_DEBUG - BSP 中需要打开调试选项中的断言RT_USING_DEBUG
- 系统空闲线程栈大小统一设置为 256IDLE_THREAD_STACK_SIZE - 系统空闲线程栈大小统一设置为 256IDLE_THREAD_STACK_SIZE
- 开启组件自动初始化RT_USING_COMPONENTS_INIT - 开启组件自动初始化RT_USING_COMPONENTS_INIT
- 需要开启 user main 选项RT_USING_USER_MAIN - 需要开启 user main 选项RT_USING_USER_MAIN

View File

@ -36,7 +36,7 @@ extern int __bss_end__;
/* External function prototypes ----------------------------------------------*/ /* External function prototypes ----------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/ /* Private functions ---------------------------------------------------------*/
#ifdef RT_DEBUG #ifdef RT_USING_DEBUG
/***************************************************************************//** /***************************************************************************//**
* @brief * @brief
* Reports the name of the source file and the source line number where the * Reports the name of the source file and the source line number where the

View File

@ -790,7 +790,7 @@ GD32 BSP 的制作规范主要分为 3 个方面工程配置ENV 配置和
#### 4.1.2 ENV 配置 #### 4.1.2 ENV 配置
- 系统心跳统一设置为 1000RT_TICK_PER_SECOND - 系统心跳统一设置为 1000RT_TICK_PER_SECOND
- BSP 中需要打开调试选项中的断言RT_DEBUG - BSP 中需要打开调试选项中的断言RT_USING_DEBUG
- 系统空闲线程栈大小统一设置为 256IDLE_THREAD_STACK_SIZE - 系统空闲线程栈大小统一设置为 256IDLE_THREAD_STACK_SIZE
- 开启组件自动初始化RT_USING_COMPONENTS_INIT - 开启组件自动初始化RT_USING_COMPONENTS_INIT
- 需要开启 user main 选项RT_USING_USER_MAIN - 需要开启 user main 选项RT_USING_USER_MAIN

View File

@ -594,7 +594,7 @@ GD32 BSP 的制作规范主要分为 3 个方面工程配置ENV 配置和
#### 4.1.2 ENV 配置 #### 4.1.2 ENV 配置
- 系统心跳统一设置为 1000RT_TICK_PER_SECOND - 系统心跳统一设置为 1000RT_TICK_PER_SECOND
- BSP 中需要打开调试选项中的断言RT_DEBUG - BSP 中需要打开调试选项中的断言RT_USING_DEBUG
- 系统空闲线程栈大小统一设置为 256IDLE_THREAD_STACK_SIZE - 系统空闲线程栈大小统一设置为 256IDLE_THREAD_STACK_SIZE
- 开启组件自动初始化RT_USING_COMPONENTS_INIT - 开启组件自动初始化RT_USING_COMPONENTS_INIT
- 需要开启 user main 选项RT_USING_USER_MAIN - 需要开启 user main 选项RT_USING_USER_MAIN

View File

@ -237,7 +237,7 @@ i.MX RT BSP 的制作规范主要分为 3 个方面工程配置ENV 配置
#### ENV 配置 #### ENV 配置
- 系统心跳统一设置为 1000RT_TICK_PER_SECOND - 系统心跳统一设置为 1000RT_TICK_PER_SECOND
- BSP 中需要打开调试选项中的断言RT_DEBUG - BSP 中需要打开调试选项中的断言RT_USING_DEBUG
- 系统空闲线程栈大小统一设置为 256IDLE_THREAD_STACK_SIZE - 系统空闲线程栈大小统一设置为 256IDLE_THREAD_STACK_SIZE
- 开启组件自动初始化RT_USING_COMPONENTS_INIT - 开启组件自动初始化RT_USING_COMPONENTS_INIT
- 需要开启 user main 选项RT_USING_USER_MAIN - 需要开启 user main 选项RT_USING_USER_MAIN

View File

@ -238,7 +238,7 @@ LPC BSP 的制作规范主要分为 3 个方面工程配置ENV 配置和 I
#### ENV 配置 #### ENV 配置
- 系统心跳统一设置为 100RT_TICK_PER_SECOND - 系统心跳统一设置为 100RT_TICK_PER_SECOND
- BSP 中需要打开调试选项中的断言RT_DEBUG - BSP 中需要打开调试选项中的断言RT_USING_DEBUG
- 系统空闲线程栈大小统一设置为 256IDLE_THREAD_STACK_SIZE - 系统空闲线程栈大小统一设置为 256IDLE_THREAD_STACK_SIZE
- 开启组件自动初始化RT_USING_COMPONENTS_INIT - 开启组件自动初始化RT_USING_COMPONENTS_INIT
- 需要开启 user main 选项RT_USING_USER_MAIN - 需要开启 user main 选项RT_USING_USER_MAIN

View File

@ -29,7 +29,7 @@
#define RT_KSERVICE_USING_STDLIB #define RT_KSERVICE_USING_STDLIB
#define RT_KPRINTF_USING_LONGLONG #define RT_KPRINTF_USING_LONGLONG
#define RT_DEBUG #define RT_USING_DEBUG
/* Inter-Thread communication */ /* Inter-Thread communication */

View File

@ -28,7 +28,7 @@
#define RT_KSERVICE_USING_STDLIB #define RT_KSERVICE_USING_STDLIB
#define RT_KPRINTF_USING_LONGLONG #define RT_KPRINTF_USING_LONGLONG
#define RT_DEBUG #define RT_USING_DEBUG
/* Inter-Thread communication */ /* Inter-Thread communication */

View File

@ -29,7 +29,7 @@
#define RT_KSERVICE_USING_STDLIB #define RT_KSERVICE_USING_STDLIB
#define RT_KPRINTF_USING_LONGLONG #define RT_KPRINTF_USING_LONGLONG
#define RT_DEBUG #define RT_USING_DEBUG
/* Inter-Thread communication */ /* Inter-Thread communication */

View File

@ -28,7 +28,7 @@
#define RT_KSERVICE_USING_STDLIB #define RT_KSERVICE_USING_STDLIB
#define RT_KPRINTF_USING_LONGLONG #define RT_KPRINTF_USING_LONGLONG
#define RT_DEBUG #define RT_USING_DEBUG
/* Inter-Thread communication */ /* Inter-Thread communication */

View File

@ -29,7 +29,7 @@
#define RT_KSERVICE_USING_STDLIB #define RT_KSERVICE_USING_STDLIB
#define RT_KPRINTF_USING_LONGLONG #define RT_KPRINTF_USING_LONGLONG
#define RT_DEBUG #define RT_USING_DEBUG
/* Inter-Thread communication */ /* Inter-Thread communication */

View File

@ -28,7 +28,7 @@
#define RT_KSERVICE_USING_STDLIB #define RT_KSERVICE_USING_STDLIB
#define RT_KPRINTF_USING_LONGLONG #define RT_KPRINTF_USING_LONGLONG
#define RT_DEBUG #define RT_USING_DEBUG
/* Inter-Thread communication */ /* Inter-Thread communication */

View File

@ -29,7 +29,7 @@
#define RT_KSERVICE_USING_STDLIB #define RT_KSERVICE_USING_STDLIB
#define RT_KPRINTF_USING_LONGLONG #define RT_KPRINTF_USING_LONGLONG
#define RT_DEBUG #define RT_USING_DEBUG
/* Inter-Thread communication */ /* Inter-Thread communication */

View File

@ -28,7 +28,7 @@
#define RT_KSERVICE_USING_STDLIB #define RT_KSERVICE_USING_STDLIB
#define RT_KPRINTF_USING_LONGLONG #define RT_KPRINTF_USING_LONGLONG
#define RT_DEBUG #define RT_USING_DEBUG
/* Inter-Thread communication */ /* Inter-Thread communication */

View File

@ -362,7 +362,7 @@ The guidelines consist of project configuration, ENV configuration, and IDE conf
#### 4.1.2 ENV Configuration #### 4.1.2 ENV Configuration
- The system tick is set as 1000 (The macro: RT_TICK_PER_SECOND) - The system tick is set as 1000 (The macro: RT_TICK_PER_SECOND)
- Enable asserting in Debug options (The macro: RT_DEBUG) - Enable asserting in Debug options (The macro: RT_USING_DEBUG)
- The stack size of the system idle thread is set to be 256 (The macro: IDLE_THREAD_STACK_SIZE) - The stack size of the system idle thread is set to be 256 (The macro: IDLE_THREAD_STACK_SIZE)
- Enable component auto initialization (The macro: RT_USING_COMPONENTS_INIT) - Enable component auto initialization (The macro: RT_USING_COMPONENTS_INIT)
- Enable the `user main` option (The macro: RT_USING_USER_MAIN) - Enable the `user main` option (The macro: RT_USING_USER_MAIN)

View File

@ -367,7 +367,7 @@ RA 的制作规范主要分为 3 个方面工程配置ENV 配置和 IDE
#### 4.1.2 ENV 配置 #### 4.1.2 ENV 配置
- 系统心跳统一设置为 1000RT_TICK_PER_SECOND - 系统心跳统一设置为 1000RT_TICK_PER_SECOND
- BSP 中需要打开调试选项中的断言RT_DEBUG - BSP 中需要打开调试选项中的断言RT_USING_DEBUG
- 系统空闲线程栈大小统一设置为 256IDLE_THREAD_STACK_SIZE - 系统空闲线程栈大小统一设置为 256IDLE_THREAD_STACK_SIZE
- 开启组件自动初始化RT_USING_COMPONENTS_INIT - 开启组件自动初始化RT_USING_COMPONENTS_INIT
- 需要开启 user main 选项RT_USING_USER_MAIN - 需要开启 user main 选项RT_USING_USER_MAIN

View File

@ -217,7 +217,7 @@ The specifications of making STM32 BSP are mainly divided into three aspects: en
#### 4.1.2 ENV configuration #### 4.1.2 ENV configuration
- The system heartbeat is uniformly set to 1000 (Macro: RT_TICK_PER_SECOND) - The system heartbeat is uniformly set to 1000 (Macro: RT_TICK_PER_SECOND)
- The assertion in the debugging option needs to be turned on in the BSP (macro: RT_DEBUG) - The assertion in the debugging option needs to be turned on in the BSP (macro: RT_USING_DEBUG)
- The system idle thread stack size is uniformly set to 256 (Macro: IDLE_THREAD_STACK_SIZE) - The system idle thread stack size is uniformly set to 256 (Macro: IDLE_THREAD_STACK_SIZE)
- Turn on automatic component initialization (Macro: RT_USING_COMPONENTS_INIT) - Turn on automatic component initialization (Macro: RT_USING_COMPONENTS_INIT)
- Need to enable the user main option (Macro: RT_USING_USER_MAIN) - Need to enable the user main option (Macro: RT_USING_USER_MAIN)

View File

@ -265,7 +265,7 @@ STM32 BSP 的制作规范主要分为 3 个方面工程配置ENV 配置和
#### 4.1.2 ENV 配置 #### 4.1.2 ENV 配置
- 系统心跳统一设置为 1000RT_TICK_PER_SECOND - 系统心跳统一设置为 1000RT_TICK_PER_SECOND
- BSP 中需要打开调试选项中的断言RT_DEBUG - BSP 中需要打开调试选项中的断言RT_USING_DEBUG
- 系统空闲线程栈大小统一设置为 256IDLE_THREAD_STACK_SIZE - 系统空闲线程栈大小统一设置为 256IDLE_THREAD_STACK_SIZE
- 开启组件自动初始化RT_USING_COMPONENTS_INIT - 开启组件自动初始化RT_USING_COMPONENTS_INIT
- 需要开启 user main 选项RT_USING_USER_MAIN - 需要开启 user main 选项RT_USING_USER_MAIN

View File

@ -27,7 +27,7 @@ INIT_EXPORT(rti_secondary_cpu_end, "7.end");
void rt_dm_secondary_cpu_init(void) void rt_dm_secondary_cpu_init(void)
{ {
#if RT_DEBUG_INIT #if RT_DEBUGING_INIT
int result; int result;
const struct rt_init_desc *desc; const struct rt_init_desc *desc;
@ -45,7 +45,7 @@ void rt_dm_secondary_cpu_init(void)
{ {
(*fn_ptr)(); (*fn_ptr)();
} }
#endif /* RT_DEBUG_INIT */ #endif /* RT_DEBUGING_INIT */
} }
#endif /* RT_USING_SMP */ #endif /* RT_USING_SMP */

View File

@ -85,7 +85,7 @@ static struct rt_mem_obj mm_page_mapper = {
.hint_free = hint_free, .hint_free = hint_free,
}; };
#ifdef RT_DEBUG_PAGE_LEAK #ifdef RT_DEBUGING_PAGE_LEAK
static volatile int enable; static volatile int enable;
static rt_page_t _trace_head; static rt_page_t _trace_head;
#define TRACE_ALLOC(pg, size) _trace_alloc(pg, __builtin_return_address(0), size) #define TRACE_ALLOC(pg, size) _trace_alloc(pg, __builtin_return_address(0), size)
@ -556,7 +556,7 @@ static void *_do_pages_alloc(rt_uint32_t size_bits, size_t flags)
{ {
alloc_buf = page_to_addr(p); alloc_buf = page_to_addr(p);
#ifdef RT_DEBUG_PAGE_LEAK #ifdef RT_DEBUGING_PAGE_LEAK
level = rt_hw_interrupt_disable(); level = rt_hw_interrupt_disable();
TRACE_ALLOC(p, size_bits); TRACE_ALLOC(p, size_bits);
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);

View File

@ -34,7 +34,7 @@
#define PAGE_ANY_AVAILABLE 0x1ul #define PAGE_ANY_AVAILABLE 0x1ul
#ifdef RT_DEBUG_PAGE_LEAK #ifdef RT_DEBUGING_PAGE_LEAK
#define DEBUG_FIELD { \ #define DEBUG_FIELD { \
/* trace list */ \ /* trace list */ \
struct rt_page *tl_next; \ struct rt_page *tl_next; \

View File

@ -577,9 +577,9 @@ Configuration is mainly done by modifying the file under project directory - rtc
#define RT_USING_OVERFLOW_CHECK #define RT_USING_OVERFLOW_CHECK
/* Define this macro to enable debug mode, if not defined, close. */ /* Define this macro to enable debug mode, if not defined, close. */
#define RT_DEBUG #define RT_USING_DEBUG
/* When debug mode is enabled: Define this macro to enable the print component initialization information, if not defined, close. */ /* When debug mode is enabled: Define this macro to enable the print component initialization information, if not defined, close. */
#define RT_DEBUG_INIT #define RT_DEBUGING_INIT
/* Defining this macro means the use of the hook function is started, if not defined, close. */ /* Defining this macro means the use of the hook function is started, if not defined, close. */
#define RT_USING_HOOK #define RT_USING_HOOK

View File

@ -36,13 +36,13 @@
extern "C" { extern "C" {
#endif #endif
/* the debug log will force enable when RT_DEBUG macro is defined */ /* the debug log will force enable when RT_USING_DEBUG macro is defined */
#if defined(RT_DEBUG) && !defined(DBG_ENABLE) #if defined(RT_USING_DEBUG) && !defined(DBG_ENABLE)
#define DBG_ENABLE #define DBG_ENABLE
#endif #endif
/* it will force output color log when RT_DEBUG_COLOR macro is defined */ /* it will force output color log when RT_DEBUGING_COLOR macro is defined */
#if defined(RT_DEBUG_COLOR) && !defined(DBG_COLOR) #if defined(RT_DEBUGING_COLOR) && !defined(DBG_COLOR)
#define DBG_COLOR #define DBG_COLOR
#endif #endif

View File

@ -271,7 +271,7 @@ typedef __gnuc_va_list va_list;
typedef int (*init_fn_t)(void); typedef int (*init_fn_t)(void);
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma section("rti_fn$f",read) #pragma section("rti_fn$f",read)
#ifdef RT_DEBUG_INIT #ifdef RT_DEBUGING_INIT
struct rt_init_desc struct rt_init_desc
{ {
const char* level; const char* level;
@ -297,7 +297,7 @@ typedef int (*init_fn_t)(void);
{__rti_level_##fn, fn }; {__rti_level_##fn, fn };
#endif #endif
#else #else
#ifdef RT_DEBUG_INIT #ifdef RT_DEBUGING_INIT
struct rt_init_desc struct rt_init_desc
{ {
const char* fn_name; const char* fn_name;

View File

@ -18,7 +18,7 @@
* 2021-11-14 Meco Man add rtlegacy.h for compatibility * 2021-11-14 Meco Man add rtlegacy.h for compatibility
* 2022-06-04 Meco Man remove strnlen * 2022-06-04 Meco Man remove strnlen
* 2023-05-20 Bernard add rtatomic.h header file to included files. * 2023-05-20 Bernard add rtatomic.h header file to included files.
* 2023-06-30 ChuShicheng Move RT_DEBUG_CONTEXT_CHECK from the rtdebug.h * 2023-06-30 ChuShicheng move debug check from the rtdebug.h
*/ */
#ifndef __RT_THREAD_H__ #ifndef __RT_THREAD_H__
@ -718,24 +718,19 @@ rt_size_t rt_strlen(const char *src);
void rt_show_version(void); void rt_show_version(void);
#ifdef RT_DEBUG #ifdef RT_USING_DEBUG
extern void (*rt_assert_hook)(const char *ex, const char *func, rt_size_t line); extern void (*rt_assert_hook)(const char *ex, const char *func, rt_size_t line);
void rt_assert_set_hook(void (*hook)(const char *ex, const char *func, rt_size_t line)); void rt_assert_set_hook(void (*hook)(const char *ex, const char *func, rt_size_t line));
void rt_assert_handler(const char *ex, const char *func, rt_size_t line); void rt_assert_handler(const char *ex, const char *func, rt_size_t line);
/* Turn on this to enable context check */
#ifndef RT_DEBUG_CONTEXT_CHECK
#define RT_DEBUG_CONTEXT_CHECK 1
#endif
#define RT_ASSERT(EX) \ #define RT_ASSERT(EX) \
if (!(EX)) \ if (!(EX)) \
{ \ { \
rt_assert_handler(#EX, __FUNCTION__, __LINE__); \ rt_assert_handler(#EX, __FUNCTION__, __LINE__); \
} }
#ifdef RT_DEBUGING_CONTEXT
/* Macro to check current context */ /* Macro to check current context */
#if RT_DEBUG_CONTEXT_CHECK
#define RT_DEBUG_NOT_IN_INTERRUPT \ #define RT_DEBUG_NOT_IN_INTERRUPT \
do \ do \
{ \ { \
@ -806,19 +801,14 @@ while (0)
#define RT_DEBUG_NOT_IN_INTERRUPT #define RT_DEBUG_NOT_IN_INTERRUPT
#define RT_DEBUG_IN_THREAD_CONTEXT #define RT_DEBUG_IN_THREAD_CONTEXT
#define RT_DEBUG_SCHEDULER_AVAILABLE(need_check) #define RT_DEBUG_SCHEDULER_AVAILABLE(need_check)
#endif #endif /* RT_DEBUGING_CONTEXT */
#else
#else /* RT_DEBUG */
#define RT_ASSERT(EX) #define RT_ASSERT(EX)
#define RT_DEBUG_NOT_IN_INTERRUPT #endif /* RT_USING_DEBUG */
#define RT_DEBUG_IN_THREAD_CONTEXT
#define RT_DEBUG_SCHEDULER_AVAILABLE(need_check)
#endif /* RT_DEBUG */
#ifdef RT_USING_FINSH #ifdef RT_USING_FINSH
#include <finsh.h> #include <finsh.h>
#endif #endif /* RT_USING_FINSH */
/**@}*/ /**@}*/
@ -826,4 +816,4 @@ while (0)
} }
#endif #endif
#endif #endif /* __RT_THREAD_H__ */

View File

@ -89,18 +89,18 @@ config ARCH_ARM_MMU
depends on ARCH_ARM depends on ARCH_ARM
if RT_USING_SMART if RT_USING_SMART
config KERNEL_VADDR_START config KERNEL_VADDR_START
hex "The virtural address of kernel start" hex "The virtural address of kernel start"
default 0xffff000000000000 if ARCH_ARMV8 default 0xffff000000000000 if ARCH_ARMV8
default 0xc0000000 if ARCH_ARM default 0xc0000000 if ARCH_ARM
default 0x80000000 if ARCH_RISCV default 0x80000000 if ARCH_RISCV
depends on ARCH_MM_MMU depends on ARCH_MM_MMU
config RT_IOREMAP_LATE config RT_IOREMAP_LATE
bool "Support to create IO mapping in the kernel address space after system initlalization." bool "Support to create IO mapping in the kernel address space after system initlalization."
default n default n
depends on ARCH_ARM_CORTEX_A depends on ARCH_ARM_CORTEX_A
depends on ARCH_MM_MMU depends on ARCH_MM_MMU
endif endif
config ARCH_ARM_ARM9 config ARCH_ARM_ARM9

View File

@ -808,8 +808,8 @@ typedef int ER; /* Error code. A signed integer. */
rt_kprintf(fmt,##__VA_ARGS__); \ rt_kprintf(fmt,##__VA_ARGS__); \
}while(0) }while(0)
#define RT_DEBUG #define RT_USING_DEBUG
#ifdef RT_DEBUG #ifdef RT_USING_DEBUG
#define DBOUT(fmt,...) \ #define DBOUT(fmt,...) \
do \ do \
{ \ { \
@ -821,7 +821,7 @@ typedef int ER; /* Error code. A signed integer. */
do{}while(0) do{}while(0)
#endif #endif
#ifdef RT_DEBUG #ifdef RT_USING_DEBUG
#define ASSERT(arg) \ #define ASSERT(arg) \
if((arg) == 0) \ if((arg) == 0) \
{ \ { \

View File

@ -81,7 +81,7 @@ struct rt_init_tag
{ {
const char *level; const char *level;
init_fn_t fn; init_fn_t fn;
#ifdef RT_DEBUG_INIT #ifdef RT_DEBUGING_INIT
const char *fn_name; const char *fn_name;
#endif #endif
}; };
@ -114,7 +114,7 @@ static int rt_init_objects_sort(void)
{ {
table->level = ((struct rt_init_desc *)ptr_begin)->level; table->level = ((struct rt_init_desc *)ptr_begin)->level;
table->fn = ((struct rt_init_desc *)ptr_begin)->fn; table->fn = ((struct rt_init_desc *)ptr_begin)->fn;
#ifdef RT_DEBUG_INIT #ifdef RT_DEBUGING_INIT
table->fn_name = ((struct rt_init_desc *)ptr_begin)->fn_name; table->fn_name = ((struct rt_init_desc *)ptr_begin)->fn_name;
#endif #endif
ptr_begin += sizeof(struct rt_init_desc) / sizeof(unsigned int); ptr_begin += sizeof(struct rt_init_desc) / sizeof(unsigned int);
@ -168,7 +168,7 @@ void rt_components_board_init(void)
{ {
break; break;
} }
#ifdef RT_DEBUG_INIT #ifdef RT_DEBUGING_INIT
rt_kprintf("initialize %s", rt_init_table[index_i].fn_name); rt_kprintf("initialize %s", rt_init_table[index_i].fn_name);
result = rt_init_table[index_i].fn(); result = rt_init_table[index_i].fn();
rt_kprintf(":%d done\n", result); rt_kprintf(":%d done\n", result);
@ -203,7 +203,7 @@ void rt_components_init(void)
{ {
break; break;
} }
#ifdef RT_DEBUG_INIT #ifdef RT_DEBUGING_INIT
rt_kprintf("initialize %s", rt_init_table[index_i].fn_name); rt_kprintf("initialize %s", rt_init_table[index_i].fn_name);
result = rt_init_table[index_i].fn(); result = rt_init_table[index_i].fn();
rt_kprintf(":%d done\n", result); rt_kprintf(":%d done\n", result);

View File

@ -374,8 +374,8 @@ typedef int ER; /* Error code. A signed integer. */
rt_kprintf(fmt,##__VA_ARGS__); \ rt_kprintf(fmt,##__VA_ARGS__); \
}while(0) }while(0)
#define RT_DEBUG #define RT_USING_DEBUG
#ifdef RT_DEBUG #ifdef RT_USING_DEBUG
#define DBOUT(fmt,...) \ #define DBOUT(fmt,...) \
do \ do \
{ \ { \
@ -387,7 +387,7 @@ typedef int ER; /* Error code. A signed integer. */
do{}while(0) do{}while(0)
#endif #endif
#ifdef RT_DEBUG #ifdef RT_USING_DEBUG
#define ASSERT(arg) \ #define ASSERT(arg) \
if((arg) == 0) \ if((arg) == 0) \
{ \ { \

View File

@ -198,28 +198,29 @@ menu "kservice optimization"
endmenu endmenu
menuconfig RT_DEBUG menuconfig RT_USING_DEBUG
bool "Enable debugging features" bool "Enable debugging features"
default y default y
if RT_DEBUG if RT_USING_DEBUG
config RT_DEBUGING_COLOR
bool "Enable color debugging log"
default y
config RT_DEBUG_COLOR config RT_DEBUGING_CONTEXT
bool "Enable color debugging log" bool "Enable debugging of environment and context check"
default n default y
config RT_DEBUG_INIT config RT_DEBUGING_INIT
bool "Enable debugging of components initialization" bool "Enable debugging of components initialization"
default n default y
if ARCH_MM_MMU config RT_DEBUGING_PAGE_LEAK
config RT_DEBUG_PAGE_LEAK
bool "Enable page leaking tracer" bool "Enable page leaking tracer"
depends on ARCH_MM_MMU
default n default n
endif endif
endif
menu "Inter-Thread communication" menu "Inter-Thread communication"
config RT_USING_SEMAPHORE config RT_USING_SEMAPHORE
@ -260,17 +261,16 @@ endmenu
menu "Memory Management" menu "Memory Management"
if ARCH_MM_MMU config RT_PAGE_MAX_ORDER
config RT_PAGE_MAX_ORDER int "Max order of pages allocatable by page allocator"
int "Max order of pages allocatable by page allocator" default 11
default 11 depends on ARCH_MM_MMU
help help
For example, A value of 11 means the maximum chunk of contiguous memory For example, A value of 11 means the maximum chunk of contiguous memory
allocatable by page system is 2^(11 + ARCH_PAGE_BITS - 1) Bytes. allocatable by page system is 2^(11 + ARCH_PAGE_BITS - 1) Bytes.
Large memory requirement can consume all system resource, and should Large memory requirement can consume all system resource, and should
consider reserved memory instead to enhance system endurance. consider reserved memory instead to enhance system endurance.
Max order should at least satisfied usage by huge page. Max order should at least satisfied usage by huge page.
endif
config RT_USING_MEMPOOL config RT_USING_MEMPOOL
bool "Using memory pool" bool "Using memory pool"

View File

@ -84,7 +84,7 @@ INIT_EXPORT(rti_end, "6.end");
*/ */
void rt_components_board_init(void) void rt_components_board_init(void)
{ {
#ifdef RT_DEBUG_INIT #ifdef RT_DEBUGING_INIT
int result; int result;
const struct rt_init_desc *desc; const struct rt_init_desc *desc;
for (desc = &__rt_init_desc_rti_board_start; desc < &__rt_init_desc_rti_board_end; desc ++) for (desc = &__rt_init_desc_rti_board_start; desc < &__rt_init_desc_rti_board_end; desc ++)
@ -100,7 +100,7 @@ void rt_components_board_init(void)
{ {
(*fn_ptr)(); (*fn_ptr)();
} }
#endif /* RT_DEBUG_INIT */ #endif /* RT_DEBUGING_INIT */
} }
/** /**
@ -108,7 +108,7 @@ void rt_components_board_init(void)
*/ */
void rt_components_init(void) void rt_components_init(void)
{ {
#ifdef RT_DEBUG_INIT #ifdef RT_DEBUGING_INIT
int result; int result;
const struct rt_init_desc *desc; const struct rt_init_desc *desc;
@ -126,7 +126,7 @@ void rt_components_init(void)
{ {
(*fn_ptr)(); (*fn_ptr)();
} }
#endif /* RT_DEBUG_INIT */ #endif /* RT_DEBUGING_INIT */
} }
#endif /* RT_USING_COMPONENTS_INIT */ #endif /* RT_USING_COMPONENTS_INIT */

View File

@ -1987,7 +1987,7 @@ int __rt_ffs(int value)
#define __on_rt_assert_hook(ex, func, line) __ON_HOOK_ARGS(rt_assert_hook, (ex, func, line)) #define __on_rt_assert_hook(ex, func, line) __ON_HOOK_ARGS(rt_assert_hook, (ex, func, line))
#endif #endif
#ifdef RT_DEBUG #ifdef RT_USING_DEBUG
/* RT_ASSERT(EX)'s hook */ /* RT_ASSERT(EX)'s hook */
void (*rt_assert_hook)(const char *ex, const char *func, rt_size_t line); void (*rt_assert_hook)(const char *ex, const char *func, rt_size_t line);
@ -2036,6 +2036,6 @@ void rt_assert_handler(const char *ex_string, const char *func, rt_size_t line)
} }
} }
RTM_EXPORT(rt_assert_handler); RTM_EXPORT(rt_assert_handler);
#endif /* RT_DEBUG */ #endif /* RT_USING_DEBUG */
/**@}*/ /**@}*/

View File

@ -353,7 +353,7 @@ void rt_object_init(struct rt_object *object,
const char *name) const char *name)
{ {
rt_base_t level; rt_base_t level;
#ifdef RT_DEBUG #ifdef RT_USING_DEBUG
struct rt_list_node *node = RT_NULL; struct rt_list_node *node = RT_NULL;
#endif #endif
struct rt_object_information *information; struct rt_object_information *information;
@ -365,7 +365,7 @@ void rt_object_init(struct rt_object *object,
information = rt_object_get_information(type); information = rt_object_get_information(type);
RT_ASSERT(information != RT_NULL); RT_ASSERT(information != RT_NULL);
#ifdef RT_DEBUG #ifdef RT_USING_DEBUG
/* check object type to avoid re-initialization */ /* check object type to avoid re-initialization */
/* enter critical */ /* enter critical */