Page 1 of 1

Programming STM32 through SWD

Posted: Thu Jul 29, 2021 8:43 am
by bscholte
For custom boards, I would like to start programming STM32F746 through the SWD interface. Is there a way to do this directly from the Astrobe IDE?

So far, I have done testing with a Nucleo board, where the board is addressed as a virtual Drive ("J:") from within the IDE. This works very well. However, hooking up an ST-Link/V2 programmer does not show a drive in the IDE.

Flashing the image can be done with external tool like the ST-LINK or STM32CubeProgrammer, but it would be much more convenient to do this directly from the IDE. A possibility could be to call the STM-CLI (Command-Lin-Interface) from the IDE with the right parameters. Does anyone have experience with this?

Anyway, looking for a practical solution......

Thanks!

Re: Programming STM32 through SWD

Posted: Fri Jul 30, 2021 4:30 am
by cfbsoftware
Yes - you can program the STM32F746 through the SWD interface directly from the Astrobe IDE using the ST-LINK CLI. This was the sort of capability that we had in mind when we designed the user-configurable Tools menu.

Edit your AstrobeM3-v7.2\Configs\Tools.ini file and add the following lines or something very similar of your choosing to suit your installation.

Code: Select all

[Command3]
MenuItem=&ST-LINK Upload
Path=C:\Program Files (x86)\STMicroelectronics\STM32 ST-LINK Utility\ST-LINK Utility\ST-LINK_CLI.exe
Parameters=-P %FileRoot%.bin 0x08000000 -V -Q
WorkingFolder=%FileDir%
ConsoleApp=TRUE
(Refer to the Astrobe Help > Configuration > Tools Menu for a specification of each entry and the ST-LINK documentation for a specification of the ST-LINK parameters.)

Restart the Astrobe IDE once you have saved the updated Tools.ini file.
  • After you have built an application
  • When the main module of the application is displayed in the Astrobe Editor window,
  • Assuming you have an SWD connection between your STM32 board and your PC

Select ST-LINK Upload from the Astrobe Tools menu and you should see something like the following displayed in the lower pane of the Astrobe IDE once the executable has been uploaded. This was the result after uploading the example Info application to an STM32L152 Nucleo 64 board:

Code: Select all

STM32 ST-LINK CLI v2.5.0
STM32 ST-LINK Command Line Interface

ST-LINK SN : 0123456789ABCDEF
ST-LINK Firmware version : V2J28M17
Connected via SWD.
SWD Frequency = 4000K.
Target voltage = 3.3 V.
Connection mode : Normal.
Device ID:0x437 
Device flash Size : 512 Kbytes
Device family :STM32L15xxE/L162xE
Loading file...
Flash Programming:
  File : Info.bin
  Address : 0x08000000
Memory programming...
Memory programmed in 1s and 172ms.
Verification...OK
Programming Complete.
Programmed memory Checksum: 0x001A79DE

Re: Programming STM32 through SWD

Posted: Fri Jul 30, 2021 9:06 am
by bscholte
Perfect!

Thanks for the quick answer.