Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 2 months ago.
bricked by debuger?
I've used the python PyOCD gdb proxy. After uploading a file the KL25Z didn't react any more. Nothing, not even the MBED drive appears. I've tried to reflash the mbed_if_v2.0_frdm_kl25z.s19 File from windows: still dead. Unfortunately that happened to two (!) KL25Z of mine. So how can I revive it?
Question relating to:
2 Answers
11 years, 1 month ago.
I had the exact same experience! I compiled the example GPIO program (http://mbed.org/users/mbed_official/code/FRDM_GPIO/docs/0f13346a8475/main_8cpp_source.html) using GCC and tried to flash the elf using gdb. Using the 'load' command, the flashing went well until I saw an error "SWD Fault" on the pyocd console. (Unfortunately, I did not save the entire message)
From that point on the mbed no longer responds, i.e., does not enumerate as usb hid device or mass storage on windows. I tried to revert the firmware to pemicro and it shows up as a mass storage device. But when I 'drag and drop' binaries it no longer programs the target =(
Previously I had compiled and flashed the mbed using drag and drop into the mbed "drive" which worked, but flashing using gdb over pyocd resulted in this.
I've attach my project here (the makefile plus binary and elf file), but flash at your own risk!
/media/uploads/timothyteh/mkl25z4.7z
Can you possible add this to Bugs section here on mbed forum ? this could be a problem of pyocd. I haven't used it, I used so far only Jlink gdb. Do you have any external debugger like Jlink/Uvision ? Could you use Jlink OpenSDA firmware, flash it, and open jlink console , what it writes? I used to lock the chip, always helped to unlock it throgh jlink console.
Regards,
0xc0170
Hi Martin,
Thanks for your response. I think you are right. pyocd may have flashed the option bytes 0x400-0x40C of the KL25. I have tried uvision, code warrior, jlink and pemicro's flash programming utilities all to no avail. The error message I get is "Device is secure, mass erase is disabled". It looks like I have permanently locked the device, and may have to do some desoldering/soldering a replacement chip, or buy a new frdm board =(
Did you unlock your device using an external programmer? If so, what is the programmer you used?
Also, when using jlink gdb, do you also 'load' the .elf file? I may consider using jlink instead of pyocd for my next attempt.
Cheers, Timothy
posted by 03 Oct 2013Hello Timothy,
I have been using pyOCD this weekend, it has not set that mass erase security bit so far. I tried flashing binary file which comes with pyOCD and also my gcc program. Using pyOCD scripts, not gdb directly.
Regards, 0xc0170
posted by 01 Dec 2013Guys, please , join a discussion here about pyOCD with KL25Z. I would like to get some details,
http://mbed.org/forum/mbed/topic/4629/?page=1#comment-23027
posted by 02 Dec 201311 years, 2 months ago.
Hi Martin, Thanks for your help and please excuse the late reply.
Yes I can get it to bootloader mode. I've tried to upload the MSD-FRDM-KL25Z_Pemicro_v105.SDA and it worked: I get the MSD drive after replugging the USB port. Now after copying the mbed_if_v2.0_frdm_kl25z.s19 to the BOOTLOADER driver it does not work: no drive will show up (Win7).
I have the elf and the bin if they are of any help. I've uploaded the ELF via the gdb which was connected to the python gdb server (the documentation had an example which uploaded an ELF so I assumed ELF would be the right file). The bin of the same programm worked when just flashing it via the PyOCD skript. I have bin and ELF because I used the gcc toolchain. Any ideas? should I upload the bin/elf/source somewhere?
Please can you test this approach - load there jlink openSDA firmware. Then connect through Jlink console, execute command "unlock kinetis" and share here what it prints. Then revert back mbed firmware.
If you don't know how to do this, I can write a tutorial on my blog (also test my proposal).
Does this work for you ? Let us know.
Regards,
0xc0170
Ran into the same problem today. The kl25z board can't be recognized after the broken of pyocd. I recovered the board through following steps:
1) enter into bootloader mode and copy/paste the file MSD-FRDM-KL25Z_Pemicro_v112.SDA into USB driver.
2) unplug the board and replug it. Now you should be able to get MSD driver, very similar to MBED Driver.
3) Download FRDM-KL25Z Quick start package from http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=FRDM-KL25Z&fpsp=1&tab=Design_Tools_Tab#.
4) Install that package on windows and some precompiled projects can be found at path "FRDM-KL25Z_QSP\FRDM-KL25Z Quick Start Package\Precompiled Examples".
5) Choose any of the project files and copy/paste it to MSD driver. The board can run the project immediately without the need of unplug/replug. Now the board should be in unsecure state.
6) disconnect the board and enter the bootloader mode. Upload the mbed_if_v2.0_frdm_kl25z.s19 firmware.
7) reset the board, the board will be saved and the MBed mode works.
posted by 14 Oct 2013Thanks Terry Guo for sharing this! Can you possibly create a notepad, where it would be more visible? I have done similar approach several times, the last time when I pressed a reset button while flashing :-)
Regards,
0xc0170
Can you please share how to create a notepad? Is it the notebook page under my username?
posted by 16 Oct 2013Hello guys, can you look at this https://github.com/0xc0170/mbed/commit/848c8bde00b2e4554e2a140430b26df736229016
Using the previous KL25Z GCC files, locking happened as you guys reported. The above link proposed a fix for it. pyOCD gdb server didn't lock my KL25Z using this fix (changes in the linker command file and the startup), although I had another issues (I was editing pyOCD gdb server implementation a bit), will investigate.
Let me know. You can create a new thread in the forum to talk about this. I am going to summarize my findings in the blogspot.
Regards,
0xc0170
Can you get KL25Z board back to bootloader mode? Upload there different firmware (for example test jlink firmware or original freescale msd).
posted by Martin Kojtal 11 Sep 2013Do you have that bin which caused this problem? Can you share it with us?