Computing stuff tied to the physical world

Extending the “ide-hardware” project

The ide-hardware project on GitHub was set up a while ago to support the ATTint84-based JeeNode Micro. It’s in fact a great place to start adding more architectures and boards.

Let’s get that going. For development, we’ll set up a new lpc8 “branch” on GitHub, which doesn’t interfere with the existing code. When (and if!) the new code is ready and turns out to work acceptably well, we can then merge all of these new files and release a new version of the “ide-hardware” project with (hopefully) added support for the new Tinker Pico.

The first step is to just get a minimal Blink example to compile, upload, and run. This demo sketch can be loaded from the menu: File => Examples => 01.Basics => Blink.

As first hardware/ide-hardware/arm/boards.txt, we’ll use a minimal config:

tkpico.name=Tinker Pico
tkpico.build.board=TINKER_PICO
tkpico.build.variant=jeelabs_tkp
tkpico.build.core=lpc8xx
tkpico.build.mcu=cortex-m0plus
tkpico.build.f_cpu=12000000L
tkpico.build.extra_flags=-mthumb -march=armv6-m -D__LPC8__ 

And the hardware/ide-hardware/arm/platform.txt file will define these settings:

name=JeeLabs ARM Boards
compiler.path={runtime.ide.path}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/
compiler.warning_flags.default=-DDEBUG_LEVEL=DEBUG_NONE
compiler.cpp.cmd=arm-none-eabi-g++
compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_{build.variant}
compiler.cpp.extra_flags=
compiler.libs.c.flags=
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {compiler.libs.c.flags} {includes} "{source_file}" -o "{object_file}"

As you can see, there are a lot of settings, some of which get re-used inside others via the {...} expansion notation. The bad news is that we will need dozens and dozens more of these before the whole setup will actually start to work.

But the reward for setting this up is a new section in the Tools => Boards menu:

Screen Shot 2015 10 08 at 20 55 09

Yippie! (note that the IDE needs to be restarted to see this new board definition)

If we now try to compile the Blink example for the new Tinker Pico board, there will be some very obvious compile errors right away:

Blink.ino: In function 'void setup()':
Blink.ino:20:15: error: 'OUTPUT' was not declared in this scope
Blink.ino:20:21: error: 'pinMode' was not declared in this scope
Blink.ino: In function 'void loop()':
Blink.ino:25:20: error: 'HIGH' was not declared in this scope
Blink.ino:25:24: error: 'digitalWrite' was not declared in this scope
Blink.ino:26:13: error: 'delay' was not declared in this scope
Blink.ino:27:20: error: 'LOW' was not declared in this scope
'OUTPUT' was not declared in this scope

Ah, of course: the Blink example is using some well-known conventions of the Arduino runtime API. So while we may have gotten the IDE to show a new board, and even start a compilation for us, we don’t have any C/C++ definitions yet, so all of these references fail.

The next step is to fix that. But we’ll need to hack, eh… cut a lot of corners, just to get going.

[Back to article index]