本文参考代码

https://letanphuc.net/2015/02/stm32f0-tutorial-gpio-blinking-led-cubemx-keil-source-insight/

ide版本信息:

STM32CubeIDE Release Note v1.4.0

CubeMX V6.0.0 integration

  • Additional support for STM32MP1 devices : OpenSTLinux 2.0 SDK & Projects support

  • Additional support for STM32H7 devices

  • itional support for STM32G4 devices

  • OpenOCD support improvements

It uses an enhanced GNU tool chain for STM32, based on GNU Arm Embedded.

It has an integrated version of STM32CubeMX and MCUFinder

ntegrates the command-line version of STM32CubeProgrammer (STM32CubeProg) for Flash memory handling while using the ST-LINK GDB server.

STM32CubeIDE is based on the following technology, with STMicroelectronics-specific enhancements:

  • ECLIPSETM 2019-09 and CDT version 9.9.0(Eclipse foundation)

  • GNU Tools for STM32, based on GNU Tools for Arm Embedded Processors 7-2018-q2-update 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]

  • GNU GDB (GNU Tools for STM32 7-2018-q2-update.20190328-1800) 8.1.0.20180315-git

  • GNU Tools for Arm Embedded Processors 7-2018-q2-update 7.3.1 20180622 (release) [ARM/embedded-7- branch revision 261907]

  • GNU GDB (GNU Tools for Arm Embedded Processors 7-2018-q2-update) 8.1.0.20180315-git

  • AdoptOpenJDK Runtime Environment (build 1.8.0_252, 64-bit)

  • ST-LINK_gdbserver 5.6.0, supporting ST-LINK/V2 and STLINK-V3

  • SEGGER J-Link GDB Server V6.80b

  • Open On-Chip Debugger 0.10.0+dev-g30d1303

启动后提示升级1.4.2

使用必须联网

install anyway

重启

新建项目

打开cubemx后

可能会更新一些文件

然后选择芯片或开发版 比如我这块

整个电路板包括:

  • 核心芯片STM32F051R8T6微控制器:64KB Flash和8KB RAM。
  • 集成STLINK/V2仿真器
  • 四个LED
  • 2个按键
  • mini-B USB接口

全扩展I/O插座开发套件还包括了一个万用板,与开发板的尺寸一样(51mm x 88.9mm,间距2.54mm)。这个万用板更方便用来扩展功能,搭建原型平台。可以用来连接各种扩展板卡比如ST自己的传感器模块甚至Arduino的各种兼容扩展板。
开发板上有一个mini-B型USB,作为供电以及调试编程。因为将STM32F051芯片的所有IO脚引出,所以也可以通过引脚接入5V外部电源或者向外输出5V和3V的直流电源。
STM32F0-Discovery 的使用很简单,在出厂时预置了一个Demo的程序。首先确认板上的跳线都已经安装,连接mini-B USB到计算机或者5V电源。这时电源指示灯(LD1)变亮,USB通讯指示灯(LD2)红色闪烁,速度由慢到快,表示USB初始化完成。同时程序执行后绿色的LED(LD3)闪烁。

next

选择语言

开始下载需要的文件

配置各个页面信息

修改代码

下载参考代码

https://www.st.com/content/st_com/zh/products/embedded-software/mcu-mpu-embedded-software/stm32-embedded-software/stm32-standard-peripheral-library-expansion/stsw-stm32049.html#get-software

https://www.st.com/en/embedded-software/stm32cubef0.html

修改while循环

  /* Infinite loop *//* USER CODE BEGIN WHILE */while (1){/* USER CODE END WHILE *//* USER CODE BEGIN 3 *//*Configure GPIO pin Output Level */HAL_GPIO_WritePin(GPIOC, LD4_Pin, GPIO_PIN_RESET);/*Configure GPIO pin Output Level */HAL_GPIO_WritePin(GPIOC,LD3_Pin, GPIO_PIN_SET);}/* USER CODE END 3 */
 /* USER CODE BEGIN WHILE */while (1){/* USER CODE END WHILE *//* USER CODE BEGIN 3 *//*Configure GPIO pin Output Level */HAL_GPIO_WritePin(GPIOC, LD4_Pin, GPIO_PIN_RESET);/*Configure GPIO pin Output Level *///HAL_GPIO_WritePin(GPIOC,LD3_Pin, GPIO_PIN_SET);HAL_GPIO_TogglePin(GPIOC, LD3_Pin); //Toggle the state of pin PC9HAL_Delay(100); //delay 100ms}/* USER CODE END 3 */

build

默认点击run会自动build

run   debug

第一次使用,提示升级stlink固件

tips--ok

按照提示完成stlink升级

run点击后会下载程序

STMicroelectronics ST-LINK GDB server. Version 5.6.0

Copyright (c) 2020, STMicroelectronics. All rights reserved.

Starting server with the following options:

Persistent Mode            : Disabled

Logging Level              : 1

Listen Port Number         : 61234

Status Refresh Delay       : 15s

Verbose Mode               : Disabled

SWD Debug                  : Enabled

InitWhile                  : Enabled

Waiting for debugger connection...

Debugger connected

-------------------------------------------------------------------

STM32CubeProgrammer v2.5.0-RC1

-------------------------------------------------------------------

ST-LINK SN  : 48FF76065185525453150287

ST-LINK FW  : V2J37S0

Board       : --

Voltage     : 2.92V

SWD freq    : 4000 KHz

Connect mode: Under Reset

Reset mode  : Hardware reset

Device ID   : 0x440

Revision ID : Rev 2.0

Device name : STM32F05x/F030x8

Flash size  : 64 KBytes

Device type : MCU

Device CPU  : Cortex-M0

Memory Programming ...

Opening and parsing file: ST-LINK_GDB_server_5wHtk2.srec

File          : ST-LINK_GDB_server_5wHtk2.srec

Size          : 4896 Bytes

Address       : 0x08000000

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [0 4]

Download in Progress:

File download complete

Time elapsed during download operation: 00:00:00.401

Verifying ...

Download verified successfully

Debugger connection lost.

Shutting down...

debug点击后会打开调试界面

勾选remember my decision  switch

STMicroelectronics ST-LINK GDB server. Version 5.6.0

Copyright (c) 2020, STMicroelectronics. All rights reserved.

Starting server with the following options:

Persistent Mode            : Disabled

Logging Level              : 1

Listen Port Number         : 61234

Status Refresh Delay       : 15s

Verbose Mode               : Disabled

SWD Debug                  : Enabled

InitWhile                  : Enabled

Waiting for debugger connection...

Debugger connected

-------------------------------------------------------------------

STM32CubeProgrammer v2.5.0-RC1

-------------------------------------------------------------------

ST-LINK SN  : 48FF76065185525453150287

ST-LINK FW  : V2J37S0

Board       : --

Voltage     : 2.93V

SWD freq    : 4000 KHz

Connect mode: Under Reset

Reset mode  : Hardware reset

Device ID   : 0x440

Revision ID : Rev 2.0

Device name : STM32F05x/F030x8

Flash size  : 64 KBytes

Device type : MCU

Device CPU  : Cortex-M0

Memory Programming ...

Opening and parsing file: ST-LINK_GDB_server_5ymeVa.srec

File          : ST-LINK_GDB_server_5ymeVa.srec

Size          : 4896 Bytes

Address       : 0x08000000

Erasing memory corresponding to segment 0:

Erasing internal memory sectors [0 4]

Download in Progress:

File download complete

Time elapsed during download operation: 00:00:00.405

Verifying ...

Download verified successfully

支持的调试功能

点击step over单步执行

点击Resume恢复程序执行

LED灯开始闪烁 ,测试ok

其他资料:

What is OpenOCD?

The Open On-Chip Debugger (OpenOCD) aims to provide debugging, in-system program- ming and boundary-scan testing for embedded target devices.

It does so with the assistance of a debug adapter, which is a small hardware module which helps provide the right kind of electrical signaling to the target being debugged. These are required since the debug host (on which OpenOCD runs) won’t usually have native support for such signaling, or the connector needed to hook up to the target.

Such debug adapters support one or more transport protocols, each of which involves dif- ferent electrical signaling (and uses different messaging protocols on top of that signaling). There are many types of debug adapter, and little uniformity in what they are called. (There are also product naming differences.)

These adapters are sometimes packaged as discrete dongles, which may generically be called hardware interface dongles. Some development boards also integrate them directly, which may let the development board connect directly to the debug host over USB (and sometimes also to power it over USB).

GDB server start-up options

The GDB server is started up with the following command:

ST-LINK_gdbserver.exe [options]

Most options are available in a short and long form. The set of options, which the GDB server supports, are described below with default modes and configurations in bold:

  • -h, --help
    Causes the ST-LINK_gdbserver to display usage information.

  • -q, --debuggers
    List connected debuggers, ST-LINK serial numbers.

  • -i <ST-LINK S/N>, --serial-number <ST-LINK S/N> Specifies the ST-LINK serial numbers the server shall connect to.

  • --frequency <max freq kHz>
    Specifies the ST-LINK communication frequency in kHz, such as 5, 25, 100, 240, 950, 1800, 4000, 8000,

    24000 kHz.

  • --erase-all
    Erases all the memories.

  • --memory-map <device id>
    Shows the memory map for the given device identifier, such as 0x410.

  • --ext-memory-loaders
    Provides the list of the available external memory loaders.

  • -cp <path>, --stm32cubeprogrammer-path <path>
    Path to the STM32CubeProgrammer (STM32CubeProg) installation.

  • --version

    Displays version information and exits.

  1. Starting the GDB server
    The GDB server can be started in a command window in the following way:

    1. cd C:\ST\STM32CubeIDE_1.0.0.19w12patch\STM32CubeIDE\plugins \com.st.stm32cube.ide.mcu.externaltools.stlink-gdb- server.win32_1.0.0.201903011553\tools\bin\ST-LINK_gdbserver

    2. Start the GDB server using –cp with the path to STM32_Programmer_CLI.exe

      For instance: ST-LINK_gdbserver.exe -d -v -cp "C:\ST\STM32CubeIDE_1.0.0.19w12patch \STM32CubeIDE\plugins \com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_1.0.0.201903011553\ tools\bin"

    3. Then, the GDB server connects to the STM32 device using the ST-LINK JTAG and waits for commands from a GDB debug session.

  1. Launching GDB

    A command-line GDB client is started by the command

    >arm-none-eabi-gdb <program.elf>
    where <program.elf> is the program to be debugged.

  2. Connecting to the server

    The server can be started in either persistent or non-persistent mode:

    • If the server is started in non-persistent mode, the client must connect to the server using the command

      >target remote <ip-address>:<port-number>

      When the client connects to the server in non-persistent mode using this command, the debug session cannot be restarted without closing both client and server.

    • If the server is started in persistent mode, the client must connect to the server using the command

      >target extended-remote <ip-address>:<port-number>

      When the client connects to the server in persistent mode using this command, the user has the facility to restart the debug session without closing the server or client. In this mode of operation for client and server, the debug session can be repeatedly restarted.

    • Loading the program on the target

      The executable program is loaded on the target using the GDB command

      >load <program.elf>

      This command loads the program on the target. If the code segment of the program lies in the Flash ROM, then the respective pages of the Flash are erased before the new code is written.

    • Note: The Flash programming (the code download into the Flash memory) is handled by the GDB server using STM32CubeProgrammer (STM32CubeProg) and is transparent to the user.

    • Running the program
      Once the program is loaded, the debugger starts execution through the command

      >continue

      Note: There is no mechanism for specifying command-line parameters to the program.

      The user can halt the program by pressing Ctrl-C while it is running. The user can step over a statement by using the next command. The user can also step inside a function by using the step command.

  3. Monitor commands
    The GDB monitor commands are supported and implement target-specific features, especially for performing

    Flash controller specific commands.
    The following commands are the monitor commands supported for the ST-LINK GDB server:

  4. >monitor help

    Prints information about the supported monitor commands.

  5. >monitor reset

    Resets the target device.

  6. >monitor flash mass_erase

    Used to erase all the pages of the Flash device. Care needs to be taken when using this command since it causes all data stored in the Flash to be lost.

Troubleshooting

In case the server hangs or fails to start up, follow these steps:

  1. Shutdown the GDB server and any client attached to the server.

  2. Power off the target board.

  3. Disconnect the ST-LINK JTAG USB cable.

  4. Re-connect the ST-LINK JTAG USB cable.

  5. Power on the target board.

  6. Check the debug configuration settings, such as the SWD/JTAG interface

  7. Start the GDB server, preferably using a different port number.

UM2576

Troubleshooting

A good practice is to try the debug of another project to eliminate the possibility of a project-specific problem with the project configuration or start-up code.

We also recommend to try and debug with another USB cable, ST-LINK or STM32 hardware to exclude hardware failures as the reason for the debug problems.

It is also advised to try and connect to the target using some other tool from STMicroelectronics, such as the STM32CubeProgrammer (STM32CubeProg). If STM32CubeProgrammer can connect to the target, try to:

  1. Erase the Flash with STM32CubeProgrammer.

  2. Program a new program with STM32CubeProgrammer.

  3. If the programming is successful, erase the Flash again with STM32CubeProgrammer.

  4. Disconnect STM32CubeProgrammer from the target.

  5. Try and debug the program using ST-LINK_gdbserver.

STM32 CUBEIDE MacOS首次使用笔记相关推荐

  1. 基于STM32四轴飞控制作笔记

    基于STM32四轴飞控制作笔记 前言 大四选了个四轴飞控作为毕业设计的题目,近来没事,把之前的制作做个总结开源出来. 硬件设计 1.遥控MCU模块和飞控的MCU模块都采用stm32f103c8t6单片 ...

  2. STM32 CubeIDE 断点失效的解决方法

    问题描述 利用STM32 CubeIDE工具调试程序过程中,设置的断点失效(程序运行,但跳过所设置的断点). 以至难以查找程序运行时的错误,失去了断点调试的意义. STM32 Cube IDE介绍 S ...

  3. STM32 Cube MX学习笔记——TOF 高速单线激光雷达 L10(usart)

    STM32 Cube MX学习笔记--TOF 高速单线激光雷达 L10_串口中断通信 1. TOF 高速单线激光雷达 L10 2. STM32 Cube MX配置 3.代码配置 4.编译 烧录 显示 ...

  4. STM32 CubeIDE(九)串口通讯

    STM32 CubeIDE(九)串口通讯 串口通讯 串口通讯(Serial Communication)是一种设备间非常常用的串行通讯方式,因为它简单便捷,大部分电子设备都支持该通讯方式,电子工程师在 ...

  5. STM32 HAL库学习笔记1-HAL库简介

    STM32 HAL库学习笔记1-HAL库简介 HAL库 SPL 库 和 HAL 库两者相互独立,互不兼容.几种库的比较如下 目前几种库对不同芯片的支持情况如下 ST 中文官网上有一篇<关于ST库 ...

  6. STM32 HAL库学习笔记4-SPI

    STM32 HAL库学习笔记4-SPI 前言 一.SPI协议简介 SPI物理层 SPI协议层 1.基本通讯过程 2. 通讯的起始和停止信号 3. 数据有效性 4. CPOL/CPHA 及通讯模式 二. ...

  7. STM32中断回调函数定时器-STM32电控学习笔记06

    STM32中断&定时器-STM32电控学习笔记06 day6:2022/9/24 [中断概述] 在 STM32 中,对信号的处理可以分为轮询方式和中断方式,轮询方式就是不断去访问一个信号的端口 ...

  8. STM32 CUbeIDE 使用Ymodem协议进行串口IAP升级

    STM32 CUbeIDE 使用Ymodem协议进行串口IAP升级 1.Ymodem协议简介 2.Boodload程序 2.1 传输32K限制解决 3.APP程序 4.升级测试 5.工程文件下载    ...

  9. 翻转电平函数实现LED闪烁-STM32电控学习笔记05

    翻转电平函数实现LED闪烁-STM32电控学习笔记05 day5:2022/9/23 [函数介绍] 在前面帖子大致了解了一下HAL_GPIO_WritePin()函数和HAL_Delay()函数的用法 ...

最新文章

  1. scp服务器复制命令跳过已有的文件夹,Linux scp命令复制文件到其它服务器上
  2. SQL SERVER错误:已超过了锁请求超时时段。 (Microsoft SQL Server,错误: 1222)
  3. java设计优化--观察者模式
  4. C语言socket()函数解析(创建套接字)af地址族,ip地址类型(Address Family)INET(Inetnet)PF(Protocol Family)
  5. NYOJ_1013除法表达式
  6. Jenkins的卸载
  7. c语言RePutDate用法,住宿结帐管理系统--C语言课程设计.doc
  8. javascript内存泄漏调试工具mac_Vuex3.1.1更新:支持jsDelivr,修复内存泄漏
  9. 最少拦截系统,简单dp,(学长说这是贪心?!。。。。。。也是醉了)
  10. 【每日算法Day 83】邻居小孩一年级就会的乘法表,你会吗?
  11. qt编写mysql导出excel_Qt编写数据导出到Excel及Pdf和打印数据
  12. 添加本地cdrom到RHEL yum 源
  13. 易语言计算机代码,易语言基础教程之简单代码的编写
  14. c#通讯西门子plc
  15. 大数取模运算Barrett reduction
  16. NXP KV10 FTM fault功能的配置
  17. Linux下rar解压工具的安装使用
  18. 聚类分析及R编程实现
  19. 用迭代法求a的平方根
  20. Java实验一—编程实现计算贷款偿还额的程序

热门文章

  1. JavaScript实现蜘蛛纸牌
  2. PE市盈率们之间的区别
  3. arista eos系统从零开始研究(1)
  4. 论遇到事情的沉着与冷静
  5. Windows操作系统类毕业论文文献有哪些?
  6. 完全免费的OCR文字识别软件
  7. 深圳商报 | 跨境电商大会聚焦跨境收款难题
  8. 前端开发问题——css设置背景样式效果无法显现
  9. 2021/4/24团队设计天梯赛L1题目集及题解
  10. 血泪!pyinstaller打包文件过大的解决方法