搭建君正平台的交叉编译环境

前言

君正提供了简单易用的Manhattan编译系统,可以一键式完成编译。但简单易用的同时也意味着灵活性稍微欠佳,对于需要使用其他工具链,或者是更习惯于传统开发方式的开发者来说可能会存在一些不便。本文将介绍的是按照传统方式搭建用于君正平台的交叉编译环境。

交叉编译工具链

文中所用交叉编译工具链为君正提供的交叉编译工具链r3.2.1版,基于Binutils-2.25、GCC-5.2、Glibc-2.22以及UClibc-0.9.33,支持君正MXU和MXU2指令集。

部署工具链

本文档将指导开发者部署并测试交叉编译工具链,文中默认工具链存放路径为“~/Ingenic/toolchain”。

1. 设置环境变量

执行以下命令:

export PATH=~/Ingenic/toolchain/bin:$PATH

然后即可使用mips-linux-gnu-gcc和mips-linux-gnu-g++来编译程序。

2. 测试工具链

创建helloworld.c文件,内容如下

#include <stdio.h> int main(void) { printf(“Hello world!\n”); return 0; }

然后执行以下命令

mips-linux-gnu-gcc -O2 -o helloworld helloworld.c

如果能正常完成编译,则说明工具链可以正常使用。

———————————————以下是英文版————————————————

Preface

Ingenic provides a simple and easy-to-use Manhattan compilation system. However, the ease of use also means that the flexibility is slightly less, and there may be some inconvenience for developers who need to use other toolchains or are more accustomed to traditional development methods. This document will introduce the configuration of the cross-compilation environment for the Ingenic platform in the traditional way.

Cross-compile toolchain

Ingenic cross-compile toolchain r3.2.1 version, based on Binutils-2.25, GCC-5.2, Glibc-2.22 and UClibc-0.9.33, supports Ingenic MXU and MXU2 instruction set.

Deploy the toolchain

This document will guide developers to deploy and test the cross-compile toolchain. In this document, it is by default that the storage path of the toolchain is “~/Ingenic/toolchain”.

1. Set PATH environment variable

Run the following command:

export PATH=~/Ingenic/toolchain/bin:$PATH

Now you can use the mips-linux-gnu-gcc and mips-linux-gnu-g++ to compile programs.

2. Test the toolchain

Create a helloworld.c file with the following contains:

#include <stdio.h> int main(void) { printf(“Hello world!\n”); return 0; }

Then build it:

mips-linux-gnu-gcc -O2 -o helloworld helloworld.c

If helloworld can be built correctly, it shows that the toolchain has been deployed properly and can be used normally.

免责声明:文章内容来自互联网,本站不对其真实性负责,也不承担任何法律责任,如有侵权等情况,请与本站联系删除。
转载请注明出处:搭建君正平台的交叉编译环境 https://www.yhzz.com.cn/a/17281.html

上一篇 2023-05-20
下一篇 2023-05-20

相关推荐

联系云恒

在线留言: 我要留言
客服热线:400-600-0310
工作时间:周一至周六,08:30-17:30,节假日休息。