Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages | Examples

Development environment, Tools

We describe the development environment for linux and possibly other unices here. It is also possible to have the same environment for win32 but we have yet to try it.
The development consists of 3 main steps:
  1. write your code, compile and link
  2. convert resulting object yourapp.elf into yourapp.trb - Turbo application object format
  3. upload yourapp.trb either via cable (turbo-app utility) or programmer (cemu utility) directly to MCU program memory or with programmer to memory card (from where user simply selects yourapp.trb and installs it into program memory).


Devel and Install


For development and building of Turbo applications you need the following tools:

  1. gcc - GNU project C compiler configured for AVR architecture;
  2. binutils - GNU project set of utilities for linking and object code manipulation configured for AVR architecture; application specific format --turbo support patch by BLADOX;
  3. turbo-devel - package containing Turbo specific libc, headers and linker scripts.

Where to get all this stuff?

As for gcc you can use the vanilla gcc from any GNU mirror, binutils have to be patched to provide turbo specific binary application format.

The binutils and turbo-devel packages can be found on



Untar and
./configure --target=avr
make install
installs all the AVR binutils into /usr/local/.


Untar and
./configure --target=avr --enable-languages=c
make install
installs all the AVR gcc into /usr/local/.


Untar the package somewhere (and use this path in Makefiles).

Notes on Makefile

Example of Makefile
ifndef TURBO_DIR
TURBO_DIR = ../../turbo-devel

TURBO_TAG = --turbo-manifest "YOUR_MANIFESTO" #--turbo-verbose
INCDIR	= -I$(TURBO_DIR)/include -I.

CC = avr-gcc
LD = avr-ld
RM = rm -f


LIB = 

CFLAGS  = -std=gnu99 -mmcu=atmega128 -mno-tablejump -Wimplicit-function-declaration -Os -fno-builtin
LDFLAGS = -L$(LIBDIR) -T -d -r --emit-relocs -R $(LIBDIR)/public_calls $(LIB) -lm -lc `avr-gcc -print-libgcc-file-name`

OBJ = $(SRC:.c=.o)
all:	$(TRG).trb

include $(SRC:.c=.d)

%.o : %.c 
	$(CC) -c $(CFLAGS) $(INCDIR) $< -o $@

%.d: %.c
	$(CC) -M $(CFLAGS) $(INCDIR) $< | sed 's/$*.o/& $@/g' >$@

$(TRG).elf: $(OBJ)
	$(LD) -o $@ $(OBJ) $(LDFLAGS)

$(TRG).trb: $(TRG).elf
	avr-objdump $(TURBO_TAG) --turbo $(TRG).elf

dis: $(TRG).elf
	avr-objdump -D --architecture=avr:5  $(TRG).elf >$(TRG).dis

install: all
	cp $(TRG).trb ../bin

	for X in *.[ch]; do \
		indent -npsl -sob -bad -bli0 -cli2 $$X; \

	$(RM) *.o
	$(RM) *.d
	$(RM) *.i
	$(RM) *.s
	$(RM) *~
	$(RM) $(TRG).dis
	$(RM) $(TRG).elf
	$(RM) $(TRG).trb

Meaning of CFLAGS:

Meaning of LDFLAGS:

trb and elf are created, dis when "make dis"

Uploading application file into Turbo memory

Assume that you have built your application and the result is helloworld.trb file. The next step is uploading this file into the program memory.

For uploading of the file you have two options:

  1. over serial data cable connected to the phone with the help of turbo-cable-utils, turbo-app utility
  2. use programmer and turbo-prog-utils, cemu utility

Cable utils

The advantage of this method is that you do not need to have the programmer. On the other hand you need to have phone which supports AT commands for SMS manipulation - notably AT+CMGR, AT+CMGW, AT+CMGD commands. Check your phone docs for the support of these commands.

The setup is following:

  1. install Turbo, have the phone running, connect data cable
  2. use turbo-app utility for uploading the file


turbo-app helloworld.trb

Programmer and turbo-prog-utils

In this case you insert Turbo (with SIM card) into the SIM connector on the programmer and with the help of cemu utility copy file into Turbo program memory.


Debugging in the embedded world is not that easy as you may know from developing in "full-size" world. You cannot easily attach debugger to the running process, setup breakpoints and see variables. Also you do not have any direct screen where you could see the partial printouts.

For Turbo debugging you need to use the USB programmer we provide. When connected to the Turbo your application can send printouts to programmer and with programmer util called dbg you can see the results.


In your code (we suggest config.h) define (or comment out)

#define DEBUG

and use the macros dbsp(), dbc(), dbih(), dbch().


u16 i;
u8 c;
dbsp("We are here\n");
dbsp("Value of short in hex is ");dbih(i);dbc('\n');
dbsp("Value of char in hex is ");dbch(c);dbc('\n');

This complied with DEBUG defined will produce longer code and with dbg utility you will see the messages.

We suggest to use "dbg|tee my_log" to save the output to the file.

When the same code is compiled without the DEBUG defined the db*() macros will be empty and no extra debugging code will be included in your application.

Copyright © 2004-2006 BLADOX
Turbo version 1.2