注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

天道酬勤 玩物丧志

用勇气去改变可以改变的事情,用胸怀去包容无法改变的事情,用智慧去判断两者的区别

 
 
 

日志

 
 

关于移植newlib的些许资料  

2014-07-30 16:06:40|  分类: 嵌入式系统 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

最近要移植newlib到csky-elf上,比较茫然(写下此刻的内心还是非常茫然的)

不过,在搜索资料的过程中还是有些些认识和了解的。

一开始,想着就是编译一下newlib就行了,于是就在网上搜索“newlib编译 XXX”

果然,许多都是介绍如何编译的。。。但是,发现,我要使用的编译工具链不是newlib已有的,target里没有csky-elf

(csky-elf-gcc在编译的时候应该也是自己做的target吧)

才发现,newlib的FAQ里有

What steps do I need to do to port newlib to a new platform?

哦,原来,我要干的是这个活。。。阿西吧,于是赶紧的在网上搜索关于“移植newlib”的资料,

果然,太专业百度不多,谷歌又上不去了。。。只好试试必应bing了

搜索“Port newlib new” 搜到了一个“Hard Maker - Re: Porting newlib to new target ”http://sourceware.org/ml/newlib/2011/msg00286.html

Re: Porting newlib to new target using libgloss


Thank's a lot  David.
With this I have more information to continue my work.
Sergio

El 28/06/2011 12:44 p.m., David Paterson escribió:
On Tue, Jun 28, 2011 at 1:26 AM, Hard Maker<hardmaker@gmail.com> wrote:
Hi list,
I'm trying to port newlib for use in a development kit. This use a Cortex
M3, so I need to port only the specific system calls to work with the
asociated  hardware.
There are some "guide" to do this? I'm googling from a week's and I can make
the port using a custom CRT0, but I don't know how to reuse the startup code
from libgloss for Cortex and add my code for the peripherical hardware.
Other question, when use newlib witch gcc, in C and C++ lenguage: ?where can
I read about the definitions needed in the linker script? I'm test with a
linker script finded in internet but I know are some linkers script builded
with the source, but I don't know how and which I need use (hosted or
semihosted). Again, I'm using a cortex m3.

Thank's a lot.

Sergio
Hi Sergio,

I've been working on something similar, so might be able to help -
although my port
is to Sparc Leon, so there will be some differences.  I can perhaps
point you to some
useful resources however.

Three documents I found helpful were Jeremy Bennett's "Simple Guide" :-

http://www.embecosm.com/download/ean9.html
http://www.embecosm.com/appnotes/ean9/ean9-howto-newlib-1.0.html
Bill Gatliff's "Porting and Using Newlib" (see section 6 on porting) :-

http://neptune.billgatliff.com/newlib.html

and (even though it's quite old and probably could do with an update) :-

http://sca.uwaterloo.ca/coldfire/gcc-doc/docs/porting_toc.html

and there are lots of other bits of info around the net, as I'm sure
you've found...

There are 18 functions which you need to implement, although most of them will
just be stubs returning an error code.

In my case the only things I needed were "sbrk" for malloc support, and simple
character I/O for printf debugging.  If you're not supporting a file system, or
processes, then you probably won't need much more.

I looked at the crt0 and linker scripts in the Newlib download, but
ended up writing
my own in both cases, so I could get exactly what I wanted.  Like you
I wanted to
add special hardware initialisation, so I put that into the startup
sequence in crt0.

For my linker script I used similar ideas to those in Newlib, and
added additional
symbols which crt0 could check to control initialisation.  You can
create any symbols
you like in the script, and refer to them in crt0, or in your own
libraries.  This can be
quite useful - for example I can pass a "_debugging" flag to the
linker which enables
the character I/O, allocates buffers etc. for debug builds only.

To simplify the command line for linking, I added a couple of references in the
script file as well :-

ENTRY(_start)
STARTUP(leon-crt0.o)
INPUT(crti.o crtbegin.o crtend.o crtn.o)
GROUP(-lleon -lc -lstdc++ -lgcc)

I hope this is of some help to you, and if there's anything I can help
with please
ask, although I probably can't help too much on Cortex-specific issues.

Regards,

David P.

果然,不错啊,当然还有

Porting Newlib http://wiki.osdev.org/Porting_Newlib

这里面特别棒的是:

http://www.embecosm.com/appnotes/ean9/ean9-howto-newlib-1.0.html
Bill Gatliff's "Porting and Using Newlib" (see section 6 on porting) :-

http://neptune.billgatliff.com/newlib.html

and (even though it's quite old and probably could do with an update) :-

http://sca.uwaterloo.ca/coldfire/gcc-doc/docs/porting_toc.html

  评论这张
 
阅读(1992)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018