From: Thomas V. <to...@on...> - 2017-09-02 19:22:02
|
Hello All, I apologize if this is a stupid question or it has been addressed before. I tried googling this, but couldn't make heads or tails from what I found and don't have a clue how to go about this. I've used a variety of embedded CPUs and IDEs, but never really mucked with OpenOCD. I have an Olimex ARM-USB-OCD device laying around, but could purchase a newer one if necessary, they are relatively low cost. I've tried downloading the latest version of OpenOCD (0.10.0). But I'm lost beyond that. What do I do now? Should I just pitch it and go buy a JLink and commercial software? I want to build a couple of handfuls of boards at a time and program them. Something commandline driven would be great. I'm using Windows 10, but have a 7 box laying around. Thank you! -Tom |
From: Paul F. <fer...@gm...> - 2017-09-02 20:05:45
|
Hello, On Sat, Sep 02, 2017 at 07:06:57PM +0000, Thomas Varghese wrote: > I have an Olimex ARM-USB-OCD device laying around, but could purchase a newer > one if necessary, they are relatively low cost. ... > I’ve tried downloading the latest version of OpenOCD (0.10.0). Please check the README.Windows , install WinUSB driver as suggested, and OpenOCD should just work. For production programming you should be able to use "program" command. What exactly is your question, what doesn't work? -- Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! mailto:fer...@gm... |
From: Thomas V. <to...@on...> - 2017-09-03 12:50:16
|
Hi Paul, Thanks for responding. I downloaded the windows binary from gnutoolchains.com/arm-eabi/openocd, don't see a README.Windows or any other readme files that had install instructions in it. I did google for it and did find it. The instructions were mostly regarding building from source and installing USB drivers. I really apologize if I'm asking stupid questions... but what do I do once it is installed/compiled? All I really want to do is load the flash in some Kinetis parts. A pointer to some more detailed instructions would be really, really appreciated. I tried the Segger J-Link Edu device, but couldn't get that to work with Kinetis IDE. Things would crash or it would say it was programmed, but didn't. Apparently need to buy the more expensive version and then the fairly expensive programming software JLink Flash. I have a couple of the OpenOCD devices from Olimex that I purchased for some other project that didn't go anywhere, so I was hoping I could put them to some use. Would really appreciate the help. Thank you in advance! -Tom -----Original Message----- From: Paul Fertser [mailto:fer...@gm...] Sent: Saturday, September 2, 2017 3:06 PM To: Thomas Varghese <to...@on...> Cc: ope...@li... Subject: Re: [OpenOCD-devel] How to program Kinetis with OpenOCD on windows? Hello, On Sat, Sep 02, 2017 at 07:06:57PM +0000, Thomas Varghese wrote: > I have an Olimex ARM-USB-OCD device laying around, but could purchase > a newer one if necessary, they are relatively low cost. ... > I’ve tried downloading the latest version of OpenOCD (0.10.0). Please check the README.Windows , install WinUSB driver as suggested, and OpenOCD should just work. For production programming you should be able to use "program" command. What exactly is your question, what doesn't work? -- Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! mailto:fer...@gm... |
From: Thomas V. <to...@on...> - 2017-09-03 16:24:16
|
Hi Paul, Did a bit of digging and found a tutorial that was somewhat relevant. So here are some basic questions that are bit more specific: 1) With the Kinetis MK20DX256VLH7, do I need the 220-470 ohm resistor on the TDI line to use SWD? 2) What should the configuration file look like, here is my attempt at an openocd.cfg: interface ftdi transport select swd adapter_khz 1000 ftdi_vid_pid 0x15BA 0x0003 ftdi_layout_init 0x0018 0x05fb ftdi_layout_signal SWD_EN -data 0 ftdi_layout_signal nSRST -data 0x0010 I did notice there was a kinetis_256K.cfg, should I be using that instead, if so how? If anyone has a working cfg file they are willing to share, that would be great! 3) Installed WinUSB driver for the Olimex ARM-USB-OCD, is this the best options? 4) When I try run "openocd.exe" in the directory with the openocd.cfg I get this: Open On-Chip Debugger 0.10.0 (2017-08-21) [https://github.com/sysprogs/openocd] Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info : FTDI SWD mode enabled adapter speed: 1000 kHz Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED Info : clock speed 1000 kHz Error: BUG: current_target out of bounds 5) Based #4, where do I get libusb? I tried changing the driver to libusb-win32 and libusbk, same error. So I must be missing something else. Thanks for your patience and understanding. -Tom -----Original Message----- From: Paul Fertser [mailto:fer...@gm...] Sent: Saturday, September 2, 2017 3:06 PM To: Thomas Varghese <to...@on...> Cc: ope...@li... Subject: Re: [OpenOCD-devel] How to program Kinetis with OpenOCD on windows? Hello, On Sat, Sep 02, 2017 at 07:06:57PM +0000, Thomas Varghese wrote: > I have an Olimex ARM-USB-OCD device laying around, but could purchase > a newer one if necessary, they are relatively low cost. ... > I’ve tried downloading the latest version of OpenOCD (0.10.0). Please check the README.Windows , install WinUSB driver as suggested, and OpenOCD should just work. For production programming you should be able to use "program" command. What exactly is your question, what doesn't work? -- Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! mailto:fer...@gm... |
From: Thomas V. <to...@on...> - 2017-09-03 16:30:52
|
I guess I should include how the hardware is connected up, to be sure I got the basics right: Chip: MK20DX256VLH7 Debugger: Olimex ARM-USB-OCD (not the -H variety) JTAG connections on CPU: Pin 23 TDI Pin 25 TMS Pin 22 TCK Pin 25 TDO Pin 34 nRST Do have a 10K pull up on pin 26 (EzPort nCS) and the pin 34 (nRST). The others do not have anything connected to them when the JTAG connector is disconnected. JTAG connections on 20pin connector Pin 1 VCC Pin 5 TDI Pin 7 TMS Pin 9 TCK Pin 13 TDO Pin 15 nRST Pin 4 GND Did I get this right so far? -Tom -----Original Message----- From: Thomas Varghese Sent: Sunday, September 3, 2017 11:09 AM To: 'Paul Fertser' <fer...@gm...> Cc: ope...@li... Subject: RE: [OpenOCD-devel] How to program Kinetis with OpenOCD on windows? Hi Paul, Did a bit of digging and found a tutorial that was somewhat relevant. So here are some basic questions that are bit more specific: 1) With the Kinetis MK20DX256VLH7, do I need the 220-470 ohm resistor on the TDI line to use SWD? 2) What should the configuration file look like, here is my attempt at an openocd.cfg: interface ftdi transport select swd adapter_khz 1000 ftdi_vid_pid 0x15BA 0x0003 ftdi_layout_init 0x0018 0x05fb ftdi_layout_signal SWD_EN -data 0 ftdi_layout_signal nSRST -data 0x0010 I did notice there was a kinetis_256K.cfg, should I be using that instead, if so how? If anyone has a working cfg file they are willing to share, that would be great! 3) Installed WinUSB driver for the Olimex ARM-USB-OCD, is this the best options? 4) When I try run "openocd.exe" in the directory with the openocd.cfg I get this: Open On-Chip Debugger 0.10.0 (2017-08-21) [https://github.com/sysprogs/openocd] Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info : FTDI SWD mode enabled adapter speed: 1000 kHz Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED Info : clock speed 1000 kHz Error: BUG: current_target out of bounds 5) Based #4, where do I get libusb? I tried changing the driver to libusb-win32 and libusbk, same error. So I must be missing something else. Thanks for your patience and understanding. -Tom -----Original Message----- From: Paul Fertser [mailto:fer...@gm...] Sent: Saturday, September 2, 2017 3:06 PM To: Thomas Varghese <to...@on...> Cc: ope...@li... Subject: Re: [OpenOCD-devel] How to program Kinetis with OpenOCD on windows? Hello, On Sat, Sep 02, 2017 at 07:06:57PM +0000, Thomas Varghese wrote: > I have an Olimex ARM-USB-OCD device laying around, but could purchase > a newer one if necessary, they are relatively low cost. ... > I’ve tried downloading the latest version of OpenOCD (0.10.0). Please check the README.Windows , install WinUSB driver as suggested, and OpenOCD should just work. For production programming you should be able to use "program" command. What exactly is your question, what doesn't work? -- Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! mailto:fer...@gm... |
From: Paul F. <fer...@gm...> - 2017-09-03 18:09:43
|
On Sun, Sep 03, 2017 at 04:30:39PM +0000, Thomas Varghese wrote: > JTAG connections on CPU: > Pin 23 TDI > Pin 25 TMS > Pin 22 TCK > Pin 25 TDO > Pin 34 nRST Oh, so you have full JTAG, then you should try using that, you do not need SWD (and the resistor hack) in this case. -- Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! mailto:fer...@gm... |
From: Paul F. <fer...@gm...> - 2017-09-03 18:08:25
|
Hi Thomas :) On Sun, Sep 03, 2017 at 04:08:58PM +0000, Thomas Varghese wrote: > 1) With the Kinetis MK20DX256VLH7, do I need the 220-470 ohm resistor on the TDI line to use SWD? If you want to use SWD with Olimex ARM-USB-OCD, then yes, you either need the resistor hack or you need an Olimex SWD adapter (or similar part from other manufacturer). > 2) What should the configuration file look like, here is my attempt at an openocd.cfg: > > interface ftdi > transport select swd > adapter_khz 1000 > ftdi_vid_pid 0x15BA 0x0003 > ftdi_layout_init 0x0018 0x05fb > ftdi_layout_signal SWD_EN -data 0 > ftdi_layout_signal nSRST -data 0x0010 You shouldn't be writing interface config file yourself, no. In this case you should just source interface/ftdi/olimex-arm-usb-ocd.cfg , then "transport select swd", then source target config, in your case "target/kx.cfg" should work. > 3) Installed WinUSB driver for the Olimex ARM-USB-OCD, is this the best options? Yes, you need to install WinUSB with Zadig, and probably you need to install it for the whole composite device (depends on windows version I guess). > 4) When I try run "openocd.exe" in the directory with the > openocd.cfg I get this: ... I suggest you try running like this: openocd -f interface/ftdi/olimex-arm-usb-ocd.cfg -c "transport select swd" -f target/kx.cfg > Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED This likely means WinUSB wasn't properly installed. > 5) Based #4, where do I get libusb? I tried changing the driver to > libusb-win32 and libusbk, same error. So I must be missing > something else. No, you should use WinUSB. libusb_open knows how to talk to it. HTH -- Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! mailto:fer...@gm... |
From: Paul F. <fer...@gm...> - 2017-09-03 18:11:16
|
On Sun, Sep 03, 2017 at 09:08:12PM +0300, Paul Fertser wrote: > I suggest you try running like this: > > openocd -f interface/ftdi/olimex-arm-usb-ocd.cfg -c "transport select swd" -f target/kx.cfg Correction, openocd -f interface/ftdi/olimex-arm-usb-ocd.cfg \ -f interface/ftdi/swd-resistor-hack.cfg \ -c "transport select swd" \ -f target/kx.cfg -- Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! mailto:fer...@gm... |
From: Thomas V. <to...@on...> - 2017-09-03 23:57:50
|
Hi Paul, This is almost working! Thanks a bunch!!! Here is what happened: ----------- START ---------------- $ ./bin/openocd.exe -f share/openocd/scripts/interface/ftdi/olimex-arm-usb-ocd.cfg -f share/openocd/scripts/target/kinetis_256k.cfg -c "program firmware.elf verify reset exit" Open On-Chip Debugger 0.10.0 (2017-08-21) [https://github.com/sysprogs/openocd] Licensed under GNU GPL v2 For bug reports, read http://openocd.org/doc/doxygen/bugs.html Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'. cortex_m reset_config sysresetreq adapter speed: 1000 kHz Info : add flash_bank kinetis pflash.0 Info : clock speed 1000 kHz Info : JTAG tap: kinetis.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4) START... Info : kinetis.cpu: hardware has 6 breakpoints, 4 watchpoints END... Info : JTAG tap: kinetis.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4) START... END... target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0x000001bc msp: 0x20008000 -event reset-init occured ** Programming Started ** auto erase enabled Info : Kinetis MK20DX256xxx7 detected: 2 flash blocks Info : 1 PFlash banks: 256k total Info : 1 FlexNVM banks: 32k total, 32k available as data flash, 2048bytes FlexRAM Warn : Missing bank 1 configuration, FCF protection flags may be incomplette Warn : Missing bank 1 configuration, FCF protection flags may be incomplette Warn : Flash Configuration Field written. Warn : Reset or power off the device to make settings effective. wrote 32768 bytes from file vs_pos_teensy_20170819_72MHz.ino.elf in 0.870272s (36.770 KiB/s) ** Programming Finished ** ** Verify Started ** Error: No working memory available. Specify -work-area-phys to target. Warn : not enough working area available(requested 52) Error: checksum mismatch - attempting binary compare diff 0 address 0x0000040c. Was 0xfe instead of 0xde diff 1 address 0x0000040d. Was 0xff instead of 0xf9 Error: No working memory available. Specify -work-area-phys to target. Warn : not enough working area available(requested 52) No more differences found. ** Verify Failed ** shutdown command invoked ----------- END ---------------- The programming didn't work, the device is not doing anything as well, just to confirm it failed the programming. So more stupid questions: 1) Autoerase is enabled, but may be it is not working? How do I erase the flash? I tried erasing the flash with no luck whatsoever, everything I try comes back with a "invalid subcommand". Tried the erase_address and erase_sector 2) Do I need to telnet to port 4444 to do this or can I do it with a -c " insert commands here " 3) I've heard the Kinetis parts are sometimes shipped with a security bit set and that needs to be removed with a chip erase. Any thoughts on how to do that? 4) Any thoughts on the "No working memory available..."? Is it a problem? Feels like we are really, really close. Thanks so much for all your help so far. Really appreciate it. -Tom -----Original Message----- From: Paul Fertser [mailto:fer...@gm...] Sent: Sunday, September 3, 2017 1:11 PM To: Thomas Varghese <to...@on...> Cc: ope...@li... Subject: Re: [OpenOCD-devel] How to program Kinetis with OpenOCD on windows? On Sun, Sep 03, 2017 at 09:08:12PM +0300, Paul Fertser wrote: > I suggest you try running like this: > > openocd -f interface/ftdi/olimex-arm-usb-ocd.cfg -c "transport select swd" -f target/kx.cfg Correction, openocd -f interface/ftdi/olimex-arm-usb-ocd.cfg \ -f interface/ftdi/swd-resistor-hack.cfg \ -c "transport select swd" \ -f target/kx.cfg -- Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software! mailto:fer...@gm... |
From: Tomas V. <to...@us...> - 2017-09-04 05:24:53
|
Hi, Paul suggested target/kx.xfg from OpenOCD distribution. You are using kinetis_256k.cfg you've found somewhere on the net. Although your config might work with some ancient OpenOCD version, it does not work well with current OpenOCD. BTW Programming worked, the verify error is caused by FCF field protection mechanism. See 'kinetis fcf_source' and 'kinetis fopt' commands in http://openocd.org/doc/html/Flash-Commands.html#flashdriverlist (yes, we have the documentation...) Tom On 04.09.2017 1:57, Thomas Varghese wrote: > Hi Paul, > > This is almost working! Thanks a bunch!!! > > Here is what happened: > ----------- START ---------------- > $ ./bin/openocd.exe -f share/openocd/scripts/interface/ftdi/olimex-arm-usb-ocd.cfg -f share/openocd/scripts/target/kinetis_256k.cfg -c "program firmware.elf verify reset exit" > Open On-Chip Debugger 0.10.0 (2017-08-21) [https://github.com/sysprogs/openocd] > Licensed under GNU GPL v2 > For bug reports, read > http://openocd.org/doc/doxygen/bugs.html > Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'. > cortex_m reset_config sysresetreq > adapter speed: 1000 kHz > Info : add flash_bank kinetis pflash.0 > Info : clock speed 1000 kHz > Info : JTAG tap: kinetis.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4) > START... > Info : kinetis.cpu: hardware has 6 breakpoints, 4 watchpoints > END... > Info : JTAG tap: kinetis.cpu tap/device found: 0x4ba00477 (mfg: 0x23b (ARM Ltd.), part: 0xba00, ver: 0x4) > START... > END... > target halted due to debug-request, current mode: Thread > xPSR: 0x01000000 pc: 0x000001bc msp: 0x20008000 > -event reset-init occured > ** Programming Started ** > auto erase enabled > Info : Kinetis MK20DX256xxx7 detected: 2 flash blocks > Info : 1 PFlash banks: 256k total > Info : 1 FlexNVM banks: 32k total, 32k available as data flash, 2048bytes FlexRAM > Warn : Missing bank 1 configuration, FCF protection flags may be incomplette > Warn : Missing bank 1 configuration, FCF protection flags may be incomplette > Warn : Flash Configuration Field written. > Warn : Reset or power off the device to make settings effective. > wrote 32768 bytes from file vs_pos_teensy_20170819_72MHz.ino.elf in 0.870272s (36.770 KiB/s) > ** Programming Finished ** > ** Verify Started ** > Error: No working memory available. Specify -work-area-phys to target. > Warn : not enough working area available(requested 52) > Error: checksum mismatch - attempting binary compare > diff 0 address 0x0000040c. Was 0xfe instead of 0xde > diff 1 address 0x0000040d. Was 0xff instead of 0xf9 > Error: No working memory available. Specify -work-area-phys to target. > Warn : not enough working area available(requested 52) > No more differences found. > ** Verify Failed ** > shutdown command invoked > ----------- END ---------------- > > The programming didn't work, the device is not doing anything as well, just to confirm it failed the programming. > > So more stupid questions: > 1) Autoerase is enabled, but may be it is not working? How do I erase the flash? I tried erasing the flash with no luck whatsoever, everything I try comes back with a "invalid subcommand". Tried the erase_address and erase_sector > 2) Do I need to telnet to port 4444 to do this or can I do it with a -c " insert commands here " > 3) I've heard the Kinetis parts are sometimes shipped with a security bit set and that needs to be removed with a chip erase. Any thoughts on how to do that? > 4) Any thoughts on the "No working memory available..."? Is it a problem? > > Feels like we are really, really close. > > Thanks so much for all your help so far. Really appreciate it. > > -Tom > > -----Original Message----- > From: Paul Fertser [mailto:fer...@gm...] > Sent: Sunday, September 3, 2017 1:11 PM > To: Thomas Varghese <to...@on...> > Cc: ope...@li... > Subject: Re: [OpenOCD-devel] How to program Kinetis with OpenOCD on windows? > > On Sun, Sep 03, 2017 at 09:08:12PM +0300, Paul Fertser wrote: >> I suggest you try running like this: >> >> openocd -f interface/ftdi/olimex-arm-usb-ocd.cfg -c "transport select swd" -f target/kx.cfg > Correction, > > openocd -f interface/ftdi/olimex-arm-usb-ocd.cfg \ > -f interface/ftdi/swd-resistor-hack.cfg \ > -c "transport select swd" \ > -f target/kx.cfg > |
From: Thomas V. <to...@on...> - 2017-09-04 12:51:25
|
Hi Tom, I actually tried a kx.cfg as well, didn't seem to make much difference. But will try it again. Glad to know about the FCF field protection, then it should work. I'll look at my code again. Thanks for your help, really appreciate it. Let me know how I can help the cause. Development boards, tools, etc. is something I could help with. Where are you located? -T -----Original Message----- From: Tomas Vanek [mailto:to...@us...] Sent: Monday, September 4, 2017 12:07 AM To: Thomas Varghese <to...@on...> Cc: ope...@li... Subject: Re: [OpenOCD-devel] How to program Kinetis with OpenOCD on windows? Hi, Paul suggested target/kx.xfg from OpenOCD distribution. You are using kinetis_256k.cfg you've found somewhere on the net. Although your config might work with some ancient OpenOCD version, it does not work well with current OpenOCD. BTW Programming worked, the verify error is caused by FCF field protection mechanism. See 'kinetis fcf_source' and 'kinetis fopt' commands in http://openocd.org/doc/html/Flash-Commands.html#flashdriverlist (yes, we have the documentation...) Tom On 04.09.2017 1:57, Thomas Varghese wrote: > Hi Paul, > > This is almost working! Thanks a bunch!!! > > Here is what happened: > ----------- START ---------------- $ ./bin/openocd.exe -f > share/openocd/scripts/interface/ftdi/olimex-arm-usb-ocd.cfg -f share/openocd/scripts/target/kinetis_256k.cfg -c "program firmware.elf verify reset exit" > Open On-Chip Debugger 0.10.0 (2017-08-21) > [https://github.com/sysprogs/openocd] > Licensed under GNU GPL v2 > For bug reports, read > http://openocd.org/doc/doxygen/bugs.html > Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'. > cortex_m reset_config sysresetreq > adapter speed: 1000 kHz > Info : add flash_bank kinetis pflash.0 Info : clock speed 1000 kHz > Info : JTAG tap: kinetis.cpu tap/device found: 0x4ba00477 (mfg: 0x23b > (ARM Ltd.), part: 0xba00, ver: 0x4) START... > Info : kinetis.cpu: hardware has 6 breakpoints, 4 watchpoints END... > Info : JTAG tap: kinetis.cpu tap/device found: 0x4ba00477 (mfg: 0x23b > (ARM Ltd.), part: 0xba00, ver: 0x4) START... > END... > target halted due to debug-request, current mode: Thread > xPSR: 0x01000000 pc: 0x000001bc msp: 0x20008000 -event reset-init > occured > ** Programming Started ** > auto erase enabled > Info : Kinetis MK20DX256xxx7 detected: 2 flash blocks Info : 1 PFlash > banks: 256k total Info : 1 FlexNVM banks: 32k total, 32k available as > data flash, 2048bytes FlexRAM Warn : Missing bank 1 configuration, FCF > protection flags may be incomplette Warn : Missing bank 1 > configuration, FCF protection flags may be incomplette Warn : Flash > Configuration Field written. > Warn : Reset or power off the device to make settings effective. > wrote 32768 bytes from file vs_pos_teensy_20170819_72MHz.ino.elf in > 0.870272s (36.770 KiB/s) > ** Programming Finished ** > ** Verify Started ** > Error: No working memory available. Specify -work-area-phys to target. > Warn : not enough working area available(requested 52) > Error: checksum mismatch - attempting binary compare diff 0 address > 0x0000040c. Was 0xfe instead of 0xde diff 1 address 0x0000040d. Was > 0xff instead of 0xf9 > Error: No working memory available. Specify -work-area-phys to target. > Warn : not enough working area available(requested 52) No more > differences found. > ** Verify Failed ** > shutdown command invoked > ----------- END ---------------- > > The programming didn't work, the device is not doing anything as well, just to confirm it failed the programming. > > So more stupid questions: > 1) Autoerase is enabled, but may be it is not working? How do I erase the flash? I tried erasing the flash with no luck whatsoever, everything I try comes back with a "invalid subcommand". Tried the erase_address and erase_sector > 2) Do I need to telnet to port 4444 to do this or can I do it with a -c " insert commands here " > 3) I've heard the Kinetis parts are sometimes shipped with a security bit set and that needs to be removed with a chip erase. Any thoughts on how to do that? > 4) Any thoughts on the "No working memory available..."? Is it a problem? > > Feels like we are really, really close. > > Thanks so much for all your help so far. Really appreciate it. > > -Tom > > -----Original Message----- > From: Paul Fertser [mailto:fer...@gm...] > Sent: Sunday, September 3, 2017 1:11 PM > To: Thomas Varghese <to...@on...> > Cc: ope...@li... > Subject: Re: [OpenOCD-devel] How to program Kinetis with OpenOCD on windows? > > On Sun, Sep 03, 2017 at 09:08:12PM +0300, Paul Fertser wrote: >> I suggest you try running like this: >> >> openocd -f interface/ftdi/olimex-arm-usb-ocd.cfg -c "transport select >> swd" -f target/kx.cfg > Correction, > > openocd -f interface/ftdi/olimex-arm-usb-ocd.cfg \ > -f interface/ftdi/swd-resistor-hack.cfg \ > -c "transport select swd" \ > -f target/kx.cfg > |
From: Thomas V. <to...@on...> - 2017-09-04 13:32:59
|
Ok, found a bug in the code, works great! Thank you again for all the pointers and help. Let me know how I can return the favor. -T -----Original Message----- From: Thomas Varghese [mailto:to...@on...] Sent: Monday, September 4, 2017 7:51 AM To: Tomas Vanek <to...@us...> Cc: ope...@li... Subject: Re: [OpenOCD-devel] How to program Kinetis with OpenOCD on windows? Hi Tom, I actually tried a kx.cfg as well, didn't seem to make much difference. But will try it again. Glad to know about the FCF field protection, then it should work. I'll look at my code again. Thanks for your help, really appreciate it. Let me know how I can help the cause. Development boards, tools, etc. is something I could help with. Where are you located? -T -----Original Message----- From: Tomas Vanek [mailto:to...@us...] Sent: Monday, September 4, 2017 12:07 AM To: Thomas Varghese <to...@on...> Cc: ope...@li... Subject: Re: [OpenOCD-devel] How to program Kinetis with OpenOCD on windows? Hi, Paul suggested target/kx.xfg from OpenOCD distribution. You are using kinetis_256k.cfg you've found somewhere on the net. Although your config might work with some ancient OpenOCD version, it does not work well with current OpenOCD. BTW Programming worked, the verify error is caused by FCF field protection mechanism. See 'kinetis fcf_source' and 'kinetis fopt' commands in http://openocd.org/doc/html/Flash-Commands.html#flashdriverlist (yes, we have the documentation...) Tom On 04.09.2017 1:57, Thomas Varghese wrote: > Hi Paul, > > This is almost working! Thanks a bunch!!! > > Here is what happened: > ----------- START ---------------- $ ./bin/openocd.exe -f > share/openocd/scripts/interface/ftdi/olimex-arm-usb-ocd.cfg -f share/openocd/scripts/target/kinetis_256k.cfg -c "program firmware.elf verify reset exit" > Open On-Chip Debugger 0.10.0 (2017-08-21) > [https://github.com/sysprogs/openocd] > Licensed under GNU GPL v2 > For bug reports, read > http://openocd.org/doc/doxygen/bugs.html > Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'. > cortex_m reset_config sysresetreq > adapter speed: 1000 kHz > Info : add flash_bank kinetis pflash.0 Info : clock speed 1000 kHz > Info : JTAG tap: kinetis.cpu tap/device found: 0x4ba00477 (mfg: 0x23b > (ARM Ltd.), part: 0xba00, ver: 0x4) START... > Info : kinetis.cpu: hardware has 6 breakpoints, 4 watchpoints END... > Info : JTAG tap: kinetis.cpu tap/device found: 0x4ba00477 (mfg: 0x23b > (ARM Ltd.), part: 0xba00, ver: 0x4) START... > END... > target halted due to debug-request, current mode: Thread > xPSR: 0x01000000 pc: 0x000001bc msp: 0x20008000 -event reset-init > occured > ** Programming Started ** > auto erase enabled > Info : Kinetis MK20DX256xxx7 detected: 2 flash blocks Info : 1 PFlash > banks: 256k total Info : 1 FlexNVM banks: 32k total, 32k available as > data flash, 2048bytes FlexRAM Warn : Missing bank 1 configuration, FCF > protection flags may be incomplette Warn : Missing bank 1 > configuration, FCF protection flags may be incomplette Warn : Flash > Configuration Field written. > Warn : Reset or power off the device to make settings effective. > wrote 32768 bytes from file vs_pos_teensy_20170819_72MHz.ino.elf in > 0.870272s (36.770 KiB/s) > ** Programming Finished ** > ** Verify Started ** > Error: No working memory available. Specify -work-area-phys to target. > Warn : not enough working area available(requested 52) > Error: checksum mismatch - attempting binary compare diff 0 address > 0x0000040c. Was 0xfe instead of 0xde diff 1 address 0x0000040d. Was > 0xff instead of 0xf9 > Error: No working memory available. Specify -work-area-phys to target. > Warn : not enough working area available(requested 52) No more > differences found. > ** Verify Failed ** > shutdown command invoked > ----------- END ---------------- > > The programming didn't work, the device is not doing anything as well, just to confirm it failed the programming. > > So more stupid questions: > 1) Autoerase is enabled, but may be it is not working? How do I erase the flash? I tried erasing the flash with no luck whatsoever, everything I try comes back with a "invalid subcommand". Tried the erase_address and erase_sector > 2) Do I need to telnet to port 4444 to do this or can I do it with a -c " insert commands here " > 3) I've heard the Kinetis parts are sometimes shipped with a security bit set and that needs to be removed with a chip erase. Any thoughts on how to do that? > 4) Any thoughts on the "No working memory available..."? Is it a problem? > > Feels like we are really, really close. > > Thanks so much for all your help so far. Really appreciate it. > > -Tom > > -----Original Message----- > From: Paul Fertser [mailto:fer...@gm...] > Sent: Sunday, September 3, 2017 1:11 PM > To: Thomas Varghese <to...@on...> > Cc: ope...@li... > Subject: Re: [OpenOCD-devel] How to program Kinetis with OpenOCD on windows? > > On Sun, Sep 03, 2017 at 09:08:12PM +0300, Paul Fertser wrote: >> I suggest you try running like this: >> >> openocd -f interface/ftdi/olimex-arm-usb-ocd.cfg -c "transport select >> swd" -f target/kx.cfg > Correction, > > openocd -f interface/ftdi/olimex-arm-usb-ocd.cfg \ > -f interface/ftdi/swd-resistor-hack.cfg \ > -c "transport select swd" \ > -f target/kx.cfg > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ OpenOCD-devel mailing list Ope...@li... https://lists.sourceforge.net/lists/listinfo/openocd-devel |