I was a bit stuck where to get a cross-compiler for a while. In the ubuntu repositories, there's various native versions of GNAT for GCC 4,5,6,7 and 8 but there's also: https://launchpad.net/ubuntu/bionic/+package/gnat-8-arm-linux-gnueabi but I couldn't work out (and please tell me if you know) if this was to compile programs to run ON Linux or if it's that the compiler is hosted BY Linux.
But then I found that I could just go to https://www.adacore.com/download/more and select "ARM ELF (hosted on linux64)" and download an installer that'll give me a nice, complete toolchain in ~/bin/gnat... and when I say a nice toolchain, it's even got a GCC that'll cross compile my first test from the previous log.
I had some trouble getting OpenOCD working... I had errors on startup that weren't exactly "beginner friendly", so I thought I'd give Texane's stlink a try instead... bit of a pity because I was hoping to be able to use the same procedure for STM32 and SAMD... but anything will do to get me started.
sudo apt-get install git build-essential libusb-1.0.0-dev cmake git clone https://github.com/texane/stlink.git cd stlink make release cd build/Release sudo make install sudo ldconfig -v
I also need a nice chunk of example code. I'm probably pushing my luck to try any "exotic" languages at this point. Plain, boring C is what I'm after at this stage. blink-plain from istepaniuk/stm32-templates should be just what I'm looking for.
git clone https://github.com/istepaniuk/stm32-templates.git cd stm32-templates/blink-plain/ nano Makefile make arm-none-eabi-objcopy -O ihex blink-plain.elf blink-plain.hex st-flash --format ihex write blink-plain.hex
I've never done any ARM Cortex development before... So the first step is probably to get a simple "blinky" working in C.
I've got various boards earmarked for various project ideas.
An Adafruit feather M4, a couple of "Blue Pills", and and STM32 Discovery that I got very cheap from E. Bay.
The SMT32 Discovery... is to get me started, like Arduino got me started in the world of AVR.
I've been lead to believe I would probably be better off using Open OCD for programming rather than ST Link because I'll be able to take that with me to the SAMDs as well.... and maybe to some other chips too?
My first step, though, is to "build" an ARM toolchain.
sudo apt-get install gcc-arm-none-eabi sudo apt-get install openocd
(that was hard ;) )
Right with two tools in my hands, and no idea what I'm doing, let's see if we can get a simple LED blinking?