[STM32U5] 【NUCLEO-U5A5ZJ-Q测评】-2-Keil开发环境搭建

[复制链接]
1367|3
 楼主| YangTwo 发表于 2023-11-11 13:24 | 显示全部楼层 |阅读模式
本帖最后由 YangTwo 于 2023-11-11 13:56 编辑

在Keil官网下载固件包:

8841654f077ca6d91.png

双击安装:
37647654f07edbba2e.png



安装完成后新建工程,可以选择芯片:STM32U5A5ZJT6Q


69881654f0b78c9b9b.png

先运行一个最简单的GPIO翻转,初始化GPIO


  1.   GPIO_InitStruct.Mode  = GPIO_MODE_OUTPUT_PP;
  2.   GPIO_InitStruct.Pull  = GPIO_NOPULL;
  3.   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;

  4.   GPIO_InitStruct.Pin = LED1_PIN;
  5.   HAL_GPIO_Init(LED1_GPIO_PORT, &GPIO_InitStruct);
  6.   GPIO_InitStruct.Pin = LED2_PIN;
  7.   HAL_GPIO_Init(LED2_GPIO_PORT, &GPIO_InitStruct);


延迟一定时间后,翻转LED状态

  1.   while (1)
  2.   {
  3.     /* USER CODE END WHILE */

  4.     /* USER CODE BEGIN 3 */
  5.     HAL_GPIO_TogglePin(LED1_GPIO_PORT, LED1_PIN);
  6.     /* Insert delay 1000 ms */
  7.     HAL_Delay(1000);
  8.     HAL_GPIO_TogglePin(LED2_GPIO_PORT, LED2_PIN);
  9.     /* Insert delay 1000 ms */
  10.     HAL_Delay(1000);

  11.   }




编译:
  1. Rebuild started: Project: GPIO_IOToggle
  2. *** Using Compiler 'V6.16', folder: 'D:\ProgramFiles\Keil_v5\ARM\ARMCLANG\Bin'
  3. Rebuild target 'GPIO_IOToggle'
  4. assembling startup_stm32u5a5xx.s...
  5. compiling main.c...
  6. compiling stm32u5xx_hal_exti.c...
  7. compiling stm32u5xx_hal_cortex.c...
  8. compiling stm32u5xx_hal.c...
  9. compiling stm32u5xx_hal_msp.c...
  10. compiling stm32u5xx_hal_dma.c...
  11. compiling stm32u5xx_hal_gtzc.c...
  12. compiling stm32u5xx_hal_icache.c...
  13. compiling stm32u5xx_hal_pwr_ex.c...
  14. compiling stm32u5xx_hal_i2c.c...
  15. compiling stm32u5xx_hal_tim.c...
  16. compiling stm32u5xx_it.c...
  17. compiling stm32u5xx_hal_pwr.c...
  18. compiling stm32u5xx_hal_i2c_ex.c...
  19. compiling stm32u5xx_hal_flash_ex.c...
  20. compiling stm32u5xx_nucleo.c...
  21. compiling stm32u5xx_hal_gpio.c...
  22. compiling stm32u5xx_hal_tim_ex.c...
  23. compiling stm32u5xx_hal_dma_ex.c...
  24. compiling stm32u5xx_hal_flash.c...
  25. compiling system_stm32u5xx.c...
  26. compiling stm32u5xx_hal_rcc.c...
  27. compiling stm32u5xx_hal_rcc_ex.c...
  28. linking...
  29. Program Size: Code=6448 RO-data=832 RW-data=12 ZI-data=1660  
  30. FromELF: creating hex file...
  31. "GPIO_IOToggle\GPIO_IOToggle.axf" - 0 Error(s), 0 Warning(s).
  32. Build Time Elapsed:  00:00:03
  33. Load "GPIO_IOToggle\\GPIO_IOToggle.axf"
  34. Erase Done.
  35. Programming Done.
  36. Verify OK.
  37. Flash Load finished at 13:40:15

还有一个选项需要注意:“RESET AND RUN”,这样下载后程序会自动运行。


70294654f16c3f0ce4.png

574427030.gif

lajfda003 发表于 2023-12-11 18:52 | 显示全部楼层
现在的主流开发环境还是KEIL,用IAR的越来越少了。
kjkujkj22 发表于 2023-12-11 19:07 | 显示全部楼层
支持用keil仿真STM32
yujielun 发表于 2023-12-12 15:01 | 显示全部楼层
论坛有keil的石皮解的工具。  
您需要登录后才可以回帖 登录 | 注册

本版积分规则

27

主题

110

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部