0
点赞
收藏
分享

微信扫一扫

API安全之《大话:API的前世今生》

钵仔糕的波波仔 2023-10-31 阅读 35

官方文档:https://esp-rs.github.io/book/introduction.html

安装 rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

工具

cargo install espup

espup install
会在 /home/你的用户名/ 下生成一个 esport-esp.sh,如果要对工程运行 cargo build 或 cargo run 就需要提前引入到命令行里
建议在 ~/.bashrc 的最后新加一行 . $HOME/export-esp.sh

cargo install ldproxy
cargo install cargo-generate

sudo apt install libudev-dev
cargo install espflash

创建模板工程

使用 std 方式,不使用 no_std,std 依赖 esp-idf,但不需要手动下载,会在第一次编译时下载
riscv 和 xtensa 架构的都可以,支持列表看官方文档

cargo generate esp-rs/esp-idf-template cargo
输入工程名
根据实际选择
    Which MCU to target? · esp32s3
    Configure advanced template options? · false

cd 到工程里
cargo build
第一次会在工程里下载 .embuild/espressif/esp-idf,可能会不断因网络问题失败,再执行。
可能会提示 xtensa-esp32s3-elf-12.2.0_20230208-x86_64-linux-gnu.tar.xz 下载不下来,可以手动下载到 .embuild/espressif/dist 里。
可能会提示 git submodule update --init --recursive,就到 .embuild/espressif/esp-idf/v5.1.1 里执行一下。

将 esp32s3 连接到电脑上,并把串口的权限改为 777。假设串口是 /dev/ttyACM0,就执行 sudo chmod 777 /dev/ttyACM0
cargo run
会让选择是哪个串口,选择对应的串口
会出现 Remember this serial port for future use?,输入 y。这会让 espflash 记住这个配置,之后可以手动直接打开串口监控
就会下载程序到 esp32 里并打开串口监控

手动打开串口监控:espflash monitor

cargo run 包含 cargo build 的操作。build 会检查 esp-idf,如果连不上 github/esp…仓库会报错。vscode 的 rust-analyzer 也会因这个原因出问题

其他

可能会用到的命令:

git submodule update --init --recursive
git clone --recursive --depth 1 --shallow-submodules --branch master https://github.com/espressif/esp-idf.git /media/xiaguangbo/linux_data/project/x/xfoc/project/esp32s3/.embuild/espressif/esp-idf/master
举报

相关推荐

0 条评论