RT-Thread V2.1.0 重构工程(IAR为例)

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/skawu/article/details/78507459
RTT版本:rt-thread-2.1.0        http://pan.baidu.com/s/1mgIAyWo

Python版本:python-2.7.14.amd64.msi

scons版本:scons-2.5.1-setup.exe

工具版本选择说明:根据README.md 说明:

RT-Thread RTOS uses [scons](http://www.scons.org) as building system. Therefore, please install scons and Python 2.7 firstly. 

 

Python安装请自行百度,提示注意环境变量的选项!

笔者window7 64位操作系统,安装完Python后安装scons时提示找不到Python安装目录,解决办法:

将以下代码完整复制为reg.py文件,然后通过cmd命令进入文件所在目录,执行reg.py,再执行scons安装程序

#
# script to register Python 2.0 or later for use with win32all
# and other extensions that require Python registry settings
#
# written by Joakim Loew for Secret Labs AB / PythonWare
#
# source:
# http://www.pythonware.com/products/works/articles/regpy20.htm
#
# modified by Valentine Gogichashvili as described in http://www.mail-archive.com/distutils-sig@python.org/msg10512.html
 
import sys
 
from _winreg import *
 
# tweak as necessary
version = sys.version[:3]
installpath = sys.prefix
 
regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version)
installkey = "InstallPath"
pythonkey = "PythonPath"
pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % (
    installpath, installpath, installpath
)
 
def RegisterPy():
    try:
        reg = OpenKey(HKEY_CURRENT_USER, regpath)
    except EnvironmentError as e:
        try:
            reg = CreateKey(HKEY_CURRENT_USER, regpath)
            SetValue(reg, installkey, REG_SZ, installpath)
            SetValue(reg, pythonkey, REG_SZ, pythonpath)
            CloseKey(reg)
        except:
            print "*** Unable to register!"
            return
        print "--- Python", version, "is now registered!"
        return
    if (QueryValue(reg, installkey) == installpath and
        QueryValue(reg, pythonkey) == pythonpath):
        CloseKey(reg)
        print "=== Python", version, "is already registered!"
        return
    CloseKey(reg)
    print "*** Unable to register!"
    print "*** You probably have another Python installation!"
 
if __name__ == "__main__":
    RegisterPy()

(笔者使用STM32F103ZET6)  

工具安装完成后修改rt-thread-v2.1.0\rt-thread-2.1.0\bsp\stm32f10x目录下rtconfig.py文件:

根据README.md介绍:

* ```CROSS_TOOL``` the compiler which you want to use, gcc/keil/iar.   使用的IDE
* ```EXEC_PATH``` the path of compiler.               iar安装目录

修改为:

第6行:CROSS_TOOL='iar'

第34行:IAR_PATH = 'D:\IAR Systems\Embedded Workbench 7.0'

通过cmd控制台进入到rt-thread-v2.1.0\rt-thread-2.1.0\bsp\stm32f10x目录,执行命令:scons

编译完成后打开IAR工程,make一下,如果依然报错,执行命令:scons --target=iar -s

命令说明:

When you set these variables correctly, you can use command:

scons

under BSP directory to simplely compile RT-Thread RTOS.

If you want to generate the IDE's project file, you can use command:

scons --target=mdk/mdk4/mdk5/iar/cb -s

to generate the project file.

IAR提示工程文件更改,选择yes to all即可。

展开阅读全文

ADS工程IAR工程

04-28

一:ADS中的设置过程:rn1)我的目的:针对我的开发板(arm7,系统uc/os-ii),用ADS开发一个在开发板上运行的应用程序。rn2)过程:rn 2-0)new->ARM Executable Image, 工程名:armtest.rn 2-1) 我 建立了我的main函数(test.c)、启动函数(boot.s)和我自定义的库。rntest.c 代码如下:rn#include "ndlib.h"rnrnint main(void)rn rn Sysinit(); // ndlib库中的函数rn MessageBox("M73Test", "Hello,Simon", MSG_OK|MSG_CANCEL);// ndlib库中的函数rn return 0;rn rnrnboot.s 代码如下:rn IMPORT |Image$$RO$$Limit|rn IMPORT |Image$$RW$$Base|rn IMPORT |Image$$ZI$$Base|rn IMPORT |Image$$ZI$$Limit|rnrn;The imported labels rnrn IMPORT main ;The entry point to the main function rn rn rnrn CODE32rnrn AREA Ramdisk,CODE,READONLYrn ENTRYrnrnRamdiskInitrnrnrn LDR R0,=|Image$$RO$$Limit|rn LDR R1,=|Image$$RW$$Base|rn LDR R3,=|Image$$ZI$$Base|rn rn CMP R0,R1rn BEQ LOOP1rn rn rnLOOP0 CMP R1,R3rn LDRCC R2,[R0],#4rn STRCC R2,[R1],#4rn BCC LOOP0rn rn rnLOOP1 LDR R1,=|Image$$ZI$$Limit|rn MOV R2,#0rn rn rnLOOP2 CMP R3,R1rn STRCC R2,[R3],#4rn BCC LOOP2rn rn rnRamDiskStacks rn B mainrnrnrnrn ENDrnrn 工程添加的文件如下:rn ndlib.a (这个是我封装的库)rn test.c (我的main函数)rn boot.s (启动代码)rn 2-2)工程的设置:rnTarGet Settings:rn Linker: ARM Linkerrn Post-linker: ARM fromELFrnlinker:rnARM Linker:rn Output: Linktype: Simple; Simple image:RO Base:0x81064000;RW Base:(为空)rn Options: Image entry point: 0x81064000rn Layout: Object/Symbol: boot.o ; Section: RamDisk ; rn整个Equipment Command line:rn-info totals -entry 0x81064000 -ro-base 0x81064000 -first boot.o(RamDisk)rnrn如上做之后,在ADS中就可以编译生成我想要的image喇。rnrn二:在IAR中的设置:我是要在IAR5.4中开发一个类似这样的工程的。rn三:我的疑问:rn 在IAR中如何设置:比如:如何设置程序的入口点:是0x81064000,等等,rn 在ADS中可以写一个启动代码boot.s来设置RO、RW、放在什么地方,但是在IAR中该如何设置呢?还是根本就不用boot.s啦,用其他的方式实现?rn 如果要在IAR中实现一样的效果的话,我应该如何修改boot.s文件呢??rn 如果转到IAR开发环境的话,boot.s中的实现,在IAR开发环境中如果实现呢(或者如何修改呢)???rn四:我想要得到的效果:rn 把上面这个ADS的工程在,IAR中实现。rnrn五:希望高手提点一下,最好可以把在IAR中我这个工程的实现过程说一下啦~~ 希望可以有高手帮帮忙啦!!! 论坛

没有更多推荐了,返回首页