开发板默认安装了ubuntu系统,可以使用如下指令查看系统版本
cat /proc/version
uname -a
lsb_release -a
root@localhost:~# cat /proc/version
Linux version 5.4.47-g20182b961 (root@ubuntu18) (gcc version 7.5.0 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)) #3 SMP PREEMPT Sun Dec 12 08:32:43 CST 2021
root@localhost:~# uname -a
Linux localhost 5.4.47-g20182b961 #3 SMP PREEMPT Sun Dec 12 08:32:43 CST 2021 aarch64 aarch64 aarch64 GNU/Linux
root@localhost:~# lsb_release -a
No LSB modules are available.
Distributor ID: NXP-LSDK
Description: NXP LSDK 2012 main
Release: 2012
Codename: bionic
root@localhost:~#
板子本身安装了GCC工具链
使用以下指令查看gcc版本
gcc -v
root@localhost:~# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/7/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=aarch64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04)
串口登录
vi led.c
按键i进入编辑模式
复制黏贴以下代码
按esc
按shift+:进入命令模式
输入wq回车保存
#include
#include
#include
#include
int main(void)
{
while(1)
{
system("echo 0 > /sys/class/leds/d22/brightness");
sleep(1);
system("echo 1 > /sys/class/leds/d22/brightness");
sleep(1);
}
return 0;
编译gcc led.c -o led
运行./led
可以看到D22以1秒间隔闪烁。
由于系统自带了gcc工具链,所以可以直接在开发板进行开发,而不需要交叉编译开发,非常便捷。
全部0条评论
快来发表一下你的评论吧 !