User forums > Embedded development

CB and Arduino 1.6.x

(1/13) > >>

AZ:
Based on the conversation http://forums.codeblocks.org/index.php/topic,21049.new.html and http://forums.codeblocks.org/index.php/topic,21246.0.html, it is my understanding that CB's project wizard for Arduino is not functioning properly for 1.6.x.
The objective of this conversation is to, hopefully, get the CB to compile the 1.6.X code and maybe get Odfusicated's template https://github.com/obfuscated/cb_arduino_template to support 1.6 and replace(?) the existing project wizard plugin.

AZ:
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.

--- Code: ---/*
  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
}


--- End code ---



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):

--- Code: ---<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>


--- End code ---

Now the compilation logs:

--- Code: ---
-------------- 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))


--- End code ---

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.

stahta01:
Post the full rebuild log in this thread.

Edit: http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

IMHO: The first step is getting an CB Project to compile using the sample code you posted or other good sample code.

Then compare the two wizards generated projects to the working project.

Tim S.

AZ:

--- Quote from: stahta01 on June 17, 2016, 10:19:16 pm ---Post the full rebuild log in this thread.

Edit: http://wiki.codeblocks.org/index.php/FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F

IMHO: The first step is getting an CB Project to compile using the sample code you posted or other good sample code.

Then compare the two wizards generated projects to the working project.

Tim S.

--- End quote ---

Thank you Tim. Got interrupted when was posting. Updated now. Please let me know if i need to add anything else.

stahta01:
I still NEED the FULL rebuild log!

A partial log is NOT enough for me to see possible issues.

And, where did the code you posted come from; it does NOT look like good C code to me.

Tim S.

Navigation

[0] Message Index

[#] Next page

Go to full version