platformio / platformio-core

Your Gateway to Embedded Software Development Excellence :alien:
https://platformio.org
Apache License 2.0
7.95k stars 792 forks source link

Cannot upload to mzeropro with using stable or development version #805

Closed fjammes closed 7 years ago

fjammes commented 8 years ago

Configuration

Operating system:

Debian jessie

PlatformIO Version (platformio --version):

PlatformIO, version 3.2.0a7 (but occurs also with current stable version)

Description of problem

Can not upload to mzeropro because of minor openocd error:

Uploading .pioenvs/mzeropro/firmware.bin
Open On-Chip Debugger 0.9.0-gd4b7679 (2014-10-03-00:26)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
/home/lora/.platformio/packages/tool-openocd/bin/openocd.bin: option requires an argument -- 'c'
Info : only one transport option; autoselect 'swd'
adapter speed: 500 kHz
adapter_nsrst_delay: 100
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 01.1F.0118
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 500 kHz
Info : SWD IDCODE 0x0bc11477
Info : at91samd21g18.cpu: hardware has 4 breakpoints, 2 watchpoints

Steps to Reproduce

git clone git@github.com:fjammes/braise.git
cd braise/gps_bme_send
platformio init --board mzeropro
# Command below is broken
platformio run -t upload

Actual Results

Script waits without doing nothing.

Expected Results

Upload code to mzeropro

Additional info

Changing openocd '-c' with '--command=' option works fine, as shown below:

~/.platformio/packages/tool-openocd/bin/openocd  -f /home/lora/.platformio/packages/framework-arduinosam/variants/arduino_zero_org/openocd_scripts/arduino_zero_org.cfg -s /home/lora/.platformio/packages/tool-openocd/share/openocd/scripts -s /home/lora/.platformio/packages/tool-openocd/share/openocd/scripts/board -s /home/lora/.platformio/packages/framework-arduinosam/variants/arduino_zero_org/openocd_scripts --command="telnet_port disabled; program {{.pioenvs/mzeropro/firmware.bin}} verify reset 0x4000; shutdown"
# Command stdout:
Open On-Chip Debugger 0.9.0-gd4b7679 (2014-10-03-00:26)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'swd'
adapter speed: 500 kHz
adapter_nsrst_delay: 100
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 01.1F.0118
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 500 kHz
Info : SWD IDCODE 0x0bc11477
Info : at91samd21g18.cpu: hardware has 4 breakpoints, 2 watchpoints
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x000028f4 msp: 0x20002c00
** Programming Started **
auto erase enabled
Info : SAMD MCU: SAMD21G18A (256KB Flash, 32KB RAM)
wrote 49152 bytes from file .pioenvs/mzeropro/firmware.bin in 6.412093s (7.486 KiB/s)
** Programming Finished **
** Verify Started **
verified 48948 bytes in 3.957394s (12.079 KiB/s)
** Verified OK **
** Resetting Target **
shutdown command invoked
ivankravets commented 8 years ago

@valeros I have the same issue. Could you help us?

@fjammes Please use mzeroproUSB board and USB port instead. It works.

fjammes commented 8 years ago

Thanks, I can indeed use mzeroproUSB to upload binaries, but then platformio device monitor -p /dev/ttyACM0 does not print any output message.

fjammes commented 8 years ago

I would need to use SerialUSB.print(...) in my code, but some third-parties use Serial.print(), so it seems I'm stick with programming port. Coudl you please fix this bug?

ivankravets commented 8 years ago

Could you try one fix? Please go to ~/.platformio/packages/tool-openocd/bin/ and edit openocd wrapper. Replace

LD_LIBRARY_PATH="$MYAPP_HOME/lib" "$0.bin" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"

with

LD_LIBRARY_PATH="$MYAPP_HOME/lib" "$0.bin" "$@"

Does it work now?

ivankravets commented 8 years ago

@fjammes do you have any news?

ivankravets commented 7 years ago

Just run pio update where tool-openocd should be updated.

/cc @fraimondo @fjammes

fraimondo commented 7 years ago

What was problem/solution then?

ivankravets commented 7 years ago

@fraimondo see https://github.com/platformio/platformio/issues/805#issuecomment-254199812