1e41f4b71Sopenharmony_ci# Magic Key
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ci## When to Use
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ciWhen the system does not respond, you can use the magic key to check whether the system is suspended by an interrupt lock or view the system task running status.
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ciIf interrupts are responded, you can use the magic key to check the task CPU percent (CPUP) and locate the task with the highest CPUP. Generally, the task with a higher priority preempts the CPU resources.
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci## How to Configure
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ciThe magic key depends on the macro **LOSCFG_ENABLE_MAGICKEY**. 
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ciTo configure **LOSCFG_ENABLE_MAGICKEY**: 
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci1. Run the **make menuconfig** command in **kernel/liteos_a**. 
18e41f4b71Sopenharmony_ci2. Locate the **Debug** option and select **Enable MAGIC KEY**.
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ciThis option is selected by default. If it is not selected, the magic key is invalid.
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci> **NOTE**<br>
23e41f4b71Sopenharmony_ci> On **menuconfig**, you can move the cursor to **LOSCFG_ENABLE_MAGICKEY** and enter a question mark (?) to view help information.
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci## How to Use
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci1. Press **Ctrl+R** to enable the magic key.
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci   When the UART or USB-to-virtual serial port is connected, press **Ctrl+R**. If "Magic key on" is displayed, the magic key is enabled. To disable it, press **Ctrl+R** again. If "Magic key off" is displayed, the magic key is disabled.
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci   The functions of the magic key are as follows:
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci   - **Ctrl+Z**: displays help information about the related magic keys.
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci   - **Ctrl+T**: displays task information.
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci   - **Ctrl+P**: allows the system to proactively enter the panic state. After the panic-related information is printed, the system is suspended.
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ci   - **Ctrl+E**: Checks the integrity of the memory pool. If an error is detected, the system displays an error message. If no error is detected, the system displays "system memcheck over, all passed!".
40e41f4b71Sopenharmony_ci   
41e41f4b71Sopenharmony_ci   > **NOTE**<br>
42e41f4b71Sopenharmony_ci   > If magic key is enabled, when special characters need to be entered through the UART or USB-to-virtual serial port, avoid using characters the same as the magic keys. Otherwise, the magic key may be triggered by mistake, causing errors in design.
43