Steps to reproduce:
install the arduino 1.6.5 from their site.
Mine is @ :
/home/az/bin/arduino-1.6.5-r5/
avr-g++ installed a custom (not system ) location: /home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/
a. Create an Arduino project using "Arduino project wizard"
b. Replace provided sketch.cpp with the code below.
c. remove libraries.cpp file from the project.
d. you should now have only one file in your project. under "Src" directory.
/*
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
void setup()
{
Serial.begin(9600);
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
}
void loop()
{
Serial.println("Hello world!");
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(1000); // wait for a second
}
Compiler setup:
a. Settings->Compiler-> GCC for AVR. Updated "Search directories"-> Compiler to have "/home/az/bin/arduino-1.6.5-r5/hardware/tools/" ; "Linker"-> /home/az/bin/arduino-1.6.5-r5/hardware/tools/avr ; "Toolchain" -> /home/az/bin/arduino-1.6.5-r5/hardware/tools/avr
everything else is set to default. There are no additional variables set.
Template usage:
// Yes, i first generated the project only after that git the template.
a. git the "
https://github.com/obfuscated/cb_arduino_template"
b. in /home/az/.config/codeblocks :
arduino -> /home/az/bin/arduino-1.6.5-r5/
cb_arduino_template-master -> /home/az/.config/codeblocks/cb_arduino_template-master
c. The project specific changes:
Wizard's generated project file has been modified to add "avr" subdir and i removed the APP_DIR reference and hardcoded the direct path to the arduino installation (for now):
<Target title="Arduino Uno">
<Option output="bin/Release/test_3.elf" prefix_auto="1" extension_auto="0" />
<Option type="1" />
<Option compiler="avr-gcc" />
<Compiler>
<Add option="-Os" />
<Add option="-mmcu=$(MCU)" />
<Add option="-D__AVR_ATmega328P__" />
<Add directory="$(ARDUINO_DIR)/hardware/arduino/cores/arduino" />
<Add directory="$(ARDUINO_DIR)/libraries" />
<Add directory="$(ARDUINO_DIR)/hardware/arduino/variants/standard" />
</Compiler>
<Linker>
<Add option="-s" />
<Add option="-mmcu=$(MCU)" />
</Linker>
<ExtraCommands>
<Add after="avr-objcopy -O ihex -R .eeprom -R .eesafe $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_FILE).hex" />
<Add after="avr-objcopy --no-change-warnings -j .eeprom --change-section-lma .eeprom=0 -O ihex $(TARGET_OUTPUT_FILE) $(TARGET_OU
TPUT_FILE).eep.hex" />
<Add after="avr-size $(TARGET_OUTPUT_FILE)" />
</ExtraCommands>
<Environment>
<Variable name="ARDUINO_DIR" value="/home/az/bin/arduino-1.6.5-r5" />
<Variable name="BOARD" value="Arduino Uno" />
<Variable name="BOARD_INDEX" value="1" />
<Variable name="MCU" value="atmega328p" />
<Variable name="UPLOAD_BAUDRATE" value="115200" />
<Variable name="UPLOAD_PORT" value="" />
</Environment>
</Target>
Now the compilation logs:
-------------- Build file: Arduino Uno in test_3 (compiler: GNU GCC Compiler for AVR)---------------
avr-g++ -Wall -fno-exceptions -ffunction-sections -fdata-sections -x c++ -s -DF_CPU=16000000L -DARDUINO=103 -DUSE_EEPROM=0 -DUSE_ETHERNET=0 -DUSE_FIRMATA=0 -DUSE_LCD=0 -DUSE_LCD4884=0 -DUSE_OBD=0 -DUSE_SD=0 -DUSE_SERVO=0 -DUSE_SOFTSERIAL=0 -DUSE_SPI=0 -DUSE_STEPPER=0 -DUSE_TINYGPS=0 -DUSE_WIRE=0 -Os -mmcu=atmega328p -D__AVR_ATmega328P__ -I/home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/cores/arduino -I/home/az/bin/arduino-1.6.5-r5/libraries -I/home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/variants/standard -I/home/az/bin/arduino-1.6.5-r5/hardware/tools/ -c sketch.cpp -o .objs/sketch.o
sketch.cpp: In function 'void setup()':
sketch.cpp:11:2: error: 'Serial' was not declared in this scope
Serial.begin(9600);
^
sketch.cpp:15:14: error: 'OUTPUT' was not declared in this scope
pinMode(13, OUTPUT);
^
sketch.cpp:15:20: error: 'pinMode' was not declared in this scope
pinMode(13, OUTPUT);
^
sketch.cpp: In function 'void loop()':
sketch.cpp:20:2: error: 'Serial' was not declared in this scope
Serial.println("Hello world!");
^
sketch.cpp:22:19: error: 'HIGH' was not declared in this scope
digitalWrite(13, HIGH); // set the LED on
^
sketch.cpp:22:23: error: 'digitalWrite' was not declared in this scope
digitalWrite(13, HIGH); // set the LED on
^
sketch.cpp:23:12: error: 'delay' was not declared in this scope
delay(1000); // wait for a second
^
sketch.cpp:24:19: error: 'LOW' was not declared in this scope
digitalWrite(13, LOW); // set the LED off
^
Process terminated with status 1 (0 minute(s), 0 second(s))
8 error(s), 0 warning(s) (0 minute(s), 0 second(s))
That is the progress for now.
As far as the template goes.
So if i right click on the "arduino project" in the wizard i get the message below.
The "ls -l ~/.local/share/codeblocks/templates/wizard/arduino/" is empty.