You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-5
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
# arduino-cslt
2
2
3
3
`arduino-cslt` is a convenient wrapper of [arduino-cli](https://github.com/arduino/arduino-cli), it compiles Arduino sketches outputting a precompiled library under `sketch-dist/` folder created in the current working directory.
4
-
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.
4
+
It generates a README.md file 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.
5
5
6
6
## Prequisites
7
7
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.
@@ -15,7 +15,7 @@ In order to build `arduino-cslt` just use `task go:build`
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:
21
21
```
@@ -28,6 +28,7 @@ sketch-dist/
28
28
│ ├── cortex-m0plus
29
29
│ │ └── libsketch.a
30
30
│ └── libsketch.h
31
+
├── README.md <--contains information regarding libraries and core to install in order to reproduce the original build environment
31
32
└── sketch
32
33
└── sketch.ino <-- the actual sketch we are going to compile with the arduino-cli later
And the content of `sketch-dist/libsketch/extras/result.json` is:
57
73
```json
58
74
{
@@ -80,12 +96,12 @@ And the content of `sketch-dist/libsketch/extras/result.json` is:
80
96
```
81
97
82
98
## How to compile the precompiled sketch
83
-
In order to compile the sketch you have first to install manually the libraries and the core listed in the `sketch-dist/<libsketch>/extras/result.json` file.
84
-
85
-
You can install a library with [`arduino-cli lib install LIBRARY[@VERSION_NUMBER]`](https://arduino.github.io/arduino-cli/latest/commands/arduino-cli_lib_install/).
99
+
In order to compile the sketch you can follow the instructions listed in the `sketch-dist/README.md` file.
86
100
87
101
You can install a core with [`arduino-cli core install PACKAGER:ARCH[@VERSION]`](https://arduino.github.io/arduino-cli/latest/commands/arduino-cli_core_install/).
88
102
103
+
You can install a library with [`arduino-cli lib install LIBRARY[@VERSION_NUMBER]`](https://arduino.github.io/arduino-cli/latest/commands/arduino-cli_lib_install/).
104
+
89
105
After completing that operation you can compile it with:
// createLib function will take care of creating the library directory structure and files required, for the precompiled library to be recognized as such.
275
274
// sketchName is the name of the sketch without the .ino extension. We use this for the name of the lib.
276
275
// buildMcu is the name of the MCU of the board we have compiled for. The library specifications (https://arduino.github.io/arduino-cli/0.20/library-specification/#precompiled-binaries) requires that the precompiled archive is stored inside a folder with the name of the MCU used during the compile.
276
+
// fqbn is required in order to generate the README.md file with instructions.
277
277
// returnJson is the ResultJson object containing informations regarding core and libraries used during the compile process.
278
278
// objFilePaths is a paths.PathList containing the paths.Paths to all the sketch related object files produced during the compile phase.
//create the README.md file containig instructions regarding what commands to run in order to have again a working binary
389
+
// the README.md contains the following:
390
+
readmeMd:=`This package contains firmware code loaded in your product.
391
+
The firmware contains additional code licensed with LGPL clause; in order to re-compile the entire firmware bundle, please execute the following.
392
+
393
+
## Install core and libraries
394
+
`+strings.Join(readmeContent, "\n") +"\n"+`
395
+
## Compile
396
+
`+readmeCompile+"\n"
397
+
398
+
readmeMdPath:=rootDir.Join("README.md")
399
+
createFile(readmeMdPath, readmeMd)
400
+
376
401
// run gcc-ar to create an archive containing all the object files except the main.cpp.o (we don't need it because we have created a substitute of it before ⬆️)
377
402
// we exclude the main.cpp.o because we are going to link the archive libsketch.a against sketchName.ino
0 commit comments