ADS到KEIL的转换{ 转 }

来源:互联网 发布:多益网络原画师工资 编辑:程序博客网 时间:2024/05/22 04:45

其实已经习惯了51下的keil,但是一直没找到破解比较好的KEIL的MDK,或者是本身没有花精力去弄,呵呵,就用了ADS来学ARM,现在装了个MDK3.20的破解版本,51的arm的都可以编译了,HOHO~~,keil的就是不错,不过开始还是出现了些问题。

还是开始的点灯程序,最最简单的,全汇编的,不需要别的设置,直接拉过来用,编译通过,Proteus仿真,没问题,哈哈,以为好了呢,换C程序的,带个汇编的启动文件,问题来了,开始是error: L6236E: No section matches selector - no section to be FIRST/LAST. 什么原因呢,呵呵,原来是S文件里面的AREA    init,CODE,READONLY ;出问题了,由于选了分散加载文件,系统默认的模块是RESET,而这里是init,换掉,问题又来了 Error: L6238E: startup.o(RESET) contains invalid call from '~PRES8' function to 'REQ8' function main. 这个问题原来是(百度了一篇文章ADS到KEIL的转换 - sweet - 有梦想 就有希望

This RVDS/RVCT linker error is given where a stack alignment conflict is detected in object code. The "ABI for the ARM Architecture" demands that code maintains 8-byte stack alignment at its interfaces. This allows efficient use of double" and "" data types.

Symbols like '~PRES8' and 'REQ8' are "" of the objects.

    • where assembler code (that does not preserve 8-byte stack alignment) calls compiled C/C++ code (that requires 8-byte stack alignment), and
    • when attempting to link legacy SDT/ADS objects with RVCT 2.x objects. Legacy SDT/ADS objects that do not have these attributes are treated as '~PRES8', even if they do actually happen to preserve 8-byte alignment.
  • This link error typically occurs in two cases:

    For example:
    ~PRES8' function to 'REQ8' function foobar

    This means that there is a function in the object 

    A similar warning that may be encountered, where the address of an external symbol is being referred to, is:

    Solutions
    There are two possible approaches to dealing with this issue:

    1) If you have access to all your source code and are allowed to rebuild it
    In this case you should rebuild all your objects/libraries using the latest version of the compilation tools. Note that if you have any assembler files, you will need to:

    i) check that all instructions preserve 8-byte stack alignment, and if necessary, correct them.
    e.g. change:

    to:

    and:

    ii) add the 
    e.g. change:

    to:


    AREA Init, CODE, READONLY

    (the 

    2) If you cannot rebuild all of your source code
    If you have any legacy objects/libraries that cannot be rebuilt, either because you do not have the source code, or because the old objects must not be rebuilt (e.g. for qualification/certification reasons), then you must inspect the legacy objects to check whether they preserve 8-byte alignment or not. Use "" to disassemble the object code. C/C++ code compiled with ADS 1.1 or later will normally preserve 8-byte alignment, but assembled code will not.

    If your objects do indeed preserve 8-byte alignment, then the linker error " on the linker command line. By using this, you are effectively saying "I guarantee that these objects are PRES8". The linker warning ".
    If you are linking with legacy objects/libraries then you should also read the information on the option "" in the FAQ entry "Are legacy ADS objects/libraries compatible with RVCT 2.0 ?".

    改了这个 又出现新问题了

    Error: L6915E: Library reports error: scatter-load file declares no heap or stack regions and __user_initial_stackheap is not defined。由于我的S文件也是用的最简单的,堆栈指针就( LDR       SP,=0x40003F00     ; 设置堆栈指针)这样设置了,看来这样行不通了,取消分散加载选项ADS到KEIL的转换 - sweet - 有梦想 就有希望

    也就是Use Memory Layout from Target Dialog这个前面的勾去掉,删除Scatter File选项里的文件,就成下面的图了

    ADS到KEIL的转换 - sweet - 有梦想 就有希望

    看下面的Linker control string ,ro-base:0x00000000,entry 0x00000000 rw-base 0x40003000,ADS到KEIL的转换 - sweet - 有梦想 就有希望就是我想要的嘛,编译,通过,哈哈,以为OK了,proteus仿真,问题来了,完全没反应啊,找原因,呵呵,还是和上次ADS的问题一样,需要在Misc controls里面写上 --first startup.o(init) ,只是设置方法不同而已,后面的startup就是S启动文件的名称啦,init是程序开始入口的模块名称,根据自己的换就是了,再编译,通过,仿真,哈哈,没问题啦ADS到KEIL的转换 - sweet - 有梦想 就有希望

     

    原文出处 http://blog.163.com/xiangyuan_122/blog/static/280073612009296556179/