-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
openocd: return error if flashing went wrong #2897
Conversation
I'm using "Open On-Chip Debugger 0.9.0-dev-00401-gf3b1405 (2015-04-15-12:26)", that's a fairly recent git compile. Without this patch: [kaspar@localhost pthread]$ BOARD=iot-lab_M3 make flash Building application "pthread" for "iot-lab_M3" with MCU "stm32f1". "make" -C /home/kaspar/src/riot.5/boards/iot-lab_M3 "make" -C /home/kaspar/src/riot.5/core "make" -C /home/kaspar/src/riot.5/cpu/stm32f1 "make" -C /home/kaspar/src/riot.5/cpu/cortex-m3_common "make" -C /home/kaspar/src/riot.5/cpu/stm32f1/periph "make" -C /home/kaspar/src/riot.5/drivers "make" -C /home/kaspar/src/riot.5/sys "make" -C /home/kaspar/src/riot.5/sys/posix "make" -C /home/kaspar/src/riot.5/sys/posix/pthread "make" -C /home/kaspar/src/riot.5/sys/timex "make" -C /home/kaspar/src/riot.5/sys/vtimer text data bss dec hex filename 14688 112 4460 19260 4b3c /home/kaspar/src/riot.5/tests/pthread/bin/iot-lab_M3/pthread.elf /home/kaspar/src/riot.5/dist/tools/openocd/openocd.sh flash ### Flashing Target ### Open On-Chip Debugger 0.9.0-dev-00401-gf3b1405 (2015-04-15-12:26) Licensed under GNU GPL v2 For bug reports, read http://openocd.sourceforge.net/doc/doxygen/bugs.html Info : auto-selecting first available session transport "jtag". To override use 'transport select '. adapter speed: 1000 kHz adapter_nsrst_delay: 100 jtag_ntrst_delay: 100 none separate cortex_m reset_config sysresetreq Error: no device found Error: unable to open ftdi device with vid 0403, pid 6010, description '*' and serial '*' Done flashing [kaspar@localhost pthread]$ Flashing always returns error 0. With this patch: [kaspar@localhost pthread]$ BOARD=iot-lab_M3 make flash Building application "pthread" for "iot-lab_M3" with MCU "stm32f1". "make" -C /home/kaspar/src/riot.5/boards/iot-lab_M3 "make" -C /home/kaspar/src/riot.5/core "make" -C /home/kaspar/src/riot.5/cpu/stm32f1 "make" -C /home/kaspar/src/riot.5/cpu/cortex-m3_common "make" -C /home/kaspar/src/riot.5/cpu/stm32f1/periph "make" -C /home/kaspar/src/riot.5/drivers "make" -C /home/kaspar/src/riot.5/sys "make" -C /home/kaspar/src/riot.5/sys/posix "make" -C /home/kaspar/src/riot.5/sys/posix/pthread "make" -C /home/kaspar/src/riot.5/sys/timex "make" -C /home/kaspar/src/riot.5/sys/vtimer text data bss dec hex filename 14688 112 4460 19260 4b3c /home/kaspar/src/riot.5/tests/pthread/bin/iot-lab_M3/pthread.elf /home/kaspar/src/riot.5/dist/tools/openocd/openocd.sh flash ### Flashing Target ### Open On-Chip Debugger 0.9.0-dev-00401-gf3b1405 (2015-04-15-12:26) Licensed under GNU GPL v2 For bug reports, read http://openocd.sourceforge.net/doc/doxygen/bugs.html Info : auto-selecting first available session transport "jtag". To override use 'transport select '. adapter speed: 1000 kHz adapter_nsrst_delay: 100 jtag_ntrst_delay: 100 none separate cortex_m reset_config sysresetreq Error: no device found Error: unable to open ftdi device with vid 0403, pid 6010, description '*' and serial '*' /home/kaspar/src/riot.5/tests/pthread/../../Makefile.include:233: recipe for target 'flash' failed make: *** [flash] Error 1 [kaspar@localhost pthread]$ BOARD=iot-lab_M3 make flash Building application "pthread" for "iot-lab_M3" with MCU "stm32f1". "make" -C /home/kaspar/src/riot.5/boards/iot-lab_M3 "make" -C /home/kaspar/src/riot.5/core "make" -C /home/kaspar/src/riot.5/cpu/stm32f1 "make" -C /home/kaspar/src/riot.5/cpu/cortex-m3_common "make" -C /home/kaspar/src/riot.5/cpu/stm32f1/periph "make" -C /home/kaspar/src/riot.5/drivers "make" -C /home/kaspar/src/riot.5/sys "make" -C /home/kaspar/src/riot.5/sys/posix "make" -C /home/kaspar/src/riot.5/sys/posix/pthread "make" -C /home/kaspar/src/riot.5/sys/timex "make" -C /home/kaspar/src/riot.5/sys/vtimer text data bss dec hex filename 14688 112 4460 19260 4b3c /home/kaspar/src/riot.5/tests/pthread/bin/iot-lab_M3/pthread.elf /home/kaspar/src/riot.5/dist/tools/openocd/openocd.sh flash ### Flashing Target ### Open On-Chip Debugger 0.9.0-dev-00401-gf3b1405 (2015-04-15-12:26) Licensed under GNU GPL v2 For bug reports, read http://openocd.sourceforge.net/doc/doxygen/bugs.html Info : auto-selecting first available session transport "jtag". To override use 'transport select '. adapter speed: 1000 kHz adapter_nsrst_delay: 100 jtag_ntrst_delay: 100 none separate cortex_m reset_config sysresetreq Info : clock speed 1000 kHz Info : JTAG tap: stm32f1x.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3) Info : JTAG tap: stm32f1x.bs tap/device found: 0x06414041 (mfg: 0x020, part: 0x6414, ver: 0x0) Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints TargetName Type Endian TapName State -- ------------------ ---------- ------ ------------------ ------------ 0* stm32f1x.cpu cortex_m little stm32f1x.cpu running Info : JTAG tap: stm32f1x.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3) Info : JTAG tap: stm32f1x.bs tap/device found: 0x06414041 (mfg: 0x020, part: 0x6414, ver: 0x0) target state: halted target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0x080002a4 msp: 0x200036b4 Info : JTAG tap: stm32f1x.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3) Info : JTAG tap: stm32f1x.bs tap/device found: 0x06414041 (mfg: 0x020, part: 0x6414, ver: 0x0) target state: halted target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0x080002a4 msp: 0x200036b4 ** Programming Started ** auto erase enabled Info : device id = 0x10016414 Info : flash size = 512kbytes wrote 16384 bytes from file /home/kaspar/src/riot.5/tests/pthread/bin/iot-lab_M3/pthread.hex in 0.732912s (21.831 KiB/s) ** Programming Finished ** ** Verify Started ** verified 14800 bytes in 0.242978s (59.483 KiB/s) ** Verified OK ** Info : JTAG tap: stm32f1x.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3) Info : JTAG tap: stm32f1x.bs tap/device found: 0x06414041 (mfg: 0x020, part: 0x6414, ver: 0x0) shutdown command invoked Done flashing [kaspar@localhost pthread]$ |
Seems they fixed openocd's behaviour in March: commit 19f219f731f29503c8e4d432935d3ea558cc1659 Author: Paul Fertser Date: Fri Mar 13 16:32:53 2015 +0300 Tcl exception codes cleanup, shutdown command amendments This patch might influence openocd Tcl commands behaviour in subtle ways, please give it a nice testing. The idea is that if an OpenOCD Tcl command returns an error, an exception is raised, and then the return code is propogated all the way up (or to the "catch" if present). This allows to detect "shutdown" which is not actually an error but has to raise an exception to stop execution of the commands that follow it in the script. openocd_thread special-cases shutdown because it should then terminate OpenOCD with a success error code, unless shutdown was called with an optional "error" argument which means terminate with a non-zero exit code. Change-Id: I7b6fa8a2e24c947dc45d8def0008b4b007c478b3 Signed-off-by: Paul Fertser Reviewed-on: http://openocd.zylin.com/2600 Tested-by: jenkins Reviewed-by: Juha Niskanen Reviewed-by: Jens Bauer Reviewed-by: Oleksij Rempel |
I think the problem remains. #2471 would fix this misbehavior as well, but I think we can (unfortunately) not assume that most RIOT developers will have a bleeding edge distribution like Arch, but more conservative stuff like Ubuntu LTS. |
We can still encourage them to build their own recent version or live with a failing flash target. |
or check for a recent openocd version... |
Or use a reasonable distribution. However, this will lead to some confusion on the "support channels". |
@OlegHahm You mean to say that confused people will show up in the support channels? |
Checking for the version sounds good to me. |
Needs rebase |
a61aad2
to
246b2b0
Compare
|
is this PR ready for the next release? just let me know if it needs to be ACK |
Let's wait for next Ubuntu LTS this April. |
New version of Ubuntu was released. |
Including a new version of OpenOCD? |
Depends on what you call "new":
|
Back then I tested with v0.9-devel, so an older version than what Ubuntu ships now. Should we get this in? |
Has anybody tried with the new Ubuntu version? |
This PR would basically break on newer openocd version if I remember this correctly. |
246b2b0
to
a539b99
Compare
I'm using
and this PR works as expected. |
Difficult to verify without access to OpenOCD documentation, but seems to work. ACK |
Can you squash what you marked to be squashed? Murdock is complaining :( |
@kaspar030 just squash, code looks good and it's already ACKed, let's merge it asap :D |
Please squash this, it's easy :D |
a539b99
to
8601285
Compare
|
Danke schön! :D |
Already ACKed, so GO! |
without this change, flashing with openocd always seems to succeed, even if it didn't.