前言
首先感谢芯查查
给予的评测机会,飞腾派板子已于近期收到(见下图)。相较于树莓派4b,飞腾派尺寸略大一些,在电源方面,与树莓派4b使用5V 3A不同,飞腾派随板附赠了一个12V 3A的圆孔适配器(见下图),无法使用Type-C一线连接。此外,随板还有一个小的散热器(见下图),装起来颇有单板计算机的味道。
什么是机器视觉?机器视觉是一项综合技术,主要包括图像处理技术和机械控制系统。机器视觉最基本的用途在于提高工业生产的灵活性以及自动化程度,工业生产中普遍存在一些不适合人工作业的危险环境,以及人工视觉易受干扰的场合,使用机器视觉则可大大提高生产效率与自动化程度。飞腾派作为采用自主研发的嵌入式处理器的全国产“派”欲在工业生产落地应用,关于机器视觉的应用是绕不开的。因此本系列文章将围绕飞腾派的机器视觉能力展开,和大家一起学习相关的技术,力有不逮之处,还请交流多多指教。
1. 准备阶段
与“其他派"类似,飞腾派在使用之前都需要准备一块足够容量的内存卡,并将系统镜像烧入到卡中,以启动“派”,飞腾派支持多种操作系统例如操作Ubuntu,Debian、Yocto等开源操作系统,在本系列文章中,选用基于Debian11的飞腾派OS作为主要开发系统。
1.1 基础参数对比
树莓派 | 飞腾派 | |
---|---|---|
SOC | Broadcom BCM2711@1.5GHz,4 Cores, ARM Cortex-A72 | 飞腾CPU@1.8GHz, 4 Cores, FTC-664(兼容ARM-V8) |
RAM | 2GB/ 4GB/8GB | 4GB |
网络 | 单网口/双频WIFI | 双网口/双频WIFI |
多媒体 | 双micros-HDMI | 标准HDMI,MINI-PCIE拓展 |
外围设备 | USB2.0 x 2, USB3.0 x 2 | USB2.0 x 2, USB3.0 x 2 |
电源 | Type-C 5V 3A | 12V-3A |
操作系统 | Raspibian(基于Debian) | 飞腾(基于Debian) |
1.2 使用如下命令对系统信息进一步查看
查看系统架构
user@phytiumpi:~$ hostnamectl
Static hostname: phytiumpi
Icon name: computer
Machine ID: 1c98bbb569fa4f01b73f2447ecd2d2e2
Boot ID: ef1df45d68604d07b574c36010750560
Operating System: Phytium Pi
Kernel: Linux 5.10.153-phytium-embeded-2023-v1.0-GA
查看系统版本
user@phytiumpi:~$ cat /etc/os-release
NAME="debian"
VERSION=debian-11
ID=Phytium
VERSION_ID=11
PRETTY_NAME=" Phytium Pi"
VERSION_CODENAME=bullseye
查看CPU核心与内存容量
user@phytiumpi:~$ lscpu
Architecture: aarch64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 3
Vendor ID: 0x70
Model: 4
Stepping: 0x0
CPU max MHz: 1800.0000
CPU min MHz: 187.5000
BogoMIPS: 100.00
L1d cache: 128 KiB
L1i cache: 128 KiB
L2 cache: 1 MiB
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Mmio stale data: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec store bypass: Not affected
Vulnerability Spectre v1: Mitigation; __user pointer sanitization
Vulnerability Spectre v2: Not affected
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid sha3 sha512
user@phytiumpi:~$ free -h
total used free shared buff/cache available
Mem: 3.8Gi 399Mi 3.1Gi 3.0Mi 302Mi 3.2Gi
Swap: 0B 0B 0B
可以看到飞腾派具有4G有效内存,CPU指令集架构为ARM-V8
2. 远程登录
飞腾派系统已安装了OpenSSH,在主机中使用SSH即可登入到飞腾派中,例如:
# default password: user
$ ssh user@192.168.1.2
然而在运行一段时间后由于系统自动进入休眠,ssh会断开连接,因此还需要禁用系统休眠选项
2.1 首先检查休眠状态
$ systemctl status sleep.target
2.2 设置禁止休眠
$ sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
2.3 再次确认
user@phytiumpi:~$ systemctl status sleep.target
● sleep.target
Loaded: masked (Reason: Unit sleep.target is masked.)
Active: inactive (dead)
3. Hello PhytiumPi
设置ssh之后,现在可以愉快的开始学习之旅了。由于飞腾派系统已经安装好GCC套件,因此首先检查系统的gcc版本:
user@phytiumpi:~$ gcc --version
gcc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 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.
开始hello world
user@phytiumpi:~/Documents$ cat hello.cc
#include <iostream>
#include <string>
#include <vector>
int main()
{
std::vector<std::string> msg {"Hello, ", "Phytiumpi"};
for (auto &word : msg) {
std::cout << word;
}
std::cout << std::endl;
return 0;
}
编译并运行
user@phytiumpi:~/Documents$ g++ hello.cc -o hello
user@phytiumpi:~/Documents$ ./hello
Hello, Phytiumpi
4. 小结
本文对飞腾派的硬件与软件系统做了初步的介绍,同时为了更稳定的ssh连接使用,对系统做了一些小的修改。再接下来的文章中,将介绍OpenCV在飞腾派的移植编译与初步使用同时简单介绍一些交叉编译的内容,为机器视觉的学习搭建基础的开发环境。
全部评论