python for arduino_arduino-oxidizer-一个python工具,用于为Arduino构建Rust项目并编写它。-loxygen Installation How to u...-程序员宅基地

技术标签: python for arduino  

作者:loxygen

### 作者邮箱:[email protected]

### 首页:https://github.com/loxygenK/oxidizer

### 文档:None

### 下载链接

# oxidizer (arduino-oxidizer)

A python tool to build Rust project for Arduino and write it.

Installation

Requirements

python3

pip

cargo

A rust project configurated to build for Arduino, or an elf file to write

If you need to make a project for it, a template loxygenK/arduino-on-rust_template is available.

avrdude

Installation

You can install oxidizer withpip

pip install arduino-oxidizer

Note: The package's name to install is arduino-oxidizer, not oxidizer.

How to use

Build and write a Cargo project configured for Arduino

Oxidizer builds the project using cargo, and write to Arduino. The target ELF file is searched based on cargo.toml.

oxidizer

example

$ cd /path/to/cargo/projects/root

$ oxidizer /dev/ttyUSB0

[i] Building 'some-nice-project' ...

[i] >> cargo build

Updating crates.io index

Finished dev [unoptimized + debuginfo] target(s) in 2.30s

[v] Building succeeded! Writing to Arduino...

[i] >> avrdude -C/etc/avrdude.conf -patmega328p -carduino -P/dev/ttyUSB0 -Uflash:w:target/avr-atmega

328p/debug/some-nice-project.elf:e

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

/* ...... */

avrdude: 4982 bytes of flash verified

avrdude: safemode: Fuses OK (E:00, H:00, L:00)

avrdude done. Thank you.

[v] All works done!

Build and write in release mode

Run with the option --release (-r) , to build in release mode.

$ cd /path/to/cargo/projects/root

$ oxidizer /dev/ttyUSB0 -r

[i] Building 'some-nice-project' in release mode...

[i] >> cargo build --release

Updating crates.io index

Finished release [optimized] target(s) in 2.42s

/* ...... */

avrdude done. Thank you.

[✓] All works done!

Write your own ELF file

Run with the option --skip-cargo (-s) and --elf-path (-e) , to skip building a cargo project, and write your own ELF file to Arduino.

$ oxidizer --skip-cargo --elf-path my_own_elf_file.elf /dev/ttyUSB0

[i] >> avrdude -C/etc/avrdude.conf -patmega328p -carduino -P/dev/ttyUSB0 -Uflash:w:my_own_elf_file.elf:e

avrdude: AVR device initialized and ready to accept instructions

/* ...... */

avrdude done. Thank you.

[✓] All works done!

Other options

Various options is available:

$ oxidizer --help

usage: oxidizer [-h] [--release] [--cargo-option [Option [Option ...]]]

[--avrdude-option [Option [Option ...]]] [--avrdude-override] [--avrdude-quite]

[--skip-cargo] [--elf-path ELF_PATH] [--no-color]

target

A building helper for the Rust project for Arduino.

positional arguments:

target Specify the serial port to write.

optional arguments:

-h, --help show this help message and exit

--release, -r Let cargo build in release mode

--cargo-option [Option [Option ...]], -c [Option [Option ...]]

Pass options to cargo. Type without '-'!

--avrdude-option [Option [Option ...]], -a [Option [Option ...]]

Pass options to avrdude. Type without '-'!

--avrdude-override, -A

override avrdude's option. Use with '-a'

--avrdude-quite, -q Use -q option when avrdude.

--skip-cargo, -s Skip building using cargo.

--elf-path ELF_PATH, -e ELF_PATH

Specify ELF file's path. Use target/avr-

atmega328p/{debug,release}/{package_name}.elf as default.

--no-color Disable color output.

| Option | Abbreviation | Arguments | Description | | -------------------- | ------------ | ------------------------------------------------------- | ------------------------------------------------------------ | | --release | -r | Nothing | Build the cargo project in release mode.

Cannot be used with --skip-cargo. | | --cargo-option | -c | Options to pass to cargo

(enumerate without-) | Run cargo with additional options. | | --avrdude-option | -a | Options to pass to avrdude

(enumerate without-) | Run avrdude with additional options. | | --avrdude-override | -A | Nothing | Replace the default options to pass to avrdude with the options specified in --avrdude-option. | | --skip-cargo | -s | Nothing | Skip building a cargo project. Use with--elf-path. | | --elf-path | -e | The ELF file to write | Specify the ELF file's path to write. | | --no-color | Nothing | Nothing | Print logs without ASCII espace sequences. |

oxidizer (arduino-oxidizer)

Pythonで作成された、Rustで書かれたArduinoプロジェクトをビルド・書き込むためのツールです。

インストール

必要なもの

python3

pip

cargo

Arduino用にビルドできるように構成されたRustのプロジェクト または書き込みたいelfファイル

avrdude

インストール

pipでインストールできます:

pip install arduino-oxidizer

注意: インストールするパッケージ名はoxidizerではなくarduino-oxidizerです。

使い方

Arduino用に構成されたCargoプロジェクトをビルド・書き込み

oxidizerは、cargoを用いてビルドを行い、avrdudeを用いてArduinoへ書き込みを行います。 書き込むELFファイルはCargo.tomlから読み込んだプロジェクト名を元に検索されます。

oxidizer

$ cd /path/to/cargo/projects/root

$ oxidizer /dev/ttyUSB0

[i] Building 'some-nice-project' ...

[i] >> cargo build

Updating crates.io index

Finished dev [unoptimized + debuginfo] target(s) in 2.30s

[v] Building succeeded! Writing to Arduino...

[i] >> avrdude -C/etc/avrdude.conf -patmega328p -carduino -P/dev/ttyUSB0 -Uflash:w:target/avr-atmega

328p/debug/some-nice-project.elf:e

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

/* ...... */

avrdude: 4982 bytes of flash verified

avrdude: safemode: Fuses OK (E:00, H:00, L:00)

avrdude done. Thank you.

[v] All works done!

Cargoプロジェクトをリリースモードでビルド・書き込み

--release(-r)をつけて実行すると、リリースモードでビルドされます。

$ cd /path/to/cargo/projects/root

$ oxidizer /dev/ttyUSB0 -r

[i] Building 'some-nice-project' in release mode...

[i] >> cargo build --release

Updating crates.io index

Finished release [optimized] target(s) in 2.42s

/* ...... */

avrdude done. Thank you.

[✓] All works done!

自作のELFファイルを書き込む

--skip-cargo(-s)と--elf-path(-e)を指定して実行すると、Cargoプロジェクトのビルドをスキップし、自作のELFファイルを書き込むことができます。

$ oxidizer --skip-cargo --elf-path my_own_elf_file.elf /dev/ttyUSB0

[i] >> avrdude -C/etc/avrdude.conf -patmega328p -carduino -P/dev/ttyUSB0 -Uflash:w:my_own_elf_file.elf:e

avrdude: AVR device initialized and ready to accept instructions

/* ...... */

avrdude done. Thank you.

[✓] All works done!

他のオプション

様々なオプションを利用できます:

$ oxidizer --help

usage: oxidizer [-h] [--release] [--cargo-option [Option [Option ...]]]

[--avrdude-option [Option [Option ...]]] [--avrdude-override] [--avrdude-quite]

[--skip-cargo] [--elf-path ELF_PATH] [--no-color]

target

A building helper for the Rust project for Arduino.

positional arguments:

target Specify the serial port to write.

optional arguments:

-h, --help show this help message and exit

--release, -r Let cargo build in release mode

--cargo-option [Option [Option ...]], -c [Option [Option ...]]

Pass options to cargo. Type without '-'!

--avrdude-option [Option [Option ...]], -a [Option [Option ...]]

Pass options to avrdude. Type without '-'!

--avrdude-override, -A

override avrdude's option. Use with '-a'

--avrdude-quite, -q Use -q option when avrdude.

--skip-cargo, -s Skip building using cargo.

--elf-path ELF_PATH, -e ELF_PATH

Specify ELF file's path. Use target/avr-

atmega328p/{debug,release}/{package_name}.elf as default.

--no-color Disable color output.

| オプション | 省略形 | 引数 | 説明 | | -------------------- | ------ | -------------------------------------- | ------------------------------------------------------------ | | --release | -r | なし | Cargoプロジェクトをリリースモードでビルドします。

--skip-cargoと同時に指定することはできません。 | | --cargo-option | -c | Cargoに渡すオプション(-なしで列挙) | Cargoでビルドする際に、追加でオプションをつけて実行します。 | | --avrdude-option | -a | avrdudeに渡すオプション(-なしで列挙) | avrdudeでビルドする際に、追加でオプションをつけて実行します。 | | --avrdude-override | -A | なし | avrdudeでビルドする際、規定のコマンドを--avrdude-optionで指定されたものに置き換えます。 | | --skip-cargo | -s | なし | Cargoでのビルドをスキップします。

--elf-pathと一緒に使用します。 | | --elf-path | -e | Arduinoに書き込むELFファイルへのパス | 書き込むELFファイルのパスを指定します。 | | --no-color | なし | なし | ASCIIエスケープシーケンスなしで出力を行います。 |

Copy from pypi.org

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_30350469/article/details/112042655

智能推荐

JWT(Json Web Token)实现无状态登录_无状态token登录-程序员宅基地

文章浏览阅读685次。1.1.什么是有状态?有状态服务,即服务端需要记录每次会话的客户端信息,从而识别客户端身份,根据用户身份进行请求的处理,典型的设计如tomcat中的session。例如登录:用户登录后,我们把登录者的信息保存在服务端session中,并且给用户一个cookie值,记录对应的session。然后下次请求,用户携带cookie值来,我们就能识别到对应session,从而找到用户的信息。缺点是什么?服务端保存大量数据,增加服务端压力 服务端保存用户状态,无法进行水平扩展 客户端请求依赖服务.._无状态token登录

SDUT OJ逆置正整数-程序员宅基地

文章浏览阅读293次。SDUT OnlineJudge#include<iostream>using namespace std;int main(){int a,b,c,d;cin>>a;b=a%10;c=a/10%10;d=a/100%10;int key[3];key[0]=b;key[1]=c;key[2]=d;for(int i = 0;i<3;i++){ if(key[i]!=0) { cout<<key[i.

年终奖盲区_年终奖盲区表-程序员宅基地

文章浏览阅读2.2k次。年终奖采用的平均每月的收入来评定缴税级数的,速算扣除数也按照月份计算出来,但是最终减去的也是一个月的速算扣除数。为什么这么做呢,这样的收的税更多啊,年终也是一个月的收入,凭什么减去12*速算扣除数了?这个霸道(不要脸)的说法,我们只能合理避免的这些跨级的区域了,那具体是那些区域呢?可以参考下面的表格:年终奖一列标红的一对便是盲区的上下线,发放年终奖的数额一定一定要避免这个区域,不然公司多花了钱..._年终奖盲区表

matlab 提取struct结构体中某个字段所有变量的值_matlab读取struct类型数据中的值-程序员宅基地

文章浏览阅读7.5k次,点赞5次,收藏19次。matlab结构体struct字段变量值提取_matlab读取struct类型数据中的值

Android fragment的用法_android reader fragment-程序员宅基地

文章浏览阅读4.8k次。1,什么情况下使用fragment通常用来作为一个activity的用户界面的一部分例如, 一个新闻应用可以在屏幕左侧使用一个fragment来展示一个文章的列表,然后在屏幕右侧使用另一个fragment来展示一篇文章 – 2个fragment并排显示在相同的一个activity中,并且每一个fragment拥有它自己的一套生命周期回调方法,并且处理它们自己的用户输_android reader fragment

FFT of waveIn audio signals-程序员宅基地

文章浏览阅读2.8k次。FFT of waveIn audio signalsBy Aqiruse An article on using the Fast Fourier Transform on audio signals. IntroductionThe Fast Fourier Transform (FFT) allows users to view the spectrum content of _fft of wavein audio signals

随便推点

Awesome Mac:收集的非常全面好用的Mac应用程序、软件以及工具_awesomemac-程序员宅基地

文章浏览阅读5.9k次。https://jaywcjlove.github.io/awesome-mac/ 这个仓库主要是收集非常好用的Mac应用程序、软件以及工具,主要面向开发者和设计师。有这个想法是因为我最近发了一篇较为火爆的涨粉儿微信公众号文章《工具武装的前端开发工程师》,于是建了这么一个仓库,持续更新作为补充,搜集更多好用的软件工具。请Star、Pull Request或者使劲搓它 issu_awesomemac

java前端技术---jquery基础详解_简介java中jquery技术-程序员宅基地

文章浏览阅读616次。一.jquery简介 jQuery是一个快速的,简洁的javaScript库,使用户能更方便地处理HTML documents、events、实现动画效果,并且方便地为网站提供AJAX交互 jQuery 的功能概括1、html 的元素选取2、html的元素操作3、html dom遍历和修改4、js特效和动画效果5、css操作6、html事件操作7、ajax_简介java中jquery技术

Ant Design Table换滚动条的样式_ant design ::-webkit-scrollbar-corner-程序员宅基地

文章浏览阅读1.6w次,点赞5次,收藏19次。我修改的是表格的固定列滚动而产生的滚动条引用Table的组件的css文件中加入下面的样式:.ant-table-body{ &amp;amp;::-webkit-scrollbar { height: 5px; } &amp;amp;::-webkit-scrollbar-thumb { border-radius: 5px; -webkit-box..._ant design ::-webkit-scrollbar-corner

javaWeb毕设分享 健身俱乐部会员管理系统【源码+论文】-程序员宅基地

文章浏览阅读269次。基于JSP的健身俱乐部会员管理系统项目分享:见文末!

论文开题报告怎么写?_开题报告研究难点-程序员宅基地

文章浏览阅读1.8k次,点赞2次,收藏15次。同学们,是不是又到了一年一度写开题报告的时候呀?是不是还在为不知道论文的开题报告怎么写而苦恼?Take it easy!我带着倾尽我所有开题报告写作经验总结出来的最强保姆级开题报告解说来啦,一定让你脱胎换骨,顺利拿下开题报告这个高塔,你确定还不赶快点赞收藏学起来吗?_开题报告研究难点

原生JS 与 VUE获取父级、子级、兄弟节点的方法 及一些DOM对象的获取_获取子节点的路径 vue-程序员宅基地

文章浏览阅读6k次,点赞4次,收藏17次。原生先获取对象var a = document.getElementById("dom");vue先添加ref <div class="" ref="divBox">获取对象let a = this.$refs.divBox获取父、子、兄弟节点方法var b = a.childNodes; 获取a的全部子节点 var c = a.parentNode; 获取a的父节点var d = a.nextSbiling; 获取a的下一个兄弟节点 var e = a.previ_获取子节点的路径 vue