I'm looking for ways I can explore ARM assembly language with STM32 devices and using Windows desktop as my preferred workstation.
I have VisualGDB already and that's is good enough for my informal, non-professional needs but I don't think it makes it straightforward to start an assembler based project.
What other ways are there to do this?
I've learnt all I know about STM32 assembler programming through Joseph Yiu's books. e.g.
The Definitive Guide to ARM® Cortex®-M3 and Cortex®-M4 Processors
The Definitive Guide to the ARM® Cortex®-M0
I also find it informative to inspect the disassembled code produced by a compiler.
Iirc, the ARM ide (Keil) now has a free-for-non-commercial use license.
That should include the standard ARM assembler (not the slightly different gcc assembler), as well as a simulator.
Beware that cortex m0 and cortex m3 are more different than you might think.
No need to learn assembler, it's a waste of time. For real tasks, a minimum amount of knowledge is required, at the level of the basics and rules of machine language. Everything you want to write is already written by someone else, you just need to find it.
However, there are free services for watching machine code, for example
https://godbolt.org/z/Wf6sEfE4bExciting task: to write code in C or another language (47 positions) so that the result in assembler is as compact as possible, and fast.
There is plenty of books, reference manuals and other documentation. I'd say there is so much it's easy to get lost.
Apart from books, there is also GCC.
GCC is pretty much the standard for all ARM processors, and it does not compile directly to binaries, but outputs assembly, which is assembled in the next (automated) step.
GCC has options for preserving these intermediate steps, and it can even write listings to disk in which each line of C (C++) code is followed by the assembly that is generated from that line of code.
This is a great feature for a lot of things. You can use it to find GCC bugs, learn about GCC's internals (such as what different optimization settings do) and of course also for learning assembly.
VisualGDB is probably fine (I personally use gdb in text mode, even that is fine). Asm development tooling is no rocket science. There is no benefits to complicated "professional" solutions, because professional projects rarely use asm beyond a few lines of inline asm. In some specific case it might be a 100-LoC module.
Processor documentation itself is of course of utmost importance.
Beware that cortex m0 and cortex m3 are more different than you might think.
Just to clarify, it is the instruction sets that the processors support that are different. Cortex-M3 supports both 16-bit Thumb and (16/32-bit) Thumb-2 instructions, Cortex-M0 supports Thumb (and a few Thumb-2) instructions. i.e. assembler code written for the Cortex-M0 will generally run on a Cortex-M3 processor but not necessarily vice-versa.
No need to learn assembler, it's a waste of time. For real tasks, a minimum amount of knowledge is required, at the level of the basics and rules of machine language.
... unless, like me, you happen to be writing the code generator for a compiler
Cortex-M0 supports Thumb (and a few Thumb-2) instructions.
Not a lot. And only because Thumb was not designed to be the only ISA on a machine and previously you could always switch to ARM mode to do system stuff.
BL ... an actual 32 bit instruction on M0, but two 16 bit instructions in Thumb
MSR, MRS: move to/from status registers
DMB, DSB, ISB: fence/barrier instructions
That's all! Nothing a C compiler cares about.
Cortex-M3 supports both 16-bit Thumb and (16/32-bit) Thumb-2 instructions, Cortex-M0 supports Thumb (and a few Thumb-2) instructions
Yeah, but what surprises you is that a bunch of things like "immediate mode" and "range of arguments" end up pushing you from the 16bit encoding to 32bit encodings (which don't exist on M0.) So you get "mov r1, 0x80" but not "mov r1, 0x8000", and you have "and (registers)" but not "and (immediate.)" Grr.
i.e. assembler code written for the Cortex-M0 will generally run on a Cortex-M3 processor but not necessarily vice-versa.
IME, not at all "vis versa." Very common m3 (v7m) code patterns don't exist for m0 (v6m.)
Cortex-M3 supports both 16-bit Thumb and (16/32-bit) Thumb-2 instructions, Cortex-M0 supports Thumb (and a few Thumb-2) instructions
Yeah, but what surprises you is that a bunch of things like "immediate mode" and "range of arguments" end up pushing you from the 16bit encoding to 32bit encodings (which don't exist on M0.) So you get "mov r1, 0x80" but not "mov r1, 0x8000", and you have "and (registers)" but not "and (immediate.)" Grr.
No surprise to those of us used to programming (and writing compilers for) ARM7TDMI and the like :-)
It's quite an exercise to memorise all 19 instruction formats for Thumb1 and their limitations!
I'm looking for ways I can explore ARM assembly language with STM32 devices and using Windows desktop as my preferred workstation.
I have VisualGDB already and that's is good enough for my informal, non-professional needs but I don't think it makes it straightforward to start an assembler based project.
What other ways are there to do this?
I understood your initial question as: "Which toolchains are available that support assembly?"
In that case - why not CubeIDE with the GCC toolchain?
If it is about exploring the functionality of assembly, it may even be helpful to let your assembly function be called by C.
I have rare applications/excuses for writing ASM on ARM. However, there are some functions that I prefer doing in ASM.
Not sure what exactly the OP is after? You don't need anything else than what you'd use for developing with C on those MCUs. An assembler is part of any compiler distribution I know of. GCC would be the most common for ARM MCUs and strictly speaking, all you'd need is binutils, but it's always part of a GCC distribution. The rest is just your favorite programming text editor/IDE.
ARM distributes their "official" binaries for the toolchain :
https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloadsYou don't need to download the full Cube crap from ST. You can use your own dev tools along with the above ARM toolchain, and then use the ref manuals for register description/etc.
You can browse ST's github repos for the libraries and take what you need if anything, for instance for the F4 series :
https://github.com/STMicroelectronics/STM32CubeF4All the base include files are in there :
https://github.com/STMicroelectronics/STM32CubeF4/tree/master/Drivers/CMSISIt's only C definitions though, I'm not quite sure where you can find assembly definitions for the registers, for instance. Can probably be found somewhere. You can otherwise generate them yourself from the SVD files.
This is a very useful repo :
https://github.com/posborne/cmsis-svdA crapton of MCUs in there with their respective SVD file, and tools in Python for parsing SVD and generating various file formats from it. Recommended for anyone doing bare metal dev and especially if using prog languages that are "exotic".