Git Product home page Git Product logo

ardi's People

Contributors

dependabot[bot] avatar robgonnella avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

tmsbodnar

ardi's Issues

Default ardi.json includes absolute paths, which is problematic when checked in

ardi add build adds entries like this by default to ardi.json:

	"builds": {
		"mpr121_mega": {
			"directory": "/home/egnor/source/machine/arduino/TESTS/mpr121_tester",
			"sketch": "/home/egnor/source/machine/arduino/TESTS/mpr121_tester/mpr121_tester.ino",
			"baud": 115200,
			"fqbn": "arduino:avr:mega",
			"props": {}
		}
	}

Since an ardi.json file is often checked in to source control (e.g. git) and checked out elsewhere, this is problematic since the absolute paths don't work elsewhere.

For me, at least, changing "directory" to "." and "sketch" to a local path seems to work, though this may have other side effects?

list of supported boards not in same order

The list of supported boards is not in the same order. So for manually compiling the number changes.

ardi compile .
instance:<id:1 >
No.        Name                                     FQBN
0          Arduino Nano                             arduino:avr:nano
1          Arduino Leonardo ETH                     arduino:avr:leonardoeth
2          LilyPad Arduino                          arduino:avr:lilypad
3          Arduino/Genuino Mega or Mega 2560        arduino:avr:mega
4          Adafruit Circuit Playground              arduino:avr:circuitplay32u4cat
5          Arduino/Genuino Uno                      arduino:avr:uno
6          Arduino Mega ADK                         arduino:avr:megaADK
7          LilyPad Arduino USB                      arduino:avr:LilyPadUSB
8          Arduino NG or older                      arduino:avr:atmegang
9          Arduino Pro or Pro Mini                  arduino:avr:pro
10         Arduino Mini                             arduino:avr:mini
11         Arduino BT                               arduino:avr:bt
12         Arduino Robot Motor                      arduino:avr:robotMotor
13         Arduino/Genuino Micro                    arduino:avr:micro
14         Arduino Ethernet                         arduino:avr:ethernet
15         Arduino Leonardo                         arduino:avr:leonardo
16         Arduino Gemma                            arduino:avr:gemma
17         Arduino Industrial 101                   arduino:avr:chiwawa
18         Arduino Uno WiFi                         arduino:avr:unowifi
19         Arduino Robot Control                    arduino:avr:robotControl
20         Arduino Yún Mini                         arduino:avr:yunmini
21         Linino One                               arduino:avr:one
22         Arduino Yún                              arduino:avr:yun
23         Arduino Duemilanove or Diecimila         arduino:avr:diecimila
24         Arduino Fio                              arduino:avr:fio
25         Arduino Esplora                          arduino:avr:esplora
26         Arduino Uno WiFi Rev2                    arduino:megaavr:uno2018
27         Arduino Nano Every                       arduino:megaavr:nona4809
ardi compile . --verbose
No.        Name                                     FQBN
0          Arduino/Genuino Uno                      arduino:avr:uno
1          Arduino Yún Mini                         arduino:avr:yunmini
2          LilyPad Arduino USB                      arduino:avr:LilyPadUSB
3          Arduino Leonardo ETH                     arduino:avr:leonardoeth
4          Arduino Mini                             arduino:avr:mini
5          Arduino/Genuino Micro                    arduino:avr:micro
6          Arduino Robot Motor                      arduino:avr:robotMotor
7          Arduino Uno WiFi                         arduino:avr:unowifi
8          Arduino Ethernet                         arduino:avr:ethernet
9          Arduino Industrial 101                   arduino:avr:chiwawa
10         Arduino Fio                              arduino:avr:fio
11         Arduino Gemma                            arduino:avr:gemma
12         Arduino Leonardo                         arduino:avr:leonardo
13         Arduino Esplora                          arduino:avr:esplora
14         Arduino NG or older                      arduino:avr:atmegang
15         Arduino/Genuino Mega or Mega 2560        arduino:avr:mega
16         Linino One                               arduino:avr:one
17         Arduino Mega ADK                         arduino:avr:megaADK
18         Arduino Nano                             arduino:avr:nano
19         Arduino Robot Control                    arduino:avr:robotControl
20         Arduino Yún                              arduino:avr:yun
21         Arduino BT                               arduino:avr:bt
22         Arduino Duemilanove or Diecimila         arduino:avr:diecimila
23         Adafruit Circuit Playground              arduino:avr:circuitplay32u4cat
24         Arduino Pro or Pro Mini                  arduino:avr:pro
25         LilyPad Arduino                          arduino:avr:lilypad
26         Arduino Uno WiFi Rev2                    arduino:megaavr:uno2018
27         Arduino Nano Every                       arduino:megaavr:nona4809

Attaching to board triggers reset

When using the standalone "attach" command, the board is reset every time. This is problematic if you wish to just attach and view logs at a given point in time.

board list missing FQBN

The board list is missing the FQBN

./ardi board list mega
instance:<id:1 >
Board                                             Platform                    FQBN
Arduino Yún                                       arduino:avr
Arduino Uno                                       arduino:avr
Arduino Uno WiFi                                  arduino:avr
Arduino Diecimila                                 arduino:avr
Arduino Nano                                      arduino:avr
Arduino Mega                                      arduino:avr
Arduino MegaADK                                   arduino:avr
Arduino Leonardo                                  arduino:avr
Arduino Leonardo Ethernet                         arduino:avr
Arduino Micro                                     arduino:avr
Arduino Esplora                                   arduino:avr
Arduino Mini                                      arduino:avr
Arduino Ethernet                                  arduino:avr
Arduino Fio                                       arduino:avr
Arduino BT                                        arduino:avr
Arduino LilyPadUSB                                arduino:avr
Arduino Lilypad                                   arduino:avr
Arduino Pro                                       arduino:avr
Arduino ATMegaNG                                  arduino:avr
Arduino Robot Control                             arduino:avr
Arduino Robot Motor                               arduino:avr
Arduino Gemma                                     arduino:avr
Adafruit Circuit Playground                       arduino:avr
Arduino Yún Mini                                  arduino:avr
Arduino Industrial 101                            arduino:avr
Linino One                                        arduino:avr
Arduino Uno WiFi Rev2                             arduino:megaavr
Arduino Nano Every                                arduino:megaavr
atmega168pb-xmini                                 atmel-avr-xminis:avr
atmega328pb-xmini                                 atmel-avr-xminis:avr
atmega328p-xmini                                  atmel-avr-xminis:avr
EMoRo 2560. Board based on ATmega 2560 MCU        emoro:avr

Feature request: Library dependency management

I would love to see something like composer is for PHP but than for Arduino.

Must have.

  • Be able to install a specific version or tag/branch for repeated builds. (composer lock)
  • The option to use custom git repo's

Nice to have

  • composer update like function (based on rules get the latest version)
  • Auto search arduino default libraries like the IDE does. (without giving full repo paths).

This would make the tool very handy for making a CI setup.
Currently i have all my libraries in one big repo. But it's getting way to big to handle. (Not in size but in numbers). And i can only build something with the latest version of my libraries. Updating external libraries is hard/tine consuming. This feature would be able to solve that.

Thanks for taking the time for this. I do not know the language GO. But if i can help with anything (like researching how the arduino ide works let me know.

CONSIDER making the "board log watcher" available outside of attach-and-watch

(Thanks for ardi! It is exactly what I was planning to write, but already written! 🙏)

The "board log watcher" (a trivial arduino-to-host-only serial terminal) is great and exactly ideal for many cases. (More complicated cases, e.g. where input is desired, can use an actual terminal program.)

However at present it's only available in the "attach-and-watch" command, which staples it to various other quite helpful but not always exactly needed behavior. It would be nice to be able to say "ardi output" or something to grab whatever the board is outputting.

This is a low priority nice-to-have, since one can always go use another serial terminal program.

Sketch (.ino) file monitoring isn't working for me in attach-and-watch

(Thanks for ardi! It is exactly what I was planning to write, but already written! 🙏)

As I understand it, ardi attach-and-watch is supposed to monitor the .ino file so if I edit and save, it will rebuild and reflash. However, this doesn't seem to work.

% ardi attach-and-watch -f arduino:avr:uno cap1188_tester.ino
ardi    Compiling...                                  fqbn="arduino:avr:uno" ske
tch=/home/egnor/source/machine/arduino/TESTS/cap1188_tester/cap1188_tester.ino
Sketch uses 5552 bytes (17%) of program storage space. Maximum is 32256 bytes.
Global variables use 532 bytes (25%) of dynamic memory, leaving 1516 bytes for l
ocal variables. Maximum is 2048 bytes.
ardi    Watching /home/egnor/source/machine/arduino/TESTS/cap1188
_tester/cap1188_tester.ino for changes 
ardi    Watching logs...                             
CAP1188 tester running
Product ID: 0x50
Manuf. ID: 0x5D
Revision: 0x83
CAP1188 init done

(The sketch continues running, and I still see output from it as it's generated.) Even though it says "Watching ... for changes", if I go save a change to cap1188_tester.ino in my editor, or even just touch cap1188_tester.ino, nothing happens. (Re-running the ardi attach-and-watch command does pick up the change, of course.)

My system is a relatively ordinary x86-64 desktop running Ubuntu 21.04. Further diagnostics available if it's helpful! I can also try strace and similar to try to see what's going on under the covers.

Successfully but given platform is invalid

 ~/go/bin/ardi init arduino:avr:mega

INFO[0000] Initializing. This may take some time...
instance:<id:1 >
INFO[0000] Installing platforms...
WARN[0001] Failed to install platform                    error="rpc error: code = Unknown desc = finding platform dependencies: platform mega not found in package arduino"

INFO[0001] Successfully initialized!

CONSIDER defaults for sketch/build name

(Thanks for ardi! It is exactly what I was planning to write, but already written! 🙏)

For quick use, it would be great to just say ardi attach-and-watch or ardi build or whatever, without having to specify a build or sketch name.

As a proposal:

  • If only one build is defined, use it
  • If a build named "default" is defined, use it
  • Otherwise, if multiple builds are defined, error (require picking one)
  • If no builds are defined, but there's a sketch matching the current directory name, use it
  • Otherwise, error (require picking something)

Of course a default sketch would still require FQBN selection, but for attach-and-watch or upload, FQBN can be autodetected.

There's some risk here of being "too magical", but I think the proposal above is on the good side of that line. Your opinion is what matters though!

[master] Unable to init / ardi not placed in PATH

I installed ardi on a ubuntu 16.04 server. When i do
/root/go/bin/ardi init

INFO[0000] Initializing. This may take some time...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x53a1fb]

goroutine 22 [running]:
github.com/arduino/go-paths-helper.(*Path).Join(0x0, 0xc0000ad858, 0x1, 0x1, 0xc000236330)
        /root/go/src/github.com/arduino/go-paths-helper/paths.go:83 +0x4b
github.com/arduino/arduino-cli/configs.(*Configuration).LibrariesDir(...)
        /root/go/src/github.com/arduino/arduino-cli/configs/configuration.go:94
github.com/arduino/arduino-cli/commands.createInstance(0xd52ea0, 0xc0001ab530, 0xc0001507e0, 0x0, 0x0, 0xc0000ada00, 0x8ecc4f, 0x127f738, 0xc00003a960, 0x22, ...)
        /root/go/src/github.com/arduino/arduino-cli/commands/instances.go:314 +0x11b
github.com/arduino/arduino-cli/commands.Init(0xd52ea0, 0xc0001ab530, 0xc0001ab560, 0xc0000adb28, 0xc0000adb10, 0xc0001aa660, 0x7fc19f62c008, 0x0, 0xc0001ab560)
        /root/go/src/github.com/arduino/arduino-cli/commands/instances.go:150 +0x314
github.com/arduino/arduino-cli/commands/daemon.(*ArduinoCoreServerImpl).Init(0xc00000fe00, 0xc0001ab560, 0xd577a0, 0xc000236160, 0xc00000fe00, 0x20)
        /root/go/src/github.com/arduino/arduino-cli/commands/daemon/daemon.go:113 +0xf6
github.com/arduino/arduino-cli/rpc/commands._ArduinoCore_Init_Handler(0xc22880, 0xc00000fe00, 0xd564e0, 0xc0000f8180, 0x127f738, 0xc0000fbf00)
        /root/go/src/github.com/arduino/arduino-cli/rpc/commands/commands.pb.go:1394 +0x109
google.golang.org/grpc.(*Server).processStreamingRPC(0xc0000334a0, 0xd5ba60, 0xc0001a4d80, 0xc0000fbf00, 0xc0001aa6f0, 0x1254500, 0x0, 0x0, 0x0)
        /root/go/src/google.golang.org/grpc/server.go:1199 +0xb2e
google.golang.org/grpc.(*Server).handleStream(0xc0000334a0, 0xd5ba60, 0xc0001a4d80, 0xc0000fbf00, 0x0)
        /root/go/src/google.golang.org/grpc/server.go:1279 +0xd30
google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc000035b30, 0xc0000334a0, 0xd5ba60, 0xc0001a4d80, 0xc0000fbf00)
        /root/go/src/google.golang.org/grpc/server.go:710 +0xbb
created by google.golang.org/grpc.(*Server).serveStreams.func1
        /root/go/src/google.golang.org/grpc/server.go:708 +0xa1

Some issues/wishes with compile

The compile commands works for me but it's a bit picky given it you can assumes the ino has the same name as the folder.

This works but gives a strage name as hex file (..arduino.avr.mega.hex) starting with a dot

 ~/go/bin/ardi compile ./ -f arduino:avr:mega:cpu=atmega2560

When the ino is not given it could take the current folder name as ,ino so you can use run ardi compile -f FQBN and it runs

Aso it would be nice if we can do verbose on compile. So we can see whats going on.

Maybe something for a backlog

Custom -D arguments for the compile (I use it for -DDEBUG so i can do a debug vs production build.
Also we should consider saving the default values (FQBN/other arguments in the project file where also the library versions will be stored.

Can't upload to Adafruit Feather nRF52832 board

While ardi can in fact program the Adafruit Circuit Playground "Bluefruit" nRF52840 and thus probably the very similar Feather nRF52840, attempting to upload to the Feather nRF52832 fails with a message about not being able to detect any boards (precise output available on request). Note that the USB-Serial differs significantly between these models, Adafruit's design uses built-in USB on the nRF52840 board but use a CP2104 USB-Serial chip on the nRF52832 board.

This happens even with "-p /dev/ttyUSB0" to point it to the direct serial port (on my Linux host), which seems like it should override detection?

The regular Arduino IDE is able to program this board with no problem, using that serial port.

(Happy to send you some of these boards, or run with more diagnostics or whatnot.)

Ardi deployement error

Hello,
I get an error using "go get github.com/robgonnella/ardi" :
package github.com/robgonnella/ardi/v3/commands: cannot find package "github.com/robgonnella/ardi/v3/commands" in any of: /usr/lib/go-1.7/src/github.com/robgonnella/ardi/v3/commands (from $GOROOT) /home/pi/go/src/github.com/robgonnella/ardi/v3/commands (from $GOPATH)
Raspberry v1
go version go1.7.4 linux/arm

CONSIDER a central (per-user) cache of large items

The .ardi directory in a project is typically quite large, e.g. 295M for a very simple project I just set up. In some cases (such as mine) I may end up with a number of different projects set up on the same machine. It would be nice if common large items could be linked to a central cache directory. (Clearly we'd want to make sure this is only done if they are exactly the same item.)

There are tradeoffs here to be sure (who cleans the cache?), but it is a popular approach taken by some other dependency managers (but not all of them).

I'm feeling the extra pain because I happen to be using this on a Raspberry Pi (among other places)... so I'm having to blow away .ardi directories occasionally to keep the disk from filling.

Custom defines as compile argument

As suggested in #9. It would be nice if we can specify -D arguments so it can use custom defines when we run compile. For example to make a debug build.

CONSIDER allowing baud rate selection for board log monitoring in attach-and-watch

(Thanks for ardi! It is exactly what I was planning to write, but already written! 🙏)

The little mini serial monitor in attach-and-watch is great, especially with how it integrates with the other attach-and-watch functionality (stopping during upload). But it seems to assume 115200 baud? That's a reasonable assumption to be sure but it seems worth adding some sort of configuration parameter (maybe something that can end up in ardi.json?).

This is low priority, since most sensible people use 115200 baud anyway, it's the fastest widely supported serial baud rate. However, it should probably be documented.

Compile HEX without a board

Currently it seems that the arduino board if taken from the attached arduino board. As this is useful for beginners i think it should be possible to define it yourself.

Also it would be useful to only compile to a hex file. Without upload or any attached board.

Additional board URLs not properly registered on "ardi install"

When board URLs are added (via ardi add board-url), corresponding files are added to the package registry. Also, the board URL is added to ardi.json. This works great when first done.

However, when ardi install is done to bring a different workspace up to date with the same ardi.json, the board URL's files aren't downloaded, and setup fails.

% mkdir test
% cd test
% ardi project-init
% ardi add board-url https://www.adafruit.com/package_adafruit_index.json
ardi    Adding board url: https://www.adafruit.com/package_adafruit_index.json
% ardi add platform adafruit:nrf52
ardi    Adding platform: adafruit:nrf52              
Updating index: library_index.json.gz downloaded                                
Updating index: library_index.json.sig downloaded                               
Updating index: package_index.json downloaded                                   
Updating index: package_index.json.sig downloaded                               
Updating index: package_adafruit_index.json downloaded                          
Downloading missing tool builtin:[email protected]...
builtin:[email protected] downloaded                                          
Installing builtin:[email protected]...
builtin:[email protected] installed
Downloading missing tool builtin:[email protected]...
builtin:[email protected] downloaded                                   
Installing builtin:[email protected]...
builtin:[email protected] installed
ardi    Installed Platform: adafruit:nrf52 1.0.0     
ardi    Updated config

% rm -rf .ardi  # reset workspace to prepare for new "install"
% ardi install
ardi    board url already added: https://www.adafruit.com/package_adafruit_index.json 
Updating index: library_index.json.gz downloaded                                
Updating index: library_index.json.sig downloaded                               
Updating index: package_index.json downloaded                                   
Updating index: package_index.json.sig downloaded                               
Downloading missing tool builtin:[email protected]...
builtin:[email protected] downloaded                                          
Installing builtin:[email protected]...
builtin:[email protected] installed
Downloading missing tool builtin:[email protected]...
builtin:[email protected] downloaded                                   
Installing builtin:[email protected]...
builtin:[email protected] installed
Error: finding platform dependencies: package adafruit not found
Usage:
  ardi install [flags]

Flags:
  -h, --help   help for install

Global Flags:
  -q, --quiet     Silence all logs
  -v, --verbose   Print all logs

ardi   Command failed                                error="finding platform dependencies: package adafruit not found"

% ardi add board-url https://www.adafruit.com/package_adafruit_index.json
ardi add board-url https://www.adafruit.com/package_adafruit_index.json
% ardi install
... same error as above ...

% ardi remove board-url https://www.adafruit.com/package_adafruit_index.json
% ardi add board-url https://www.adafruit.com/package_adafruit_index.json   
ardi    Adding board url: https://www.adafruit.com/package_adafruit_index.json
% ardi install
ardi    board url already added: https://www.adafruit.com/package_adafruit_index.json 
Error initializing instance: Loading index file: loading json index file /home/egnor/test/.ardi/package_adafruit_index.json: open /home/egnor/test/.ardi/package_adafruit_index.json: no such file or directory
Error: finding platform dependencies: package adafruit not found
Usage:
  ardi install [flags]

Flags:
  -h, --help   help for install

Global Flags:
  -q, --quiet     Silence all logs
  -v, --verbose   Print all logs

ardi   Command failed                                error="finding platform dependencies: package adafruit not found"

% ardi remove board-url https://www.adafruit.com/package_adafruit_index.json
% ardi add board-url https://www.adafruit.com/package_adafruit_index.json
ardi    Adding board url: https://www.adafruit.com/package_adafruit_index.json
% ardi install
ardi    board url already added: https://www.adafruit.com/package_adafruit_index.json 

ardi    Installed Platform: adafruit:nrf52 1.0.0

Why did it work the second time and not the first after the remove/add cycle? I don't know. But something is surely not right here.

Please CONSIDER FQBN autodetection for attach-and-watch

(Thanks for ardi! It is exactly what I was planning to write, but already written! 🙏)

If I say ardi upload mysketch.ino, and a single board is connected and can be detected, the FQBN is automatically set up:

% ardi upload cap1188_tester.ino          
ardi    Uploading...                                  build=/home/egnor/source/m
achine/arduino/TESTS/cap1188_tester device=/dev/ttyACM0 fqbn="arduino:avr:uno"
ardi    Upload successful                            

That's nifty and handy. However, ardi attach-and-watch mysketch.ino doesn't do this:

% ardi attach-and-watch cap1188_tester.ino                   
ardi    Compiling...                                  fqbn= sketch=/home/egnor/s
ource/machine/arduino/TESTS/cap1188_tester/cap1188_tester.ino
Error: no FQBN provided
Usage:
  ardi attach-and-watch [sketch|build] [flags]

Flags:
  -p, --build-prop stringArray   Specify build property to compiler
  -f, --fqbn string              Specify fully qualified board name
  -h, --help                     help for attach-and-watch
      --port string              The port your arduino board is connected to

Global Flags:
  -q, --quiet     Silence all logs
  -v, --verbose   Print all logs

ardi   Command failed                                error="no FQBN provided"

Be a lot cooler if it did! Especially since attach-and-watch is the sort of thing that gets used interactively in a quick way, so it would be nice to minimize what has to be selected to run it.

build command to run predefined compile commands

In the ardi.json it would be nice if we can define multiple compile commands. Every compile command should get a name. The resulting hex file should include this name so it will not be overwritten by other compile commands.

running ardi build should execute all compile commands in order. As a bonus there could be extra options to run only a subset.

"ardi attach-and-watch" fails on platforms with onboard USB-serial support

Some Arduino platforms (like the Uno) have a dedicated USB-serial chip, so the USB-serial device is consistently present throughout the program-run-reset cycle. However, others (like the Leonardo and Micro) use the same chip for USB-serial and for running Arduino programs, which means that on reset the device goes away (at least momentarily).

The one I'm using now is from Adafruit's "Bluefruit" line of nRF52-based Arduino-compatible boards.

Because the USB-serial device doesn't exist for a moment after programming (until the chip boots and the USB-serial device is recognized by the host), ardi attach-and-watch can fail:

% ardi attach-and-watch
ardi    Using compile opts from build definition: blinky 
ardi    Using baud from build definition: blinky      baud=9600
ardi    Compiling...                                  fqbn="adafruit:nrf52:cplaynrf52840" sketch=blinky.ino
Sketch uses 40596 bytes (4%) of program storage space. Maximum is 815104 bytes.
Global variables use 7140 bytes (3%) of dynamic memory, leaving 230428 bytes for local variables. Maximum is 237568 bytes.
ardi    Compilation successful                        fqbn="adafruit:nrf52:cplaynrf52840" sketch=blinky.ino
ardi    Uploading...                                  build=. device=/dev/ttyACM0 fqbn="adafruit:nrf52:cplaynrf52840"
TOUCH: error during reset: setting DTR to OFF: protocol error
Upgrading target on /dev/ttyACM0 with DFU package /tmp/arduino-sketch-3015A9A7226BD79EC290418CB735FCEF/bluefruit.ino.zip. Flow control is disabled, Single bank, Touch disabled
########################################
########################################
Activating new firmware
Device programmed.
ardi    Upload successful                             build=. device=/dev/ttyACM0 fqbn="adafruit:nrf52:cplaynrf52840"
ardi    Watching blinky.ino for changes              
ardi    Attaching to port                             port=/dev/ttyACM0
ardi Failed to read from device                    baud=9600 error="no such file or directory" name=/dev/ttyACM0

Note that once the chip boots (mere milliseconds later), the serial device shows up and can be accessed just fine; a separate ardi attach afterward works:

% ardi attach
ardi    Attaching to port                             port=/dev/ttyACM0
Hello!
Hello!
Hello!
...

Probably this is best dealt with by polling for the serial port to exist? Note that if the chip gets reset (e.g. someone hits a reset button) the serial port will wink out of existence for a moment, so it's probably best if after a serial read error "attach" returned to polling for the device? (That's secondary though.)

CONSIDER having attach-and-watch install platforms if needed

Running ardi attach-and-watch seems to install libraries if needed, but if a platform isn't installed, there's an error:

$ ~/go/bin/ardi attach-and-watch cap1188_mega
ardi    Compiling...                                  fqbn="arduino:avr:mega" sketch=cap1188_tester.ino
Downloading missing tool builtin:[email protected]...
builtin:[email protected] downloaded                                                                                       
Installing builtin:[email protected]...
builtin:[email protected] installed
Downloading missing tool builtin:[email protected]...
builtin:[email protected] downloaded                                                                                    
Installing builtin:[email protected]...
builtin:[email protected] installed
Updating index: library_index.json downloaded                                                                                
Updating index: package_index.json downloaded                                                                                
Updating index: package_index.json.sig downloaded                                                                            
Error: platform not installed
Usage:
  ardi attach-and-watch [sketch|build] [flags]

Flags:
  -p, --build-prop stringArray   Specify build property to compiler
  -f, --fqbn string              Specify fully qualified board name
  -h, --help                     help for attach-and-watch
      --port string              The port your arduino board is connected to

Global Flags:
  -q, --quiet     Silence all logs
  -v, --verbose   Print all logs

ardi   Command failed                                error="platform not installed"

Of course this is trivially remedied with a run of ardi install but it would be nifty for attach-and-watch to just Do The Sensible Thing on a machine that hadn't previously been install-ed.

(Of course, it should avoid pinging the network if things are installed, because it might be used offline.)

CONSIDER verifying proper sketch directory layout

See the original bug below; I'd forgotten that the Arduino IDE (and thus the embedded arduino-cli inside ardi) requires a wacky directory layout, and got myself confused. 🤦

CONSIDER: When builds are added, verify that the sketch directory layout matches Arduino expectations, with "sketchname" directory and a "sketchname.ino" file inside it (plus, perhaps, other files). Otherwise, foolish users who forget about Arduino conventions will confuse themselves later when they try to build something and the builder looks for a directoryname.ino file, and also combines all the *.ino files in the directory!

Original report was: Most operations don't work if "dirname.ino" isn't present

(Ardi version 2.4.1)

Unless an .ino file is present that matches the project directory name, most ardi commands (ardi build, etc) fail, even if the build is very explicitly given a different sketch name.

Example:

% cd foo
% ardi project-init
% ardi add platform arduino:avr
... successful output elided ...
% cat > bar.ino
void setup() {
  Serial.begin(115200);
}

void loop() {
  Serial.println("Hello world!");
  delay(500);
}
^D

% ardi add build -f arduino:avr:mega -s bar.ino -n bar
ardi    using parsed baud from sketch                 baud=0
ardi    Addding build: bar                           
ardi                                                 
ardi    bar:                                         
ardi      Directory: .                               
ardi      Sketch: bar.ino                            
ardi      Baud: 115200                                 
ardi      FQBN: arduino:avr:mega                     
ardi      Props:

% ardi build bar
ardi   Compilation failed                            error="opening sketch: no valid sketch found in /home/egnor/foo: missing /home/egnor/foo/foo.ino" fqbn="arduino:avr:mega" sketch=bar.ino
Error: opening sketch: no valid sketch found in /home/egnor/foo: missing /home/egnor/foo/foo.ino
Usage:
... usage message elided ...
ardi   Command failed                                error="opening sketch: no valid sketch found in /home/egnor/foo: missing /home/egnor/foo/foo.ino"

% ardi touch foo.ino
% ardi build bar
ardi    Using compile opts from build definition: bar 
ardi    Compiling...                                  fqbn="arduino:avr:mega" sketch=bar.ino
Sketch uses 1980 bytes (0%) of program storage space. Maximum is 253952 bytes.
Global variables use 200 bytes (2%) of dynamic memory, leaving 7992 bytes for local variables. Maximum is 8192 bytes.
ardi    Compilation successful                        fqbn="arduino:avr:mega" sketch=bar.ino

Given the explicitly specified sketch and build name, it seems like foo.ino based on the directory name shouldn't be needed. (And once it exists, even if completely empty, building "bar" does succeed and uses bar.ino correctly.)

MINOR "ardi list board-platforms" shows lots of duplicates

(Ardi 2.4.1)

When I do a fresh ardi project-init and run ardi list board-platforms I see a list with lots of duplicate entries:

Board                                             Platform
Adafruit Circuit Playground                       arduino:avr
Adafruit Circuit Playground                       arduino:avr
Adafruit Circuit Playground                       arduino:avr
Adafruit Circuit Playground                       arduino:avr
Adafruit Circuit Playground                       arduino:avr
Adafruit Circuit Playground                       arduino:avr
Adafruit Circuit Playground                       arduino:avr
Adafruit Circuit Playground                       arduino:avr
Adafruit Circuit Playground                       arduino:avr
Adafruit Circuit Playground                       arduino:avr
Adafruit Circuit Playground                       arduino:avr
Adafruit Circuit Playground Express               arduino:samd
Adafruit Circuit Playground Express               arduino:samd
Adafruit Circuit Playground Express               arduino:samd
Adafruit Circuit Playground Express               arduino:samd
Adafruit Circuit Playground Express               arduino:samd
Adafruit Circuit Playground Express               arduino:samd
... long list omitted ...
atmega328p-xmini                                  atmel-avr-xminis:avr
atmega328p-xmini                                  atmel-avr-xminis:avr
atmega328p-xmini                                  atmel-avr-xminis:avr
atmega328p-xmini                                  atmel-avr-xminis:avr
atmega328pb-xmini                                 atmel-avr-xminis:avr
atmega328pb-xmini                                 atmel-avr-xminis:avr
atmega328pb-xmini                                 atmel-avr-xminis:avr
atmega328pb-xmini                                 atmel-avr-xminis:avr
littleBits w6 Arduino module                      littleBits:avr

Seems like these ought to be de-duped for display?

CONSIDER a command like "ardi compile-and-upload"?

I continue to use and love Ardi!! 🙏 I am recommending it to everyone!

A very very common use case is to run ardi compile followed by ardi upload. If one is not careful, it's easy to forget the compile step, or not notice a failure, and upload an old firmware image from a previous compilation.

Possibilities:

  • Add an ardi compile-and-upload command (that takes the union of both steps options), which can become the standard thing to run for programming (similar to attach-and-watch).
  • Make ardi upload complain (perhaps even fail) if the firmware image is older than the source .ino file (and its dependencies??).
  • Or maybe even make ardi upload always build as needed??

CONSIDER wrapping console output to 80 characters

(Thanks for ardi! It is exactly what I was planning to write, but already written! 🙏)

This is minor and please feel free to ignore (not meaning to start a holy war), but on my regular xterms, ardi's output looks like this:

% ardi attach-and-watch --help

Compile, upload, watch board logs, and watch for sketch changes. Updates to the 
sketch file will trigger automatic recompile, reupload, and restarts the board l
og watcher. If the sketch argument matches a user defined build in ardi.json, th
e build values will be used for compilation, upload, and watch path

...

... which is a bit unattractive and hard to read, compared to word-wrapped text. Maybe you run everything in some terminal environment that always word-wraps?

CONSIDER log output when platforms are installed

(This is EXTREMELY minor!)

There's log output when libraries are installed, but not platforms. So if you do an ardi install, you might get this:

$ ~/go/bin/ardi install
ardi    Installed library: Adafruit CAP1188 Library 1.0.2 

In reality it also installed the arduino:avr platform, which is why the command took as long as it did. This is mainly good for clarity, especially about running time.

Question about the used compile tool version

When u use the arduino IDE u have version like 0.x 1.x 1.6.x 1.8.x. What version is used when u do a ardi init and is it possible to define this version?

I have had projects that did not work on specific versions of the arduino build tools. So this is maybe also something to consider.
I do not think it's needed to have several versions installed at the same time. But it would be a nice to have 😅

WatchSketch is deadlock susceptible (uses fsnotify without separate goroutine)

According to howeyc/fsnotify#7, fsnotify/fsnotify#55 and https://github.com/fsnotify/fsnotify#faq, callers need to start a separate goroutine to select on watcher events (vs where fsnotify.NewWatcher() is called). However, currently WatchSketch() is selecting events in the same thread where the watcher is created, which (apparently) may deadlock.

Disclaimer: I am not very go-literate, so, could easily be misunderstanding things somehow.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.