在FreeRTOS中需要启用 ARM-Cortex 内核 CYCNT 寄存器。要实现这个功能,必须将地址为0xE0001000的 DWT_CTRL 寄存器的使能位置 1。
我不理解的是为什么要使用下面这种宏定义(第 1 行),把寄存器的值赋值给宏DWT_CTRL,然后像第 34 行那样去修改它?
#define DWT_CTRL *((volatile uint32_t*)0xE0001000)
int main(void)
{
/* USER CODE BEGIN 1 */
TaskHandle_t task1_handle;
TaskHandle_t task2_handle;
BaseType_t status;
/* USER CODE END 1 */
/* MCU Configuration--------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* USER CODE BEGIN Init */
/* USER CODE END Init */
/* Configure the system clock */
SystemClock_Config();
/* USER CODE BEGIN SysInit */
/* USER CODE END SysInit */
/* Initialize all configured peripherals */
MX_GPIO_Init();
/* USER CODE BEGIN 2 */
//Enable the CYCCNT
DWT_CTRL |= (1<<0);
|
|