当前位置:网站首页>【无标题】
【无标题】
2022-06-29 16:16:00 【weixin_45747542】
嵌入式linux及交叉编译练习
一、树莓派嵌入式linux环境配置
1.下载相关工具及系统镜像
前往树莓派官网下载适合当前系统的烧录器,根据提示安装好该烧录器,然后启动。选择所需操作系统,在弹出界面中选择的二项,根据需要选择所需系统。
2.格式化sd卡并将系统镜像烧录至该sd卡
- 将SD插入到读卡器中,接着将读卡器插到电脑上。
- 打开sd卡格式化工具
- 选择需要格式化的SD卡,将该sd卡格式化
- 在烧录器中选择sd卡,开始烧录
3.配置网络
本次使用手机热点,主要步骤如下
1.在电脑上,打开刚才烧录镜像的SD卡
2.在boot目录下,建立一个ssh的空文件
3.在boot目录下,建立文件,文件名命名为wpa_supplicant.conf
country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="无线网名称"
psk="无线网密码"
key_mgmt=WPA-PSK
priority=1
}
4.将SD卡插入树莓派中,同时打开手机热点和给树莓派接上电源
可以在手机上查看得到树莓派的ip地址
二、assert断言练习
1.编写代码
通过ssh登录Linux,通过nano编写代码如下
通过gcc -o hello hello.c编译该文件,然后执行该文件。
2.测试使用
当断言为假时,结果如下
当断言为假时,程序会直接报错退出,后续不会执行。如果断言为真,则后续代码会正常执行
assert断言只在软件的debug中生效,在其他版本中不会生效。合理使用assert可以使得代码更容易调试。
三.交叉编译
1.在github上下载相关工具,下载zip,将其传输至linux或树莓派上,通过unzip命令解压该压缩包。此时进入./tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin,该目录下有我们需要的交叉编译gcc文件。在通过nano ~/.bashrc,在其最后添加PATH=$PATH:~/tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin~处为文件该tools-master文件夹所在目录,然后使用source ~/.bashrc使更改生效。
2.通过ln -s a b创建软连接,a为原文件,b为目标文件,我们需要将树莓派中的wiringpi库在当前系统中的/usr/local/lib/中创建软连接供交叉编译工具使用。
3.通过交叉编译工具编译源文件,通过scp /path/to/source/file [email protected]:/path/to/destination/directory命令将该文件上传至树莓派上运行.
总结
本次主要练习了嵌入式linux的配置及linux相关命令的使用以及交叉编译和assert断言的基本知识。通过本次练习,提高了我对相关知识的熟练程度。
边栏推荐
- Metadata management Apache Atlas Compilation integration deployment and testing
- Sophon Base 3.1 推出MLOps功能,为企业AI能力运营插上翅膀
- What are the financial products suitable for the poor in 2022?
- MySQL cdc jobmanager 中存了哪些比较耗内存的数据呢?
- telnet+ftp 对设备进行 操控 和 升级
- 数学知识复习:第一型曲线积分
- 工具链赋能百家,地平线开启智能驾驶量产的“马太效应”
- 水球图-利用动态波纹展示百分比
- [day 28] given a string s, please judge whether it is a palindrome string | palindrome judgment
- 实践 | 移动端图片上传旋转、压缩的解决方案
猜你喜欢

Sophon kg upgrade 3.1: break down barriers between data and liberate enterprise productivity

In order to prevent being rectified after 00, a company requires employees not to sue the company

MATLAB给数据加噪声/扰动

Profil de risque de monnaie stable: l'usdt et l'USDC sont - ils sûrs?

都3年测试经验了,用例设计还不知道状态迁移法?

Sophon AutoCV:助力AI工业化生产,实现视觉智能感知

迪赛智慧数——其他图表(基本旭日图):毕业演讲高频词

小程序在产业互联网有「大」作为

Science: the interrelated causes and consequences of sleep in the brain

C language -- printf print base prefix
随机推荐
[rust daily] rust 2021 stability
高级性能测试工程师面试必问十大问题
CompletableFuture的入门
The difference between Magento and WordPress
Notice on organizing the declaration of Nanjing innovative products (the first batch) in 2022
稳定币风险状况:USDT 和 USDC 安全吗?
卫龙辣条第三次冲刺上市:业绩增速下滑,刘卫平、刘福平提前套现
新股民如何网上开户?究竟网上开户是否安全么?
DAP大屏主题开发说明
Cv5200 ad hoc network remote WiFi module, UAV wireless image transmission application, HD low delay scheme
技术分享| 融合调度中的广播功能设计
ssl免费证书申请,免费的ssl证书实际效果怎么样啊?
Which parameter is the partition information adjusted? The MySQL source stream API is used, not the table API
STM32 key chattering elimination -- Thinking of entry state machine
Accelerate the implementation of intelligent driving projects? You still lack a truth evaluation system
C language -- printf print base prefix
工具链赋能百家,地平线开启智能驾驶量产的“马太效应”
STM32按键消抖——入门状态机思维
我想网上注册股票开户,如何操作?另外,手机开户安全么?
Key sprite fighting monsters - multi window and multi thread background skills