|
1 | | -# RT-Thread # |
| 1 | +# RT-Thread Nano 简介 |
2 | 2 |
|
3 | | -[中文页](README_zh.md) | |
| 3 | +RT-Thread Nano 是一个极简版的硬实时内核,它是由 C 语言开发,采用面向对象的编程思维,具有良好的代码风格,是一款可裁剪的、抢占式实时多任务的 RTOS。其内存资源占用极小,功能包括任务处理、软件定时器、信号量、邮箱和实时调度等相对完整的实时操作系统特性。适用于家电、消费电子、医疗设备、工控等领域大量使用的 32 位 ARM 入门级 MCU 的场合。 |
4 | 4 |
|
5 | | -[](https://github.com/RT-Thread/rt-thread/blob/master/LICENSE) |
6 | | -[](https://github.com/RT-Thread/rt-thread/releases) |
7 | | -[](https://travis-ci.org/RT-Thread/rt-thread) |
8 | | -[](https://gitter.im/RT-Thread/rt-thread?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) |
9 | | -[](https://github.com/RT-Thread/rt-thread/pulls) |
10 | | -[](https://github.com/RT-Thread/rt-thread/pulls) |
| 5 | +下图是 RT-Thread Nano 的软件框图,包含支持的 CPU 架构与内核源码,还有可拆卸的 FinSH 组件: |
11 | 6 |
|
12 | | -RT-Thread is an open source IoT operating system from China, which has strong scalability: from a tiny kernel running on a tiny core, for example ARM Cortex-M0, or Cortex-M3/4/7, to a rich feature system running on MIPS32, ARM Cortex-A8, ARM Cortex-A9 DualCore etc. |
| 7 | + |
13 | 8 |
|
14 | | -## Overview ## |
| 9 | +**支持架构**:ARM:Cortex M0/ M3/ M4/ M7 等、RISC-V 及其他。 |
15 | 10 |
|
16 | | -RT-Thread RTOS like a traditional real-time operating system. The kernel has real-time multi-task scheduling, semaphore, mutex, mail box, message queue, signal etc. However, it has three different things: |
| 11 | +**功能**:线程管理、线程间同步与通信、时钟管理、中断管理、内存管理。 |
17 | 12 |
|
18 | | -* Device Driver; |
19 | | -* Component; |
20 | | -* Dynamic Module |
| 13 | +## Nano 的特点 |
21 | 14 |
|
22 | | -The device driver is more like a driver framework, UART, IIC, SPI, SDIO, USB device/host, EMAC, MTD NAND etc. The developer can easily add low level driver and board configuration, then combined with the upper framework, he/she can use lots of features. |
| 15 | +### 简单 |
23 | 16 |
|
24 | | -The Component is a software concept upon RT-Thread kernel, for example a shell (finsh/msh shell), virtual file system (FAT, YAFFS, UFFS, ROM/RAM file system etc), TCP/IP protocol stack (lwIP), POSIX (thread) interface etc. One component must be a directory under RT-Thread/Components and one component can be descripted by a SConscript file (then be compiled and linked into the system). |
| 17 | +**1、下载简单** |
25 | 18 |
|
26 | | -The Dynamic Module, formerly named as User Applicaion (UA) is a dynamic loaded module or library, it can be compiled standalone without Kernel. Each Dynamic Module has its own object list to manage thread/semaphore/kernel object which was created or initialized inside this UA. More information about UA, please visit another [git repo](https://github.com/RT-Thread/rtthread-apps). |
| 19 | +RT-Thread Nano 以软件包的方式集成在 Keil MDK 与 CubeMX 中,可以直接在软件中下载 Nano 软件包获取源码,获取方式详见 [使用 KEIL MDK 移植 RT-Thread Nano](nano-port-keil/nano-port-keil.md) 与 [使用 CubeMX 移植 RT-Thread Nano](nano-port-cube/nano-port-cube.md) 。 |
27 | 20 |
|
28 | | -## Board Support Package ## |
| 21 | +同时也提供 [下载 Nano 源码压缩包]() 的途径,方便在其他开发环境移植 RT-Thread Nano,如 [使用 IAR 移植 RT-Thread Nano](nano-port-iar/nano-port-iar.md)。 |
29 | 22 |
|
30 | | -RT-Thread RTOS can support many architectures: |
| 23 | +**2、代码简单** |
31 | 24 |
|
32 | | -* ARM Cortex-M0 |
33 | | -* ARM Cortex-M3/M4/7 |
34 | | -* ARM Cortex-R4 |
35 | | -* ARM Cortex-A8/A9 |
36 | | -* ARM920T/ARM926 etc |
37 | | -* MIPS32 |
38 | | -* x86 |
39 | | -* Andes |
40 | | -* C-Sky |
41 | | -* RISC-V |
42 | | -* PowerPC |
| 25 | +与 RT-Thread 完整版不同的是,Nano 不含 Scons 构建系统,不需要 Kconfig 以及 Env 配置工具,也去除了完整版特有的 device 框架和组件,仅是一个纯净的内核。 |
43 | 26 |
|
44 | | -## License ## |
| 27 | +**3、移植简单** |
45 | 28 |
|
46 | | -RT-Thread is Open Source software under the Apache License 2.0 since RT-Thread v3.1.1. License and copyright information can be found within the code. |
| 29 | +由于 Nano 的极简特性,使 Nano 的移植过程变得极为简单。添加 Nano 源码到工程,就已完成 90% 的移植工作。并且在 Keil MDK 与 Cube MX 中还提供了 Nano 的软件包,可以一键下载加入到工程。以下是使用不同开发环境时,可以选择移植 Nano 的方法: |
47 | 30 |
|
48 | | - /* |
49 | | - * Copyright (c) 2006-2018, RT-Thread Development Team |
50 | | - * |
51 | | - * SPDX-License-Identifier: Apache-2.0 |
52 | | - */ |
| 31 | +- [使用 KEIL MDK 移植 RT-Thread Nano](nano-port-keil/nano-port-keil.md) |
| 32 | +- [使用 CubeMX 移植 RT-Thread Nano](nano-port-cube/nano-port-cube.md) |
| 33 | +- [使用 IAR 移植 RT-Thread Nano](nano-port-iar/nano-port-iar.md) |
| 34 | +- [移植 RT-Thread Nano 到 RISC-V](nano-port-gcc-riscv/nano-port-gcc-riscv.md) |
53 | 35 |
|
54 | | -Since 9th of September 2018, PRs submitted by the community may be merged into the main line only after signing the Contributor License Agreement(CLA). |
| 36 | +**4、使用简单** |
55 | 37 |
|
56 | | -## Usage ## |
| 38 | +RT-Thread Nano 在使用上也非常简单,带给开发者友好的开发体验。 |
57 | 39 |
|
58 | | -RT-Thread RTOS uses [scons](http://www.scons.org) as building system. Therefore, please install scons and Python 2.7 firstly. |
59 | | -So far, the RT-Thread scons building system support the command line compile or generate some IDE's project. There are some option varaibles in the scons building script (rtconfig.py): |
| 40 | +- 易裁剪:Nano 的配置文件为 rtconfig.h,该文件中列出了内核中的所有宏定义,有些默认没有打开,如需使用,打开即可。具体的配置可见 Nano 版块的 [RT-Thread Nano 配置](nano-config/nano-config.md) 教程。 |
| 41 | +- 易添加 FinSH 组件:[FinSH 组件](../../programming-manual/finsh/finsh.md) 可以很方便的在 Nano 上进行移植,而不再依赖 device 框架,只需要对接两个必要的函数即可完成 [FinSH 移植](finsh-port/finsh-port.md)。 |
| 42 | +- 自选驱动库:可以使用厂商提供的固件驱动库,如 ST 的 STD 库、HAL 库、LL 库等,可以自行选择。 |
| 43 | +- 完善的文档:包含 [内核基础](../../programming-manual/basic/basic.md)、[线程管理 (例程)](../../programming-manual/thread/thread.md)、[时钟管理 (例程)](../../programming-manual/timer/timer.md)、[线程间同步 (例程)](../../programming-manual/ipc1/ipc1.md)、[线程间通信 (例程)](../../programming-manual/ipc2/ipc2.md)、[内存管理 (例程)](../../programming-manual/memory/memory.md)、[中断管理](../../programming-manual/interrupt/interrupt.md) ,以及 Nano 版块的移植教程。 |
60 | 44 |
|
61 | | -* ```CROSS_TOOL``` the compiler which you want to use, gcc/keil/iar. |
62 | | -* ```EXEC_PATH``` the path of compiler. |
| 45 | +### 小巧 |
63 | 46 |
|
64 | | -In SConstruct file: |
| 47 | +**资源占用小**:对 RAM 与 ROM 的开销非常小,在支持 semaphore 和 mailbox 特性,并运行两个线程 (main 线程 + idle 线程) 情况下,ROM 和 RAM 依然保持着极小的尺寸,RAM 占用约 1K 左右,ROM 占用 4K 左右。 |
65 | 48 |
|
66 | | -```RTT_ROOT``` This variable is the root directory of RT-Thread RTOS. If you build the porting in the bsp directory, you can use the default setting. Also, you can set the root directory in ```RTT_ROOT``` environment variable and not modify SConstruct files. |
| 49 | +Nano 资源占用情况举例:在运行两个线程 (main 线程 + idle 线程) 情况下,ROM 和 RAM 依然保持着极小的尺寸。以下是基于 Cortex M3 的 MDK 工程编译结果(优化等级 3)。 |
67 | 50 |
|
68 | | -When you set these variables correctly, you can use command: |
| 51 | +``` |
| 52 | + Total RO Size (Code + RO Data) 4000 ( 3.91kB) |
| 53 | + Total RW Size (RW Data + ZI Data) 1168 ( 1.14kB) |
| 54 | + Total ROM Size (Code + RO Data + RW Data) 4092 ( 4.00kB) |
| 55 | +``` |
69 | 56 |
|
70 | | - scons |
| 57 | +> 注:如果需要丰富的组件、驱动以及软件包等功能,则建议使用 [RT-Thread 完整版](../../index.md)。 |
71 | 58 |
|
72 | | -under BSP directory to simplely compile RT-Thread RTOS. |
| 59 | +### 开源免费(Apache 2.0) |
73 | 60 |
|
74 | | -If you want to generate the IDE's project file, you can use command: |
| 61 | +RT-Thread Nano 实时操作系统遵循 Apache 许可证 2.0 版本,实时操作系统内核及所有开源组件可以免费在商业产品中使用,不需要公布应用程序源码,没有潜在商业风险。 |
75 | 62 |
|
76 | | - scons --target=mdk/mdk4/mdk5/iar/cb -s |
77 | | - |
78 | | -to generate the project file. |
79 | | - |
80 | | -NOTE: RT-Thread scons building system will tailor the system according to your rtconfig.h configuration header file. For example, if you disable the lwIP in the rtconfig.h by commenting the ```#define RT_USING_LWIP```, the generated project file should have no lwIP related files. |
81 | | - |
82 | | -## Contribution ## |
83 | | - |
84 | | -Please refer the contributors in the github. Thank all of RT-Thread Developers. |
0 commit comments