This project is an effort to program for Arduino hardware using pure C. You will need the Arduino base software (arduino-core Debian package) to be installed.
This package contains:
- a Makefile: self-sufficient (aside Arduino software itself) to compile
C++ Arduino projects (including *.ino files) or a pure C Arduino project
without libraries or serial access (no
- C core files: porting of a part of the C++ Arduino core for serial communications.
- blink: see http://arduino.cc/en/Tutorial/Blink
- bargraph: see http://arduino.cc/en/Tutorial/BarGraph
- digit: controls a single 7 segment display
- shift: same, through a shift register (serial to parallel)
First, decide how you will call the Makefile.
The most convenient way is to add a symbolic link to the Makefile in the project. For example:
arduino.c/ Makefile core/ bargraph/ Makefile -> ../Makefile ...
Then, you can just change dir to bargraph and run
make (the Makefile
assumes core/ is in the same directory as the regular file Makefile).
If you cannot use symbolic link or are not sure how to use them, just copy Makefile and core/ in your project directory:
bargraph/ Makefile core/ ...
Again, you can compile by running just
Finally, you can of course use:
make -f ../arduino.c/Makefile
Then, check that the following variables are set to the right values:
|TARGET||program||target program name (program.o, program.hex)|
|BOARD||leonardo||identifier of the board|
|ARD_BASE||/usr/share/arduino||installation path of arduino (or sources)|
|PORT||/dev/ttyACM0||file pointing to the serial connection|
|LIB_OBJ||$(BASE_PATH)/obj||building directory for C core (e.g. /tmp/xyz)|
|LIB_C||$(BASE_PATH)/core||source directory for C core (c_*.c)|
$(BASE_PATH) is the directory where the Makefile is located
If you want to compile C++ Arduino project (like the Arduino IDE does),
you should add " MODE=cpp" to every call to the
make command. If you
prefer, you can just uncomment the appropriate line in the Makefile.
The Makefile support the following commands:
make allbuild the .hex file to be sent to the board
make cleanremove the project object files (*.o)
make cleanobjremove the global object files (obj/)
make destroysame as
make cleanand remove the .hex file
make rebuildsame as
make destroy all
make uploadupload the .hex file to the board