Skip to content

Commit 8119c2b

Browse files
committed
feat: unoq: enable menu for immediate mode
Selecting "Startup mode->Immediate" will instruct the loader to skip the boot animation and directly start the sketch. Extra care should be taken to ensure that the Linux side is up before calling any Bridge function. The status of Linux boot can be easily retrieved by checking the status of GPIO G13 (67 in Arduino world). Please note that this will be operational only after a new release of zephyr-sketch-tool
1 parent a338a5e commit 8119c2b

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

boards.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
menu.debug=Debug
22
menu.link_mode=Link mode
33
menu.flash_mode=Flash mode
4+
menu.wait_linux_boot=Startup mode
45

56
##########################################################################################
67

@@ -543,6 +544,9 @@ unoq.menu.flash_mode.flash=Flash
543544
unoq.menu.flash_mode.flash.openocd_cfg=flash_sketch.cfg
544545
unoq.menu.flash_mode.ram=RAM
545546
unoq.menu.flash_mode.ram.openocd_cfg=flash_sketch_ram.cfg
547+
unoq.menu.wait_linux_boot.yes=Wait for Linux
548+
unoq.menu.wait_linux_boot.no=Immediate
549+
unoq.menu.wait_linux_boot.no.build.boot_mode=immediate
546550

547551
unoq.build.zephyr_target=arduino_uno_q
548552
unoq.build.zephyr_args=

extra/zephyr-sketch-tool/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
func main() {
1212
var output = flag.String("output", "", "Output to a specific file (default: add -zsk.bin suffix)")
1313
var debug = flag.Bool("debug", false, "Enable debugging mode")
14+
var immediate = flag.Bool("immediate", false, "Start sketch immediately [UNO Q]")
1415
var linked = flag.Bool("prelinked", false, "Provided file has already been linked to Zephyr")
1516
var force = flag.Bool("force", false, "Ignore safety checks and overwrite the header")
1617
var add_header = flag.Bool("add_header", false, "Add space for the header to the file")
@@ -59,6 +60,9 @@ func main() {
5960
if *linked {
6061
header.flags |= 0x02
6162
}
63+
if *immediate {
64+
header.flags |= 0x04
65+
}
6266

6367
var bytes = make([]byte, 9)
6468
_, err = binary.Encode(bytes, binary.LittleEndian, header)

platform.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ compiler.zephyr.extra_ldflags=-lstdc++ -lsupc++
5050
build.extra_flags=
5151
build.extra_ldflags=
5252
build.link_mode=dynamic
53+
build.boot_mode=wait
5354
upload.extension=elf-zsk.bin
5455

5556
build.ldscript.path={runtime.platform.path}/variants/_ldscripts
@@ -76,6 +77,8 @@ build.link_args.build-common="-Wl,-Map,{build.path}/{build.project_name}.map" -o
7677
build.zsk_args.debug=
7778
build.zsk_args.mode-dynamic=
7879
build.zsk_args.mode-static=-prelinked
80+
build.zsk_args.startup-mode-wait=
81+
build.zsk_args.startup-mode-immediate=-immediate
7982

8083
# These can be overridden in platform.local.txt
8184
compiler.c.extra_flags=
@@ -132,8 +135,8 @@ recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf
132135
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"
133136

134137
## Mangle the file
135-
recipe.hooks.objcopy.postobjcopy.1.pattern="{runtime.tools.zephyr-sketch-tool.path}/zephyr-sketch-tool" {build.zsk_args.debug} {build.zsk_args.mode-{build.link_mode}} "{build.path}/{build.project_name}.elf"
136-
recipe.hooks.objcopy.postobjcopy.2.pattern="{runtime.tools.zephyr-sketch-tool.path}/zephyr-sketch-tool" {build.zsk_args.debug} {build.zsk_args.mode-{build.link_mode}} "{build.path}/{build.project_name}.bin"
138+
recipe.hooks.objcopy.postobjcopy.1.pattern="{runtime.tools.zephyr-sketch-tool.path}/zephyr-sketch-tool" {build.zsk_args.debug} {build.zsk_args.mode-{build.link_mode}} {build.zsk_args.startup-mode-{build.boot_mode}} "{build.path}/{build.project_name}.elf"
139+
recipe.hooks.objcopy.postobjcopy.2.pattern="{runtime.tools.zephyr-sketch-tool.path}/zephyr-sketch-tool" {build.zsk_args.debug} {build.zsk_args.mode-{build.link_mode}} {build.zsk_args.startup-mode-{build.boot_mode}} "{build.path}/{build.project_name}.bin"
137140

138141
## Compute size
139142
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"

0 commit comments

Comments
 (0)