ADS 中的 semihosting 问题

   最近在做一个移植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!

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值