I'm compiling newlib for a bespoke PowerPC platform with no OS. Reading information on the net I realise I need to implement stub functions in a <newplatform>
subdirectory of libgloss.
我正在为没有操作系统的定制PowerPC平台编译newlib。在网上读取信息我意识到我需要在libgloss的
My confusion is to how this is going to be picked up when I compile newlib. Is it the last part of the --target
argument to configure e.g. powerpc-ibm-<newplatform>
?
我的困惑是在编译newlib时如何获取它。它是--target参数的最后一部分,用于配置,例如powerpc-ibm-
If this is the case, then I guess I should use the same --target
when compiling binutils and gcc?
如果是这种情况,那么我想我应该在编译binutils和gcc时使用相同的--target?
Thank you
2 个解决方案
#1
I ported newlib and GCC myself too. And i remember i didn't have to do much stuff to make newlib work (porting GCC, gas and libbfd was most of the work).
我自己移植了newlib和GCC。而且我记得我没有做太多工作来使newlib工作(移植GCC,gas和libbfd是大部分工作)。
Just had to tweak some files about floating point numbers, turn off some POSIX/SomeOtherStandard flags that made it not use some more sophisticated functions and write support code for longjmp
/ setjmp
that load and store register state into the jump buffers. But you certainly have to tell it the target using --target
so it uses the right machine sub-directory and whatnot. I remember i had to add small code to configure.sub
to make it know about my target and print out the complete configuration trible (cpu-manufacturer-os or similar). Just found i had to edit a file called configure.host
too, which sets some options for your target (for example, whether an operation systems handles signals risen by raise
, or whether newlib itself should simulate handling).
只需要调整一些关于浮点数的文件,关闭一些POSIX / SomeOtherStandard标志,使得它不使用一些更复杂的函数,并为longjmp / setjmp编写支持代码,将加载和存储寄存器状态加载到跳转缓冲区中。但你必须使用--target告诉它目标,所以它使用正确的机器子目录和诸如此类的东西。我记得我必须在configure.sub中添加一些小代码,以使其了解我的目标并打印出完整的配置trible(cpu-manufacturer-os或类似的)。刚刚发现我必须编辑一个名为configure.host的文件,它为你的目标设置了一些选项(例如,操作系统是否处理通过加注而上升的信号,或者newlib本身是否应该模拟处理)。
I used this blog of Anthony Green as a guideline, where he describes porting of GCC, newlib and binutils. I think it's a great source when you have to do it yourself. A fun read anyway. It took a total of 2 months to compile and run some fun C programs that only need free-standing C (with dummy read/write functions that wrote into the simulator's terminal).
我使用Anthony Green的博客作为指导,他描述了GCC,newlib和binutils的移植。我认为,当你必须自己做的时候,这是一个很好的来源。无论如何有趣的阅读。编译和运行一些有趣的C程序总共需要2个月,这些程序只需要独立的C(具有写入模拟器终端的虚拟读/写功能)。
So i think the amount of work is certainly manageable. The one that made me nearly crazy was libgloss
's build scripts. I certainly was lost in those autoconf magics :) Anyway, i wish you good luck! :)
所以我认为工作量肯定是可以控制的。使我几乎疯狂的是libgloss的构建脚本。我当然迷失在那些autoconf魔法中:)无论如何,祝你好运! :)
#2
Check out Porting Newlib.
看看Porting Newlib。
Quote:
I decided that after an incredibly difficult week of trying to get newlib ported to my own OS that I would write a tutorial that outlines the requirements for porting newlib and how to actually do it. I'm assuming you can already load binaries from somewhere and that these binaries are compiled C code. I also assume you have a syscall interface setup already. Why wait? Let's get cracking!
我决定在尝试将newlib移植到我自己的操作系统之后的一周非常困难之后,我会编写一个教程,概述移植newlib的要求以及如何实际操作。我假设你已经可以从某个地方加载二进制文件,并且这些二进制文件是编译的C代码。我还假设您已经设置了系统调用接口。干嘛要等?让我们开始吧!
#1
I ported newlib and GCC myself too. And i remember i didn't have to do much stuff to make newlib work (porting GCC, gas and libbfd was most of the work).
我自己移植了newlib和GCC。而且我记得我没有做太多工作来使newlib工作(移植GCC,gas和libbfd是大部分工作)。
Just had to tweak some files about floating point numbers, turn off some POSIX/SomeOtherStandard flags that made it not use some more sophisticated functions and write support code for longjmp
/ setjmp
that load and store register state into the jump buffers. But you certainly have to tell it the target using --target
so it uses the right machine sub-directory and whatnot. I remember i had to add small code to configure.sub
to make it know about my target and print out the complete configuration trible (cpu-manufacturer-os or similar). Just found i had to edit a file called configure.host
too, which sets some options for your target (for example, whether an operation systems handles signals risen by raise
, or whether newlib itself should simulate handling).
只需要调整一些关于浮点数的文件,关闭一些POSIX / SomeOtherStandard标志,使得它不使用一些更复杂的函数,并为longjmp / setjmp编写支持代码,将加载和存储寄存器状态加载到跳转缓冲区中。但你必须使用--target告诉它目标,所以它使用正确的机器子目录和诸如此类的东西。我记得我必须在configure.sub中添加一些小代码,以使其了解我的目标并打印出完整的配置trible(cpu-manufacturer-os或类似的)。刚刚发现我必须编辑一个名为configure.host的文件,它为你的目标设置了一些选项(例如,操作系统是否处理通过加注而上升的信号,或者newlib本身是否应该模拟处理)。
I used this blog of Anthony Green as a guideline, where he describes porting of GCC, newlib and binutils. I think it's a great source when you have to do it yourself. A fun read anyway. It took a total of 2 months to compile and run some fun C programs that only need free-standing C (with dummy read/write functions that wrote into the simulator's terminal).
我使用Anthony Green的博客作为指导,他描述了GCC,newlib和binutils的移植。我认为,当你必须自己做的时候,这是一个很好的来源。无论如何有趣的阅读。编译和运行一些有趣的C程序总共需要2个月,这些程序只需要独立的C(具有写入模拟器终端的虚拟读/写功能)。
So i think the amount of work is certainly manageable. The one that made me nearly crazy was libgloss
's build scripts. I certainly was lost in those autoconf magics :) Anyway, i wish you good luck! :)
所以我认为工作量肯定是可以控制的。使我几乎疯狂的是libgloss的构建脚本。我当然迷失在那些autoconf魔法中:)无论如何,祝你好运! :)
#2
Check out Porting Newlib.
看看Porting Newlib。
Quote:
I decided that after an incredibly difficult week of trying to get newlib ported to my own OS that I would write a tutorial that outlines the requirements for porting newlib and how to actually do it. I'm assuming you can already load binaries from somewhere and that these binaries are compiled C code. I also assume you have a syscall interface setup already. Why wait? Let's get cracking!
我决定在尝试将newlib移植到我自己的操作系统之后的一周非常困难之后,我会编写一个教程,概述移植newlib的要求以及如何实际操作。我假设你已经可以从某个地方加载二进制文件,并且这些二进制文件是编译的C代码。我还假设您已经设置了系统调用接口。干嘛要等?让我们开始吧!