Skip to content

FEATURE: Added arduino CLI support #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

usman1515
Copy link

Improvements

Added a simple, README, Makefile and YAML config file that automate the process of:

  • setting up the tool
  • installing board file
  • compiling and uploading arduino sketch on the board.

@usman1515
Copy link
Author

To be reviewed by @IAmMarcelJung. Can't add him as an assignee hence mentioned here.

@IAmMarcelJung IAmMarcelJung added the enhancement New feature or request label Jan 29, 2025
@IAmMarcelJung IAmMarcelJung self-requested a review January 29, 2025 13:56
@IAmMarcelJung
Copy link
Collaborator

Thanks for this! Will look into it when I have the time :)

Copy link
Collaborator

@IAmMarcelJung IAmMarcelJung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for this! I added some suggestions and remarks. So far I could not test out uploading a firmware, since I don't have the hardware at hand.

Also, I got a lot of errors like /bin/sh: 9: @: not found when running make setup-board-files and also /bin/sh: 5: source: not found when running make setup-arduino-cli this should also be fixed.

# setup and install arduino CLI
setup-arduino-cli:
@ echo " "
[ -d ~/arduino_cli ] || mkdir -p ~/arduino_cli; \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably add a prompt for changing the installation directory?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also see nothing that implements this. Any thoughts?

Comment on lines 23 to 24
- Move to directory `./software/clock_setup_using_arduino_code` which contains
the Makefile required for setup, compilation and uploading the sketch.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Move to directory `./software/clock_setup_using_arduino_code` which contains
the Makefile required for setup, compilation and uploading the sketch.

These files are already in this directory.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still in the latest commits

[ -d ~/arduino_cli ] || mkdir -p ~/arduino_cli; \
cd ~/arduino_cli; \
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh; \
echo "========== Verifying installation..."; \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this layout a standard from somewhere?

If not, what about something like this (also for all others and also the comments):

Suggested change
echo "========== Verifying installation..."; \
echo "===== Verifying installation... ====="; \

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about this formatting? This is also used on multiple occasions

@IAmMarcelJung IAmMarcelJung self-requested a review April 16, 2025 12:59
Copy link
Collaborator

@IAmMarcelJung IAmMarcelJung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor typos :)

- Verify your installation.

```bash
# arduino CLI installation path
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# arduino CLI installation path
# Arduino CLI installation path

# arduino CLI installation path
which arduino-cli

# arduino CLI installed version
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# arduino CLI installed version
# Arduino CLI installed version

[ -d ~/arduino_cli ] || mkdir -p ~/arduino_cli; \
cd ~/arduino_cli; \
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh; \
echo "========== Verifying installation..."; \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about this formatting? This is also used on multiple occasions

Comment on lines 23 to 24
- Move to directory `./software/clock_setup_using_arduino_code` which contains
the Makefile required for setup, compilation and uploading the sketch.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still in the latest commits

# setup and install arduino CLI
setup-arduino-cli:
@ echo " "
[ -d ~/arduino_cli ] || mkdir -p ~/arduino_cli; \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also see nothing that implements this. Any thoughts?

- Run `make setup-arduino-cli` which will install `arduino-cli`.
- Move to directory `./software/clock_setup_using_arduino_code` which contains the Makefile required for setup, compilation and uploading the sketch.
```bash
# install Arduino CLI
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# install Arduino CLI
# Install Arduino CLI

```bash
# install Arduino CLI

# NOTE: the CLI will be installed in the $PATH_INSTALL provided.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# NOTE: the CLI will be installed in the $PATH_INSTALL provided.
# NOTE: The CLI will be installed in the $PATH_INSTALL provided.

@IAmMarcelJung
Copy link
Collaborator

I think something went wrong in the review and it appears two times.

@IAmMarcelJung
Copy link
Collaborator

So I finally checked out your updates locally. Overall its very neat, easy to use and works out-of-the-box. Thanks for that!

When executing make setup-board-files I get some errors like /bin/sh 2: @: not found I'm currently not entirely sure where this originates from. Here is the full output:

$ make setup-board-files

==================== Creating board config file
arduino-cli config init && \
@ echo "==================== Copy file to config folder"; \
[ -d /home/marcel/.arduino15 ] || mkdir -p /home/marcel/.arduino15; \
cp -rv ./arduino-cli.yaml /home/marcel/.arduino15/arduino-cli.yaml && \
@ echo "==================== Update the core index"; \
arduino-cli core update-index && \
@ echo "==================== Search for WCH boards"; \
arduino-cli core search wch && \
@ echo "==================== Install the core"; \
arduino-cli core install WCH:ch32v && \
@ echo "==================== Verify installation"; \
arduino-cli core list && \
@ echo "==================== List all WCH boards"; \
arduino-cli board listall WCH
Config file written to: /home/marcel/.arduino15/arduino-cli.yaml
/bin/sh: 2: @: not found
'./arduino-cli.yaml' -> '/home/marcel/.arduino15/arduino-cli.yaml'
/bin/sh: 5: @: not found
Downloading index: package_index.tar.bz2 downloaded
Downloading index: package_ch32v_index.json downloaded
/bin/sh: 7: @: not found
Downloading missing tool builtin:[email protected]...
builtin:[email protected] downloaded
Installing builtin:[email protected]...
Skipping tool configuration....
builtin:[email protected] installed
ID        Version Name
WCH:ch32v 1.0.4   CH32 MCU EVT Boards

/bin/sh: 9: @: not found
Platform WCH:[email protected] already installed
/bin/sh: 11: @: not found
ID              Installed Latest Name
arduino:avr     1.8.6     1.8.6  Arduino AVR Boards
attiny:avr      1.0.2     1.0.2  ATtiny Microcontrollers
esp32:esp32     3.1.1     3.2.0  esp32
esp8266:esp8266 3.1.2     3.1.2  ESP8266 Boards (3.1.2)
WCH:ch32v       1.0.4     1.0.4  CH32 MCU EVT Boards

/bin/sh: 13: @: not found
Board Name FQBN
CH32V00x   WCH:ch32v:CH32V00x_EVT
CH32V10x   WCH:ch32v:CH32V10x_EVT
CH32V20x   WCH:ch32v:CH32V20x_EVT
CH32V30x   WCH:ch32v:CH32V30x_EVT
CH32X035   WCH:ch32v:CH32X035_EVT

Probably we can ignore it, but it's still better if there are no errors :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants