blumenplace

smart plant watering blog

Building and debugging emb-template

Apr 17, 2015

Once you checked out https://github.com/DataArt/ebc-template repository and created a separate directory for out-of-source build, you need to run a command like this:

cmake ../mbed-template/ -DCMAKE_TOOLCHAIN_FILE=../mbed-template/lm3s6965evb.cmake \
    -DTOOLCHAIN_PATH=~/gcc-arm-none-eabi/bin -DQEMU_PATH=~/qemu-arm/bin

The first argument of the cmake command specifies a directory that contains CMakeLists.txt file - a file that holds project description, and defines rules of how to compile and link the project.

DCMAKE_TOOLCHAIN_FILE argument specifies so called toolchain file. This file basically redefines standard cmake definitions. It can define the way cmake actually invoke particular command. For instance, if you need to use arm-none-eabi-gcc executable insteard of gcc, this file is a right place to acomplish this.

Read more

TI cmsis library is broken

Mar 26, 2015

If you read this, most likely you have faced the same issue I did. It means that most likely you have downloaded cmsis implementation from one of the biggest silicon manufacturer in the world - TI. And the library does not work. Even worth, your toolchain cannot assemble it and failed on strex instruction.

strex r0, r0, [r1]

It seems like someone do not give a dump about specifications. Because it cleary states that For STREX, Rd must not be the same register as Rt, Rt2, or Rn.

Read more

Cortex-M3 clock sources

Mar 25, 2015

As you may know, any digital circuit can be either combinational or sequential. And all modern microcontroller, including lm3c, consists of circuits of both types.

A simplest example for combinational logic is just a boolean expression like B = not A. This expression does not compute value of B, but rather states that B is an inverted value of signal A. In electronics world this means that once a signal comes to input A it is immediately appear on output B.

On other hand sequential logic requires and an additional input, which moves circuit from one state to another. In microcontrollers an example of such an additional signal is a clock.

Read more

CMake and IDE setup

Mar 23, 2015

This tutorial really does not bring anything new in the meaning of code. Basically we have copied all source files from the previous post and put them under hw and src folders. But we also added one small file called CMakefile.txt that dramatically changes the way of how you think about building C/C++ projects.

The good practice when you building CMake project is to create a separate build directory and start cmake utility from there. This method is called “out of source build”. A significant advantage of this method is that this way you keep intact all your source codes and all object or temporary files will be created in a separate folder. As a side, for instance, you can use Qt Creator during normal development workflow, but when, for some reason, you want to see the raw output from build tools you can build the project from command-line.

Read more