THE PARTICLE COMPUTER DOCU
(Using SDCC on Windows)

This chapter summarises and explains how to use the SDCC on Windows platforms.

Contents

Installing SDCC

Download our installer package .

Run the installer

The package contains

Obtaining the Particle Base System

Download the Particle Base System Snapshot. You can also obtain the sources from SVN. (Ask your local guru)

If you download the snapshot, we recommend for the first time:

Compiling a project

Compiling the demo program

We assume you want to compile the demo program and already followed the instructions above. If you renamed your folder and/or your program sources, you have to modify the Makefile in build subfolder.

Run the following commands in your MSYS shell: (assuming you are still in the same directory as above) $ cd demo/build
$ make
Then the project will be build. You will find the demo.hex in your current folder (MinGW: /c/projects/ParticleBaseSystem/demo/build, Windows: C:\projects\ParticleBaseSystem\demo\build).

Compiling your own project

To compile your project with the make tool you have to adapt the Makefile found in the build folder of the demo program with a text editor that supports UNIX line breaks.

Change the following items:

MAIN:
set the path to your program source (relative or absolute path, seen from your projects directory)
MY_SRC:
add other .c sources that your program needs, separated by spaces (relative or absolute paths)
PPATH:
set the path to the particle base system folder
BOARD:
set your board version
SENSORBOARD:
set your sensorboard or leave blank if you do not want it
STACKOPTIONS:
enable the options that affect the stack like SDJS or ACK
OPTIONS:
enable the optional parts that do not affect the stack like RTC

Run the command $ make in the build directory to compile your project.

If you want to build the separate flash loader, enter $ make loader

If you want to remove the generated binary files, assembler files and dependency information (.d files), enter $ make clean

File structure and concepts

Organization

The Particle Base System has the following file structure:

Concepts behind the structure

The sources and dependencies follow the following principles:

The modularized Particle Base System does not need to reside in the project tree like the earlier versions. Also all binaries are located only in the build directory of the project so it is easy to "clean" from generated binaries. This enables the developer to handle base system and application separate.

You can also find two VCG files in the ParticleBaseSystem/particle/doc directory that display the dependencies. (requires xvcg or AISee)

Using MinGW and MSYS

MinGW and MSYS enriches and extens a Windows environment with many powerful GNU tools and allows us to run the SDCC which was designed on UNIX/LINUX systems by emulating such an environment.

MSYS shell vs. cmd.exe shell

There are some differences between the MSYS shell and the build-in cmd shell from Microsoft:

Important and useful commands

MSYS offers a set of feature rich command line tools. Except the shell internal commands, these tools can also be used in the cmd shell. To get information about the behaviour and valid command line parameters of a command, enter $ [command] --help

Common tools are:

cd
changes the current working directory; nearly the same as Windows' cd, but does not allow the "shortcut" cd.. (without space between cd and ..) and calling cd without parameters does not show the current directory but changes to your home directory
cp
copies files and directories
diff
shows the differences between two (text) files or even whole directories
exit
closes the current shell ([Ctrl]+[d] does the same)
find
find a file
grep
searches a string or regex in a file, directory or stream
make
interprets Makefiles to build whole projects
mv
moves and renames files and directories (there is no dedicated rename command)
less
shows the content of a file or a stream page by page; better replacement for Windows' more command (guess where the name comes from ...)
ls
lists the content of a directory and shows file attributes; powerful replacement for Windows' dir
mkdir
creates a directory
pwd
shows the absolute path of the current working directory
rm
deletes files and directories
sed
stream editor, allows manipulation of files and streams
tar
packs or extracts files to/from archives

Links