Protected FLASH Pages with Processor Expert Failed Programming with protected FLASH If I try to re-program the protected bootloader with Segger J-Link (both in CodeWarrior and Eclipse/KDS with GDB), then the download silently fails. The effect is that somehow the application on the board does not match what it should be. Looking at the Console view, it shows that erase has failed (but no real error reported):-(: Jlink: Failed to erase sectors 0 @ address 0x00000000 (Algo135: Flash protection violation.
Flash is write-protected.). ERROR Algo135 Flash Protection Violation about failed FLASH Programming What I need is to unprotect the memory and then erase it. Erasing The Segger J-Link features a very fast programming. Part of that speed is that the Segger firmware checks each FLASH page if it really needs to be programmed, and only then it erases and reprogrammed that page. So downloading twice the same application actually will not touch the FLASH memory at all. Additionally, it does not do a complete erase of the device: it only programs the pages I’m using in my application.
The J-Link/J-Trace driver, located in the folder.ARMSegger of the Keil MDK-ARM, supports the J-Link/J-Trace adapters. When you connect the J-Link/J-Trace adapter for the first time, Windows will display the Found New Hardware wizard, which allows you to install the. Free Segger Windows 98/NT/2000/XP Version n/a Full Specs. J-Flash comes with sample projects for most popular microcontrollers and evaluation boards which run out-of-the-box. J-Flash can be controlled via GUI or via command line which makes it also possible to use J-Flash for production purposes. Download J-Flash as part of the J-Link Software & Documentation Package. Oct 18, 2017 This video tutorial will show you how to request your free license in your browser and add the activation key in SEGGER Embedded Studio. J-Flash Serial Number. GNU ARM and J.
The advantage of that is first speed. And it does not erase the application data I’m using in non-volatile memory (see ““). However, sometimes I really need to clear all my data in FLASH too, and then I need to erase all my FLASH pages on the device.
![]()
Segger has product named ‘J-Flash’ which is used to Flash and Erase devices outside of an IDE. There is a free-of-charge ‘Lite’ version available for download from Segger. This utility is not intended to be used for production. With this utility I have a GUI to erase and program my device. Erasing Device with Flash File to Target Again, this does not work if the device is locked. CodeWarrior has another feature called ‘Target Task’ which can be used to erase/unsecure (if your device is supported), see ““.
So I need to use a different tool to unlock and unprotect my device: the J-Link Commander. Unlocking and Erasing with J-Link Commander To unlock the device, Segger has a utility named ‘J-Link Commander’, available from. The binary is ‘jlink.exe’ on Windows and is a command line utility.
To unlock the device use unlock Kinetis. Unlocking and Erasing with J-Link Commander Summary In order to re-program the protected FLASH sectors with Segger J-Link, I need first to unlock and mass erase the device.
For this, there is the J-Link Commander utility which has a command line interface to unprotect and erase the device. For erasing only, the J-Flash (and Lite) is a very useful tool, especially to get a ‘clean’ device memory. To me, the Segger way and tools are very powerful. In this case, things are very flexible, but not that obvious. So I hope this post can help others to get his device unlocked and erased. Happy Erasing ?.
Hi Erich, I am trying to use similar procedure as yours to “erase my secure Kinetis KV31 device”, I use J-link utility – unfortunately I can’t erase it due to device is secured. J-Linkunlock Kinetis Found SWD-DP with ID 0x2BA01477 Unlocking deviceO.K. J-Linkerase Erasing device (MKV31F512xxx12). Error: Failed to erase sectors 8 @ address 0x00004000 (Algo135: Flash pro tection violation.
Flash is write-protected.) Info: J-Link: Flash download: Total time needed: 1.155s (Prepare: 0.689s, Compar e: 0.000s, Erase: 0.067s, Program: 0.000s, Verify: 0.000s, Restore: 0.398s) ERROR: Erase returned with error code -5. J-Link Is there a way to unlock secured device and erase it? I am OK with deleting my flash I just want to reprogram device again. Thanks for you advice. HI Erich I Had the “Device is secured” problem on 2 of 5 MKV31F devices. Using universal multilink i had no way to unlock it,and the odd thing is that one of the devices was new,so i was not able to flash it for the very first time.The project that i tred to load was working fine with other boards let’s call it “Aproject”.
I built an almost empty project,let’s call it “Dummy” and i have found a difference in Hex files: In Aproject the byte ad address 0x40C=0x7E and in “Dummy” 0x40C=0xFE.,at least the SEC bits were Unsecured,i will check why i haveKEYEN Field= Backdoor key access disabled Furthermore the reset pin toggles continously(it has 10K to VDD,100nF to GND). I dont ‘have a Segger J-Link,but almost for shure i should have some demo board with a JLink on board. Do you think i can do something? This is a 100 pins IC,and i ‘m am scared that after changed it by hand,i could face the same problem. Many thanks once more.
Hi Diego, yes, using a J-Link might work for you. The ‘real’ J-Links have stronger pull down circuit I think so would be better. But give it a try. Ultimately, I always have J-Link at hand for these kind of things. The reason why you see the reset pin toggling is that the device is continuously resetting: it starts, then runs into a hard fault, restarts again, etc. You might try as well to pull down (e.g. Push button) the reset line while you connect to the target.
This would give the debug probe a chance or larger time window to connect to the microcontroller and halt it. You migt try this several times. I hope this helps, and good luck! No, there is no utility for this as far as I know. So in your case the reset pin is still active after power-up until it reads the FOPT register. With JTAG you can reset the device using the JTAG command. So if you are using JTAG, you should be able to connect.
If you only have SWD, then you need to be able to connect with the debugger during this tiny window. So I would try to debug it while the microcontroller is powered up. You might need 10, 50, 100 or more tries, but I think this is what you can do. The other way is that you add a button to the reset pin and pull it to GND. Give it a try.
Dear Erich, regarding your post I’m having a similar problem with internal KE02 EEPROM.
Flash is write-protected.). ERROR Algo135 Flash Protection Violation about failed FLASH Programming What I need is to unprotect the memory and then erase it. Erasing The Segger J-Link features a very fast programming. Part of that speed is that the Segger firmware checks each FLASH page if it really needs to be programmed, and only then it erases and reprogrammed that page.
So downloading twice the same application actually will not touch the FLASH memory at all. Additionally, it does not do a complete erase of the device: it only programs the pages I’m using in my application. The advantage of that is first speed. And it does not erase the application data I’m using in non-volatile memory (see ““). However, sometimes I really need to clear all my data in FLASH too, and then I need to erase all my FLASH pages on the device.
Segger has product named ‘J-Flash’ which is used to Flash and Erase devices outside of an IDE. There is a free-of-charge ‘Lite’ version available for download from Segger. This utility is not intended to be used for production. With this utility I have a GUI to erase and program my device. Erasing Device with Flash File to Target Again, this does not work if the device is locked. CodeWarrior has another feature called ‘Target Task’ which can be used to erase/unsecure (if your device is supported), see ““. So I need to use a different tool to unlock and unprotect my device: the J-Link Commander.
Unlocking and Erasing with J-Link Commander To unlock the device, Segger has a utility named ‘J-Link Commander’, available from. The binary is ‘jlink.exe’ on Windows and is a command line utility. To unlock the device use unlock Kinetis. Unlocking and Erasing with J-Link Commander Summary In order to re-program the protected FLASH sectors with Segger J-Link, I need first to unlock and mass erase the device. For this, there is the J-Link Commander utility which has a command line interface to unprotect and erase the device. For erasing only, the J-Flash (and Lite) is a very useful tool, especially to get a ‘clean’ device memory. To me, the Segger way and tools are very powerful.
In this case, things are very flexible, but not that obvious. So I hope this post can help others to get his device unlocked and erased. Happy Erasing ?. Hi Erich, I am trying to use similar procedure as yours to “erase my secure Kinetis KV31 device”, I use J-link utility – unfortunately I can’t erase it due to device is secured. J-Linkunlock Kinetis Found SWD-DP with ID 0x2BA01477 Unlocking deviceO.K. J-Linkerase Erasing device (MKV31F512xxx12).
Error: Failed to erase sectors 8 @ address 0x00004000 (Algo135: Flash pro tection violation. Flash is write-protected.) Info: J-Link: Flash download: Total time needed: 1.155s (Prepare: 0.689s, Compar e: 0.000s, Erase: 0.067s, Program: 0.000s, Verify: 0.000s, Restore: 0.398s) ERROR: Erase returned with error code -5.
J-Link Is there a way to unlock secured device and erase it? I am OK with deleting my flash I just want to reprogram device again.
Thanks for you advice. HI Erich I Had the “Device is secured” problem on 2 of 5 MKV31F devices.
Segger J-flash Arm
Using universal multilink i had no way to unlock it,and the odd thing is that one of the devices was new,so i was not able to flash it for the very first time.The project that i tred to load was working fine with other boards let’s call it “Aproject”. I built an almost empty project,let’s call it “Dummy” and i have found a difference in Hex files: In Aproject the byte ad address 0x40C=0x7E and in “Dummy” 0x40C=0xFE.,at least the SEC bits were Unsecured,i will check why i haveKEYEN Field= Backdoor key access disabled Furthermore the reset pin toggles continously(it has 10K to VDD,100nF to GND). I dont ‘have a Segger J-Link,but almost for shure i should have some demo board with a JLink on board. Do you think i can do something? This is a 100 pins IC,and i ‘m am scared that after changed it by hand,i could face the same problem. Many thanks once more.
Hi Diego, yes, using a J-Link might work for you. The ‘real’ J-Links have stronger pull down circuit I think so would be better. But give it a try.
Ultimately, I always have J-Link at hand for these kind of things. The reason why you see the reset pin toggling is that the device is continuously resetting: it starts, then runs into a hard fault, restarts again, etc.
You might try as well to pull down (e.g. Push button) the reset line while you connect to the target. This would give the debug probe a chance or larger time window to connect to the microcontroller and halt it. You migt try this several times. I hope this helps, and good luck! No, there is no utility for this as far as I know. So in your case the reset pin is still active after power-up until it reads the FOPT register.
Segger Flasher Arm
With JTAG you can reset the device using the JTAG command. So if you are using JTAG, you should be able to connect. If you only have SWD, then you need to be able to connect with the debugger during this tiny window. So I would try to debug it while the microcontroller is powered up.
You might need 10, 50, 100 or more tries, but I think this is what you can do. The other way is that you add a button to the reset pin and pull it to GND. Give it a try. Dear Erich, regarding your post I’m having a similar problem with internal KE02 EEPROM.
Segger J Link Software
I remember the old times. Debugging was mostly made using printf()-output that was redirected to a UART channel and a serial cable hooked up to a terminal window on the PC. This technique was however too slow when debugging interrupt handlers, so I had to toggle a LED or set a digital I/O pin and let the oscilloscope visualize its value, to see what happened inside the interrupt handler.
Sometimes, a rudimentary debugger with run-stop-step debugging was available, but not always. In a historical perspective, this was not so long ago, although younger developers will probably think it was during the medieval times. Luckily, modern developers now enjoy much better tools to look into the target system and debug it. In this blog post, I summarize my best advice for ARM Cortex-M debugging. I have saved my best advice to the very end!
Cortex-M hardware support
The Cortex-M processors from ARM Ltd have excellent hardware support for debugging.
To use system analysis and real-time event tracing in compatible Cortex-M processors, a number of different technologies interact; Serial Wire Viewer (SWV), Serial Wire Debug (SWD) and Serial Wire Output (SWO). Their respective roles will be explained below.
Additionally, some Cortex-M cores and devices have support for instruction tracing, using the Instruction Trace Macrocell (ITM), the Embedded Trace Buffer (ETB) or the Micro Trace Buffer (MTB) technologies.
And finally, ARM added support for hard fault crash analysis. This enables powerful debuggers to work out why the software crashed the CPU and went into the hard fault state.
All these capabilities, when taken together, is a very useful set of hardware capabilities in terms of debugger support. Now, what can you do with it?
1. The SFR register view
I know, I know. This is not a “shiny new object” you haven’t played with before. But even so, having the capability to look into the peripheral SFR registers and see how the hardware is configured, and its status, is a must-have for embedded developers worth their salt.
2. Hard fault crash analysis
Does your system crash once every week? Are you still clueless as to why it happens? Use a debugger with a hard fault crash analyzer. It can tell you exactly why the CPU went into the hard fault crash state, what code line made it happen, and the CPU context when it happened.
3. Serial Wire Viewer real-time event tracing and system analysis
This is the single most powerful debugger feature of compatible Cortex-M processors and debuggers.Serial Wire Viewer (SWV) and compatible debuggers can provide the following types of target information (in real-time, as the target executes at full speed):
The developer can configure SWV in many different ways, to make it emit various combinations of information, e.g. values of memory locations, events, PC values etc. As more types of trace data are enabled for transmission, the more trace packages are needed to be sent from the CPU to the PC debugger. It is possible in certain circumstances that all of the data may not be received by the front end debugging software on the PC.
There are several reasons for this. The target CPU running at full speed can exceed bandwidth on the one-pin SWO output. In addition, trace data makes its way to the SWO via internal buffers which are limited in depth. If the CPU generates more trace packages than the SWO pin can transmit, there will be resulting packet loss. This is normal.
The reason is that Cortex-M microcontrollers are designed to meet aggressive cost targets. The resource limitation is a byproduct of the tradeoff between resources and cost, and is to some extent, “by design”. While this imposes minor limitations on what can be done, it is also true that SWV, used with care, are capable of providing very powerful debug information that in some cases are otherwise unobtainable information without very expensive debug hardware.
In either case, SWV is one of the most powerful debugging tools you have in your toolbox.
4. Instruction tracing
To crack really tough bugs, you might have to resort to instruction tracing, where the execution history is recorded for later off-line analysis. Using a trace log, you can work out what the CPU made before a particular bug – revealing the cause of most problems. With an instruction trace log, every C code line and assembler instruction the CPU executed up to the bug has been recorded. Advanced trigger conditions and filtering capabilities are usually available to aid the developer, who would otherwise be drenched in enormous amounts of trace data.
5. Live variable watch
Using certain debugger probes (Segger J-Link, for example), powerful debuggers can visualize the variable values “live” as the target system executes at full speed. With Atollic TrueSTUDIO, for example, this is possible also with complex data types, like pointers to an array of structs. You can get the complete data structure visualized with live data.
6. Kernel-aware RTOS debugging
If you are using an RTOS, such as FreeRTOS, you really need to have a debugger that is RTOS-aware. You want the debugger to visualize all the RTOS objects, for example, tasks/threads, semaphores, timers, mutexes, message queues, etc. I am sorry, but using an RTOS and not having an RTOS-aware debugger is a very poor choice, in my opinion.
7. Memory analyzer
Have you ever experienced a bug that was almost impossible to find? You were studying the source code for days, and everything looked perfectly fine and there absolutely was no bug there? And still, the system didn’t work as expected? I have. It is very frustrating.
As it turns out, some bugs cannot be found by studying the source code. Why is that? Because it is not caused by the software code itself, but rather by the way the system was built together. Either, the makefile included the wrong version of the source code files (and so you were trying to find the bug in the wrong files), or the linker has placed some code or data in the wrong memory location. Or, the linker optimizer inadvertently removed the code, as the case can be if you use function pointers instead of static calls to the function.
Either way, you will not find this type of bugs by studying the source code. You may have to analyze the memory layout of the generated binary flash image file. Only then can you detect that the interrupt vector table is misconfigured, or the linker has removed the function you call only using a function pointer.
If you have a modern tool like Atollic TrueSTUDIO, use the visual build analyzer. If not, wrap up your sleeves and get dirty using the obscure MAP file.
![]() 8. Don’t introduce bugsSegger J Flash License
This is probably my best advice. You want a debugger with all the powerful debug features to help you out when you run into problems – and you will get into problems, sooner or later. But having great debugger functionalities should not be taken as an excuse to behave like a cowboy hacker and write error-prone spaghetti code.
What separates professional developers from the crowd is the experience that makes them write better code in the first place. They can thus avoid many bugs, saving themselves from grief later. While this list is by no means exhaustive, you can deploy these techniques to prevent bugs from being introduced in your code:
Segger J Flash Lite V6.40
And so, these are the 8 tips I have to minimize the bugs you introduce into your design and find the ones you do introduce.
Segger J Flash Arm Keygens And Hacks
Do you want to learn more on ARM Cortex development and debugging? Read this whitepaper:
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |