gremwell / go-jtagenum

JTAG enumeration tool written in Go. A port of https://github.com/cyphunk/JTAGenum enhanced with https://github.com/grandideastudio/jtagulator improved implementation.
GNU General Public License v3.0
97 stars 11 forks source link

runtime issue on rpi 3b+ #2

Closed ipatch closed 4 years ago

ipatch commented 4 years ago

hello,

I setup the go-lang infrastructure on my pi running raspbian buster with all updates applied as of april 28, 2020.

I used the below commands to setup the go-lang tooling

sudo apt install golang --fix-missing
sudo apt install gpiod libgpiod-dev
echo 'export GOPATH=$HOME/go' >> ~/.profile
echo 'PATH="$HOME/go/bin:$PATH"' >> ~/.profile

then compiled a simple hello world binary to make sure things work as intended.

// helloworld project main.go.
package main

import ("fmt")
// main is the entrypoint of the application.
func main() {
    fmt.Println("Hello world! Greetings from Raspberry Pi")
}

ran the below command to see if the binary would run

go run main.go

the binary successfully prints the hellow world message to STDOUT

then i tried downloading and installing this app

go get github.com/gremwell/go-jtagenum

then i try to run the go-jtagenum binary in my $PATH

go-jtagenum

which outputs the below panic ...is this the expected behavior of the built binary? i'm running the command with no arguments or anything connected to the pi, just wanted to see what would happen when exectuing the binary.

provide command
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xb4ff8]

goroutine 1 [running]:
main.(*Jtag).closeJtag(0x878060)
        /home/pi/go/src/github.com/gremwell/go-jtagenum/jtagenum.go:111 +0x1c
main.main()
        /home/pi/go/src/github.com/gremwell/go-jtagenum/jtagenum.go:941 +0xdc4
the output of the go env command ```shell GOARCH="arm" GOBIN="" GOCACHE="/home/pi/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="arm" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/pi/go" GOPROXY="" GORACE="" GOROOT="/usr/lib/go-1.11" GOTMPDIR="" GOTOOLDIR="/usr/lib/go-1.11/pkg/tool/linux_arm" GCCGO="gccgo" GOARM="6" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -marm -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build244125353=/tmp/go-build -gno-record-gcc-switches" ```

please let me know if i need to provide any more information

cheers Chris

zOrg1331 commented 4 years ago

Thank you, should be fixed now.

ipatch commented 4 years ago

thank you

ipatch commented 4 years ago

for people, such as myself adding a command to update the tool / app could be beneficial for the README

go get -u github.com/gremwell/go-jtagenum
grymoire commented 5 months ago

I'm getting a similar error on a RPi 4b

I first installed go 1.23 from the website, but when I had problems, (the executable go-jtagenum was missing( I used the steps above to install the supported package.)

But I had to make some modifications:

go get github.com/gremwell/go-jtagenum
go: errors parsing go.mod:
/home/pi/Code/go.mod:3: invalid go version '1.22.3': must match format 1.23
pi@pi4:~/Code $ rm go.mod
pi@pi4:~/Code $ go get github.com/gremwell/go-jtagenum
go: go.mod file not found in current directory or any parent directory.
    'go get' is no longer supported outside a module.
    To build and install a command, use 'go install' with a version,
    like 'go install example.com/cmd@latest'
    For more information, see https://golang.org/doc/go-get-install-deprecation
    or run 'go help get' or 'go help install'.
pi@pi4:~/Code $ go install github.com/gremwell/go-jtagenum
go: 'go install' requires a version when current directory is not in a module
    Try 'go install github.com/gremwell/go-jtagenum@latest' to install the latest version
pi@pi4:~/Code $ go install github.com/gremwell/go-jtagenum@latest
go: finding module for package github.com/stianeikeland/go-rpio
go: found github.com/stianeikeland/go-rpio in github.com/stianeikeland/go-rpio v4.2.0+incompatible

So when I executed the command, it reported.

provide command
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x4b4260]

goroutine 1 [running]:
main.(*Jtag).closeJtag(0x0?)
    /home/pi/go/pkg/mod/github.com/gremwell/go-jtagenum@v0.4.0/jtagenum.go:111 +0x20
main.main()
    /home/pi/go/pkg/mod/github.com/gremwell/go-jtagenum@v0.4.0/jtagenum.go:941 +0x7cc

"go env" gives:

env.txt

abbbe commented 5 months ago

This project has no maintainer at the moment. Pull requests are welcome.