Skip to content

Commit 9c112bf

Browse files
committed
package_tool: document the tools and the packager script
1 parent 5c9bace commit 9c112bf

File tree

3 files changed

+65
-8
lines changed

3 files changed

+65
-8
lines changed

extra/package_tool.sh

+13-8
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22

33
set -e
44

5-
TOOL_NAME=$(basename $1)
6-
VERSION=$2
5+
TOOL_DIR=$(readlink -f ${1:-.})
6+
TOOL_NAME=$(basename $TOOL_DIR)
7+
VERSION=${2:-dev}
78

8-
BASE_DIR=$(readlink -f $(dirname $0)/..)
9-
TOOL_DIR="$BASE_DIR/extra/$TOOL_NAME"
10-
if ! [ -d "$TOOL_DIR" ] || [ -z "$VERSION" ] ; then
11-
echo "Usage: $0 <tool_name> <version>"
9+
if ! [ -f "$TOOL_DIR/go.mod" ] ; then
10+
echo "Not a valid tool directory: $TOOL_DIR"
11+
echo "Usage: $0 [<tool_dir>] [<version>]"
1212
exit 1
1313
fi
1414

15+
BASE_DIR=$(readlink -f $(dirname $0)/..)
1516
DIR=${BASE_DIR}/distrib
1617

1718
hash_file() {
@@ -71,5 +72,9 @@ build_for_arch "linux" "amd64" "x86_64-linux-gnu"
7172
build_for_arch "linux" "arm64" "aarch64-linux-gnu"
7273
build_for_arch "darwin" "amd64" "i386-apple-darwin11"
7374
build_for_arch "windows" "386" "i686-mingw32"
74-
build_json
75-
echo "Build completed for $TOOL_NAME $VERSION: $DIR/$TOOL_NAME-$VERSION.json"
75+
if [ "${VERSION}" == "dev" ] ; then
76+
echo "Build completed for $TOOL_NAME $VERSION in $DIR"
77+
else
78+
build_json
79+
echo "Build completed for $TOOL_NAME $VERSION: $DIR/$TOOL_NAME-$VERSION.json"
80+
fi

extra/sync-zephyr-artifacts/README.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## Sync Zephyr Artifacts tool
2+
3+
This tool fetches the pre-built files that are associated with the current
4+
revision of the Arduino core for Zephyr. This makes it possible to use the
5+
repository as a local core with the Arduino IDE without the need to have the
6+
full Zephyr build system installed and configured.
7+
8+
Pre-built files are generated only for the most recent commits in each branch.
9+
If in doubt, checkout the current version of the branch you are interested in
10+
before running the tool.
11+
12+
### Getting the tool
13+
14+
If you have installed the Arduino IDE and the Arduino core for Zephyr, you can
15+
find the pre-built files in the `.arduino15/packages/arduino/tools/` folder in
16+
your home directory. You can directly use the tool from there.
17+
18+
### Building manually
19+
20+
To build the tool, you need to have the Go programming language installed; make
21+
sure you have the `go` command available in your PATH. Then, use the `go build`
22+
command to build the tool for your platform.
23+
24+
To build the full set of binaries for all platforms, run the `package_tool.sh`
25+
script in the parent directory with `../package_tool.sh`, or provide the path
26+
to this directory as an argument.

extra/zephyr-sketch-tool/README.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## Zephyr Sketch Tool
2+
3+
This tool converts various binary files into a format that can be used
4+
by the Zephyr loader.
5+
6+
The loader expects to find a specific header in a fixed location in the binary
7+
file, with information about the sketch and the build options chosen by the
8+
user. The location of the header was selected so that it affects unused bytes
9+
in the ELF file format; when dealing with binary files, 16 bytes are added at
10+
the beginning to reserve space for the header.
11+
12+
### Getting the tool
13+
14+
If you have installed the Arduino IDE and the Arduino core for Zephyr, you can
15+
find the pre-built files in the `.arduino15/packages/arduino/tools/` folder in
16+
your home directory. You can directly use the tool from there.
17+
18+
### Building manually
19+
20+
To build the tool, you need to have the Go programming language installed; make
21+
sure you have the `go` command available in your PATH. Then, use the `go build`
22+
command to build the tool for your platform.
23+
24+
To build the full set of binaries for all platforms, run the `package_tool.sh`
25+
script in the parent directory with `../package_tool.sh`, or provide the path
26+
to this directory as an argument.

0 commit comments

Comments
 (0)