Skip to content

jangala-dev/devicecode-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

150 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

devicecode-go

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.

Flashing ISOC Power Board via USB port on Pico

tinygo flash -stack-size=3KB -monitor -scheduler tasks -target=pico -tags "pico_bb_proto_1" main.go

Flashing ISOC Power Board via USB port on Pico2

tinygo flash -stack-size=3KB -monitor -scheduler tasks -target=pico2 -tags "pico_bb_proto_1" main.go


Debugging instructions

The following instructions set you up debugging the code on an MCU, using a Pico debug module, connected to a Mac (tested on arm64).

Environment Setup

Why codesign the GDB executable?

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.

Build and debug from VSCode

  • Select target from debug dropdown (Pico or Pico2)
  • Press F5 to begin debugging

alt text

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.

UART1 diagnostic facade

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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors