From 583022cb562ad77d2b10480064f185a1bc1e0308 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Thu, 13 Feb 2025 12:59:53 +0100 Subject: [PATCH 1/3] license: update year and make consistent with main repo Signed-off-by: deadprogram --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index a55ddf2..c624d83 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2023, TinyGo +Copyright (c) 2023-2025 The TinyGo Authors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: From 883b034ce7d964a0274011b9d565cfb3ed0349f0 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Thu, 13 Feb 2025 13:45:58 +0100 Subject: [PATCH 2/3] docs: additional info about how to install and use this package Signed-off-by: deadprogram --- README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/README.md b/README.md index 4fcf56e..1bb4e48 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ # pio + +[![Build](https://github.com/tinygo-org/pio/actions/workflows/build.yml/badge.svg)](https://github.com/tinygo-org/pio/actions/workflows/build.yml) + Provides clean API to interact with RP2040's on-board Programable Input/Output (PIO) block. See chapter 3 of the [RP2040 datasheet](https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf#page=310) for more information. @@ -32,3 +35,35 @@ again: set pins, 0 ; Drive pin low jmp again ; Set PC to label `again` ``` + +### How to install pioasm + +To develop new code using PIO with this package, you must build and install the `pioasm` tool. It can be be built from the pico-sdk: + +```shell +git clone git@github.com:raspberrypi/pico-sdk.git +cd pico-sdk/tools/pioasm +cmake . +make +sudo make install +``` + +### How to develop a PIO program + +To develop a PIO program you first start out with the .pio file. Let's look at the Pulsar example first. + +1. `pulsar.pio` specifies a binary PIO program that can be loaded to the PIO program memory. +2. `all_generate.go`: holds the code generation command on the line with `//go:generate pioasm -o go pulsar.pio pulsar_pio.go` which by itself generates the raw binary code that can be loaded onto the PIO along with helper code to load it correctly inside `pulsar_pio.go`. +3. `pulsar_pio.go`: contains the generated code by the `pioasm` tool. +4. `pulsar.go`: contains the User facing code that allows using the PIO as intended by the author. + +### Regenerating piolib + +```shell +cd rp2-pio/piolib +go generate . +``` + +### Other notes + +Keep in mind PIO programs are very finnicky, especially differentiating between SetOutPins and SetSetPins. The difference is subtle but it can be the difference between spending days debugging a silly conceptual mistake. Have fun! From 653177d07e200b9ee4ff01034b80bddfdd898339 Mon Sep 17 00:00:00 2001 From: Patricio Whittingslow Date: Thu, 13 Feb 2025 09:58:44 -0300 Subject: [PATCH 3/3] tweaks --- README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1bb4e48..c681cfb 100644 --- a/README.md +++ b/README.md @@ -52,16 +52,15 @@ sudo make install To develop a PIO program you first start out with the .pio file. Let's look at the Pulsar example first. -1. `pulsar.pio` specifies a binary PIO program that can be loaded to the PIO program memory. -2. `all_generate.go`: holds the code generation command on the line with `//go:generate pioasm -o go pulsar.pio pulsar_pio.go` which by itself generates the raw binary code that can be loaded onto the PIO along with helper code to load it correctly inside `pulsar_pio.go`. -3. `pulsar_pio.go`: contains the generated code by the `pioasm` tool. -4. `pulsar.go`: contains the User facing code that allows using the PIO as intended by the author. +1. [`pulsar.pio`](./rp2-pio/piolib/pulsar.pio): specifies a binary PIO program that can be loaded to the PIO program memory. +2. [`all_generate.go`](./rp2-pio/piolib/all_generate.go): holds the code generation command on the line with `//go:generate pioasm -o go pulsar.pio pulsar_pio.go` which by itself generates the raw binary code that can be loaded onto the PIO along with helper code to load it correctly inside `pulsar_pio.go`. +3. [`pulsar_pio.go`](./rp2-pio/piolib/pulsar_pio.go): contains the generated code by the `pioasm` tool. +4. [`pulsar.go`](./rp2-pio/piolib/pulsar.go): contains the User facing code that allows using the PIO as intended by the author. ### Regenerating piolib ```shell -cd rp2-pio/piolib -go generate . +go generate ./... ``` ### Other notes