Skip to content

Commit 6ac4bf8

Browse files
committed
Use the 'toit' executable instead of the sub-programs.
1 parent ce44d8c commit 6ac4bf8

7 files changed

Lines changed: 40 additions & 47 deletions

File tree

docs/language/index.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ you add to your programs are significant.
4444
<Tab label="toitlang.org">
4545

4646
```txt
47-
$ toit.run hello.toit
47+
$ toit hello.toit
4848
Hello World!
4949
```
5050

51-
What just happened? The `toit.run` command line tool read your source code
51+
What just happened? The `toit` command line tool read your source code
5252
(`hello.toit`) and started running it from the `main` method that you defined.
5353
The `main` method consists of all the indented statements just below the method
5454
declaration line `main:`. Toit is indentation-based like Python, so the spaces
@@ -82,7 +82,7 @@ Hello World!
8282
<Tab label="toitlang.org">
8383

8484
```txt
85-
$ toit.run hello.toit
85+
$ toit hello.toit
8686
Hello World!
8787
Hello World!
8888
```
@@ -138,7 +138,7 @@ Hello Kasper!
138138
<Tab label="toitlang.org">
139139

140140
```txt
141-
$ toit.run hello.toit
141+
$ toit hello.toit
142142
Hello Lars!
143143
Hello Kasper!
144144
```
@@ -195,7 +195,7 @@ Hello Kasper!
195195
<Tab label="toitlang.org">
196196

197197
```txt
198-
$ toit.run hello.toit
198+
$ toit hello.toit
199199
Hello World!
200200
Hello Kasper!
201201
```
@@ -274,7 +274,7 @@ Bye Helena, come back soon.
274274
<Tab label="toitlang.org">
275275

276276
```txt
277-
$ toit.run hello.toit
277+
$ toit hello.toit
278278
Hi Helena!
279279
Bye Helena, come back soon.
280280
```
@@ -403,7 +403,7 @@ The names are [World]
403403
<Tab label="toitlang.org">
404404

405405
```txt
406-
$ toit.run hello.toit
406+
$ toit hello.toit
407407
The names are [World]
408408
```
409409
</Tab>
@@ -459,7 +459,7 @@ Bye World, Lars, Kasper, Rikke, come back soon.
459459
<Tab label="toitlang.org">
460460

461461
```txt
462-
$ toit.run hello.toit
462+
$ toit hello.toit
463463
Hello World!
464464
Bye World, come back soon.
465465
Hello World!

docs/language/package/pkgtutorial.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,14 +365,14 @@ jag run -d host morse_test.toit
365365

366366
```shell
367367
# In the test directory:
368-
toit.pkg init
369-
toit.pkg install --local --name=morse-tutorial ..
368+
toit pkg init
369+
toit pkg install --local --name=morse-tutorial ..
370370
```
371371

372372
The test should then execute successfully by running it locally:
373373

374374
```shell
375-
toit.run morse_test.toit
375+
toit morse_test.toit
376376
```
377377
</Tab>
378378
</Tabs>
@@ -403,7 +403,7 @@ dependencies:
403403
version: ^1.0.0
404404
```
405405
406-
You normally don't need to worry about them, as they are automatically added when running `jag pkg install <dependency>` or `toit.pkg install <dependency>`.
406+
You normally don't need to worry about them, as they are automatically added when running `jag pkg install <dependency>` or `toit pkg install <dependency>`.
407407

408408
## Publishing to the Toit package registry
409409

@@ -423,7 +423,7 @@ Once published successfully, the registry will distribute a description of the p
423423
</Tab>
424424
<Tab label="toitlang.org">
425425

426-
Once published successfully, the registry will distribute a description of the package so that anyone can start using the package with a simple `toit.pkg install`.
426+
Once published successfully, the registry will distribute a description of the package so that anyone can start using the package with a simple `toit pkg install`.
427427
</Tab>
428428
</Tabs>
429429

docs/tutorials/containers/toit-sdk.mdx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,32 @@ Archlinux with `yay -S toit` (in which case the SDK can be found in
1010
[build from source](https://github.com/toitlang/toit). When building
1111
locally, the SDK is located at `build/host/sdk`.
1212

13-
This tutorial assumes that Toit's firmware tool is
14-
available as `firmware`. This tool can be found in the SDK
15-
at `$SDK/tools/firmware`.
13+
This tutorial assumes that Toit's executable is
14+
available as `toit`. This tool can be found in the SDK
15+
at `$SDK/bin/toit`.
1616

1717
It also assumes that a Toit firmware envelope is available as
1818
`firmware.envelope`. In a local build it is located at
1919
`build/esp32/firmware.envelope`. Each Toit release also has
2020
a corresponding firmware envelope available for download
2121
(for example `firmware-esp32.gz`).
2222

23-
Finally, it assumes that the Toit compiler is available as `toit.compile`.
24-
This tool can be found in the SDK at `$SDK/bin/toit.compile`.
25-
2623
## Instructions
2724
Start by building a snapshot of the program you want to install.
2825

2926
``` shell
30-
toit.compile -w hello.snapshot hello.toit
27+
toit compile --snapshot -o hello.snapshot hello.toit
3128
```
3229

3330
Then add the snapshot to a firmware envelope.
3431
``` shell
3532
# By using '-o' we don't modify the envelope but create a new one.
36-
firmware -e firmware.envelope container install -o hello.envelope hello hello.snapshot
33+
toit tool firmware -e firmware.envelope container install -o hello.envelope hello hello.snapshot
3734
```
3835

3936
The created envelope can be flashed to a device using the `flash` command.
4037
``` shell
41-
firmware -e hello.envelope flash --port /dev/ttyUSB0 --baud 921600
38+
toit tool firmware -e hello.envelope flash --port /dev/ttyUSB0 --baud 921600
4239
```
4340

4441
When the device boots up, it will run the installed container.

docs/tutorials/misc/ota.mdx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ first.
1919
A new firmware consists of updating a Toit firmware envelope with
2020
the desired containers and to build a binary image out of it.
2121
We will provide the necessary steps to create a new firmware, but
22-
you might need to update your setup to have the required tools
23-
(`toit.compile` and `firmware`) accessible. See the
22+
you might need to update your setup to have the required tool
23+
(`toit`) accessible. See the
2424
[containers tutorial](../../containers/toit-sdk) for how to
2525
set up your environment, and for more information on how containers
2626
and envelopes work.
@@ -108,16 +108,16 @@ You should now have a file called `firmware-esp32`.
108108
Compile the validate program to a snapshot and add it to the envelope:
109109

110110
``` shell
111-
toit.compile -w validate.snapshot validate.toit
112-
firmware -e firmware-esp32 container install validate validate.snapshot
111+
toit compile --snapshot -o validate.snapshot validate.toit
112+
toit tool firmware -e firmware-esp32 container install validate validate.snapshot
113113
```
114114

115115
Optionally, add other containers to the envelope.
116116

117117
Run the `firmware` tool again to extract a binary image from the envelope:
118118

119119
``` shell
120-
firmware -e firmware-esp32 extract --format=binary -o ota.bin
120+
toit tool firmware -e firmware-esp32 extract --format=binary -o ota.bin
121121
```
122122

123123
### Makefile
@@ -131,9 +131,8 @@ The paths are set up for a Linux system with the Toit SDK installed in
131131

132132
``` makefile
133133
TOIT_SDK := /opt/toit-sdk
134-
TOIT_COMPILE := $(TOIT_SDK)/bin/toit.compile
135-
TOIT_FIRMWARE := $(TOIT_SDK)/tools/firmware
136-
VERSION := $(shell $(TOIT_SDK)/bin/toit.lsp version)
134+
TOIT := $(TOIT_SDK)/bin/toit
135+
VERSION := $(shell $(TOIT) version)
137136
ENVELOPE_URL := https://github.com/toitlang/toit/releases/download/$(VERSION)/firmware-esp32.gz
138137

139138
.PHONY: all
@@ -148,11 +147,11 @@ firmware.envelope.gz:
148147
curl -L -o $@ $(ENVELOPE_URL)
149148

150149
%.snapshot: %.toit
151-
$(TOIT_COMPILE) -w $@ $<
150+
$(TOIT) compile --snapshot -o $@ $<
152151

153152
ota.bin: validate.snapshot firmware.envelope
154-
$(TOIT_FIRMWARE) -e firmware.envelope container install validate validate.snapshot
155-
$(TOIT_FIRMWARE) -e firmware.envelope extract --format=binary -o ota.bin
153+
$(TOIT) tool firmware -e firmware.envelope container install validate validate.snapshot
154+
$(TOIT) tool firmware -e firmware.envelope extract --format=binary -o ota.bin
156155

157156
.PHONY: serve
158157
serve: ota.bin

tools/run_all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ do
2020
$name != "../docs/language/imports.mdx" ]
2121
then
2222
echo $name
23-
"$TOIT_SDK/bin/toit.run" run_snippets.toit $name
23+
"$TOIT_SDK/bin/toit" run run_snippets.toit -- $name
2424
fi
2525
done

tools/run_snippets.toit

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,7 @@ class State:
143143
toit-sdk := os.env.get "TOIT_SDK"
144144
if not toit-sdk:
145145
throw "TOIT_SDK environment variable not set"
146-
toitc := "$toit-sdk/bin/toit.compile"
147-
toitvm := "$toit-sdk/bin/toit.run"
148-
kebabify := "$toit-sdk/tools/kebabify"
146+
toit := "$toit-sdk/bin/toit"
149147
filename := snippet-filename ? snippet-filename : DEFAULT-OUTPUT
150148
snippet-filename = null
151149
snippet := file.Stream.for-write filename
@@ -170,11 +168,11 @@ class State:
170168
snippet.close
171169
result := ?
172170
if check-only:
173-
result = pipe.system "$toitc --analyze $werror-flag $filename"
171+
result = pipe.system "$toit analyze $werror-flag $filename"
174172
else:
175-
result = pipe.system "$toitvm $werror-flag $filename"
173+
result = pipe.system "$toit run $werror-flag -- $filename"
176174
before-kebabify := file.read-content filename
177-
pipe.system "$kebabify code $filename --toitc $toitc"
175+
pipe.system "$toit tool kebabify code $filename"
178176
after-kebabify := file.read-content filename
179177
if before-kebabify != after-kebabify:
180178
throw "Kebabify changed the file $filename"

tutorial_code/ota/Makefile

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
# be found in the LICENSE_BSD0 file.
44

55
TOIT_SDK := /opt/toit-sdk
6-
TOIT_COMPILE := $(TOIT_SDK)/bin/toit.compile
7-
TOIT_FIRMWARE := $(TOIT_SDK)/tools/firmware
8-
VERSION := $(shell $(TOIT_SDK)/bin/toit.lsp version)
6+
TOIT := $(TOIT_SDK)/bin/toit
7+
VERSION := $(shell $(TOIT) version)
98
ENVELOPE_URL := https://github.com/toitlang/toit/releases/download/$(VERSION)/firmware-esp32.gz
109
WIFI_CREDENTIALS := {"wifi.ssid":"<my-ssid>","wifi.password":"<my-password>"}
1110

@@ -21,12 +20,12 @@ firmware.envelope.gz:
2120
curl -L -o $@ $(ENVELOPE_URL)
2221

2322
%.snapshot: %.toit
24-
$(TOIT_COMPILE) -w $@ $<
23+
$(TOIT) compile --snapshot -o $@ $<
2524

2625
ota.bin: validate.snapshot firmware.envelope
27-
$(TOIT_FIRMWARE) -e firmware.envelope container install validate validate.snapshot
28-
$(TOIT_FIRMWARE) -e firmware.envelope property set wifi '$(WIFI_CREDENTIALS)'
29-
$(TOIT_FIRMWARE) -e firmware.envelope extract --format=binary -o ota.bin
26+
$(TOIT) tool firmware -e firmware.envelope container install validate validate.snapshot
27+
$(TOIT) tool firmware -e firmware.envelope property set wifi '$(WIFI_CREDENTIALS)'
28+
$(TOIT) tool firmware -e firmware.envelope extract --format=binary -o ota.bin
3029

3130
.PHONY: serve
3231
serve: ota.bin

0 commit comments

Comments
 (0)