Page tree
Skip to end of metadata
Go to start of metadata

PanGu开发板的应用开发,需要先安装应用开发工具包(SDK)。PanGu开发板提供了两种SDK工具包:i2som-image-qt-openstlinux-eglfs-pangu-x86_64-toolchain-2.6-snapshot.sh和i2som-image-weston-openstlinux-weston-pangu-x86_64-toolchain-2.6-snapshot.sh。


开发SDK说明
i2som-image-qt-openstlinux-eglfs-pangu-x86_64-toolchain-2.6-snapshot.sh用于Qt5图形应用的开发,包含Qt5.11相关的开发库
i2som-image-weston-openstlinux-weston-pangu-x86_64-toolchain-2.6-snapshot.sh用于Weston图形应用的开发

两种工具链都可以编译C,C++标准库的应用,但对于第三方的库支持有差异。


下面以安装i2som-image-qt-openstlinux-eglfs-pangu-x86_64-toolchain-2.6-snapshot.sh工具包为例。

在“资源下载”页面下载工具包后,确认有执行权限,然后安装即可。这里将安装路径设置为“/opt/i2SOM-yocto-adk-core/2.2-r0”。

$ chmod a+x i2SOM-yocto-glibc-x86_64-core-image-base-cortexa7hf-neon-toolchain-2.2-r0.sh
$ ls -lh
-rwxr-xr-x 1 i2somdev i2somdev 199M Nov 29 10:20 i2SOM-yocto-glibc-x86_64-core-image-base-cortexa7hf-neon-toolchain-2.2-r0.sh
$ $ ./i2som-image-qt-openstlinux-eglfs-pangu-x86_64-toolchain-2.6-snapshot.sh
ST OpenSTLinux - EGLfs - (A Yocto Project Based Distro) SDK installer version 2.6-snapshot
==========================================================================================
Enter target directory for SDK (default: /opt/st/pangu/2.6-snapshot): /opt/st/pangu-i2som-image-qt/2.6-snapshot
You are about to install the SDK to "/opt/st/pangu-i2som-image-qt/2.6-snapshot". Proceed[Y/n]? y
[sudo] password for build:
Extracting SDK...................................................................................................................................................................................................................................................................................................................................................................................................done
Setting it up...done
SDK has been successfully set up and is ready to be used.
Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
 $ . /opt/st/pangu-i2som-image-qt/2.6-snapshot/environment-setup-cortexa7t2hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi


验证开发工具是否安装正确,显示版本信息就表示工具链安装和加载正确。

$ source /opt/st/pangu-i2som-image-qt/2.6-snapshot/environment-setup-cortexa7t2hf-neon-vfpv4-openstlinux_eglfs-linux-gnueabi
$ $CC --version
arm-openstlinux_eglfs-linux-gnueabi-gcc (GCC) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


然后就可以编译应用程序了。


测试Helloworld应用

编写hello.c文件,内容如下:

#include <stdio.h>
int main(int argc, char* argv)
{
	printf("Hello, world!");
}

编译hello应用

$CC hello.c -o hello
file hello
hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=b6a98060e4d0423c65a477d0a0d74cb183441648, not stripped

这里必须要用$CC变量来编译,不能直接用gcc名称。然后复制在PanGu开发板后,直接运行就可以了。


  • No labels