Windows中嵌入式平台的交叉编译器

时间:2021-12-06 02:20:36

I wish to build a compiler (GCC port) for Linux, so that the built GCC runs on Windows and creates executables for an embedded platform.

我希望为Linux构建一个编译器(GCC端口),以便构建的GCC在Windows上运行并为嵌入式平台创建可执行文件。

Is the above possible?

以上可能吗?

5 个解决方案

#1


6  

Yes, it is possible.

对的,这是可能的。

It also utterly painful to try to do this yourself -- it is OK on Linux, mostly, but very tricky on Windows. My suggestion is to see if some ready-built compiler from a place like DENX.de, CodeSourcery, or the manufacturer of your embedded platform is available.

尝试自己做这件事也是非常痛苦的 - 大多数情况下在Linux上都可以,但在Windows上却非常棘手。我的建议是看看是否有像DENX.de,CodeSourcery或嵌入式平台制造商这样的现成编译器。

I have become a huge fan of the CodeSourcery compilers for platforms like MIPS and Power Architecture. They tend to come with variants for big- and little-endian, various Libc flavors, and to have both bare-metal and linux-target versions available. See their pages about their Lite edition

我已成为MIPS和Power Architecture等平台的CodeSourcery编译器的忠实粉丝。它们往往带有大端和小端的变体,各种Libc风格,并且可以提供裸机和Linux目标版本。查看有关其Lite版本的页面

Building your own cross-compiler and toolset is a right pain.

构建自己的交叉编译器和工具集是一件痛苦的事。

If your target is running Linux, I suggest doing your cross-work on a Linux box as well, saving you plenty of pain. I use VmWare for that express purpose. You cannot expect to build a Linux for a target on Windows, for example.

如果您的目标是运行Linux,我建议您在Linux机器上进行交叉工作,这样可以省去很多痛苦。我将VmWare用于此目的。例如,您不能指望在Windows上为目标构建Linux。

#2


2  

In embedded systems compilers are referred based on processor architecture and not on OS. What you probably want is to build a "cross compiler" for a processor other than the one running in your Windows machine. This is of course possible. See for example the WinAVR and WinARM projects. These are compilers for AVR and ARM processor architectures, based on GCC and running in Windows machines. Another example is yagarto. These aren't just a compiler, but a full tool chain that will allow you to built Linux executables (for ARM processors), if the requires libraries are available.

在嵌入式系统中,编译器基于处理器架构而不是OS。您可能想要的是为除Windows机器中运行的处理器之外的处理器构建“交叉编译器”。这当然是可能的。例如,参见WinAVR和WinARM项目。这些是基于GCC并在Windows机器上运行的AVR和ARM处理器体系结构的编译器。另一个例子是yagarto。这些不仅仅是一个编译器,而是一个完整的工具链,如果需要库可用,它将允许您构建Linux可执行文件(对于ARM处理器)。

Because GCC relies on POSIX functionality that is not available in Windows natively, you need a Linux-like environment for Windows (such as Cygwin or MinGW).

由于GCC依赖于Windows本身不具备的POSIX功能,因此您需要类似Linux的Windows环境(例如Cygwin或MinGW)。

#4


1  

If you are satisfied to running it on Windows then at www.gnupit.org you can donwload ready GCC cross toolchain for free. There are many target platforms.

如果您对在Windows上运行它感到满意,那么可以在www.gnupit.org上免费下载准备好的GCC交叉工具链。有许多目标平台。

#5


0  

You have to build GCC on Windows using MinGW or Cygwin for your target platform (e.g. ARM little endian).

您必须在Windows上使用MinGW或Cygwin为您的目标平台构建GCC(例如ARM little endian)。

#1


6  

Yes, it is possible.

对的,这是可能的。

It also utterly painful to try to do this yourself -- it is OK on Linux, mostly, but very tricky on Windows. My suggestion is to see if some ready-built compiler from a place like DENX.de, CodeSourcery, or the manufacturer of your embedded platform is available.

尝试自己做这件事也是非常痛苦的 - 大多数情况下在Linux上都可以,但在Windows上却非常棘手。我的建议是看看是否有像DENX.de,CodeSourcery或嵌入式平台制造商这样的现成编译器。

I have become a huge fan of the CodeSourcery compilers for platforms like MIPS and Power Architecture. They tend to come with variants for big- and little-endian, various Libc flavors, and to have both bare-metal and linux-target versions available. See their pages about their Lite edition

我已成为MIPS和Power Architecture等平台的CodeSourcery编译器的忠实粉丝。它们往往带有大端和小端的变体,各种Libc风格,并且可以提供裸机和Linux目标版本。查看有关其Lite版本的页面

Building your own cross-compiler and toolset is a right pain.

构建自己的交叉编译器和工具集是一件痛苦的事。

If your target is running Linux, I suggest doing your cross-work on a Linux box as well, saving you plenty of pain. I use VmWare for that express purpose. You cannot expect to build a Linux for a target on Windows, for example.

如果您的目标是运行Linux,我建议您在Linux机器上进行交叉工作,这样可以省去很多痛苦。我将VmWare用于此目的。例如,您不能指望在Windows上为目标构建Linux。

#2


2  

In embedded systems compilers are referred based on processor architecture and not on OS. What you probably want is to build a "cross compiler" for a processor other than the one running in your Windows machine. This is of course possible. See for example the WinAVR and WinARM projects. These are compilers for AVR and ARM processor architectures, based on GCC and running in Windows machines. Another example is yagarto. These aren't just a compiler, but a full tool chain that will allow you to built Linux executables (for ARM processors), if the requires libraries are available.

在嵌入式系统中,编译器基于处理器架构而不是OS。您可能想要的是为除Windows机器中运行的处理器之外的处理器构建“交叉编译器”。这当然是可能的。例如,参见WinAVR和WinARM项目。这些是基于GCC并在Windows机器上运行的AVR和ARM处理器体系结构的编译器。另一个例子是yagarto。这些不仅仅是一个编译器,而是一个完整的工具链,如果需要库可用,它将允许您构建Linux可执行文件(对于ARM处理器)。

Because GCC relies on POSIX functionality that is not available in Windows natively, you need a Linux-like environment for Windows (such as Cygwin or MinGW).

由于GCC依赖于Windows本身不具备的POSIX功能,因此您需要类似Linux的Windows环境(例如Cygwin或MinGW)。

#3


#4


1  

If you are satisfied to running it on Windows then at www.gnupit.org you can donwload ready GCC cross toolchain for free. There are many target platforms.

如果您对在Windows上运行它感到满意,那么可以在www.gnupit.org上免费下载准备好的GCC交叉工具链。有许多目标平台。

#5


0  

You have to build GCC on Windows using MinGW or Cygwin for your target platform (e.g. ARM little endian).

您必须在Windows上使用MinGW或Cygwin为您的目标平台构建GCC(例如ARM little endian)。