文章目录

    • 运行环境:
    • 1.1 freeRTOS_LED工程移植
      • 1)修改cubeMX配置
      • 2)setting设置
      • 3)launch设置
      • 4)修改makefile
      • 5)修改代码
      • 6)实验效果

运行环境:

ubuntu18.04.melodic
宏基暗影骑士笔记本
stm32f427IIH6
stlink
9-24v可调电源
robomaster A 板

1.1 freeRTOS_LED工程移植

1)修改cubeMX配置

选择makefile

2)setting设置


{"[python]": {"editor.formatOnType": true},"cortex-debug.gdbPath": "/home/duduzai/Documents/RM/stmpack/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-gdb","cortex-debug.openocdPath.linux": "/usr/local/bin/openocd","cortex-debug.armToolchainPath": "","terminal.integrated.enableMultiLinePasteWarning": false,}

3)launch设置


修改成以下内容:可执行文件名是freeRTOS_LED.elf

{"configurations": [{"showDevDebugOutput": "parsed","cwd": "${workspaceRoot}","executable": "./build/freeRTOS_LED.elf","name": "Debug STM32","request": "launch","type": "cortex-debug","servertype": "openocd","device": "stm32f427","configFiles": ["interface/stlink-v2-1.cfg","target/stm32f4x.cfg"]}]}

4)修改makefile

makefile中只包含工程生成的src文件,没有包含applications中的编写的 .c 文件

make,报错内容是重复,注释掉这部分内容,再编译

F5 烧录调试

5)修改代码

由于控制led灯亮灭分别是PF14和PE11

//GPIO端口使能 __HAL_RCC_GPIOE_CLK_ENABLE();__HAL_RCC_GPIOF_CLK_ENABLE();// GPIO电平设置HAL_GPIO_WritePin(GPIOF, GPIO_PIN_14, GPIO_PIN_RESET);HAL_GPIO_WritePin(GPIOE, GPIO_PIN_11, GPIO_PIN_RESET);//GPIO引脚配置/*Configure GPIO pin : PE11 */GPIO_InitStruct.Pin = GPIO_PIN_11;GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;GPIO_InitStruct.Pull = GPIO_NOPULL;GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;HAL_GPIO_Init(GPIOE, &GPIO_InitStruct);/*Configure GPIO pin : PF14 */GPIO_InitStruct.Pin = GPIO_PIN_14;GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;GPIO_InitStruct.Pull = GPIO_NOPULL;GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
HAL_GPIO_WritePin(GPIOF, GPIO_PIN_14, GPIO_PIN_RESET);osDelay(500);HAL_GPIO_WritePin(GPIOF, GPIO_PIN_14, GPIO_PIN_RESET);osDelay(500);HAL_GPIO_WritePin(GPIOF, GPIO_PIN_14, GPIO_PIN_SET);osDelay(500);

6)实验效果

绿灯闪烁,红灯一直亮着

⭐⭐⭐嘟嘟崽 ⭐⭐⭐ ⭐⭐⭐ 祝你成功 ⭐⭐⭐