Cannot configure Objective C in the RL-RTX (cm3) task, otherwise the reason for entering the hardfault
Http://www.keil.com/support/man/docs/rlarm/rlarm_ar_cfgrunpriv.htm
Run in privileged Mode
The RTX library of the cortex-M device allows you to select the running mode of user tasks. The task can run in two modes:
- Non-privilege mode-Protected Mode
- Privileged mode-Unprotected Mode
Protection should refer to operating system protectionCodeRun]
In privileged mode, you can access and configure system registers and control registers, such as the objective C interrupt controller. In non-privileged mode, these operations are not allowed. Accessing the Objective C register in non-privileged mode will cause hardware errors (hard fault ).
- MacroOS _runprivEnables all tasks to run in privileged mode. Set 1 to enable the privileged mode, and set 0 to disable the privileged mode. This macro is disabled by default.
For old projects, you can enable the privileged mode. When the new cortex-m rtx kernel library is updated and the rtx_config.c configuration file is replaced, the existing code can be run without any changes. In privileged mode, tasks are unprotected. You can configure the system in any task, such as configuration interruption.
The privileged mode is disabled by default. This allows all tasks to run in protected mode. The task cannot change the system configuration or interrupt. You have two options:
- Run the configuration code in privileged mode such as _ SVC function in the task
- When the system kernel is not started, that is, when the device is still running in privileged mode, run the configuration code
Note:
- This option is not supported in the RTX kernel library of arm7.