1menu "RT-Thread Kernel"
2
3rsource "klibc/Kconfig"
4
5config RT_NAME_MAX
6    int "The maximal size of kernel object name"
7    range 2 64
8    default 8
9    help
10        Each kernel object, such as thread, timer, semaphore etc, has a name,
11        the RT_NAME_MAX is the maximal size of this object name.
12
13config RT_USING_ARCH_DATA_TYPE
14    bool "Use the data types defined in ARCH_CPU"
15    default n
16    help
17        For the data type like, `rt_uint8/int8_t, rt_uint16/int16_t, rt_uint32/int32_t`,
18        BSP can define these basic data types in ARCH_CPU level.
19
20        Please re-define these data types in rtconfig_project.h file.
21
22config RT_USING_NANO
23    bool "Enable RT-Thread Nano"
24    default n
25    help
26        RT-Thread Nano is a very small size and refined hard real-time kernel,
27        which is suited for the extremely resource-constrained MCU system.
28
29config RT_USING_SMART
30    bool "Enable RT-Thread Smart (microkernel on kernel/userland)"
31    default n
32    select RT_USING_LWP
33    select RT_USING_DFS
34    select RT_USING_POSIX_CLOCKTIME
35    select RT_USING_DEVICE
36    select RT_USING_NULL
37    select RT_USING_ZERO
38    select RT_USING_RANDOM
39    select RT_USING_RTC
40    select RT_USING_POSIX_TIMER
41    select RT_USING_POSIX_CLOCK
42    select RT_USING_POSIX_FS
43    select RT_USING_POSIX_TERMIOS
44    select RT_USING_KTIME
45    select RT_USING_STDC_ATOMIC
46    select RT_USING_SYSTEM_WORKQUEUE
47    select RT_USING_CPU_USAGE_TRACER
48    select RT_USING_SCHED_THREAD_CTX
49    depends on ARCH_ARM_CORTEX_M || ARCH_ARM_ARM9 || ARCH_ARM_CORTEX_A || ARCH_ARMV8 || ARCH_RISCV64
50    depends on !RT_USING_NANO
51    help
52        RT-Thread Smart is a microkernel based operating system on RT-Thread.
53
54config RT_USING_AMP
55    bool "Enable AMP (Asymmetric Multi-Processing)"
56    default n
57    if RT_USING_AMP
58        choice
59            prompt "Select the AMP role"
60            default RT_AMP_SLAVE
61
62            config RT_AMP_MASTER
63            bool "amp role MASTER"
64
65            config RT_AMP_SLAVE
66            bool "amp role SLAVE"
67        endchoice
68    endif
69
70config RT_USING_SMP
71    bool "Enable SMP (Symmetric multiprocessing)"
72    default n
73    help
74        This option should be selected by machines which have an SMP-
75        capable CPU.
76        The only effect of this option is to make the SMP-related
77        options available to the user for configuration.
78
79config RT_CPUS_NR
80    int "Number of CPUs"
81    default 1
82    range 1 1 if !RT_USING_SMP && !RT_USING_AMP
83    help
84        Number of CPUs in the system
85
86config RT_ALIGN_SIZE
87    int "Alignment size for CPU architecture data access"
88    default 8
89    help
90        Alignment size for CPU architecture data access
91
92choice
93    prompt "The maximal level value of priority of thread"
94    default RT_THREAD_PRIORITY_32
95
96    config RT_THREAD_PRIORITY_8
97        bool "8"
98
99    config RT_THREAD_PRIORITY_32
100        bool "32"
101
102    config RT_THREAD_PRIORITY_256
103        bool "256"
104endchoice
105
106config RT_THREAD_PRIORITY_MAX
107    int
108    default 8   if RT_THREAD_PRIORITY_8
109    default 32  if RT_THREAD_PRIORITY_32
110    default 256 if RT_THREAD_PRIORITY_256
111
112config RT_TICK_PER_SECOND
113    int "Tick frequency, Hz"
114    range 10 1000
115    default 1000
116    help
117        System's tick frequency, Hz.
118
119config RT_USING_OVERFLOW_CHECK
120    bool "Using stack overflow checking"
121    default y if RT_USING_DEBUG
122    help
123        Enable thread stack overflow checking. The stack overflow is checking when
124        each thread switch.
125
126config RT_USING_HOOK
127    bool "Enable system hook"
128    default y
129    select RT_USING_IDLE_HOOK
130    help
131        Enable the hook function when system running, such as idle thread hook,
132        thread context switch etc.
133
134    if RT_USING_HOOK
135        config RT_HOOK_USING_FUNC_PTR
136            bool "Using function pointers as system hook"
137            default y
138    endif
139
140config RT_USING_HOOKLIST
141    bool "Enable hook list"
142    default n
143    help
144        Enable the hook list feature for rt-thread packages. With this, they can
145        plug in to the system on run-time.
146
147config RT_USING_IDLE_HOOK
148    bool "Enable IDLE Task hook"
149    default y if RT_USING_HOOK
150
151    if RT_USING_IDLE_HOOK
152        config RT_IDLE_HOOK_LIST_SIZE
153            int "The max size of idle hook list"
154            default 4
155            range 1 16
156            help
157                The system has a hook list. This is the hook list size.
158    endif
159
160config IDLE_THREAD_STACK_SIZE
161    int "The stack size of idle thread"
162    default 1024 if ARCH_CPU_64BIT
163    default 256
164
165config SYSTEM_THREAD_STACK_SIZE
166    int "The stack size of system thread (for defunct etc.)"
167    depends on RT_USING_SMP
168    default IDLE_THREAD_STACK_SIZE
169
170config RT_USING_TIMER_SOFT
171    bool "Enable software timer with a timer thread"
172    default y
173    help
174        the timeout function context of soft-timer is under a high priority timer
175        thread.
176
177if RT_USING_TIMER_SOFT
178    config RT_TIMER_THREAD_PRIO
179        int "The priority level value of timer thread"
180        default 4
181
182    config RT_TIMER_THREAD_STACK_SIZE
183        int "The stack size of timer thread"
184        default 2048 if ARCH_CPU_64BIT
185        default 512
186
187    config RT_USING_TIMER_ALL_SOFT
188        bool "Set all timer as soft timer"
189        default n
190endif
191
192config RT_USING_CPU_USAGE_TRACER
193    select RT_USING_HOOK
194    bool "Enable cpu usage tracing"
195    help
196        Enable cpu usage tracer for application like top.
197    default y if RT_USING_SMART
198    default n
199
200menu "kservice options"
201    config RT_USING_TINY_FFS
202        bool "Enable kservice to use tiny finding first bit set method"
203        default n
204endmenu
205
206menuconfig RT_USING_DEBUG
207    bool "Enable debugging features"
208    default y
209
210    if RT_USING_DEBUG
211        config RT_DEBUGING_ASSERT
212            bool "Enable assertion debugging"
213            default y
214
215        config RT_DEBUGING_COLOR
216            bool "Enable color debugging log"
217            default y
218
219        config RT_DEBUGING_CONTEXT
220            bool "Enable debugging of environment and context check"
221            default y
222
223        config RT_DEBUGING_AUTO_INIT
224            bool "Enable debugging of components automatic initialization"
225            default n
226
227        config RT_DEBUGING_SPINLOCK
228            bool "Enable spinlock debugging"
229            depends on RT_USING_SMP
230            default n
231
232        config RT_DEBUGING_CRITICAL
233            bool "Enable critical level tracing"
234            depends on RT_USING_SMP
235            default y if RT_USING_SMART
236            default n
237    endif
238
239config RT_USING_CI_ACTION
240    bool "Enable CI Action build mode"
241    select RT_USING_UTEST
242    select RT_UTEST_USING_AUTO_RUN
243    select RT_UTEST_USING_ALL_CASES
244    default n
245    help
246        Identify that the environment is CI Action.
247
248menu "Inter-Thread communication"
249
250    config RT_USING_SEMAPHORE
251        bool "Enable semaphore"
252        default y
253
254    config RT_USING_MUTEX
255        bool "Enable mutex"
256        default y
257
258    config RT_USING_EVENT
259        bool "Enable event flag"
260        default y
261
262    config RT_USING_MAILBOX
263        bool "Enable mailbox"
264        default y
265
266    config RT_USING_MESSAGEQUEUE
267        bool "Enable message queue"
268        default y
269
270    config RT_USING_MESSAGEQUEUE_PRIORITY
271        bool "Enable message queue priority"
272        depends on RT_USING_MESSAGEQUEUE
273        default n
274
275    config RT_USING_SIGNALS
276        bool "Enable signals"
277        select RT_USING_MEMPOOL
278        default n
279        help
280            A signal is an asynchronous notification sent to a specific thread
281            in order to notify it of an event that occurred.
282
283endmenu
284
285menu "Memory Management"
286
287    config RT_USING_MEMPOOL
288        bool "Using memory pool"
289        default y
290        help
291            Using static memory fixed partition
292
293    config RT_USING_SMALL_MEM
294        bool "Using Small Memory Algorithm"
295        default n
296        help
297            Using Small Memory Algorithm
298
299    config RT_USING_SLAB
300        bool "Using SLAB Memory Algorithm"
301        default n
302        help
303            The slab allocator of RT-Thread is a memory allocation algorithm
304             optimizedfor embedded systems based on the slab allocator
305             implemented by Matthew Dillon, founder of dragonfly BSD.
306             The original slab algorithm is an efficient kernel memory
307             allocation algorithm introduced by Jeff bonwick for
308             Solaris Operating System.
309
310    menuconfig RT_USING_MEMHEAP
311        bool "Using memheap Memory Algorithm"
312        default n
313
314        if RT_USING_MEMHEAP
315            choice
316                prompt "Memheap memory allocation mode"
317                default RT_MEMHEAP_FAST_MODE
318
319                config RT_MEMHEAP_FAST_MODE
320                    bool "fast mode"
321                    help
322                        Speed priority mode.
323                        As long as the memory block size meets the requirements, the search ends immediately.
324
325                config RT_MEMHEAP_BEST_MODE
326                    bool "best mode"
327                    help
328                        Best size first.
329                        The search does not end until the memory block of the most appropriate size is found
330            endchoice
331        endif
332
333    choice
334        prompt "System Heap Memory Management"
335        default RT_USING_SMALL_MEM_AS_HEAP
336
337        config RT_USING_SMALL_MEM_AS_HEAP
338            bool "Small Memory Algorithm"
339            select RT_USING_SMALL_MEM
340
341        config RT_USING_MEMHEAP_AS_HEAP
342            bool "Use memheap objects as heap"
343            select RT_USING_MEMHEAP
344
345            if RT_USING_MEMHEAP_AS_HEAP
346                config RT_USING_MEMHEAP_AUTO_BINDING
347                    bool "Use all of memheap objects as heap"
348                    default y
349            endif
350
351        config RT_USING_SLAB_AS_HEAP
352            bool "SLAB Algorithm for large memory"
353            select RT_USING_SLAB
354
355        config RT_USING_USERHEAP
356            bool "Use user heap"
357            help
358                If this option is selected, please implement these functions:
359                    rt_malloc(), rt_malloc_sethook()
360                    rt_free(),   rt_free_sethook()
361                    rt_calloc(), rt_realloc()
362                    rt_memory_info()
363                    rt_system_heap_init()
364
365        config RT_USING_NOHEAP
366            bool "Disable Heap"
367    endchoice
368
369    config RT_USING_MEMTRACE
370        bool "Enable memory trace"
371        default n
372        help
373            When enable RT_USING_MEMTRACE with shell, developer can call cmd:
374            1. memtrace
375                to dump memory block information.
376            2. memcheck
377                to check memory block to avoid memory overwritten.
378
379            And developer also can call memcheck() in each of scheduling
380            to check memory block to find which thread has wrongly modified
381            memory.
382
383    config RT_USING_HEAP_ISR
384        bool "Using heap in ISR"
385        default n
386        help
387            When this option is enabled, the critical zone will be protected with disable interrupt.
388
389    config RT_USING_HEAP
390        bool
391        default n if RT_USING_NOHEAP
392        default y if RT_USING_SMALL_MEM
393        default y if RT_USING_SLAB
394        default y if RT_USING_MEMHEAP_AS_HEAP
395        default y if RT_USING_USERHEAP
396endmenu
397
398config RT_USING_DEVICE
399    bool "Using device object"
400    depends on !RT_USING_NANO
401    default y
402
403config RT_USING_DEVICE_OPS
404    bool "Using ops for each device object"
405    depends on RT_USING_DEVICE
406    default n
407
408config RT_USING_INTERRUPT_INFO
409    bool "Enable additional interrupt trace information"
410    default n
411    help
412        Add name and counter information for interrupt trace.
413
414config RT_USING_THREADSAFE_PRINTF
415    bool "Enable thread safe kernel print service"
416    default y if RT_USING_SMP && RT_USING_SMART
417
418config RT_USING_CONSOLE
419    bool "Using console for rt_kprintf"
420    default y
421
422if RT_USING_CONSOLE
423    config RT_CONSOLEBUF_SIZE
424        int "the buffer size for console log printf"
425        default 256 if RT_USING_UTEST
426        default 128
427
428    config RT_CONSOLE_DEVICE_NAME
429        string "the device name for console"
430        default "uart1"
431
432endif
433
434config RT_VER_NUM
435    hex
436    default 0x50201
437    help
438        RT-Thread version number
439
440config RT_USING_STDC_ATOMIC
441    bool "Use atomic implemented in stdatomic.h"
442    default n
443
444config RT_BACKTRACE_LEVEL_MAX_NR
445    int "Max number of backtrace level"
446    default 32
447
448endmenu
449