ARM Cortex-M3 (STM32) development on the Mac

stm32-chip

The whole ARM processor core thing is really attractive. Here is a widespread, powerful core available in a whole bunch of packages and processor combinations from a range of suppliers. Then there came the Cortex-M3 version. More interesting still is the ST processor series known as the STM32. These really are interesting. they are cheap, readily available, fast, have a peripheral set that could be made for the kind of tasks I am most interested in and you can get free or low cost development tools…

Last year, I got hold of some development boards and a J-link programmer/debugger. I put up some details about these because there were some gotchas about he boards and the Segger J-link. Have a look here:

STM32 and the Segger J-LINK

Now, I have finally gotten around to trying to do something with these toys tools. Since that wasn’t going to be hard enough, I now use a Mac. Not surprisingly, pretty well all of the information out there and all the conveniently packaged tools are about Windows and Linux. Not much Linux except for the die-hard open-source developers.

It took a lot of effort, remarkably little sleep, several attempts, the help of clever people and plenty of regrettable language in the small hours before it was working but I think I have it largely sorted now.

The project started when I got curious and called Rowley to ask why they had Mac versions of almost all their Crossworks products except the ARM tools. I was pleasantly surprised to learn that they were on the verge of releasing a Mac version of Crossworks for Arm and would I like to download a copy to try?

Well, no, not really… Oh, wait a minute, yes, Yes, Yes Please. I also asked them about programmers and debuggers. The Rowley Tools normally support the Segger J-Link but that was not ready yet in this release. So they offered to lend me one of their CrossConnect JTAG devices so that I could get started. It was like having a birthday. Actually, it was my birthday but I don’t suppose they knew that.

Now, I was definitely interested in Crossworks. If it did what it was supposed to and worked as well as the Windows version, I could see myself paying the $150 for IDE, compiler and simulator all neatly rolled up into one. Rowley have a free 30 day trial policy where you get to use the full, unrestricted tools for that period.

As soon as I had the bits ready, I had a go. Well, I knew it wasn’t going to be easy but surely, it could be easier than this.

Getting Crossworks installed and running was no trouble at all. There are one or two issues to be sorted in the IDE – small fonts here and there for example – but I expect they will be fixed in the full release. the simulator runs nicely and only appears to lack the ability to count execution time rather than just processor clocks. All-in-all it is a nice package.

However, two problems have caused me some grief. one is the Crossconnect JTAG interface. I can’t make it work. I can only assume it is broken and I will have to send it back to see what is up. Trying it with a Crossworks install on a Windows machine does not work either. That is a shame and stopped me downloading code to my test boards. I ordered an Olimex ARM-USB-OCD as a substutute and that has proved difficult to get working but I have it sorted now.

The other shortcoming is the lack of any useful test code for the STM32. Now there are lots of places where you can find the firmware library for the STM32 and that contains lots of examples for driving the peripherals. However, some of these seem to have been subtly messed with to suit particular toolchains and they are certainly not all the same. Add to that the complexity of the processor and the unbelievably convoluted way ST sample code sets up the hardware and I have been scratching my head a good deal.

Searching for STM32 or other ARM Cortex-M3 code turns up quite a lot but it is often for complex projects or is based on the Primer and CircleOs. There seems to be a real lack of beginners stuff such as you would find for more traditional processors like the AVR and PIC.

To eliminate any dependence upon commercial tools, I have also managed to build and install the CodeSourcery toolchain for the ARM and a serial bootloader.

Watch this space for details on how to get all these things working on your Mac (if it is a recent one) and some simpler code samples to get you going.

This entry was posted in STM32. Bookmark the permalink.

6 Responses to ARM Cortex-M3 (STM32) development on the Mac

  1. Peter Scott says:

    holding my breath waiting

    pete

  2. Peter Scott says:

    hey, any luck??
    still waiting
    pete

  3. peteh says:

    If you check the ‘arm’ category, you might find some of what you want…

    http://www.micromouseonline.com/category/processors/arm

  4. Rick says:

    Any progress on telling us how to develop for STM32 on a Mac? I’ve been doing well on Atmel ARM, but without JTAG.

  5. Peter Harrison says:

    I have been busy on other stuff really so I am afraid waht you see is what there is for now. I do hope to get back to it soon though.

  6. Sebastian says:

    Hi Peter,
    very nice homepage.
    Im Mac user too and haven’t luck with Eclipse&OOCD stuff. So tried CrossWorks and be so happy! Im actually hardware developer and learn myself Embedded C. Have JLink (Edu) but it still not supported on Mac, so Ive invest small money to NGX-ARM-USB – it runs on Mac&CrossWorks very well. I been slowly familiar with CrossStudio and like it more and more because I can take my Projects between OSX, Linux and Windows- great!
    Best Regards,
    Sebastian

Leave a Reply