6月24日 PC与嵌入式计算机 参考微处理器与嵌入式系统设计课程内容。介绍计算机的体系结构、组成等。
开发环境及配置 介绍了在VMware中安装Ubuntu20.04LTS的方法
介绍通过运维三大神器之一sed来实现CLI换源操作,对sudo apt update命令作用做了分析介绍
安装openssh服务端,通过xshell、secureCRT、CMD、powershell等工具来实现对linux的访问,此处也介绍了systemctl命令的常用用法status、enabled、start等
介绍cd ls mkdir rm 等文件操作命令及参数
介绍文件权限管理命令chmod以及文件类型判断、文件权限修改等
介绍环境变量的概念,以及影响环境变量的多个配置文件,有系统级和用户级配置文件
介绍tar的归档打包与解包
总结 第一天实习主要工作是配置Linux(Ubuntu)环境,学习并实践Linux常用命令(主要针对的是文件管理的命令)。因为有Linux基础,学习起来相对轻松。
6月25日 vi/vim的安装与使用 vim是Linux命令行最强大的编辑器之一,快捷键操作是它最大的特点。拥有Linux基础不再过多描述这一部分
交叉编译环境的搭建 交叉编译是指在x86的平台上从源代码开始编译适用于arm架构的程序,甚至是x86_64编译arm32的程序。
Ubuntu20.04最小安装缺少基本的C的编译环境,我们可以从apt包管理器下载安装基本的编译环境 #安装为64位的环境 sudo apt install build-essential #若需要32位的函数库支持 sudo apt-get install lib32stdc++6 #为gcc编译32位程序做准备 sudo dpkg --add-architecture i386 sudo apt update sudo apt install gcc-multilib g++-multilib 至此,我们搭建了Ubuntu上编译x86和x86_64位C程序的环境,接下来我们通过SecureFX、winSCP等软件上传开发板的arm下的C语言编译器,并进行如下操作 #此为归档文件,我们用tar命令解包,注意此为绿色软件(已经编译好的二进制文件),为了Linux的使用规范,我们将其解包到/usr/local下,而/usr/local是root用户的目录,普通用户需要sudo权限才能进行写的操作 sudo tar jxvf arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linuxgnu.tar.bz2 -C /usr/local #检查是否安装完成 /usr/local/arm-2014.05/bin/arm-none-linux-gnueabi-gcc -V 至此,我们完成了检查编译环境的搭建,我们使用此环境简单编译hello world程序 /usr/local/arm-2014.05/bin/arm-none-linux-gnueabi-gcc hello.c -o hello 添加环境变量
sudo vim /etc/profile 添加以下内容 export PATH=/usr/local/arm-2014.05/bin:$PATH #使上面修改生效 source /etc/profile 6月24日 通过内核控制LDE亮灭 #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/ioctl.h> #include <unistd.h> int main() { int fd; int ret; fd = open("/dev/leds",O_RDWR); if (-1==fd) { printf("打开设备失败\n"); exit(1); } while(1) { ioctl(fd,0,0); ioctl(fd,1,1); sleep(1); ioctl(fd,1,0); ioctl(fd,0,1); sleep(1); } } #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/ioctl.h> #include <unistd.h> int main() { int fd; int ret; fd = open("/dev/leds",O_RDWR); if (-1==fd) { printf("打开设备失败\n"); exit(1); } while(1) { ioctl(fd,0,0); ioctl(fd,0,1); sleep(1); ioctl(fd,1,0); ioctl(fd,1,1); sleep(1); } } Linux内核编译 Linux内核编译的重点是.config文件的修改,即自己需要选择适合自己机器(开发板)的套件,而我们为了简化难度,.config文件老师已经给出,我们执行下面的命令
...