当前位置:网站首页>树莓派-环境设置和交叉编译
树莓派-环境设置和交叉编译
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
边栏推荐
- Solutions to st link USB communication error
- 【历史上的今天】6 月 15 日:第一个手机病毒;AI 巨匠司马贺诞生;Chromebook 发布
- Desai wisdom number - histogram (column folding mixed graph): ratio of rental price to rental income in the graduation quarter of 2021
- LeetCode - Easy - 197
- 【历史上的今天】6 月 18 日:京东诞生;网店平台 Etsy 成立;Facebook 发布 Libra 白皮书
- 【 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
- Starting sequence of Turing machine
- CRF+BiLSTM代码分步骤解读
- 【历史上的今天】6 月 13 日:分组交换网路的“亲子纠纷”;博弈论创始人出生;交互式电视初现雏形
- isEmpty 和 isBlank 的用法区别
猜你喜欢

【历史上的今天】6 月 12 日:美国进入数字化电视时代;Mozilla 的最初开发者出生;3Com 和美国机器人公司合并

Win11 cannot create a new text document? Solution to win11 right click failure to create a new text document
![[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

Interpretation of the source code of scheduledthreadpoolexecutor (II)

被通知裁员后拿到5个offer
![[today in history] June 1: Napster was founded; MS-DOS original author was born; Google sells Google SketchUp](/img/fe/497eab2ac4a762298e71d28ed26e41.png)
[today in history] June 1: Napster was founded; MS-DOS original author was born; Google sells Google SketchUp

isEmpty 和 isBlank 的用法區別

【方块编码】基于matlab的图像方块编码仿真

【历史上的今天】6 月 18 日:京东诞生;网店平台 Etsy 成立;Facebook 发布 Libra 白皮书

英特尔锐炫A380显卡即将在中国面市
随机推荐
ROS+Gazebo中红绿黄交通灯如何实现?
Skills in schematic merging
How to use data-driven "customer lifecycle management" to improve lead conversion rate and customer satisfaction?
Graduation summary
4G-learn from great partners
Résumé de la graduation
批阅2022春季学期课程小论文提交情况
[today in history] June 11: the co inventor of Monte Carlo method was born; Google launched Google Earth; Google acquires waze
[inverted pendulum control] Simulink simulation of inverted pendulum control based on UKF unscented Kalman filter
Mysql查询相关知识(进阶七:子查询
【历史上的今天】6 月 5 日:洛夫莱斯和巴贝奇相遇;公钥密码学先驱诞生;函数语言设计先驱出生
JS implementation of Slide Puzzle verification
There appears to be a failure with your network connection Retrying.
【历史上的今天】6 月 6 日:世界 IPv6 启动纪念日;《俄罗斯方块》发布;小红书成立
【历史上的今天】6 月 18 日:京东诞生;网店平台 Etsy 成立;Facebook 发布 Libra 白皮书
被通知裁员后拿到5个offer
Stm32f1 interrupt introduction
Mysql database foundation: DML data operation language
math_(函数&数列)极限的含义&误区和符号梳理/邻域&去心邻域&邻域半径
11 timers for STM32F103