Skip to content

rename cslt-tool to arduino-cslt #13

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

Merged
merged 1 commit into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cslt-tool
arduino-cslt
.vscode
lib*
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# cslt-tool
# arduino-cslt

`cslt-tool` is a convenient wrapper of [arduino-cli](https://github.com/arduino/arduino-cli), it compiles Arduino sketches outputting a precompiled library in the current working directory.
`arduino-cslt` is a convenient wrapper of [arduino-cli](https://github.com/arduino/arduino-cli), it compiles Arduino sketches outputting a precompiled library in the current working directory.
It generates a json file in the `extras/` folder that contains information regarding libraries and core to use in order to build the sketch. The result is achieved by parsing the verbose output of `arduino-cli` and by using [GNU ar](https://sourceware.org/binutils/docs/binutils/ar.html) to generate an archive of the object files.

## Prequisites
In order to run this tool you have to install first the [Arduino CLI](https://github.com/arduino/arduino-cli) and have `arduino-cli` binary in your `$PATH`, otherwise `cslt-tool` won't work.
In order to run this tool you have to install first the [Arduino CLI](https://github.com/arduino/arduino-cli) and have `arduino-cli` binary in your `$PATH`, otherwise `arduino-cslt` won't work.
Please use a version of the Arduino CLI that has [this](https://github.com/arduino/arduino-cli/pull/1608) change (version > 0.20.2).

Another requirement is [`gcc-ar`](https://sourceware.org/binutils/docs/binutils/ar.html) (installable with `apt-get install gcc`) in your `$PATH`.

## Build it
In order to build `cslt-tool` just use `go build`
In order to build `arduino-cslt` just use `go build`

## Usage
`./cslt-tool compile -b <fqbn> <sketch_path>`
`./arduino-cslt compile -b <fqbn> <sketch_path>`

[![asciicast](https://asciinema.org/a/463342.svg)](https://asciinema.org/a/463342)

For example, running `./cslt-tool compile -b arduino:samd:mkrwifi1010 sketch/sketch.ino` should produce a library with the following structure, in the current working directory:
For example, running `./arduino-cslt compile -b arduino:samd:mkrwifi1010 sketch/sketch.ino` should produce a library with the following structure, in the current working directory:
```
libsketch/
├── examples
Expand All @@ -34,7 +34,7 @@ libsketch/

This is an example execution:
```
$ ./cslt-tool compile -b arduino:samd:mkrwifi1010 sketch/sketch.ino
$ ./arduino-cslt compile -b arduino:samd:mkrwifi1010 sketch/sketch.ino
INFO[0000] arduino-cli version: git-snapshot
INFO[0000] GNU ar (GNU Binutils) 2.37
INFO[0000] the ino file path is sketch/sketch.ino
Expand Down Expand Up @@ -90,7 +90,7 @@ After completing that operation you can compile it with:

`arduino-cli compile -b <fqbn> <libsketch>/examples/sketch/sketch.ino --library <libsketch>`.

It's important to use the `--library` flag to include the precompiled library generated with cslt-tool otherwise the Arduino CLI won't find it.
It's important to use the `--library` flag to include the precompiled library generated with arduino-cslt otherwise the Arduino CLI won't find it.

For example a legit execution looks like this:
```
Expand Down
6 changes: 3 additions & 3 deletions cmd/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func compileSketch(cmd *cobra.Command, args []string) {
// remove main.cpp file, we don't need it anymore
removeMainCpp(inoPath)

// restore the sketch content, this allows us to rerun cslt-tool if we want without breaking the compile process
// restore the sketch content, this allows us to rerun arduino-cslt if we want without breaking the compile process
createFile(inoPath, string(oldSketchContent))
logrus.Infof("restored %s", inoPath.String())

Expand Down Expand Up @@ -227,7 +227,7 @@ _loop();
}

// removeMainCpp function, as the name suggests. will remove a main.cpp file inside inoPath
// we do this after the compile has been completed, this way we can rerun cslt-tool again.
// we do this after the compile has been completed, this way we can rerun arduino-cslt again.
// If we do not remove this file and run the compile again it will fail because a main.cpp file with the same definitions is already present
func removeMainCpp(inoPath *paths.Path) {
mainCppPath := inoPath.Parent().Join("main.cpp")
Expand Down Expand Up @@ -316,7 +316,7 @@ author=TODO
maintainer=TODO
sentence=This technically is not a library but a precompiled sketch. The result is produced using ` + os.Args[0] + `
paragraph=
url=https://github.com/arduino/cslt-tool
url=https://github.com/arduino/arduino-cslt
version=1.0.0
precompiled=true`

Expand Down
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "cslt-tool",
Short: "cslt-tool is a command-line tool that uses the Arduino CLI to generate objectfiles and a json file with info regarding core and libraries used",
Use: "arduino-cslt",
Short: "arduino-cslt is a command-line tool that uses the Arduino CLI to generate objectfiles and a json file with info regarding core and libraries used",
}

// Execute adds all child commands to the root command and sets flags appropriately.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module cslt-tool
module arduino-cslt

go 1.17

Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Copyright © 2021 NAME HERE <EMAIL ADDRESS>
*/
package main

import "cslt-tool/cmd"
import "arduino-cslt/cmd"

func main() {
cmd.Execute()
Expand Down