使用MDK 打开工程
从上到下 的组依次为 OS 的C文件
.s 启动文件
用户文件
HAL库文件
CMSIS中间件文件
其中 在 第一组中的 cmsis_os.c 中实现了 cmsis_os 到FREERTOS 的中间层转换 稍后会讨论其中一处代码
![](http://www.stmcu.org/module/forum/data/attachment/forum/201501/08/101939owsz4wtwmcmos3q3.jpg)
接下来 添加自己的代码 首先添加 072 上面LED吧 板子不在身边 记得是PA5 控制
先看看 main.c 的 64 到 105行
int main(void)
{
/* USER CODE BEGIN 1 */
/* USER CODE END 1 */
/* MCU Configuration----------------------------------------------------------*/
/* Reset of all peripherals, Initializes the Flash interface and the Systick. */
HAL_Init();
/* Configure the system clock */
SystemClock_Config();
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART2_UART_Init();
/* USER CODE BEGIN 2 */
/* USER CODE END 2 */
/* Init code generated for FreeRTOS */
/* Create Start thread */
osThreadDef(USER_Thread, StartThread, osPriorityNormal, 0, configMINIMAL_STACK_SIZE);
osThreadCreate (osThread(USER_Thread), NULL);
/* Start scheduler */
osKernelStart(NULL, NULL);
/* We should never get here as control is now taken by the scheduler */
/* USER CODE BEGIN 3 */
/* Infinite loop */
while (1)
{
}
/* USER CODE END 3 */
}
|