NO IMAGE

其實已經習慣了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/