的,帶個彙編的啟動檔案,問題來了,開始是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:
‘ 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:


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

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:



ii) add the 
e.g. change:




2) If you cannot rebuild all of your source code

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 - 有夢想 就有希望

controls裡面寫上 –first startup.o(init)
哈,沒問題啦ADS到KEIL的轉換 - sweet - 有夢想 就有希望