www.keil/arm/microlib.asp
MicroLib
ARM Library Optimized for Embedded Applications
Improved in MDK-ARM v4.1x
MicroLib is a highly-optimized library for ARM-based embedded applications written in C. When compared to the standard C library included with the ARM Compiler toolchain, MicroLib provides significant code size advantages required for many embedded systems.
The primary differences between MicroLib and the standard C library are:
MicroLib is designed for deeply embedded applications.
MicroLib is optimized to use less code and data memory than using the ARM standard library.
MicroLib has been designed to work without an operating system, however this does not prevent it being used together with any OS or RTOS such as Keil RTX.
MicroLib contains no file I/O or wide character support.
As MicroLib has been optimized to minimize code size, some functions will execute more slowly than the standard C library routines available in the ARM compilation tools.
Both MicroLib and the ARM Standard Library are included in the Keil MDK-ARM.
See Differences from the default C library for more detailed information
To use MicroLib in your embedded application, select the MicroLib check box in µVision and compile your application. µVision links your program with MicroLib and reduces your program size quickly and easily.
[]KEIL RTX_Kernel使用小结 2012-01-11 01:07:36
分类: 嵌入式
前言:本人使用的是STM32F103VC开发板,标准的8MHz晶振,72MHz主频运行。
    M3处理器的话,不用实时操作系统显得太没效率了。正好也看到Micrium官方把uC/OS-III的源代码放出来了。于是从下了一个针对STM32F版本的uC/OS-III,修改了下里面的
任务函数,改成点亮发光二极管,编译下载后不执行。一看Micrium官方这个版本是针对STM32F107的,互联网型,标准晶振是25MHz,我想可能是频率设置不对,我也不想去探索如何解决。
    我从Keil上下载最新的MDK423,看到里面关于RTX_Kernel的介绍。以前写51单片机程序的时候知道RTX这个东西,但从来没用过。这次打算用下RTX_Kernel试试,毕竟RTX_Kernel是商用免费的,uC/OS是商用收费的。另外是ARM Keil自家的东西,想必也不错。
正式开始我的RTX_Kernel使用例程:
1、我的Keil MDK版本是此时从下载的最新版本MDK423,之前的Keil注册机在这里可用。
2、在ST下载STM32F10x_StdPeriph_Lib_V3.5.0,用这里面的工程作为工程模板。
3、依据ST官方库的例子,建立一个GPIO/IOToggle 工程。修改里面的IO端口与你的板子匹
配。编译运行成功。
4、开始使用RTX_Kernel。在main.c中加入
1. #inlude <rtl.h>
项目选项里,在Target下,Operating system选择 RTX Kernel复制
D:\Keil\ARM\Boards\ST\STM32F10X_EVAL\RTX_Blinky\RTX_Config.h到项目目录下,并将RTX_Config.h添加到项目中。
然后main.c的主要代码如下:
1. /*----------------------------------------------------------------------------
2.  * Task 1 
3.  *---------------------------------------------------------------------------*/
4. __task void task1 (void) {
5.   for (;;) {
6.     led1on();    //点亮LED1,函数具体内容依照你的开发板
7.     os_dly_wait (10);
8.     led1off();    //熄灭LED1
9.     os_dly_wait (10);
10.   }
11. }
12. /*----------------------------------------------------------------------------
13.  * Task 2 
14.  *---------------------------------------------------------------------------*/
15. __task void task2 (void) {
16.   for (;;) {
17.     led2off();     //熄灭LED2,函数具体内容依照你的开发板
18.     os_dly_wait (10);
19.     led2on();
20.     os_dly_wait (10);
21.   }
22. }
23. /*----------------------------------------------------------------------------
24.  * Task  'init': 建立所有的任务
25.  *---------------------------------------------------------------------------*/
26. __task void init_task (void) {
27.
28.   id1 = os_tsk_create (task1, 0); /* start task phaseA */
29.   id2 = os_tsk_create (task2, 0); /* start task phaseB */
30.   os_tsk_delete_self ();
31. }
32. int main(void)
33. {
34.   /*!< At this stage the microcontroller clock setting is already configured, 
35.        this is done through SystemInit() function which is called from startup
36.        file (startup_stm32f10x_xx.s) before to branch to application main.
37.        To reconfigure the default setting of SystemInit() function, refer to
38.        system_stm32f10x.c file
39.      */ 
40.        
41.   /* To achieve GPIO toggling maximum frequency, the following sequence is 模拟串口使用printf函数mandatory. 
42.      You can monitor PD0 or PD2 on the scope to measure the output signal. 
43.      If you need to fine tune this frequency, you can add more GPIO set/reset 
44.      cycles to minimize more the infinite loop timing.
45.      This code needs to be compiled with high speed optimization option. 
46.      */
47.
48.     GPIO_Config();    //IO口初始化函数,具体根据你的开发板
49.     os_sys_init (init_task);
50.
51. }
    上面代码很简单,不用解释,一看即明白。编译,运行,会看到两个发光二极管一闪一闪的。恭喜你,RTX Kernel成功运行了!
    说明:编译时如果提示有3个函数定义冲突,在stm32f10x_it.c中屏蔽掉那三个函数即可。
5RTX Kernel教程
    实际上RTX Kernel API比较简单,相对于uC/OS-III而言。有一些uc/OS的基础的话,参照Keil帮助文档和rtl.h头文件,即可轻松使用RTXAPI。简要总结如下: