STLink Upgrade software is written in Java. As of the date this gist was initially written, it did not seem to work with Java natively installed on Apple M1. It requires x86_64 architecture execution under Rosetta.
This guide is about installing Java OpenJDK 17 support via Homebrew x86_64, on Apple M1 machine, in order to be able to run STLinkUpgrade.jar software by ST Microelectronics.
https://www.st.com/en/development-tools/stsw-link007.html
It is similar to installing Homebrew natively, with added arch --x86_64
prefix before the command line: