I finally got a day to play with some of my new toys. These are the IAR STM32-SK and the IAR J-Link debugger.The IAR J-Link is a re-badges Segger unit and I believe they are identical. I was quite excited about having a real debugger to use. – especially as programming the STM32 through the bootloader is a bit of a fiddle. Things didn’t turn out quite as I had hoped…
The development kit came with a 32k code-limited version of the IAR compiler. After a good few hours playing with this, I have decided to abandon it. The 32k code limit will be too restrictive for a micromouse. While is is way more than enough with an 8 bit micro, the ARM is a 32 bit device and so instructions take up a corresponding extra amount of flash. Not four times as much but enough to make it a bit of a squeeze. Besides, the full compiler would require me to sign over most of my organs and a share of the house to own. What is more, IAR seem to have stopped developing their IDE in the last century and it is not very slick.
Then came the decision about what tools to use. There seems to be two choices if I don’t want to assemble a set of disparate bits an pieces from the open source bucket. Don’t get me wrong, they are probably just fantastic but I am not keen on spending lots of time working out how to build a toolset when it is going to take quite long enough learning to drive the STM32.
There seems to be two choices. First, there is the Raisonance Ride 7 environment which can be downloaded for nothing and has a complete GNU tool set – also free. The IDE is quite nice to use and does everything I would expect at this stage. Compiling is easy and there is a simulator available as a target which runs quite nicely. The problem is getting the code into the chip. So far, I have been using the serial bootloader built in to the processor. This is very handy but the ST Flash Loader Demonstrator is a very clunky piece of software that I soon became tired with. The real drawback with the Raisonance tools is that you can’t use the IAR J-link to either program or debug the chip. For that you will need the Raisonance R-Link. It is not too expensive at £53 or so and, apparently, works well with the tools. However, unless you want to start spending proper money, it will only allow on-chip debugging of 32k of code. I can’t decide if that will be a real limitation. While the mouse software will grow beyond 32k, it should be possible to do a restricted build to deal with particular problems that might need the debugger. Up to now, I have not used on-chip debugging as the ICD2 kept destroying processors.
The other choice is the Rowley Crossworks toolset. A 30 day demo is available which is unrestricted apart from the time limit. This is a proper commercial environment, using the GNU tools. A personal, non-profit version is available for about £88. Crossworks can talk to the J-Link and is not limited in either programming or debugging. So I got an evaluation licence to give it a try. I wasted almost an entire day with errors, faults and inconsistent behaviour of the J-Link. I was about ready to give up when I came across mention on the Segger site about the processor reset and the JTAG reset line. You can look it up here.
Essentially, it says do not connect RST and TRST. I really don’t know why this caught my eye but I then checked the development boards that I have. Both are made for IAR by Olimex and both have a jumper connecting RST to TRST. A couple of minutes work with the soldering iron and some solder wick and the jumper was cleared. Suddenly everything seemed to work just fine. It needs a lot more testing yet but this seemed to cure all the issues I was having with the J-Link. Below are pictures of each of the boards with the location of the jumper highlighted.