日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

STM32 CUBEIDE MacOS首次使用笔记

發布時間:2023/12/8 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 STM32 CUBEIDE MacOS首次使用笔记 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

本文參考代碼

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.

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

  • 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

  • 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"

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

  • ?

  • 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.

  • 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.

  • 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:

  • >monitor help

    Prints information about the supported monitor commands.

  • >monitor reset

    Resets the target device.

  • >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:

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

  • Power off the target board.

  • Disconnect the ST-LINK JTAG USB cable.

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

  • Power on the target board.

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

  • 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:

  • Erase the Flash with STM32CubeProgrammer.

  • Program a new program with STM32CubeProgrammer.

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

  • Disconnect STM32CubeProgrammer from the target.

  • Try and debug the program using ST-LINK_gdbserver.

  • ?

    總結

    以上是生活随笔為你收集整理的STM32 CUBEIDE MacOS首次使用笔记的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。