Initial setup
Install the necessary components and tools
We will use the following tools and components, make sure that they are installed by using the provided instructions.
❎ Install the tools described below.
cargo-edit
cargo-edit provides the cargo rm subcommand which lets you remove dependencies easily from your project if you don't need them anymore:
$ cargo install cargo-edit
cargo-binutils
cargo-binutils provides the cargo size subcommand and requires the llvm-tools-preview component:
$ rustup component add llvm-tools-preview
$ cargo install cargo-binutils
probe-rs
We will use those two tools later:
$ cargo install probe-rs-tools
💡 You might need to install the
libudev-devpackage on Debian and Ubuntu systems forprobe-rsto work.
Create the project
❎ In your git repository, create a tp-led-matrix new library project. Use cargo new --help if you are not sure of the arguments to pass to cargo new to create a library project.
At every step you are expected to check that your project compiles fine and without any warning. It must be kept formatted at all time (using cargo fmt), and you can use cargo clippy to keep it tidy and get advices on what to change.
no_std
Since our program will run in an embedded context, we cannot use the standard library. We must declare in our src/lib.rs file that we do not use any standard library imports.
❎ Add the inner attribute no_std to your library.
Since this attribute applies to the whole library, it must be indicated as follows: #![no_std].