Access to illegal addresses causes core to crash
When debugging applications, it can often happen that pointers etc. point to invalid memory addresses temporarily (e.g. when they are local pointer variables and not initialized yet, so they just point to an address present on the stack). Usually, this is no problem but in some IDEs it might be a problem if the IDE tries to dereference the pointer to show the contents it points to (e.g. for const char* which usually point to strings etc.). It heavily depends on the target device how good J-Link can handle such cases.
For some devices it is no problem and J-Link can make the MCU to recover from such illegal accesses. However, on some devices it is problematic if illegal addresses are accessed and the device may lockup and becomes unresponsive (also to debug commands issued by J-Link). In such cases, the debug session is usually over and the device needs a power cycle.
As it heavily depends on the IDE if things like pointer dereferencing etc. is done in the variable view windows and it heavily depends on the setup if a specific address range is invalid or not, there is no good out-of-the-box setup for some cases. Therefore, J-Link allows to specify certain areas as illegal, via J-Link script files. If an area is specified as illegal, J-Link won't perform a hardware access but just return "access failed" to the IDE that requests the access. This way, such lockup scenarios can be avoided. By specifying this via a J-Link script file, it is IDE independent and the IDE does not need to provide an interface for this.
Sample J-Link script file
Please find below a sample J-Link script file that demonstrates how to specify certain address ranges as illegal. The J-Link script file can be modified as needed and may be distributed with a project etc.
How to make the IDE session using the script file
For more information how to make a specific IDE using the J-Link script file, please refer to the IDE section
Refer to the "Using J-Link script files" section for the specific IDE.