嵌入式Linux(一):东山派壹号 ubuntu开发环境配置
前言
最近要学嵌入式Linux,网上查了下,被价格吓死了,基本上都是四五百或以上。终于找到了东山派壹号这块板子。主板和底板加起来两百多。本文,主要介绍这块板子 嵌入式linux开发环境的搭建,包括相关资料链接,交叉编译环境,tftp上传程序到板子。买板子的时候,建议主板底板都买,因为在上传程序时,需要底板的网路接口。
嵌入式Linux(一):东山派壹号 ubuntu开发环境配置
- 前言
- (一)相关资料链接
- (二)上电连接
- 1. 安装 MobaXterm
- 2. 使用Type-C线连接板子一电脑
- 3.使用Mobaxterm登录串口
- 4.成功界面
- 5.ubuntu minicom 连接开发板
- (三)ubuntu 交叉环境配置
- 1.安装编译需要的lib & tool
- 2.获取源码
- 3.添加环境变量
- 4.测试编译环境
- (四)通过网线连接板子和电脑
- 1.接线
- 2.设置windows 路由 IP
- 3.设置板子路由 IP
- 4.测试网络连通状态
- (五)安装TFTP
- 1.ubuntu 端
- 2.板子端 文件上传下载
- (六)helloworld
- 1.编译hello.c
- 2.ubuntu 测试编译
- 3.交叉编译
- 4.板子通过tftp获取编译后的程序
- 结语
(一)相关资料链接
- 东山派壹号官方文档:https://dongshanpi.com/DongshanPi-One/01-BoardIntroduction/
- MobaXterm可以通过访问页面 https://mobaxterm.mobatek.net/ 获取 (推荐使用)。
- 交叉编译环境配置官方文档 https://dongshanpi.com/DongshanPi-One/05-GetSourceCode/
(二)上电连接
1. 安装 MobaXterm
在连接电脑前,需要安装MobaXterm串口访问软件,可以到https://mobaxterm.mobatek.net/ 下载安装。
2. 使用Type-C线连接板子一电脑
参考
3.使用Mobaxterm登录串口
打开MobaXterm,点击左上角的“Session”,在弹出的界面选中“Serial”,如下图所示选择端口号(前面设备管理器显示的端口号COM21)、波特率(Speed 115200)、流控(Flow Control: none),最后点击“OK”即可。步骤如下图所示。 注意:流控(Flow Control)一定要选择none,否则你将无法在MobaXterm中向串口输入数据 连接
4.成功界面
5.ubuntu minicom 连接开发板
直接参考:ubuntu minicom使用USB串口连接shell(ubuntu下的xshell)
//安装
sudo apt-get install minicom
//修改serial串口
sudo minicom -s
//我的电脑ubuntu18.04,串口号是
/dev/ttyACM0
(三)ubuntu 交叉环境配置
在进行环境配置之前,需要有一个ubuntu18.04的系统环境,可以用VMWARE来跑双系统,也可以安装win10下的ubuntu18.04子系统,我这里使用的是win10的ubuntu子系统。
配置win10 ubuntu子系统 可以参考 https://blog.csdn.net/liangzc1124/article/details/108952232
参考
1.安装编译需要的lib & tool
book@100ask:~$ sudo apt-get install libc6-dev-i386
book@100ask:~$ sudo apt-get install lib32z1 lib32ncurses5
book@100ask:~$ sudo apt-get install libuuid1:i386
book@100ask:~$ sudo apt-get install cmake
book@100ask:~$ sudo apt-get install libncurses5-dev libncursesw5-dev
book@100ask:~$ sudo apt install bc
book@100ask:~$ sudo apt-get install xz-utils
book@100ask:~$ sudo apt-get install automake
book@100ask:~$ sudo apt-get install libtool
book@100ask:~$ sudo apt-get install libevdev-dev
book@100ask:~$ sudo apt-get install pkg-config
book@100ask:~$ sudo apt-get install openssh-server
book@100ask:~$ sudo apt-get install repo
//改sh为bash
book@100ask:~$ sudo rm /bin/sh
book@100ask:~$ sudo ln -s /bin/bash /bin/sh
2.获取源码
book@100ask:~$ git clone https://e.coding.net/codebug8/repo.git
book@100ask:~$ mkdir DongshanPiOne-TAKOYAKI && cd DongshanPiOne-TAKOYAKI
book@100ask:~/DongshanPiOne-TAKOYAKI$ ../repo/repo init -u https://gitee.com/weidongshan/manifests.git -b linux-sdk -m SSD202D/dongshanpi-one_takoyaki_dlc00v030.xml --no-repo-verify
book@100ask:~/DongshanPiOne-TAKOYAKI$ ../repo/repo sync -j4
3.添加环境变量
//打开环境变量文件
book@100ask:~$ vim ~/.bashrc
//在行尾添加或修改,加上下面几行:
export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
export PATH=$PATH:/home/book/DongshanPiOne-TAKOYAKI/gcc-arm-8.2-2018.08-x86_64-arm-linux-gnueabihf/bin
//执行 source ~/.bashrc 命令使其生效
source ~/.bashrc
4.测试编译环境
book@100ask:~$ arm-linux-gnueabihf-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/home/book/DongshanPiOne-TAKOYAKI/gcc-arm-8.2-2018.08-x86_64-arm-linux-gnueabihf/bin/../libexec/gcc/arm-linux-gnueabihf/8.2.1/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: /tmp/dgboter/bbs/bc-b1-2-11--rhe6x86_64/buildbot/rhe6x86_64--arm-linux-gnueabihf/build/src/gcc/configure --target=arm-linux-gnueabihf --prefix= --with-sysroot=/arm-linux-gnueabihf/libc --with-build-sysroot=/tmp/dgboter/bbs/bc-b1-2-11--rhe6x86_64/buildbot/rhe6x86_64--arm-linux-gnueabihf/build/build-arm-linux-gnueabihf/install//arm-linux-gnueabihf/libc --enable-gnu-indirect-function --enable-shared --disable-libssp --disable-libmudflap --disable-libsanitizer --enable-checking=release --enable-languages=c,c++,fortran --with-gmp=/tmp/dgboter/bbs/bc-b1-2-11--rhe6x86_64/buildbot/rhe6x86_64--arm-linux-gnueabihf/build/build-arm-linux-gnueabihf/host-tools --with-mpfr=/tmp/dgboter/bbs/bc-b1-2-11--rhe6x86_64/buildbot/rhe6x86_64--arm-linux-gnueabihf/build/build-arm-linux-gnueabihf/host-tools --with-mpc=/tmp/dgboter/bbs/bc-b1-2-11--rhe6x86_64/buildbot/rhe6x86_64--arm-linux-gnueabihf/build/build-arm-linux-gnueabihf/host-tools --with-isl=/tmp/dgboter/bbs/bc-b1-2-11--rhe6x86_64/buildbot/rhe6x86_64--arm-linux-gnueabihf/build/build-arm-linux-gnueabihf/host-tools --with-arch=armv7-a --with-fpu=neon --with-float=hard --with-arch=armv7-a --with-pkgversion='GNU Toolchain for the A-profile Architecture 8.2-2018-08 (arm-rel-8.23)'
Thread model: posix
gcc version 8.2.1 20180802 (GNU Toolchain for the A-profile Architecture 8.2-2018-08 (arm-rel-8.23))
book@100ask:~$
(四)通过网线连接板子和电脑
1.接线
若你的电脑有RJ45接口,可以用两头RJ45接口的将板子连接电脑,若没有,可以使用USB转RJ45接口来连接电脑。
2.设置windows 路由 IP
ubuntu&windows:192.168.5.10
板子:192.168.5.10
物理连接到板子后,在windows上查看网络连接,
右键,点击状态,然后按下图顺序,设置IP,mask
3.设置板子路由 IP
通过MobaXterm 连接板子,通过下面命令设置IP
//设置
ifconfig eth0 192.168.5.9
//测试
ifconfig
4.测试网络连通状态
在测试之前需要保证,防火墙是关闭的
在板子上输入命令:ping 192.168.5.10
在ubuntu上输入命令:ping 192.168.5.9
(五)安装TFTP
1.ubuntu 端
//安装软件
sudo apt-get install tftp-hpa tftpd-hpa
//然后,创建 TFTP 服务器工作目录,并打开 TFTP 服务配置文件,如下:
mkdir -p /home/book/tftpboot
sudo chmod 777 /home/book/tftpboot
sudo vim /etc/default/tftpd-hpa
//在配置文件/etc/default/tftpd-hpa 中,添加以下字段:
TFTP_DIRECTORY="/home/book/tftpboot"
TFTP_OPTIONS="-l -c -s"
//最后,重启 TFTP 服务:
sudo service tftpd-hpa restart
//查看 tftp 服务是否在运行,运行如下命令,即可查看是否在后台运行。
ps -aux | grep "tftp"
2.板子端 文件上传下载
//嵌入式开发板下载 ubuntu端的
tftp -g -r hello 192.168.5.10//嵌入式开发板发送
tftp -p -l note.txt 192.168.5.10
(六)helloworld
1.编译hello.c
/*hello.c*/
/* 执行命令: ./hello weidongshan* argc = 2* argv[0] = ./hello* argv[1] = weidongshan*/
#include <stdio.h>
int main(int argc, char **argv)
{if (argc >= 2)printf("Hello, %s!\n", argv[1]);elseprintf("Hello, world!\n");return 0;
}
2.ubuntu 测试编译
gcc hello.c -o hello
./hello lingcb
3.交叉编译
//交叉编译
arm-linux-gnueabihf-gcc hello.c -o hello
//移动到ubuntu tftp服务器根目录/home/book/tftpboot
cp hello /home/book/tftpboot
ls /home/book/tftpboot
4.板子通过tftp获取编译后的程序
/home # tftp -g -r hello 192.168.5.10
hello 100% |*******************************| 12052 0:00:00 ETA
/home # chmod 777 ./hello
/home # ./hello
Hello, world!
结语
终于是完成了入门,这些资料主要是参考韦东山老师的视频,文档等资料的,有看不懂的,可以到B站搜索,韦东山linux嵌入式应用。下面是一些资料
【1】嵌入式Linux应用开发完全手册_韦东山全系列视频文档全集V2.4 链接:https://pan.baidu.com/s/1qS0Mo5YVS43wYGZdWq1MmA?pwd=w23p 提取码:w23p
【2】嵌入式Linux教程_韦东山手把手教你嵌入式Linux快速入门到精通https://www.bilibili.com/video/BV1w4411B7a4?spm_id_from=333.337.search-card.all.click
【3】东山Pi壹号-开发板官方文档 https://dongshanpi.com/DongshanPi-One/01-BoardIntroduction/
嵌入式Linux(一):东山派壹号 ubuntu开发环境配置相关推荐
- Ubuntu开发环境配置--- 安装chrome浏览器
Ubuntu开发环境配置--- 安装chrome浏览器 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.c ...
- 嵌入式linux/鸿蒙开发板(IMX6ULL)开发(七)Ubuntu开发环境配置
文章目录 1.配置Ubuntu初始开发环境 2.使用git工具下载源码 3.使用repo工具获取内核以及工具链 3.1 本地下载 3.2 配置repo 3.4 下载源码 3.5 同步最新代码 4.配置 ...
- linux mysql jdk路径配置,Linux下的jdk1.5+eclipse+mysql开发环境配置的经验总结
先说个题外话,由于我一直都是用windows系统,所以很多资料都保存在windows分区.在linux挂载NTFS分区对于我太复杂,所以我就使用了U盘.我想也会有很多朋友和我一样,我就先说一下U盘的使 ...
- Ubuntu开发环境配置(七) 卸载Mysql
前言 在安装Mysql的过程中,因为网络问题,导致安装报错中断,需要完全卸载mysql,进行重装.我的mysql是5.7.x版本. 安装配置过程 一.卸载Mysql 在终端中,输入以下 ...
- 【嵌入式Linux】第一部分 - 玩转Ubuntu
本部分是嵌入式Linux教程的第一部分,Ubuntu基础 这个专栏的主要目的是带大家熟悉基础的Linux操作环境,做到心里有数,同时也是快速入门. 玩转Ubuntu(Linux起源与发展) 玩转Ubu ...
- 基于嵌入式linux电子相册设计,用于LINUX或者嵌入式LINUX的电子相册程序,基于QT开发...
用于LINUX或者嵌入式LINUX的电子相册程序,基于QT开发,包含源代码和编译好的可执行程序 linux_project\album\album.pro .............\.....\al ...
- Linux开发环境配置
一.学习Linux开发的必要性 现在大部分的公司都改用Linux,尤其是银行.可见Linux是相对windows是安全的多.windows不是开源的,也就是你不知道它的源代码,我们无法或者很难在win ...
- Linux 开发环境配置(框架)
Linux 开发环境配置(框架): 一.安装linux 二.配置网络: 1.virtualbox网络配置为桥接模式 2.ifconfig -a 命令 查看网卡的信息 3.配置CentOS网卡 vi / ...
- Linux桌面版安装及开发环境配置
Linux桌面版安装及开发环境配置 1.安装Linux For Desktop 本文所面向对象无非也是和本人一样的技术小白,和windows系统以及mac不同,对于linux系统的选择却也是众说纷纭, ...
最新文章
- AI芯片之争白热化的当下,如何设计一款真正适用于终端的AI芯片?
- typescript继承和重写
- C#:winform使用chart控件绘制折线图,时间轴可缩放
- 2017.9.28 lca 失败总结
- 黄轩成为QQ阅读新代言人 变身“队长”号召网友 “组队读书”
- 9.数据库服务器部署之------3步实现远程访问
- php 中function_PHP中的function函数详解
- Redhat6.8安装docker环境
- qlv视频转换器免费版_推荐几款强大的视频剪辑软件
- 从三个方面理解ARM嵌入式系统
- xp计算机如何共享打印机,在XP系统下怎么设置俩台电脑或多台电脑共享一个打印机?...
- 仁人帮探索大数据技术
- 愿世间所有美好都恰逢其时
- react项目中使用消息订阅(subscribe)-发布(publish)机制
- 接口测试面试题汇总(含答案)
- 8月16最新青龙京东拉库《目前更新的库》
- AVAudioPlayer常用属性
- 基于51单片机电热水壶自动加热水温控制系统(源程序+仿真+论文)
- 响应式报名系统源码(含数据库脚本)
- Final Cut Pro导出视频「下」
热门文章
- 【POJ - 3669】Meteor Shower(bfs)
- 牛人经验0(个人定位 命名风格 编码风格 设计风格)
- 【编程之美】如何将代码写得像诗一样优雅?
- 双硬盘笔记本安装windows+linux双系统
- 实训报告万能模板计算机专业,有关大学生计算机专业实习报告模板
- python怎么画出圆润的曲线_Python如何对折线进行平滑曲线处理?
- python 爬取新浪微博
- 基于unity物体定点移动与模拟刹车的细节 GIF 图文详解——线性差值函数以及平滑阻尼的运用和实践(Lerp AND SmoothDamp)
- 带你了解软件工程中的类与类的关系
- 团体程序设计天梯赛 L2-016. 愿天下有情人都是失散多年的兄妹