There is a Java GUI, but there is also a very scriptable command line version:
-------------------------------------------------------------------
STM32CubeProgrammer v1.0.0
-------------------------------------------------------------------
Usage :
STM32_Programmer_CLI.exe [command_1] [Agruments_1][[command_2] [Agruments_2]...]
Available commands:
-?, -h, --help : Show this help
-l, --list : List all available communication interfaces
<uart> : UART interface
<usb> : USB interface
-q, --quietMode : Enable quiet mode. No progress bar displayed
-log, --log : Store the detailed output in log file
[<file_Path.log>] : Path of the log file,
default path = $HOME/.STM32Programmer/trace.log
-vb, --verbosity : Specify verbosity level
<Level> : Verbosity level, value in {1, 2, 3}
-sl, --safelib : Add a segment into a firmware file (elf,bin
hex,srec) containing computed CRC values
To use only with the safety lib component
<file_path> : File path to be modified
<start_address> : Flash memory start address
<end_address> : Flash memory end address
<slice_size> : Size of data per CRC value
-c, --connect : Establish connection to the device
<port=<PortName> : Interface identifer. ex COM1, /dev/ttyS0, usb1,
JTAG, SWD...)
UART port optional parameters:
[br=<baudrate>] : Baudrate. ex: 115200, 9600, etc, default 115200
[P=<parity>] : Parity bit, value in {NONE,ODD,EVEN}, default EVEN
[db=<data_bits>] : Data bit, value in {6, 7, 8} ..., default 8
[sb=<stop_bits>] : Stop bit, value in {1, 1.5, 2} ..., default 1
[fc=<flowControl>] : Flow control
Value in {OFF,Hardware,Software} ..., default OFF
[noinit=noinit_bit]: Set No Init bits, value in {0,1} ..., default 0
JTAG/SWD debug port optional parameters:
[freq=<frequency>] : Frequency in KHz. Default frequencies:
4000 SWD 9000 JTAG with STLINKv2
24000 SWD 21333 with STLINKv3
[index=<index>] : Index of the debug probe. default index 0
[ap=<accessPort>] : Access Port index to connect to. default ap 0
[mode=<mode>] : Connection mode. Value in {UR/HOTPLUG/NORMAL}
default mode: NORMAL
[reset=<mode>] : Reset modes: SWrst/HWrst/Crst. Default mode: SWreset
-e, --erase : Erase memory pages/sectors devices:
[all] : Erase all sectors
[<sectorsCodes>] : Erase the specified sectors identified by sectors
codes. ex: 0, 1, 2 to erase sectors 0, 1 and 2
[<[start end]>] : Erase the specified sectors starting from
start code to end code, ex: -e [5 10]
-w, --write
-d, --download : Download the content of a file into device memory
<file_path> : File path name to be downloaded: (bin, hex, srec,
elf, stm32 or tsv file)
[<address>] : Start address of download
-w32 : Write a 32-bits data into device memory
<address> : Start address of download
<32-bit_data> : 32-bit data to be downloaded
values should be separated by space
-v, --verify : Verify if the programming operation is achieved
successfully
-r32 : Read a 32-bit data from device memory
<address> : Read start address
<size> : Size of data
-rst : Reset system
-hardRst : Hardware reset
Available only with JTAG/SWD debug port
-r, --read
-u, --upload : Upload the device memory content to a .bin file
<address> : Start address of read and upload
<size> : Size of memory content to be read
<file_path> : Binary file path
-el, --extload : Select a custom external memory-loader
<file_path> : External memory-loader file path
-s, --start
-g, --go : Run the code at the specified address.
[<address>] : Start address
-rdu, --readunprotect: Remove memory's Read Protection by shifting the RDP
level from level 1 to level 0.
-ob, --optionbytes : This command allows the user to manipulate the device
's OptionBytes by displaying or modifying them.
[displ] : This option allows the user to display the whole set
of Option Bytes.
[OptByte=<value>] : This option allows the user to program the given
Option Byte.