Skip to content
rhn edited this page Aug 31, 2011 · 6 revisions

Jazda uses an extremely simple buildsystem: main.c includes all .c files it uses. This might not be a "real" build system, but it's sufficient for current use.

Requirements

  • Linux
  • avrdude
  • gcc
  • avr-libc
  • Unix shell

If you're using Windows, you can use Linux on a virtual machine to create the .hex file and then flash the microcontroller from Windows.

Building

Building is combined with flashing. If you only need the .hex file though, you can leave your controller disconnected. Use the same commands to flash example files - just change main.c.

  1. Place AtMega8 chip in the programmer

  2. Connect the programmer to the computer

  3. Execute the following comands, replace usbasp with your programmer name (look for it in avrdude manual):

     cd src
     sh ../build.sh usbasp m8 main.c
    

    This will create main.c.hex file for flashing, main.c.obj intermediate file and main.c.disasm assembly file. If you had your programmer connected, main.c.hex will start uploading.

Why not make?

The most important reason is that the simple buildsystem works just fine.

Against make

  • it already works
  • files not included thanks to #ifdefs are not compiled and may be broken without a problem
  • easier to use C than make language for including files
  • whole program optimizations for free
  • less header files

For make

  • files can have private namespaces
  • bettert separation of functionality
  • more standardized
  • shorter compilation (not really a problem)

Regardless, all modules, sensors and builtins should #include every header file they refer to, as if make was used. In the depths of internal subsystems, header files are not used and every .c file is simply #included.

Clone this wiki locally