在路上...

The development of life
我们一直都在努力,有您的支持,将走得更远...

站内搜索: Google

  :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

最近在做一个移植UCOS-II的任务,遇到了semihosting的问题,现在把这个问题的解决办法总结一下。
 

Step 1 : 用#pragma import(__use_no_semihosting_swi)保证用户程序不调用semihostSWI;
   此后,link时会有
    Error :L6200E:Symbol __semihosting_swi_guard multiply defined (by use_semi.o and use_no_semi.o)
   这是因为,还有compiler helper functions 和 initialization code在调用semihostSWI (This error is reported when functions that use semihosting SWIs are linked in from the Clibrary, in the presence of the __use_no_semihosting_swi guard)

 

Step 2 : armlink -verbose 结果中,查出调用semihostSWI的外部库函数,如:
   Loading member sys_exit.o from c_a__un.l.
                 definition:   _sys_exit
                 reference :   __I_use_semihosting_swi

    在报错的窗口中寻找__I_use_semihosting_swi很麻烦,我们可以再在连接器中修改一下参数如下:

    Link with 'ARMlink -verbose -errors err.txt'

    ----------------------------------------

For example:
    Loading member sys_exit.o from c_a__un.l.
    reference : __I_use_semihosting_swi
    definition: _sys_exit
:This shows that the SWI-using function _sys_exit is being linked-in from the C library. To
prevent this, you will need to provide your own implementation of this function.
    ----------------------------------------

 

Step 3 : 在用户程序中重写这些函数,如:
     AREA ||.text||, CODE, READONLY
   __user_initial_stackheap
       LDR r0, =0x20000 ; HB
       LDR r1, =0x40000 ; SB
                        ; r2 not used (HL)
                        ; r3 not used (SL)
       MOV PC,LR
     EXPORT __user_initial_stackheap
       END

Step 4 : compile and link OK!

posted on 2009-09-06 23:29  palam  阅读(1006)  评论(0编辑  收藏  举报