Solution: mcumgr not working in MacOs

Hello,
I've seen a problem with mcumgr where we get this error : 

mcumgr image upload panic: runtime error: slice bounds out of range [:-62]
 on MacOs (the problem exist since Big Sur I believe).

mcumgr is wrapper around newtmgr and source for newtmgr have been updated, we just need to download source, update dependencies and build it:
Here are the commands:

# Clone repo
git clone https://github.com/apache/mynewt-mcumgr-cli.git
# Build
cd mynewt-mcumgr-cli/mcumgr
go get -u mynewt.apache.org/newt
go get -u mynewt.apache.org/newtmgr
go get -u
go build
# Mv to go bin
GOPATH=$(which go)
# sudo cp mcumgr $GOPATH/bin # To install for all users
sudo cp mcumgr ~/go/bin
# Remove repo
cd ../../
rm -rf mynewt-mcumgr-cli

And mcumgr should then work as intended. You could even speedup uploading by changing the MTU with flag -m

Parents
  • Hi,

    Thank you for sharing this

    Could you state if you also see issues when you're installing through go install github.com/apache/mynewt-mcumgr-cli/mcumgr@latest instead of building mcumgr yourself for MacOS?

    Kind regards,
    Andreas

  • Hi Andreas,
    Yes issues are present when using github.com/apache/mynewt-mcumgr-cli/mcumgr@latest because the go.sum and go.mod dependencies are outdated.
    Using the latest release of newtmgr doesn't help because release is too long ago, but using newtmgr installed from HEAD works.

    
    

    brew tap runtimeco/homebrew-mynewt
    brew update
    brew install mynewt-newtmgr --HEAD


    Command is the same as mcumgr, just a different name.

    newtmgr --conntype ble --connstring peer_name="", image upload $BIN_FILE

    I could put a PR on mcumgr repo if needed
    
    

     

Reply
  • Hi Andreas,
    Yes issues are present when using github.com/apache/mynewt-mcumgr-cli/mcumgr@latest because the go.sum and go.mod dependencies are outdated.
    Using the latest release of newtmgr doesn't help because release is too long ago, but using newtmgr installed from HEAD works.

    
    

    brew tap runtimeco/homebrew-mynewt
    brew update
    brew install mynewt-newtmgr --HEAD


    Command is the same as mcumgr, just a different name.

    newtmgr --conntype ble --connstring peer_name="", image upload $BIN_FILE

    I could put a PR on mcumgr repo if needed
    
    

     

Children
No Data
Related