Pure go implementation of pru app loader for beaglebone black. C source of Pruss app loader (the inspiration for this)
The quality of this code is hacked at best (at the moment). See prussdrv_test.go
for usage.
gopru is licensed under the two-clause BSD license. See LICENSE.txt
.
package main
import (
"github.com/mikelikespie/gopru"
"log"
)
func main() {
drv, err := pruss.InitDrv()
if err != nil {
log.Panicln("Error initializing:", err)
}
defer func() {
err := drv.Close()
if err != nil {
log.Panicln("Error closing:", err)
}
}()
// Open the interrupt. One needs the listener to wait on them later
listener, err := drv.OpenInterrupt(pruss.PRU_EVTOUT_0);
if err != nil {
log.Panicln("Error opening interrupt:", err)
}
if err = drv.InitInterrupts(); err != nil {
log.Panicln("Error initializing interrupts:", err)
}
pru := drv.Pru(0)
if err = pru.ExecProgram("my_program.bin"); err != nil {
log.Panicln("Error executing image:", err)
}
defer pru.Disable()
// Wait for the program to send an interrupt
listener.Wait()
drv.ClearEvent(pruss.PRU0_ARM_INTERRUPT)
}
the pasm
directory contains a port of the pasm assembler (from
https://github.com/beagleboard/am335x_pru_package/tree/master/pru_sw/utils/pasm_source).
It is modified to be callable via cgo. This allows for testing to be much
easier for gopru. (see prussdrv_test.go
for example)
pasm's license can be found in pasm/LICENSE.txt