瀏覽代碼

[nano] rt-thread susport nano option

Meco Man 1 年之前
父節點
當前提交
005828eba7

+ 7 - 2
components/Kconfig

@@ -26,15 +26,20 @@ config RT_USING_LEGACY
     default n
 
 source "$RTT_DIR/components/finsh/Kconfig"
+
+if !RT_USING_NANO
 source "$RTT_DIR/components/dfs/Kconfig"
 source "$RTT_DIR/components/fal/Kconfig"
-source "$RTT_DIR/components/lwp/Kconfig"
 source "$RTT_DIR/components/drivers/Kconfig"
 source "$RTT_DIR/components/libc/Kconfig"
 source "$RTT_DIR/components/net/Kconfig"
 source "$RTT_DIR/components/utilities/Kconfig"
 source "$RTT_DIR/components/vbus/Kconfig"
+endif
+
+if RT_USING_SMART
+source "$RTT_DIR/components/lwp/Kconfig"
 source "$RTT_DIR/components/mm/Kconfig"
 source "$RTT_DIR/components/mprotect/Kconfig"
-
+endif
 endmenu

+ 2 - 2
components/drivers/Kconfig

@@ -346,7 +346,7 @@ config RT_USING_PHY
 
 config RT_USING_PIN
     bool "Using generic GPIO device drivers"
-    default y
+    default n
 
 config RT_USING_ADC
     bool "Using ADC device drivers"
@@ -771,7 +771,7 @@ endif
 config RT_USING_DEV_BUS
     bool "Using Device Bus device drivers"
     default y if RT_USING_SMART
-    default n if !RT_USING_SMART
+    default n
 
 menuconfig RT_USING_WIFI
     bool "Using Wi-Fi framework"

+ 1 - 0
components/finsh/Kconfig

@@ -1,5 +1,6 @@
 menuconfig RT_USING_MSH
     bool "MSH: command shell"
+    default n if RT_USING_NANO
     default y
 
 if RT_USING_MSH

+ 0 - 14
components/libc/Kconfig

@@ -1,20 +1,6 @@
 menu "C/C++ and POSIX layer"
 
-config RT_USING_INTERNAL_LIBC_ONLY
-    bool "Only use tool chain internal libc"
-    default n
-    help
-        This option is for RT-Thread Nano version.
-        If select this option, it will not compile components/libc
-        folder and only use tool chain internal libc. Normally, the
-        tool chain internal is only cover ISO standard (e.g. armcc),
-        but some tool chains' internal libc will cover more than
-        ISO standard (e.g. newlib). However, no matter the cover level
-        it is, the rt-thread libc leveling layer will not be involved
-        at all if select this option.
-
 config RT_USING_EXTERNAL_LIBC
-    depends on !RT_USING_INTERNAL_LIBC_ONLY
     bool
     help
         This is for external libc(e.g. mlib),

+ 5 - 4
components/libc/SConscript

@@ -7,9 +7,10 @@ cwd = GetCurrentDir()
 objs = []
 list = os.listdir(cwd)
 
-for d in list:
-    path = os.path.join(cwd, d)
-    if os.path.isfile(os.path.join(path, 'SConscript')):
-        objs = objs + SConscript(os.path.join(d, 'SConscript'))
+if not GetDepend('RT_USING_NANO'):
+    for d in list:
+        path = os.path.join(cwd, d)
+        if os.path.isfile(os.path.join(path, 'SConscript')):
+            objs = objs + SConscript(os.path.join(d, 'SConscript'))
 
 Return('objs')

+ 4 - 5
components/libc/compilers/SConscript

@@ -7,10 +7,9 @@ cwd = GetCurrentDir()
 objs = []
 list = os.listdir(cwd)
 
-if not GetDepend('RT_USING_INTERNAL_LIBC_ONLY'):
-    for d in list:
-        path = os.path.join(cwd, d)
-        if os.path.isfile(os.path.join(path, 'SConscript')):
-            objs = objs + SConscript(os.path.join(d, 'SConscript'))
+for d in list:
+    path = os.path.join(cwd, d)
+    if os.path.isfile(os.path.join(path, 'SConscript')):
+        objs = objs + SConscript(os.path.join(d, 'SConscript'))
 
 Return('objs')

+ 7 - 17
include/rtdef.h

@@ -52,7 +52,7 @@
  * 2023-09-15     xqyjlj       perf rt_hw_interrupt_disable/enable
  * 2023-10-10     Chushicheng  change version number to v5.1.0
  * 2023-10-11     zmshahaha    move specific devices related and driver to components/drivers
- * 2023-11-21     Meco Man     add RT_USING_INTERNAL_LIBC_ONLY macro
+ * 2023-11-21     Meco Man     add RT_USING_NANO macro
  */
 
 #ifndef __RT_DEF_H__
@@ -60,26 +60,16 @@
 
 #include <rtconfig.h>
 
-/*
- * If RT_VER_NUM is not defined or RT_USING_INTERNAL_LIBC_ONLY is defined,
- * there is no extra libc support, only internal libc can be used.
- */
-#if defined(RT_USING_INTERNAL_LIBC_ONLY) || !defined(RT_VER_NUM)
-#define __RT_USING_INTERNAL_LIBC_ONLY  (1)
-#else
-#define __RT_USING_INTERNAL_LIBC_ONLY  (0)
-#endif /* defined(RT_USING_INTERNAL_LIBC_ONLY) && !defined(RT_VER_NUM) */
-
 #include <stdint.h>
 #include <stddef.h>
 #include <stdarg.h>
-#if !__RT_USING_INTERNAL_LIBC_ONLY
+#ifndef RT_USING_NANO
 #include <sys/types.h>
 #include <sys/errno.h>
 #if defined(RT_USING_SIGNALS) || defined(RT_USING_SMART)
 #include <sys/signal.h>
 #endif /* defined(RT_USING_SIGNALS) || defined(RT_USING_SMART) */
-#endif /* !__RT_USING_INTERNAL_LIBC_ONLY */
+#endif /* RT_USING_NANO */
 
 #ifdef __cplusplus
 extern "C" {
@@ -135,13 +125,13 @@ typedef unsigned long long              rt_uint64_t;    /**< 64bit unsigned inte
 #endif /* RT_USING_LIBC */
 #endif /* RT_USING_ARCH_DATA_TYPE */
 
-#if defined(RT_USING_LIBC) && !__RT_USING_INTERNAL_LIBC_ONLY
+#if defined(RT_USING_LIBC) && !defined(RT_USING_NANO)
 typedef size_t                          rt_size_t;      /**< Type for size number */
 typedef ssize_t                         rt_ssize_t;     /**< Used for a count of bytes or an error indication */
 #else
 typedef rt_ubase_t                      rt_size_t;      /**< Type for size number */
 typedef rt_base_t                       rt_ssize_t;     /**< Used for a count of bytes or an error indication */
-#endif /* defined(RT_USING_LIBC) && !__RT_USING_INTERNAL_LIBC_ONLY */
+#endif /* defined(RT_USING_LIBC) && !defined(RT_USING_NANO) */
 
 typedef rt_base_t                       rt_err_t;       /**< Type for error number */
 typedef rt_uint32_t                     rt_time_t;      /**< Type for time stamp */
@@ -405,7 +395,7 @@ typedef int (*init_fn_t)(void);
 /**@{*/
 
 /* RT-Thread error code definitions */
-#if defined(RT_USING_LIBC) && !__RT_USING_INTERNAL_LIBC_ONLY
+#if defined(RT_USING_LIBC) && !defined(RT_USING_NANO)
 /* POSIX error code compatible */
 #define RT_EOK                          0               /**< There is no error */
 #define RT_ERROR                        255             /**< A generic/unknown error happens */
@@ -440,7 +430,7 @@ typedef int (*init_fn_t)(void);
 #define RT_EPERM                        13              /**< Operation not permitted */
 #define RT_ETRAP                        14              /**< Trap event */
 #define RT_EFAULT                       15              /**< Bad address */
-#endif /* defined(RT_USING_LIBC) && !__RT_USING_INTERNAL_LIBC_ONLY */
+#endif /* defined(RT_USING_LIBC) && !defined(RT_USING_NANO) */
 
 /**@}*/
 

+ 8 - 0
src/Kconfig

@@ -37,9 +37,17 @@ config RT_USING_SMART
     select RT_USING_POSIX_TERMIOS
     select RT_USING_KTIME
     depends on ARCH_ARM_CORTEX_M || ARCH_ARM_ARM9 || ARCH_ARM_CORTEX_A || ARCH_ARMV8 || ARCH_RISCV64
+    depends on !RT_USING_NANO
     help
         RT-Thread Smart is a microkernel based operating system on RT-Thread.
 
+config RT_USING_NANO
+    bool "Enable RT-Thread Nano"
+    default n
+    help
+        RT-Thread Nano with a very small size and refined hard real-time kernel,
+        which is very suited for the resource-constrained MCU system.
+
 config RT_USING_AMP
     bool "Enable AMP (Asymmetric Multi-Processing)"
     default n