Chinaunix首页 | 论坛 | 博客
  • 博客访问: 659070
  • 博文数量: 186
  • 博客积分: 1875
  • 博客等级: 上尉
  • 技术积分: 2117
  • 用 户 组: 普通用户
  • 注册时间: 2010-10-23 23:21
个人简介

有时候,就是想窥视一下不知道的东东,因为好奇!

文章分类

全部博文(186)

文章存档

2024年(2)

2023年(3)

2020年(1)

2019年(1)

2018年(1)

2017年(2)

2016年(69)

2015年(53)

2014年(14)

2013年(1)

2012年(5)

2011年(25)

2010年(9)

分类: 其他平台

2015-05-09 18:28:39

rt-thread for stm32f103

一、 环境

Window7

Keil uVision V4.00

ToolchainRealView MDK-ARM version4.00

二、 Rt-thread代码下载

Rt-thread-1.2.2.zip:

 

三、 解压rt-thread代码
     得到名为rt-thread-1.2.2的文件夹

四、 新建目录

在与rt-thread-1.2.2同一级的目录下新建目录myrtthread,并在其下新建子目录.
     
最终的myrtthread和rt-thread-1.2.2目录结构如下图:

五、 添加文件

1、 将以下

rt-thread-1.2.2\bsp\stm32f10x\applications\application.c

rt-thread-1.2.2\bsp\stm32f10x\applications\startup.c

rt-thread-1.2.2\bsp\stm32f10x\drivers\board.c 
rt-thread-1.2.2\bsp\stm32f10x\drivers\board.h

rt-thread-1.2.2\bsp\stm32f10x\drivers\stm32f10x_it.c

rt-thread-1.2.2\bsp\stm32f10x\drivers\stm32f10x_it.h

rt-thread-1.2.2\bsp\stm32f10x\drivers\stm32f10x_conf.h

rt-thread-1.2.2\bsp\stm32f10x\rtconfig.h

rt-thread-1.2.2\components\init\components.c

rt-thread-1.2.2\components\init\components.h

rt-thread-1.2.2\components\drivers\include\rtdevice.h

共11个文件放入到新建立的apps目录下

并修改以下文件:

aboard.c22行添加”include usart.h”

bboard.h44行添加”void rt_hw_board_init(void);”

 

   2、 将以下

rt-thread-1.2.2\bsp\stm32f10x\drivers\led.c

rt-thread-1.2.2\bsp\stm32f10x\drivers\led.h

rt-thread-1.2.2\bsp\stm32f10x\drivers\rtc.c

rt-thread-1.2.2\bsp\stm32f10x\drivers\rtc.h 

rt-thread-1.2.2\bsp\stm32f10x\drivers\usart.c

rt-thread-1.2.2\bsp\stm32f10x\drivers\usart.h

rt-thread-1.2.2\components\drivers\serial\serial.c 

rt-thread-1.2.2\components\drivers\include\drivers\serial.h 

共8个文件放入到新建立的driver目录下

 

3将以下

rt-thread-1.2.2\bsp\stm32f10x\Libraries\CMSIS

rt-thread-1.2.2\bsp\stm32f10x\Libraries\STM32F10x_StdPeriph_Driver

2个目录及以下文件复制到新建立的third_part目录下

六、 新建MDK工程

在新建的project目录下新建工程

1、新建一名为:rtt工程

2、目标芯片:STM32F103ZE
      

3、不要加入MDK为我们准备的启动文件

4、为新工程添加文件

 

在以上的各Groups放入以下文件:

a、StartUp放入新建appsdrivers文件夹中的所有内容

b、Apps不添加文件

c、Driver添加以下文件

    1rt-thread-1.2.2\components\drivers\src\dataqueue.c

d、cm3添加以下文件

    1rt-thread-1.2.2\libcpu\arm\common目录下所有.c文件(3)

    2rt-thread-1.2.2\libcpu\arm\cortex-m3\cpuport.c

3rt-thread-1.2.2\libcpu\arm\cortex-m3\context_rvds.S

eSTM32_StdPeriph添加以下文件

     1third_part\STM32F10x_StdPeriph_Driver\src全部.c文件(23)

2、third_part\CMSIS\CM3\CoreSupport\core_cm3.c

3、third_part\CMSIS\CM3\DeviceSupport\ST\STM32F10x\system_stm32f10x.c

4、third_part\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\arm\startup_stm32f10x_hd.s

           fkernel添加rt-thread-1.2.2\src下的全部.c文件(17)

gFinsh添加rt-thread-1.2.2\components\finsh下的全部.c文件(15)

至此文件添加完毕。

5、为新工程设定包含路径。如下:

    

     6、设定编译链接时的outputlisting路径为obj文件夹

        
       

     7、设置器件类型和定制stm32固件库。如下图

        

     8、加两条链接控制选项

        

七、 编译链接工程得到目标文件
 

八、参考
    


阅读(8948) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~