This module imports the MCU A/B update support from
github.com/jangala-dev/pico2-a-b. For direct devicecode-go builds outside a
local workspace, configure Go for private Jangala modules, for example:
go env -w GOPRIVATE=github.com/jangala-dev/*When devicecode-go is built through pico2-a-b make package, the package
flow writes a local go.work so the build uses the current pico2-a-b
checkout.
tinygo flash -stack-size=3KB -monitor -scheduler tasks -target=pico -tags "pico_bb_proto_1" main.go
tinygo flash -stack-size=3KB -monitor -scheduler tasks -target=pico2 -tags "pico_bb_proto_1" main.go
The following instructions set you up debugging the code on an MCU, using a Pico debug module, connected to a Mac (tested on arm64).
- Install Go according to https://go.dev/doc/install
- Install TinyGo according to https://tinygo.org/getting-started/install/
- Install OpenOCD according to https://openocd.org/pages/getting-openocd.html (just use
brew install open-ocdif on MacOs) - Install arm-none-eabi-gdb (
brew install arm-none-eabi-gdbon MacOs). - Install GDB (
brew install gdbon MacOs). - Codesign the GDB executable - https://sourceware.org/gdb/wiki/PermissionsDarwin
- Install VSCode Extensions for Go, TinyGo & Cortex-Debug
The Darwin Kernel requires the debugger to have special permissions before it is allowed to control other processes. These permissions are granted by codesigning the GDB executable. The debugger will not work until this step is performed.
- Select target from debug dropdown (Pico or Pico2)
- Press F5 to begin debugging
An OpenOCD server will be started, a GDB session started. Then the project will be built with flags specified in .vscode/tasks.json. Next, the compiled .elf file will be flashed to the MCU. The MCU will then be reset and control is handed over to you for the debug session.
You'll then be able to add breakpoints, pause, resume and reset the MCU remotely using VsCode debug tools.
This bundle keeps the original direct UART1 logger architecture and adds a small importable diagnostic facade at devicecode-go/utilities/diag.
Use it from deep code as a TinyGo-serial-safe analogue of print / println:
import "devicecode-go/utilities/diag"
diag.Print("ltc sample us=", sampleUS)
diag.Println("fabric reject", reason)
diag.WriteLine([]byte("raw diagnostic"))The facade does not use TinyGo's standard serial path. The Reactor attaches the existing uart1 serial_raw TX ring to it when the log session opens. It has no goroutine, no channel, no queue, and no blocking write path. Calls are best-effort and may drop bytes if UART1 is busy or its TX ring is full.
The proven CRLF line-ending fix is retained.
