STM32G030 in Arduino IDE on linux using ST-LINK v2 - How to read variable value? - Page 1
Forum section: electronics / general

author: dusan
author_rank: Regular Contributor
timestamp: December 07, 2024, 08:28:38 am
content: I'm using Arduino IDE on linux with STM32G030 programmed via ST-LINK v2, here is working blinking example (everything works fine, the led is blinking):Code:void setup() {pinMode(PB11, OUTPUT);}int n = 0;void loop() {n++;digitalWrite(PB11, n % 3 == 0 ? HIGH : LOW);delay(100);}I would like the read the value of "n". I don't want to use UART as I'm trying to find out if I can ommit UART and use just ST-LINK for debugging. How to do it using ST-LINK v2? How to read variable value?I'm not sure if it helps but here is what arduino prints during compilation:Code:Sketch uses 13688 bytes (20%) of program storage space. Maximum is 65536 bytes.Global variables use 900 bytes (10%) of dynamic memory, leaving 7292 bytes for local variables. Maximum is 8192 bytes.-------------------------------------------------------------------STM32CubeProgrammer v2.11.0-------------------------------------------------------------------ST-LINK SN : 39002100050000343251524EST-LINK FW : V2J29S7Board : --Voltage : 3.23VSWD freq : 4000 KHzConnect mode: Under ResetReset mode : Hardware resetDevice ID : 0x466Revision ID : Rev 1.1Device name : STM32G03x/STM32G04xFlash size : 64 KBytesDevice type : MCUDevice CPU : Cortex-M0+BL Version : --Memory Programming ...Opening and parsing file: example1.ino.binFile : example1.ino.binSize : 13.57 KBAddress : 0x08000000Erasing memory corresponding to segment 0:Erasing internal memory sectors [0 6]Download in Progress:File download completeTime elapsed during download operation: 00:00:00.464RUNNING Program ...Address: : 0x8000000Application is running, Please Hold on...Start operation achieved successfully

author: tooki
author_rank: Super Contributor
timestamp: December 07, 2024, 12:57:20 pm
content: What you want to do is debugging, but Arduino IDE supports debugging only with a very, very short list of boards using SAMD microcontrollers:https://docs.arduino.cc/software/ide-v2/tutorials/ide-v2-debugger/So your STM32G030 is not supported for debugging in Arduino IDE.EDIT: it seems debugging is supported as of a few months ago. See link in DavidAlfa’s reply.The STM32G030 is not officially supported in the PlatformIO IDE (with which I have successfully debugged other STM32’s), but it has been done by others:https://github.com/platformio/platform-ststm32/pull/622The only environments that I know for sure will support debugging your chip right away are the Cube IDE and Keil. But you’d lose Arduino code compatibility.(See edit note above.)

author: dusan
author_rank: Regular Contributor
timestamp: December 07, 2024, 01:42:15 pm
content: Can I somehow get the information via command line?

author: DavidAlfa
author_rank: Super Contributor
timestamp: December 07, 2024, 01:57:50 pm
content: Maybe this:https://github.com/stm32duino/Arduino_Core_STM32/wiki/How-to-debug

author: tooki
author_rank: Super Contributor
timestamp: December 07, 2024, 02:24:58 pm
content: Quote from: DavidAlfa on December 07, 2024, 01:57:50 pmOh cool, it seems the STM32 board support now includes debugging. Per the page’s edit history, just since July.