Skip to main content

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

Project description

oxidizer (arduino-oxidizer)

日本語版が使用できます / Japanese version is avaialble

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
  • 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 <Serial port to write>

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)

English version is available / 英語版が利用できます

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エスケープシーケンスなしで出力を行います。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arduino-oxidizer-1.0.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

arduino_oxidizer-1.0.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file arduino-oxidizer-1.0.0.tar.gz.

File metadata

  • Download URL: arduino-oxidizer-1.0.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for arduino-oxidizer-1.0.0.tar.gz
Algorithm Hash digest
SHA256 280aecb78836b1b9649fc9501dee5ce9a73a4f819cc415dae8792436566134b7
MD5 67cea87d988c389e2432cae856fd3df9
BLAKE2b-256 a5a32215caa5187f228b744b84a258dae862097b01cee698160057d11808626d

See more details on using hashes here.

File details

Details for the file arduino_oxidizer-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: arduino_oxidizer-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for arduino_oxidizer-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 99d729e9a6f9f64e898fa929d9f5bf9d95129f3613698984f9a6f345d4f4feb9
MD5 ca9b56a1fda946e0b6072c4e2497b9f7
BLAKE2b-256 30d9e4d99986f4711b273341afe84b324b92b428d00e88fc5b8081e717024d1f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page