areeb (Customer) asked a question.

Uploading ino sketch from headless linux server using arduino-cli

I'm looking to build and upload .ino files from a headless linux server connected to the P1AM-100 via USB. I'm running into a somewhat cryptic error: "Error during build: fork/exec /bin/arm-none-eabi-g++: no such file or directory"

I've followed the steps on the arduino-cli github as follows

 

1. updated ~/.arduino15/arduino-cli.yaml to contain:

  1. board_manager:
  2. additional_urls:
  3. - https://raw.githubusercontent.com/facts-engineering/facts-engineering.github.io/master/package_productivity-P1AM-boardmanagermodule_index.json

2. arduino-cli core update-index

  1. Updating index: package_index.json downloaded
  2. Updating index: package_productivity-P1AM-boardmanagermodule_index.json downloaded

3. ard core install P1AM-100:samd

  1. Downloading packages...
  2. arduino:CMSIS@4.5.0 already downloaded
  3. arduino:CMSIS-Atmel@1.1.0 already downloaded
  4. P1AM-100:samd@1.6.20 already downloaded
  5. Installing arduino:arm-none-eabi-gcc@4.8.3-2014q1...
  6. Installing arduino:bossac@1.7.0...
  7. Installing arduino:openocd@0.9.0-arduino6-static...
  8. Installing arduino:CMSIS@4.5.0...
  9. arduino:CMSIS@4.5.0 installed
  10. Installing arduino:CMSIS-Atmel@1.1.0...
  11. arduino:CMSIS-Atmel@1.1.0 installed
  12. Installing arduino:arduinoOTA@1.2.0...
  13. Installing P1AM-100:samd@1.6.20...
  14. P1AM-100:samd@1.6.20 installed

4. ard core list # note I also installed the arduino:samd core

  1. ID Installed Latest Name
  2. P1AM-100:samd 1.6.20 1.6.20 P1AM-100
  3. arduino:avr 1.8.2 1.8.3 Arduino AVR Boards
  4. arduino:samd 1.8.6 1.8.6 Arduino SAMD Boards (32-bits ARM Cortex-M0+)

5. ard lib install P1AM

  1. P1AM depends on P1AM@1.0.0
  2. Downloading P1AM@1.0.0...
  3. P1AM@1.0.0 downloaded
  4. Installing P1AM@1.0.0...
  5. Installed P1AM@1.0.0

6. arduino-cli compile -b P1AM-100:samd:P1AM-100_native Blink --verbose

  1. Using board 'P1AM-100_native' from platform in folder: /home/nvidia/.arduino15/packages/P1AM-100/hardware/samd/1.6.20
  2. Using core 'arduino' from platform in folder: /home/nvidia/.arduino15/packages/P1AM-100/hardware/samd/1.6.20
  3. Detecting libraries used...
  4. /bin/arm-none-eabi-g++ -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10607 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -DUSE_ARDUINO_MKR_PIN_LAYOUT -D__SAMD21G18A__ -DUSB_VID=0x1354 -DUSB_PID=0x4000 -DUSBCON "-DUSB_MANUFACTURER=\"Facts Engineering\"" "-DUSB_PRODUCT=\"P1AM-100\"" -I/home/nvidia/.arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/ -I/home/nvidia/.arduino15/packages/arduino/tools/CMSIS-Atmel/1.1.0/CMSIS/Device/ATMEL/ -I/home/nvidia/.arduino15/packages/P1AM-100/hardware/samd/1.6.20/cores/arduino -I/home/nvidia/.arduino15/packages/P1AM-100/hardware/samd/1.6.20/variants/P1AM-100 /tmp/arduino-sketch-CFAD0A7419F44EA0C64DB24197ABBF70/sketch/Blink.ino.cpp -o /dev/null
  5. Error during build: fork/exec /bin/arm-none-eabi-g++: no such file or directory

Any ideas what I might be missing?

 

 

SOLUTION

Summarizing everything that happened below:

1.

Make sure you have gcc installed:

  1. sudo apt-get install gcc-arm-none-eabi

2.

Make sure the compiler can find gcc. In ~/.arduino15/packages/P1AM-100/hardware/samd/1.6.20/platform.txt, update the line

  1. compiler.path={runtime.tools.arm-none-eabi-gcc-4.8.3-2014q1.path}/bin/

to

  1. compiler.path=/usr/bin/

(this is where my gcc got installed, yours may be different)

 

3.

Upload with bossa:

3.1 - Install bossa

  1. git clone https://github.com/shumatech/BOSSA.git -b "arduino"
  2. cd BOSSA
  3. make bin/bossac -j4

3.2 - Put the P1AM-100 into bootloader using 1200 touch

  1. stty -F /dev/ttyACM0 speed 1200 cs8 -cstopb -parenb

3.3 - Upload program. Make sure to change the path to the bin for you program

  1. ./bin/bossac --port=/dev/ttyACM0 --force_usb_port=true -e -w -v /home/pi/blink/build/P1AM-100.samd.P1AM-100_native/blink.ino.bin -R

 


  • FACTS_AdamC (AutomationDirect)

    OK so I got it working with just bossa.

    • Install bossa (arduino branch)
    1. git clone https://github.com/shumatech/BOSSA.git -b "arduino"
    2. cd BOSSA
    3. make bin/bossac -j4
    • Put the P1AM-100 into bootloader using 1200 touch
    1. stty -F /dev/ttyACM0 speed 1200 cs8 -cstopb -parenb
    • Upload program. Make sure to change the path to the bin for you program
    1. ./bin/bossac --port=/dev/ttyACM0 --force_usb_port=true -e -w -v /home/pi/blink/build/P1AM-100.samd.P1AM-100_native/blink.ino.bin -R
    •  
    Expand Post
    Selected as Best
  • FACTS_AdamC (AutomationDirect)

    Hey Areeb,

     

    What folder are you running the compile command from and does it contain a folder named Blink?

     

    Thanks

    Adam

    • areeb (Customer)

      Yep folder is there. It's the standard Blink program from arduino's examples

  • FACTS_AdamC (AutomationDirect)

    I'd also run this in the same directory to double check the compiler is installed and in your PATH

    1. arm-none-eabi-g++ --version

     

  • areeb (Customer)

    Good thinking - I checked and did not have arm-none-eabi-g++ installed. Installed it with

    1. sudo apt-get install gcc-arm-none-eabi

    but am now running into a more specific issue. Same error as above but I think this time it's because arm-none-eabi-g++ is installed in /usr/bin/ instead of /bin/. Copying it over to /bin/ produces further errors, so I'm not sure that's the right hack.

    1. Using board 'P1AM-100_native' from platform in folder: /home/nvidia/.arduino15/packages/P1AM-100/hardware/samd/1.6.20
    2. Using core 'arduino' from platform in folder: /home/nvidia/.arduino15/packages/P1AM-100/hardware/samd/1.6.20
    3. Detecting libraries used...
    4. /bin/arm-none-eabi-g++ -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10607 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -DUSE_ARDUINO_MKR_PIN_LAYOUT -D__SAMD21G18A__ -DUSB_VID=0x1354 -DUSB_PID=0x4000 -DUSBCON "-DUSB_MANUFACTURER=\"Facts Engineering\"" "-DUSB_PRODUCT=\"P1AM-100\"" -I/home/nvidia/.arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/ -I/home/nvidia/.arduino15/packages/arduino/tools/CMSIS-Atmel/1.1.0/CMSIS/Device/ATMEL/ -I/home/nvidia/.arduino15/packages/P1AM-100/hardware/samd/1.6.20/cores/arduino -I/home/nvidia/.arduino15/packages/P1AM-100/hardware/samd/1.6.20/variants/P1AM-100 /tmp/arduino-sketch-CFAD0A7419F44EA0C64DB24197ABBF70/sketch/Blink.ino.cpp -o /dev/null
    5. Error while detecting libraries included by /tmp/arduino-sketch-CFAD0A7419F44EA0C64DB24197ABBF70/sketch/Blink.ino.cpp
    6. Generating function prototypes...
    7. /bin/arm-none-eabi-g++ -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10607 -DARDUINO_SAMD_ZERO -DARDUINO_ARCH_SAMD -DUSE_ARDUINO_MKR_PIN_LAYOUT -D__SAMD21G18A__ -DUSB_VID=0x1354 -DUSB_PID=0x4000 -DUSBCON "-DUSB_MANUFACTURER=\"Facts Engineering\"" "-DUSB_PRODUCT=\"P1AM-100\"" -I/home/nvidia/.arduino15/packages/arduino/tools/CMSIS/4.5.0/CMSIS/Include/ -I/home/nvidia/.arduino15/packages/arduino/tools/CMSIS-Atmel/1.1.0/CMSIS/Device/ATMEL/ -I/home/nvidia/.arduino15/packages/P1AM-100/hardware/samd/1.6.20/cores/arduino -I/home/nvidia/.arduino15/packages/P1AM-100/hardware/samd/1.6.20/variants/P1AM-100 /tmp/arduino-sketch-CFAD0A7419F44EA0C64DB24197ABBF70/sketch/Blink.ino.cpp -o /tmp/arduino-sketch-CFAD0A7419F44EA0C64DB24197ABBF70/preproc/ctags_target_for_gcc_minus_e.cpp
    8. arm-none-eabi-g++: error trying to exec 'cc1plus': execvp: No such file or directory
    9. Error during build: exit status 1

    It seems like if I could convince the compiler to look in /usr/bin/ instead of /bin/ that might help, but that's a stab in the dark at this point.

     

    Worth noting by the way, that I'm able to build using a different arduino core (e.g. arduino:avr:mega)

    Expand Post
  • FACTS_AdamC (AutomationDirect)

    I don't believe the avr core uses the ARM compiler. It would be useful to try and build one of the SAMD boards, more specifically the MKRZERO. We use the same toolchain as that board.

     

    What sort of errors was it throwing when you have it in "/usr/bin"?

     

     

     

     

     

     

    Expand Post
  • areeb (Customer)

    1. arduino-cli compile -b arduino:samd:mkrzero Blink

    compiles successfully.

     

    when I copy things to /bin/, I get the error in my message two up from here ending in

    1. arm-none-eabi-g++: error trying to exec 'cc1plus': execvp: No such file or directory

    when it's in /usr/bin/ (and not /bin/) I get the original error of the post

    Expand Post
  • FACTS_AdamC (AutomationDirect)

    Try running this and see if it was installed:

    1. sudo apt-get install build-essential

     

  • areeb (Customer)

    build-essential is already installed and updated to the newest version. ran the failing command again and am still getting the original error

  • areeb (Customer)

    In ~/.arduino15/packages/P1AM-100/hardware/samd/1.6.20/platform.txt, I changed the line

    1. compiler.path={runtime.tools.arm-none-eabi-gcc-4.8.3-2014q1.path}/bin/

    to

    1. compiler.path=/usr/bin/

    and was able to build successfully. I'm still unable to upload however. Running the following command

    1. arduino-cli upload -p /dev/ttyACM0 -b P1AM-100:samd:P1AM-100_native Blink/

    yields the following error:

    1. panic: runtime error: invalid memory address or nil pointer dereference
    2. [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x364910]
    3.  
    4. goroutine 1 [running]:
    5. github.com/arduino/go-paths-helper.(*Path).String(...)
    6. /github/home/go/pkg/mod/github.com/arduino/go-paths-helper@v1.0.1/paths.go:470
    7. github.com/arduino/arduino-cli/arduino/cores.(*ToolRelease).RuntimeProperties(0x40002cce10, 0x4)
    8. /__w/arduino-cli/arduino-cli/arduino/cores/tools.go:136 +0x88
    9. github.com/arduino/arduino-cli/commands/upload.Upload(0x95a900, 0x40000b8010, 0x4000177ce8, 0x947e80, 0x40000bc008, 0x947e80, 0x40000bc010, 0x4000099920, 0xc, 0xc)
    10. /__w/arduino-cli/arduino-cli/commands/upload/upload.go:118 +0x680
    11. github.com/arduino/arduino-cli/cli/upload.run(0x40001d9180, 0x4000190500, 0x1, 0x5)
    12. /__w/arduino-cli/arduino-cli/cli/upload/upload.go:75 +0x1d4
    13. github.com/spf13/cobra.(*Command).execute(0x40001d9180, 0x40001904b0, 0x5, 0x5, 0x40001d9180, 0x40001904b0)
    14. /github/home/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:830 +0x1cc
    15. github.com/spf13/cobra.(*Command).ExecuteC(0xea4c80, 0x3fa2c, 0x1, 0x4000000180)
    16. /github/home/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914 +0x22c
    17. github.com/spf13/cobra.(*Command).Execute(...)
    18. /github/home/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
    19. main.main()
    20. /__w/arduino-cli/arduino-cli/main.go:26 +0x30

     

    Expand Post
    • FACTS_AdamC (AutomationDirect)

      I'm not sure how to tackle this error.

      I do know we have built and uploaded from the Arduino CLI with the P1AM-100, so it is definitely possible.

       

      You may want to go to the Arduino-CLI repo or their forum and create a post for help. I think this comes down more to their tool so they will have a much better sense of what's going on.

       

      Thanks

      Adam

      Expand Post
10 of 23