DIY5 calculator progress


Richard Ottosen is hard at work doing the PC layout for one variant of the DIY5 calculator, which we plan to show at HHC 2012. I've been working on the firmware for quite a while, using the DIY4X hardware, and will have some exciting new stuff to demo. I'm keeping mum about most of the details until the conference, but I'll post about it here after that.

One bit of progress that I thought I'd report is that I've now got my firmware build system working cleanly on both Linux and Windows. I do all my development on Linux, and Windows is of almost no interest to me, but I plan to open-source the firmware for one variant of the calculator. I expect that at lest some of the people that might want to hack on the firmware will want to use Windows, so I spent most of yesterday and today making that work. Now I can build bit-for-bit identical firmware on both host platforms.

The development environment uses these tools, all of which can be downloaded at no charge:

  • SCons 2.2.0, a software construction tool conceptually similar to the more well-known "make"
  • Python 2.7.3, needed for SCons
  • Mentor Sourcery Codebench Lite Edition ARM EABI cross-development toolchain (GCC, linker, GDB, etc.) 2012-03 release (no charge, but registration required)
  • Energy Micro libraries and tools, which for Windows can be conveniently downloaded and installed using Simplicity Studio

In principle it is possible to use the Eclipse IDE to develop with these tools, and Energy Micro even has an application note about that ("AN0023 Eclipse Toolchain"), but I find Eclipse, and even commercial IDEs such as IAR Embedded Workbench, to be slower than molasses flowing uphill in the middle of winter. I used to use IAR Kickstart on Windows until my code hit the 32KB limit, but every time I'd ask it to do a build it would take quite a few seconds before it would even launch the compiler. From the command line I just type "scons" and it starts compiling in less than a second, even though it does a complete and correct dependency analysis!

I need to write up some instructions on how to get everything set up, but it isn't terribly complicated.


Nice I look forward to hearing more.

How recent is the compiler? There has been an amount of ARM work done in gcc and llvm recently.

- Pauli


I'm using the March 2012 release of Mentor Sourcery CodeBench Lite for ARM EABI. It is based on GCC 4.6.3 with some newer ARM-specific patches applied.

Part of the reason I prefer Mentor Sourcery to other GNU toolchain distributions is that the Mentor Sourcery team essentially IS the upstream for the ARM target of GCC. They do much of the ARM development, and push the changes to the FSF, but the FSF is sometimes rather slow to integrate them. Thus the Mentor Sourcery ARM toolchain is usually far more up-to-date than others in terms of bug fixes and code generation enhancements.

If there are any specific cases of recent ARM work in GCC that you think are important, let me know, and I'll check whether they are in the Mentor release.

I use LLVM for other projects, but the code generation for ARM Thumb mode doesn't yet seem to be nearly as good as that of GCC. (And GCC's isn't as good as the commercial compilers, unfortunately.)


I know how long & difficult it is to get modifications merged into the gcc mainline (check out the credits file :-)

GCC assumes much about the nature of the CPU and much of this isn't all that suitable for ARM, they are closer for Thumb at least.

I've not yet compared LLVM to GCC for arm/thumb support. Might be an interesting project.

- Pauli


If the Mentor Sourcery GCC is the same as the free Code Sourcery compiler I would be very cautious! We had an issue with a firmware hang which magically went away after switching to a different GCC release. Obviously one of the optimizations was too good to be working correctly. We are currently using GCC 4.6.0 without any issues. We might want to give the Mentor Sourcery compiler another chance but this will require some testing on the hardware to make sure nothing is broken.


Yes, Mentor Sourcery CodeBench Lite is what used to be called Code Sourcery G++ Lite.

I'm not proposing that anyone else switch to it for other projects such as WP-34s. I only brought it up because the "stock" firmware that I'll provide for the open-source version of the DIY5 is built and tested with it.


I've got the bootloader USB code successfully enumerating on the host now. That just means that the host can tell the device is present and what it's vendor and product ids are. It doesn't yet actually program new firmware from USB, but that will be easy compared to the huge hassle of getting the basic USB communication working. Currently I can get it to toggle a GPIO pin under host control from a trivial Linux program using libusb.

With the basic USB code, the bootloader is now over 64KB, but I still think I'll be able to reduce it by 20K by using a lightweight printf() replacement. I've given up on fitting it in 32KB, though. I think the new target is 64KB.

With the early chip I was using, the entire flash was only 128KB. The current chip has 1MB, so there will still be 960KB for the calculator.

Getting the USB code working in the bootloader will also lead to USB support in the calculator, since they share a lot of the infrastructure code.



Possibly Related Threads…
Thread Author Replies Views Last Post
  DIY4X/DIY5 progress! Eric Smith 6 2,136 03-08-2012, 06:51 PM
Last Post: Eric Smith
  Seeking DIY5 update and webpage David Griffith 1 1,134 02-11-2012, 01:27 PM
Last Post: Eric Smith
  DIY4X, DIY5 update Eric Smith 5 2,029 01-05-2012, 01:39 AM
Last Post: Eric Smith
  Any DIY5 pics out there? Ángel Martin 64 15,128 12-16-2011, 08:09 AM
Last Post: Derek Walker (UK)
  9100B restoration progress David Ramsey 6 2,124 11-27-2011, 10:33 AM
Last Post: Etienne Victoria
  9100B progress David Ramsey 11 3,156 11-17-2011, 08:30 AM
Last Post: Joel Setton (France)
  9100B progress David Ramsey 6 2,078 11-04-2011, 11:32 AM
Last Post: David Ramsey
  OpenRPN Prototyping In Progress Hugh Evans 19 4,927 10-20-2011, 09:16 AM
Last Post: Oliver Unter Ecker
  More FPGA progress Olivier De Smet 4 1,528 08-11-2010, 03:17 PM
Last Post: Mike
  Some progress (HP 85B) Olivier De Smet 3 1,391 05-02-2010, 03:01 AM
Last Post: Olivier De Smet

Forum Jump: