Skip to content
Open
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
4 changes: 4 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
menu.debug=Debug
menu.link_mode=Link mode
menu.flash_mode=Flash mode
menu.wait_linux_boot=Startup mode

##########################################################################################

Expand Down Expand Up @@ -543,6 +544,9 @@ unoq.menu.flash_mode.flash=Flash
unoq.menu.flash_mode.flash.openocd_cfg=flash_sketch.cfg
unoq.menu.flash_mode.ram=RAM
unoq.menu.flash_mode.ram.openocd_cfg=flash_sketch_ram.cfg
unoq.menu.wait_linux_boot.yes=Wait for Linux
unoq.menu.wait_linux_boot.no=Immediate
unoq.menu.wait_linux_boot.no.build.boot_mode=immediate

unoq.build.zephyr_target=arduino_uno_q
unoq.build.zephyr_args=
Expand Down
4 changes: 4 additions & 0 deletions extra/zephyr-sketch-tool/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
func main() {
var output = flag.String("output", "", "Output to a specific file (default: add -zsk.bin suffix)")
var debug = flag.Bool("debug", false, "Enable debugging mode")
var immediate = flag.Bool("immediate", false, "Start sketch immediately [UNO Q]")
var linked = flag.Bool("prelinked", false, "Provided file has already been linked to Zephyr")
var force = flag.Bool("force", false, "Ignore safety checks and overwrite the header")
var add_header = flag.Bool("add_header", false, "Add space for the header to the file")
Expand Down Expand Up @@ -59,6 +60,9 @@ func main() {
if *linked {
header.flags |= 0x02
}
if *immediate {
header.flags |= 0x04
}

var bytes = make([]byte, 9)
_, err = binary.Encode(bytes, binary.LittleEndian, header)
Expand Down
7 changes: 5 additions & 2 deletions platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ compiler.zephyr.extra_ldflags=-lstdc++ -lsupc++
build.extra_flags=
build.extra_ldflags=
build.link_mode=dynamic
build.boot_mode=wait
upload.extension=elf-zsk.bin

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

# These can be overridden in platform.local.txt
compiler.c.extra_flags=
Expand Down Expand Up @@ -132,8 +135,8 @@ recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf
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"

## Mangle the file
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"
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"
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"
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"

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