Ubuntu子系统下ESP32的编译环境

Ubuntu子系统下ESP32的编译环境

安装Ubuntu18.04

在开启和关闭windows功能中打开linux子系统选项
在这里插入图片描述
在windows stroe中安装Ubuntu18.04
在这里插入图片描述
新建用户名和密码

更改软件源

备份

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

修改

sudo vim /etc/apt/sources.list

将原有源注释或删除,添加以下源:

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

更新源

sudo apt-get update
sudo apt-get upgrade

设置ESP-IDF工具链

安装编译所需要的依赖库

sudo apt-get install gcc git wget make libncurses-dev flex bison gperf python python-pip python-setuptools python-serial python-cryptography python-future python-pyparsing python-pyelftools

获取工具链

wget https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz

解压

mkdir -p ~/esp
cd ~/esp
tar -xzf ~/Downloads/xtensa-esp32-elf-linux64-1.22.0-80-g6c4433a-5.2.0.tar.gz

添加工具链到环境变量

vim ~/.profile

添加

export PATH="$HOME/esp/xtensa-esp32-elf/bin:$PATH"

更新环境变量

source ~/.profile

在这里插入图片描述

获取ESP-IDF

cd esp
git clone --recursive https://github.com/espressif/esp-idf.git

注意千万不要少了–recursive参数,否则无法获取子模块代码。
将IDF添加到环境变量

vim ~/.profile
export IDF_PATH="$HOME/esp/esp-idf"

编译ESP-IDF

安装python库

python2.7 -m pip install --user -r $IDF_PATH/requirements.txt

复制Demo工程

cp -r $IDF_PATH/examples/get-started/hello_world .  

配置串口

make menuconfig

在这里插入图片描述
在这里插入图片描述

编译

make

烧录

make flash

烧录时,出现以下信息时,需要按下BOOT按键,然后按RESET按键。
在这里插入图片描述

查看监视器

make monitor

在这里插入图片描述

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值