当前位置:网站首页>树莓派-环境设置和交叉编译
树莓派-环境设置和交叉编译
2022-06-28 01:03:00 【m0_61811389】
一、树莓派VNC Viewer方式的远程连接
1.需要的工具有树莓派,格式化工具,VNC Viewer,镜像烧录工具,远程连接工具
树莓派(官网):https://www.raspberrypi.org/downloads/raspbian/
格式化工具:SDCardFormatterv5(软件)
VNC Viewer(官网):https://www.realvnc.com/en/connect/download/viewer/
镜像烧录工具: Raspberry Pi(软件)
远程连接工具(官网):https://www.chiark.greenend.org.uk/~sgtatham/putty/
如有不明白可以参考:https://blog.csdn.net/qq_43279579/article/details/109142276
2.SD卡格式化
(1)将SD插入到读卡器中,接着将读卡器插到电脑上。
(2)打开格式化工具SDCardFormatterv5。
(3)选择你需要格式化的SD卡。
(4)对弹出的对话框进行选择,选择“是”。
(5)接着会弹出,格式化完成的提示,选择确定,就完成了SD卡的格式化。
3.烧录镜像
(1)打开烧录的工具raspberry pi。
(2)点击“CHOOSE OS”,选择到刚才下载的镜像文件,然后点击“CHOOSE SD CARD” 选择刚才格式化的SD卡,接着就点击WRITE。
(3)接着会弹出一个对话框,选择“Continue/OK”,然后,就开始进行烧录了。
4.配置网络
(1)在电脑上,打开刚才烧录镜像的SD卡。
(2)在boot目录下,建立一个ssh的空文件。
(3)在boot目录下,先建立一个文本文件。
(4)打开文本文件,将下面的内容复制到文本中。
country=CN
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="你的无线网名称"
psk="你的无线网密码"
key_mgmt=WPA-PSK
priority=1
}
(5)将刚才的文本保存,并将名称修改为wpa_supplicant.conf。
(6)取出SD卡,将SD卡插入树莓派中,同时打开手机热点和给树莓派接上电源。
(7)可以在手机上查看得到树莓派的ip地址。
5.putty远程连接
(1)打开putty,在Host Name处,输入刚才查看得到的IP地址,接着选择“open”。
(2)对弹出的对话框进行选择,选择“否”。
(3)输入用户和密码(默认的用户:pi默认的密码:raspberry)。
(4)开启树莓派VNC服务,输入指令(sudo raspi-config),进行树莓派配置。
(5)通过上下键选择“Interfacing Options”,接着左右键选择“Select”。
(6)接着上下键选择“VNC”,左右键选择“Select”。
(7)“would you like the vNc server to be enabled?”–>选择“Yes”。
(8)“The VNC server is enabled”–>回车选择“OK”。
(9)上下键选择“Advanced Options”,左右键选择“Select”。
(10)上下键选择“Resolution”,左右键选择“Select”。
(11)接着是分辨率选择,选择“DMT Mode 16”,接着选择“OK”。
(12)“The resolution is set to DMT mode 16”–>回车选择“OK”。
(13)回到开始,选择“Finish”,完成。
6.VNC Viewer远程界面显示
安装后打开VNC Viewer界面,首先在最上面输入树莓派的IP地址,接着在弹出的界面中输入Username,Password,点击“OK”。
二、assert(断言)
assert()一般被称为断言,它是一个调试程序时经常使用的宏。它定义在<assert.h>头文件中,通常用于判断程序中是否出现了非法的数据,在程序运行时它计算括号内的表达式的值。
需要注意的是,assert()只在Debug版本中有,编译的Release版本则被忽略。
还需要注意的是assert()与asser() 的区别,assert() 是宏,而 assert()是ANSIC标准中规定的函数,它与assert()的功能类似,但是可以应用在Release版本中,使用assert()的缺点是,频繁的调用会极大影响程序的性能,增加额外的开销。
assert 宏的定义如下
#define assert(ignore) ((void)0)
三、树莓派执行.c文件
先用putty连树莓派,然后再用(nano helloworld.c)命令创建文件,用gcc工具编译(gcc helloworld.c)输出用(./a.out)
文件代码如下
#include <assert.h>
#include <stdio.h>
int main()
{
int a;
char str[50];
printf("请输入一个整数值: ");
scanf("%d", &a);
assert(a >= 10);
printf("输入的整数是: %d\n", a);
printf("请输入字符串: ");
scanf("%s", str);
assert(str != NULL);
printf("输入的字符串是: %s\n", str);
return(0);
}
四、用scp 命令,练习在Ubuntu系统与树莓派系统间进行文件复制传输。
1.创建一个example.txt文件

2.输入命令 “sudo nano /etc/ssh/sshd_config”,然后去掉 "PermitRootLogin prohibit-password "之前的注释,保存退出。
错误,先添加输入命令 “systemctl enable ssh.service”,然后重启。用
scp /home/example.txt [email protected]192.168.75.1:/home/JingL //@后自己树莓派的IP地址
将其拷贝在树莓派中
4,在树莓派里ls命令来查看文件里是否有example.txt文件,使用nano example.txt命令打开查看:
ls
nano example.txt
五、参考链接
https://blog.csdn.net/qq_45659777/article/details/125347172?spm=1001.2014.3001.5501
https://blog.csdn.net/qq_43279579/article/details/109142276
边栏推荐
- MFC常用 当前路径
- [block coding] simulation of image block coding based on MATLAB
- isEmpty 和 isBlank 的用法區別
- 【历史上的今天】6 月 15 日:第一个手机病毒;AI 巨匠司马贺诞生;Chromebook 发布
- 【历史上的今天】6 月 16 日:甲骨文成立;微软 MSX 诞生;快速傅里叶变换发明者出生
- [2D code image correction and enhancement] simulation of 2D code image correction and enhancement processing based on MATLAB
- Win11新建不了文本文档?Win11右键无法新建文本文档的解决方法
- Mysql数据库基础:DML数据操作语言
- [JS reverse hundreds of examples] I love to solve 2022 Spring Festival problems and receive red envelopes
- MFC CString互转LPVOID
猜你喜欢

【 amélioration de la correction d'image de Code bidimensionnel】 simulation du traitement d'amélioration de la correction d'image de Code bidimensionnel basée sur MATLAB

在线JSON转PlainText工具

Starting sequence of Turing machine

迪赛智慧数——柱状图(折柱混合图):2021年毕业季租房价格和房租收入比

ROS+Gazebo中红绿黄交通灯如何实现?
![[2D code image correction and enhancement] simulation of 2D code image correction and enhancement processing based on MATLAB](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[2D code image correction and enhancement] simulation of 2D code image correction and enhancement processing based on MATLAB

How does win11 add printers and scanners? Win11 add printer and scanner settings
![[today in history] May 29: the pioneer of sharing software was born; Chromebox launched; VoodooPC founder was born](/img/ba/aa5db22e1391886a4e263d10e5f9f7.png)
[today in history] May 29: the pioneer of sharing software was born; Chromebox launched; VoodooPC founder was born

Win11 ne peut pas faire glisser l'image sur le logiciel de la barre des tâches

Cloud native (30) | kubernetes' app store Helm
随机推荐
Desai wisdom number - histogram (column folding mixed graph): ratio of rental price to rental income in the graduation quarter of 2021
How to use data-driven "customer lifecycle management" to improve lead conversion rate and customer satisfaction?
How to realize red, green and yellow traffic lights in ros+gazebo?
stm32f1中断介绍
Flashtext, a data cleaning tool, has directly increased the efficiency by dozens of times
Is it safe for qiniu to open an account? How do I open an account online?
[today in history] May 31: the father of Amiga was born; The co developer of basic language was born; BlackBerry BBM shutdown
MySQL collection, here are all the contents you want
[today in history] June 8: the father of the world wide web was born; PHP public release; IPhone 4 comes out
Opencv——几何空间变换(仿射变换和投影变换)
【 amélioration de la correction d'image de Code bidimensionnel】 simulation du traitement d'amélioration de la correction d'image de Code bidimensionnel basée sur MATLAB
启牛开户安全吗?怎么线上开户?
【云原生】-Docker安装部署分布式数据库 OceanBase
Mysql查询相关知识(进阶七:子查询
Livedata interview question bank and answers -- 7 consecutive questions for livedata interview~
在线JSON转PlainText工具
There appears to be a failure with your network connection Retrying.
抓包整理外篇fiddler————了解工具栏[一]
[today in history] June 6: World IPv6 launch anniversary; Tetris release; Little red book established
Opencv -- Hough transform and some problems encountered