Conquering software complexity

I am involved in a number of robotic, volunteer and art groups and find that the computer questions I come across are very simple, yet the questions illustrate just how difficult it is to get started. Perhaps the greatest credit that Arduino has is its ability to simplify the getting started experience by hiding the complexity behind a simple user interface. As I consider this I am painfully aware that for most micro controllers the tool chain, hardware and lack of good examples make life very difficult.

The question in my mind is can it be simpler? So I started to consider what simpler might look like and how I might make it available. In making things simpler I didn’t want to remove the flexibility that is possible using a high performance processor. The goal is simplicity to getting started and as you learn more you can add complexity as your skills grow. First I needed a simple open source tool chain that has been pre-built so that it just needs to be installed. Given GCC’s significance as a compiler and tool chain I decided that whatever solution I came up with it had to be based on GCC tools. The GCC tools are open source and are under continuous development so that the generated code is very efficient and supports a variety of processor platforms.

Next I want to eliminate the complex IDE’s which offer professional coders great flexibility but they also offer to much flexibility for someone just starting out. A beginner needs little more than an editor to support them, however syntax highlighting and a light weight project manager are also very desirable. The AVR community has used programmers notepad as part of the WinAVR tools chain for years and this seems like a great choice.

Once the tool chain has been worked out I need to focus on making the actual control of the micro controller a lot simpler. Even the most basic program requires a significant number of files that need to be linked correctly. When the compiler or linker fails, the tools generate confusing and meaningless error messages for the beginner. The obvious simplification is to compile the code into a library which means I take care of the compiler complexities and the beginner only needs to link one file which is a lot easier than trying to manage 200+ files used internally by the library. The entire support library will be written as open source code and can be changed, modified or extended to meet your needs. The main issue I see with pre-compiled libraries is that they are less memory efficient but this can be solved with better hardware. Libraries also need to be well thought out so that the functions they provide are easy to remember and use. In fact my goal is to minimize the number of functions, sacrificing features in favour of simplicity. Complexity is easy to add later, elegant simplicity is more difficult to achieve.

Finally the choice of hardware platform is critical. I have been a fan of the 8 bit AVR however I see it as very limited given the 32bit ARM alternatives on the market. The AVR and ARM offer similar peripherals but the ARM is a better value. Consider the LPC1347 $6.08 while the ATMega32U4 $6.43. The AVR has half the memory and one tenth the processor speed. The decision for me is easy the ARM is now my preferred platform. This is where I divert from the mainstream thinking where hobbyist use 8 bit processors. While simple, the 8 bit processor has limited speed and memory which is why I am leaning toward using a 32 bit ARM processor as the heart of the design. The extra memory provided by the ARM allows me to provide a large default library without having to worry about using to many system resources. To the user it means you can write programs quickly and easily using a small number of functions offered by the library.

The 32 bit ARM has more than 10 times the performance and simplifies coding because everything can be coded in a high level language like ‘C’. The key to making the ARM easy to use, is to do, what Arduino did and that is hide the complexity in libraries. The processors I have initially chosen to support are the LPC1343 and LPC1347. The features include:

  • 32 bit ARM Cortex M3 @72MHz
  • USB device interface
  • Flash boot loader which supports in system programming
  • libDNC_LABS library provides CMSIS2, USB, UART and LIBC support

My goal is to make it easy to get started with high power 32 bit embedded computing using a friendly development environment. This allows you to experiment and get printed results immediately. What I haven’t done is provide libraries for every feature under the sun and I am not building an Arduino. I will add libraries as I need them but I think that there are enough features that the beginner can take advantage of.

Proposed Libraries:

  • STDIO Comport_Init(port,baud),printf(), putchar(value), getchar()
  • I2C I2C_init(speed), I2C_read(device), I2C_write(device,value)
  • GPIO GPIO_dir(port,bit),GPIO_read(port,bit),GPIO_write(port,bit,value)
  • PWM PWM_init(port,bit,frequency,high_period)
  • A/D A/D _init(speed,bit), A/D _read(bit)
  • DAC DAC _init(bit), DAC _read(bit), DAC _write(bit,data)

Leave a Reply

Your email address will not be published.