Code::Blocks Forums

User forums => Embedded development => Topic started by: AZ on June 17, 2016, 08:44:09 pm

Title: CB and Arduino 1.6.x
Post by: AZ on June 17, 2016, 08:44:09 pm
Based on the conversation http://forums.codeblocks.org/index.php/topic,21049.new.html (http://forums.codeblocks.org/index.php/topic,21049.new.html) and http://forums.codeblocks.org/index.php/topic,21246.0.html (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 (https://github.com/obfuscated/cb_arduino_template) to support 1.6 and replace(?) the existing project wizard plugin.
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 17, 2016, 09:24:26 pm
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
}




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>


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


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.
Title: Re: CB and Arduino 1.6.x
Post by: 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 (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.
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 17, 2016, 10:32:05 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 (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.

Thank you Tim. Got interrupted when was posting. Updated now. Please let me know if i need to add anything else.
Title: Re: CB and Arduino 1.6.x
Post by: stahta01 on June 18, 2016, 03:28:51 am
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.
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 18, 2016, 04:16:50 am
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.

it is NOT a good C/C++ code. It is a sketch file. As i'm learning here (https://www.arduino.cc/en/Hacking/BuildProcess).  Arduino converts the sketch file to proper c/cpp and only after that calls the g++ compiler.

Let me work on the _proper_ cpp file.


> I still NEED the FULL rebuild log!
I'm not sure where/what you need... I uploaded all information from the "build log" window.
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 18, 2016, 06:39:48 am
So i took step back and tried to compile the files by hand ( without CB).
Here is what i learned.
The ino file (in it's simplified form) is converted to a cpp with 3 lines:
Code
// save as Blink.cpp

#include "Arduino.h"
void setup();
void loop();
/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the Uno and
  Leonardo, it is attached to digital pin 13. If you're unsure what
  pin the on-board LED is connected to on your Arduino model, check
  the documentation at http://www.arduino.cc

  This example code is in the public domain.

  modified 8 May 2014
  by Scott Fitzgerald
 */


// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin 13 as an output.
  pinMode(13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second
}

that can be compiled with :
Code
avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10604 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR  -I. -I${CORE} Blink.cpp

where CORE - /home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/cores/arduino

Next step up was to understand how Arduino (IDE) compiles the sketches (ino files).

 It seems that it copies *.cpp and *.c file to a temp directory adds a "Blink.cpp" and compiles them one by one then it links them all into one file before uploading to a board.

The arduino-1.6.5-r5/hardware/arduino/avr/cores/arduino/main.cpp is the actual "main" file, that calls all the functions from "Blink":
Code
#include <Arduino.h>

// Declared weak in Arduino.h to allow user redefinitions.
int atexit(void (* /*func*/ )()) { return 0; }

// Weak empty variant initialization function.
// May be redefined by variant files.
void initVariant() __attribute__((weak));
void initVariant() { }

int main(void)
{
init();

initVariant();

#if defined(USBCON)
USBDevice.attach();
#endif

setup();
   
for (;;) {
loop();
if (serialEventRun) serialEventRun();
}
       
return 0;
}


Summary so far:
 a. arduino converts "ino" files to cpp by adding 3 lines to the top of the ino file.
 b. arduino copies all the c/cpp files into single temp location. One of these files is "main.cpp" that has calls to the functions in the Blink.cpp
 c. then arduino calls g++ to compile each of these files separately and links them into one file
 d. once completed, the file gets uploaded to the board.

So the cb project (probably) needs to make a copy of that main.cpp. and treat all "sketches" as libraries.
Next, since arduino copies all cpp/c files into one temp location and compiles and links them there, i would think, that either project wizard should do that or CB should use a build system.


P.S. cool. i just found the up-to-date ( and up to latest arduino version) build system - https://github.com/sudar/Arduino-Makefile
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 18, 2016, 07:04:28 am
I suspect Tim will yell at me again for not posting the complete log...
But here the entire log from "build log":
Code

-------------- Clean: Arduino Uno in test_3 (compiler: GNU GCC Compiler for AVR)---------------

Cleaned "test_3 - Arduino Uno"

-------------- Build: 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 main.cpp -o .objs/main.o
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
avr-g++ -L/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr -o bin/Release/test_3.elf .objs/main.o .objs/sketch.o  -Wl,--gc-sections -s -mmcu=atmega328p 
.objs/main.o: In function `main':
main.cpp:(.text.startup.main+0x0): undefined reference to `init'
.objs/sketch.o: In function `setup':
sketch.cpp:(.text.setup+0xa): undefined reference to `Serial'
sketch.cpp:(.text.setup+0xc): undefined reference to `Serial'
sketch.cpp:(.text.setup+0xe): undefined reference to `HardwareSerial::begin(unsigned long, unsigned char)'
sketch.cpp:(.text.setup+0x16): undefined reference to `pinMode'
.objs/sketch.o: In function `loop':
sketch.cpp:(.text.loop+0x4): undefined reference to `Serial'
sketch.cpp:(.text.loop+0x6): undefined reference to `Serial'
sketch.cpp:(.text.loop+0x8): undefined reference to `Print::println(char const*)'
sketch.cpp:(.text.loop+0x10): undefined reference to `digitalWrite'
sketch.cpp:(.text.loop+0x1c): undefined reference to `delay'
sketch.cpp:(.text.loop+0x24): undefined reference to `digitalWrite'
sketch.cpp:(.text.loop+0x30): undefined reference to `delay'
collect2: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
13 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 

I have 3 files in the project - main.cpp, sketch.cpp and pins_arduino.h .
Title: Re: CB and Arduino 1.6.x
Post by: yvesdm3000 on June 18, 2016, 06:14:37 pm
Your compiler is saying that it can't link some functions, normally this is because some libraries are not specified or missing.

Yves
Title: Re: CB and Arduino 1.6.x
Post by: oBFusCATed on June 18, 2016, 07:02:06 pm
You need to build the files inside the Arduino that contain the code that is not defined.
In my wizard (probably in the original, too) this is done by adding files that are named the same as the on being compiled and their content is #include <Blabla.cpp>. Make sure you use <> instead of "".
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 18, 2016, 07:23:15 pm
Your compiler is saying that it can't link some functions, normally this is because some libraries are not specified or missing.

Yves

correct. I'm not at the stage where i can build the project yet.
Learning how to get all the o files together.
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 18, 2016, 07:25:23 pm
You need to build the files inside the Arduino that contain the code that is not defined.
In my wizard (probably in the original, too) this is done by adding files that are named the same as the on being compiled and their content is #include <Blabla.cpp>. Make sure you use <> instead of "".

Can you please elaborate a bit on what did you mean by "You need to build the files inside the Arduino that contain the code that is not defined."?

Did you mean this:
b. arduino copies all the c/cpp files into single temp location. One of these files is "main.cpp" that has calls to the functions in the Blink.cpp
 c. then arduino calls g++ to compile each of these files separately and links them into one file
 

Also, are you saying that your wizard parses the file and adds all "includes" prior to compilation?
Title: Re: CB and Arduino 1.6.x
Post by: stahta01 on June 18, 2016, 08:04:22 pm
I got the linked to Wizard to work. https://github.com/obfuscated/cb_arduino_template (https://github.com/obfuscated/cb_arduino_template)

Code
#include <Arduino.h>

/*
  Turns on an LED on for one second, then off for one second, repeatedly.
 
  This example code is in the public domain.
*/

void setup()
{
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);     
}

void loop()
{
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
}

My Full build log is too large to put in code tags ( total message was over 20,000 characters).

No idea of what fixes I did in the past; this is NOT the first time I tried to use this wizard; will try to post what I think is needed later today.

Edit: Attached log.

Tim S.
Title: Re: CB and Arduino 1.6.x
Post by: stahta01 on June 18, 2016, 09:15:48 pm
I think I have the steps I used.

https://github.com/stahta01/cb_misc/blob/master/Notes/Arduino/CodeBlocks_Arduino_noSim_setup.txt (https://github.com/stahta01/cb_misc/blob/master/Notes/Arduino/CodeBlocks_Arduino_noSim_setup.txt)

The steps in link above are in the Code Tags below; no idea where the idea for the steps came from; I did them in trial and error using info found on Internet.
Code
## Code::Blocks IDE should already be installed.
## But, the Code::Blocks IDE should NOT be running!

#  See if arduino wizard exists already.
ls  /usr/share/codeblocks/templates/wizard/arduino/

#  If not copy form the location it was downloaded.
cd ~ && pwd     # /home/stahta01
su              # Enter su mode
cp -p --recursive /home/stahta01/cb_arduino_template-master/ /usr/share/codeblocks/templates/wizard/arduino/
exit            # Exit su mode

# Start Code::Blocks IDE
# Check if the "Arduino Project" Wizard exists.

# If "Arduino Project" wizard missing, add the next line to the startup script.
RegisterWizard(wizProject,     _T("arduino"),      _T("Arduino Project"),       _T("Embedded Systems"));


## Run "Arduino Project" Wizard; I used "Arduino Uno" option to test.

# First error I get when building "Arduino Uno" Project.
fatal error: CDC.cpp: No such file or directory


mkdir -p ~/.codeblocks

cd ~/.codeblocks

ln -s ~/sketchbook sketches

pwd  # /home/stahta01/.codeblocks

su
ln -s /usr/share/arduino /home/stahta01/.codeblocks/arduino
exit  # su mode

Tim S.
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 18, 2016, 10:29:47 pm
I think I have the steps I used.

https://github.com/stahta01/cb_misc/blob/master/Notes/Arduino/CodeBlocks_Arduino_noSim_setup.txt (https://github.com/stahta01/cb_misc/blob/master/Notes/Arduino/CodeBlocks_Arduino_noSim_setup.txt)

The steps in link above are in the Code Tags below; no idea where the idea for the steps came from; I did them in trial and error using info found on Internet.
Code
## Code::Blocks IDE should already be installed.
## But, the Code::Blocks IDE should NOT be running!

#  See if arduino wizard exists already.
ls  /usr/share/codeblocks/templates/wizard/arduino/

#  If not copy form the location it was downloaded.
cd ~ && pwd     # /home/stahta01
su              # Enter su mode
cp -p --recursive /home/stahta01/cb_arduino_template-master/ /usr/share/codeblocks/templates/wizard/arduino/
exit            # Exit su mode

# Start Code::Blocks IDE
# Check if the "Arduino Project" Wizard exists.

# If "Arduino Project" wizard missing, add the next line to the startup script.
RegisterWizard(wizProject,     _T("arduino"),      _T("Arduino Project"),       _T("Embedded Systems"));


## Run "Arduino Project" Wizard; I used "Arduino Uno" option to test.

# First error I get when building "Arduino Uno" Project.
fatal error: CDC.cpp: No such file or directory


mkdir -p ~/.codeblocks

cd ~/.codeblocks

ln -s ~/sketchbook sketches

pwd  # /home/stahta01/.codeblocks

su
ln -s /usr/share/arduino /home/stahta01/.codeblocks/arduino
exit  # su mode

Tim S.

Tim, does this run on Arduino 1.5+ ? 
looks pretty cool.
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 18, 2016, 10:36:28 pm
Now to get the project to build on CB i used the https://github.com/sudar/Arduino-Makefile project.

I just updated the Linux portion of the documentation( the documentation was good already btw), so hopefully, it will be an easy 10 minutes setup and integration with the CB. BTW the integration is described in detail and worked right away for me.

What i did to get Arduino-Makefile to work with CB is i created an _empty_ project and then followed the documentation in the https://github.com/sudar/Arduino-Makefile readme.

Looks like we have 3 options to use CB with Arduino 1.5.x+:
1. https://github.com/sudar/Arduino-Makefile
2. platformio
3. (and hopefully) https://github.com/obfuscated/cb_arduino_template
Title: Re: CB and Arduino 1.6.x
Post by: stahta01 on June 19, 2016, 12:59:29 am
Tim, does this run on Arduino 1.5+ ? 
looks pretty cool.

I used Debian testing version "2:1.0.5+dfsg2-4".

Is version "2:1.5.6.2+sdfsg2-3" in Debian experimental likely to be easy for me to build on Debian Testing?
(I have only built code from "Sid" in the past and it took some time and just a slight effort to do.)

Because, I think it is NOT worth anymore effort on my part; till you fail to get it to work using what I posted.

Tim S.
Title: Re: CB and Arduino 1.6.x
Post by: stahta01 on June 19, 2016, 01:06:19 am
Now to get the project to build on CB i used the https://github.com/sudar/Arduino-Makefile project.

I just updated the Linux portion of the documentation( the documentation was good already btw), so hopefully, it will be an easy 10 minutes setup and integration with the CB. BTW the integration is described in detail and worked right away for me.

What i did to get Arduino-Makefile to work with CB is i created an _empty_ project and then followed the documentation in the https://github.com/sudar/Arduino-Makefile readme.

Looks like we have 3 options to use CB with Arduino 1.5.x+:
1. https://github.com/sudar/Arduino-Makefile
2. platformio
3. (and hopefully) https://github.com/obfuscated/cb_arduino_template

Items 1 and 3 are NOT compatible!!!!

I have given up on helping you; you seem to need too much help for me to spend the time.
It is obvious to me that you also need someone with more experience with Arduino to help you.

FYI: If you plan to continue on the CB custom makefile path, STOP wasting time using the Code::Blocks wizards!!!

Tim S.

Title: Re: CB and Arduino 1.6.x
Post by: stahta01 on June 19, 2016, 01:26:05 am
I have decided to build package for version "2:1.5.6.2+sdfsg2-3" in Debian experimental for on Debian Testing and see if the obfuscated/cb_arduino_template works.
(Currently the package does NOT build using the normal steps I use; will try building again when the package is next updated.)

But, I still have given up on helping you; we are too much of the blind leading the blind.

Tim S.
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 19, 2016, 05:15:33 am
Tim, does this run on Arduino 1.5+ ? 
looks pretty cool.

I used Debian testing version "2:1.0.5+dfsg2-4".

Is version "2:1.5.6.2+sdfsg2-3" in Debian experimental likely to be easy for me to build on Debian Testing?
(I have only built code from "Sid" in the past and it took some time and just a slight effort to do.)

Because, I think it is NOT worth anymore effort on my part; till you fail to get it to work using what I posted.

Tim S.

Tim,
 please correct me if i'm mistaken, but it looks like the  2:1.5.6.2+sdfsg2-3 version is for Arduino 1.0.5 (https://launchpad.net/ubuntu/+source/arduino/2:1.0.5+dfsg2-4). 

I started this thread to specifically address the Arduino 1.5+ problem.

The CB's wizard and https://github.com/obfuscated/cb_arduino_template are said to work with Arduino 1.0.x, but not so with 1.5.+

> FYI: If you plan to continue on the CB custom makefile path, STOP wasting time using the Code::Blocks wizards!!!
Obfusicated, the owner of the b_arduino_template said that he will try to update the template to work with arduino 1.5/1.6 versions. It is my understanding that until that happens, there is no other way (but platforio) to use CB, but with the custom makefiles.

Am i mistaken, Tim?
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 19, 2016, 06:02:53 am
Now a new issue - there is no autocompletion.
CB log:
Code
Scanning for lexers in /usr/share/codeblocks/lexers/...
Found 56 lexers
Loading lexer_ada
Loading lexer_d
Loading lexer_A68k
Loading lexer_xml
Loading lexer_java
Loading lexer_srec
Loading lexer_html
Loading lexer_OgreMaterial
Loading lexer_python
Loading lexer_f77
Loading lexer_pascal
Loading lexer_smalltalk
Loading lexer_bash
Loading lexer_perl
Loading lexer_latex
Loading lexer_cu
Loading lexer_cpp
Loading lexer_css
Loading lexer_angelscript
Loading lexer_hitasm
Loading lexer_lua
Loading lexer_masm
Loading lexer_postscript
Loading lexer_registry
Loading lexer_haskell
Loading lexer_vhdl
Loading lexer_inno
Loading lexer_squirrel
Loading lexer_ihex
Loading lexer_cmake
Loading lexer_properties
Loading lexer_verilog
Loading lexer_matlab
Loading lexer_proto
Loading lexer_autotools
Loading lexer_caml
Loading lexer_nsis
Loading lexer_make
Loading lexer_prg
Loading lexer_glsl
Loading lexer_batch
Loading lexer_vbscript
Loading lexer_gm
Loading lexer_OgreCompositor
Loading lexer_bibtex
Loading lexer_tehex
Loading lexer_cg
Loading lexer_ruby
Loading lexer_javascript
Loading lexer_coffee
Loading lexer_sql
Loading lexer_lisp
Loading lexer_rc
Loading lexer_fortran
Loading lexer_diff
Loading lexer_objc
Configured 0 tools
Scanning for plugins in /home/az/.local/share/codeblocks/plugins
Loaded 0 plugins
Scanning for plugins in /usr/lib64/codeblocks/plugins
Tools Plus Plugin: Registering shell type Piped Process Control
Loaded 57 plugins
Loading:
ProjectOptionsManipulator
ToolsPlus
IncrementalSearch
Debugger
ReopenEditor
HelpPlugin
HeaderFixup
CodeStat
FilesExtensionHandler
ScriptedWizard
Profiler
MouseSap
cbKeyBinder
SmartIndentXML
SmartIndentCpp
Abbreviations
FileManager
lib_finder
copystrings
Exporter
CppCheck
HexEditor
RegExTestbed
ClassWizard
Valgrind
Compiler
ProjectsImporter
EnvVars
CodeCompletion
EditorConfig
ThreadSearch
BrowseTracker
SpellChecker
SpellChecker: Thesaurus files '/usr/share/mythes/th_en_US.idx' not found!
SpellChecker: Loading '/usr/share/mythes/th_en_US_v2.idx' instead...
EditorTweaks
CB_Koders
AStylePlugin
SmartIndentPython
AutoVersioning
Cscope
OpenFilesList
Cccc
CodeSnippets
Autosave
cbDragScroll
OccurrencesHighlighting
ToDoList
SymTab
Running startup script
Script plugin registered: Find Broken Files plugin
Script/function 'edit_startup_script.script' registered under menu '&Settings/-Edit startup script'
Opening /home/az/Dropbox/work//Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj/Makeprj.cbp
Done.
Current compiler 'GNU GCC Compiler for AVR' doesn't have correctly defined debugger!
NativeParser::CreateParser(): Finish creating a new parser for project 'Makeprj'
NativeParser::OnParserEnd(): Project 'Makeprj' parsing stage done!

log from project loading:
Code
OccurrencesHighlighting plugin activated
Todo List plugin activated
Symbol Table Plugin plugin activated
Loading toolbar...
Initializing plugins...
Loading project file...
Parsing project file...
Loading target Debug
Loading target Release
Loading project files...
1 files loaded
Done loading project in 1ms
Project's base path: /home/az/Dropbox/work/Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj/
Project's common toplevel path: /home/az/Dropbox/work/Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj/
Mozilla universal detection engine detected 'Pure *ASCII*'.
Final encoding detected: Unicode 8 bit (UTF-8) (ID: 41)
Editor Open
Project data set for /home/az/Dropbox/work/Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj/master_reader.cpp
Top Editor: /home/az/Dropbox/work/Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj/master_reader.cpp
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/lib/gcc/avr/4.8.1/include
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/lib/gcc/avr/4.8.1/include-fixed
NativeParser::GetGCCCompilerDirs(): Caching GCC default include dir: /home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/avr/include
NativeParser::AddCompilerPredefinedMacrosGCC: Caching predefined macros for compiler '/home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/bin/avr-g++':
#define __DBL_MIN_EXP__ (-125)
<skip>

NativeParser::DoFullParsing(): AddProjectDefinedMacros failed!
NativeParser::DoFullParsing(): Adding cpp/c files to batch-parser
NativeParser::DoFullParsing(): Added 1 source file(s) for project 'Makeprj' to batch-parser...
ClassBrowser::UpdateClassBrowserView(): No active project available.
NativeParser::GetAllPathsByFilename(): Traversing '/home/az/Dropbox/work/Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj' for: master_reader.*
NativeParser::GetAllPathsByFilename(): Found 1 files:
- /home/az/Dropbox/work/Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj/master_reader.cpp
NativeParser::CreateParser(): Finish creating a new parser for project 'Makeprj'
ClassBrowser::OnThreadEvent(): Updating class browser...
ClassBrowser::OnThreadEvent(): Class browser updated.
NativeParser::OnParserStart(): Starting batch parsing for project 'Makeprj'...
NativeParser::OnParserEnd(): Project 'Makeprj' parsing stage done!
Project 'Makeprj' parsing stage done (2 total parsed files, 425 tokens in 0 minute(s), 0.005 seconds).
NativeParser::GetAllPathsByFilename(): Traversing '/home/az/Dropbox/work/Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj' for: master_reader.*
NativeParser::GetAllPathsByFilename(): Traversing ' - /home/az/Dropbox/work/Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj/' for: master_reader.*
NativeParser::GetAllPathsByFilename(): Found 1 files:
- /home/az/Dropbox/work/Arduino/Sketches/Examples/CB_PRJ_TEST/Makeprj/master_reader.cpp
ClassBrowser::OnThreadEvent(): Updating class browser...
ClassBrowser::OnThreadEvent(): Class browser updated.
SystemHeadersThread: /home/az/bin/arduino-1.6.5-r5/hardware/tools/ , 179
SystemHeadersThread: /home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/lib/gcc/avr/4.8.1/include/ , 13
SystemHeadersThread: /home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/lib/gcc/avr/4.8.1/include-fixed/ , 3
SystemHeadersThread: /home/az/bin/arduino-1.6.5-r5/hardware/tools/avr/avr/include/ , 307
SystemHeadersThread: Total number of paths: 4

Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 20, 2016, 03:15:31 am
Auto-completion is sort of working with Search Directories -> Compiler set to:
/home/az/bin/arduino-1.6.5-r5/libraries
/home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/cores/arduino
/home/az/bin/arduino-1.6.5-r5/hardware/arduino/avr/libraries

So if i take :
Code
// Wire Master Reader
// by Nicholas Zambetti <http://www.zambetti.com>

// Demonstrates use of the Wire library
// Reads data from an I2C/TWI slave device
// Refer to the "Wire Slave Sender" example for use with this

// Created 29 March 2006

// This example code is in the public domain.

#include <Arduino.h>
#include <Wire.h>

void setup()
{

  Wire.begin();        // join i2c bus (address optional for master)
  Serial.begin(9600);  // start serial for output


}

void loop()
{
  Wire.requestFrom(2, 6);    // request 6 bytes from slave device #2

  while(Wire.available())    // slave may send less than requested
  {
    char c = Wire.read(); // receive a byte as character
    Serial.print(c);         // print the character
  }

  delay(500);
}


and type #include < there will be a list of h files, but there will be no "wire.h". There will be Wire/Wire.h though. Once i add wire.h and  wire. will expend after the first symbol.
At the same time "Serial." would not expend at all.
File compiles fine.
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 22, 2016, 10:57:57 pm
One thing that i already do NOT like about using make file approach is that i have to manually adjust a cbp file for every new project. That is obvious ( that this hs to be done), but considering that i'm burning thru a few arduino examples a day - really annoying.
Title: Re: CB and Arduino 1.6.x
Post by: oBFusCATed on June 26, 2016, 12:49:52 am
https://github.com/obfuscated/cb_arduino_template now supports Arduino 1.6.9. Please test and report if there are any problems with the wizard.
Title: Re: CB and Arduino 1.6.x
Post by: stahta01 on June 26, 2016, 02:04:06 am
https://github.com/obfuscated/cb_arduino_template now supports Arduino 1.6.9. Please test and report if there are any problems with the wizard.

The two Simulator Targets and the last three hardware targets did NOT build for me on Windows 7.
"Arduino Mega 8", "Microduino Core+ (644P)", and "Freematics OBD-II Adapter".
The others all built for me; but, I have no Arduino hardware to see it the code works.

But, the Arduino 1.6.9 I have on my Computer does NOT support those last three hardware targets.
So, likely no problem exists; I have not tried to figure out how to setup the two Simulator Targets.

Tim S.
Title: Re: CB and Arduino 1.6.x
Post by: oBFusCATed on June 26, 2016, 10:30:32 am
But, the Arduino 1.6.9 I have on my Computer does NOT support those last three hardware targets.
So, likely no problem exists; I have not tried to figure out how to setup the two Simulator Targets.
Same here. Probably I'll just remove them.
I've not tried a simulator setup, too.

Can you provide a patch for README.md with the steps needed to setup the wizard on windows?
Title: Re: CB and Arduino 1.6.x
Post by: stahta01 on June 26, 2016, 03:25:41 pm
But, the Arduino 1.6.9 I have on my Computer does NOT support those last three hardware targets.
So, likely no problem exists; I have not tried to figure out how to setup the two Simulator Targets.
Same here. Probably I'll just remove them.
I've not tried a simulator setup, too.

Can you provide a patch for README.md with the steps needed to setup the wizard on windows?

I will see what I need to do; I will have to do a fresh CB Install and other stuff.

Overall outline of sections that I remember.

1. Copy Wizard Files
2. Edit wizard config script
3. Edit AVR Toolchain settings (I think that doing a patch to create Arduino Compiler Toolchain is a good Idea for someone to do)
4A. Install Arduino 1.6.9 (I plan to use zip download instead of installer download)
4B. Set CB Global Var "Arduino" to point to Arduino 1.6.9 folder.


It will take a while for me to get the time to do it.
One of the hard things for me to document on Windows is how to edit the "wizard config script".
Do you know of any other places that document how to edit "wizard config script" on Windows?

Tim S.

Title: Re: CB and Arduino 1.6.x
Post by: stahta01 on June 26, 2016, 03:36:57 pm
FYI: A problem on Windows that I have been ignoring is I get this message below.

Code
Arduino Project has failed to load XRC resource...

I have been thinking I need to test with wxWidgets 3.0 to see if the message goes away.
But, I have NOT yet had time to do any testing.

Have you tested on any Linux that uses wxWidgets 2.8?

Tim S.

Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 26, 2016, 06:34:53 pm
https://github.com/obfuscated/cb_arduino_template now supports Arduino 1.6.9. Please test and report if there are any problems with the wizard.
awesome news! let me try on Fedora 22. I'll update the thread  in next 2 days

UPDATE:
cb start:
Code
[az@toshiba ~]$ codeblocks 
Warning: Mismatch between the program and library build versions detected.
The library used 2.8 (no debug,Unicode,compiler with C++ ABI 1008,wx containers,compatible with 2.4,compatible with 2.6),
and your program used 2.8 (no debug,Unicode,compiler with C++ ABI 1009,wx containers,compatible with 2.4,compatible with 2.6).
Starting Code::Blocks svn build  rev 10868 Jun 14 2016, 05:59:11 - wx2.8.12 (Linux, unicode) - 64 bit
Initialize EditColourSet .....
Initialize EditColourSet: done.
.....


And the error message is attached as a snapshot:
Code
Filename: /home/az/.local/share/codeblocks/templates/wizard//config.script
Error: the index 'RegisterWizard' does not exist
Details:
AN ERROR HAS OCCURED [the index 'RegisterWizard' does not exist]

CALLSTACK
*FUNCTION [main()] /home/az/.local/share/codeblocks/templates/wizard//config.script line [1]

LOCALS
[this] TABLE

Also in the log i see:
Code
....
Help plugin plugin activated
Header Fixup plugin activated
Code statistics plugin activated
Files extension handler plugin activated

(codeblocks:2314): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width 18 and height -16


Similiar error was posted here (forums.codeblocks.org/index.php?action=post;msg=145176;topic=21252.15) with the resolution :
Code
This doesn't work because wxArrayString::Item is missing from the squirrel bindings your version of c::b.
The first fixed version is rev10400. So you need to install a recent night build or the latest stable build 16.01.

wxWidgets are:
Code
 rpm -qa | grep wx
wxGTK-2.8.12-16.fc22.x86_64
wxBase-2.8.12-16.fc22.x86_64


tried all versions until codeblocks.x86_64 16.01.svn.10827-1.fc22 with no positive results.
Title: Re: CB and Arduino 1.6.x
Post by: stahta01 on June 26, 2016, 09:23:13 pm
Code
Error: the index 'RegisterWizard' does not exist

The above happens if you do NOT have the scriptedWizard plugin installed and enabled.

Edit: All your other issues; are NOT related to the CB Wizard change.

Tim S.
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 27, 2016, 04:41:53 am
Code
Error: the index 'RegisterWizard' does not exist

The above happens if you do NOT have the scriptedWizard plugin installed and enabled.

Edit: All your other issues; are NOT related to the CB Wizard change.

Tim S.

hmm.. doesn't look like this is the case. See attached.
Also, if i disable the plugin the CB starts wo issues. And once i enable it it (CB) immediately complains with the above mentioned message.

I should note that the READ.ME states:
Add the following two lines in the RegisterWizards function insde the file ~/.local/share/codeblocks/templates/wizard/config.script

but i did not have this file.

Code
[az@toshiba wizard]$ pwd
/home/az/.local/share/codeblocks/templates/wizard
[az@toshiba wizard]$ ls -l
total 4
lrwxrwxrwx 1 az az  41 Jun 26 13:06 arduino -> /home/az/work/Arduino/cb_arduino_template
-rw-rw-r-- 1 az az 174 Jun 26 22:52 config.script
[az@toshiba wizard]$ cat ./config.script
RegisterWizard(wizProject, _T("arduino"), _T("Arduino Project"), _T("Embedded Systems"));
RegisterWizard(wizTarget,  _T("arduino"), _T("Arduino"),_T("Embedded Systems"));


UPDATE 2:

if i to remove the config.script then CB will load wo issues and the "Arduino project" template will be colored red. once i select it in the attempt to create a new project i'll get "Arduino Project has failed to load XRC resource..." . See below attached.

After that the wizards starts normally.
Once i load the sketch.cpp the "invalid variable" dialog pops up. Doesn't matter what i clikc ( yes/no) the dialog gets created again and again. the way out is to specify the "base" path and click (as many times as needed) the "Yes" button until the dialog goes away.
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 27, 2016, 05:09:01 am
posting a screenshot

After that if i were to select a UNO it builds the project.

IT definitely does n;t work in "Simulation" mode.
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 27, 2016, 03:27:05 pm
https://github.com/obfuscated/cb_arduino_template now supports Arduino 1.6.9. Please test and report if there are any problems with the wizard.

Instead of adding 2 "RegisterWizard" lines to the local user's config file, i added (for testing purposes) to the global /usr/share/codeblocks/templates/wizard/config.script.
the New (arduino, arduino) line created a new build target "Arduino". Both "Arduino" and "Arduino Project" wizards are red now and have exact same behavior (same errors, same list of options to select).

The only difference is :
Code
Initializing plugins...
ClassBrowser::OnThreadEvent(): Updating class browser...
ClassBrowser::OnThreadEvent(): Class browser updated.
Mozilla universal detection engine detected 'Pure *ASCII*'.
Final encoding detected: Unicode 8 bit (UTF-8) (ID: 41)
ClassBrowser::UpdateClassBrowserView(): No active project available.
NativeParser::GetAllPathsByFilename(): Traversing '/home/az/Dropbox/work/Arduino/cb_arduino_template' for: wizard.*
NativeParser::GetAllPathsByFilename(): Found 0 files:
ClassBrowser::OnThreadEvent(): Updating class browser...
ClassBrowser::OnThreadEvent(): Class browser updated.



when i select a new "Arduino" build target.
Title: Re: CB and Arduino 1.6.x
Post by: oBFusCATed on June 27, 2016, 08:54:19 pm
What OS are you running?
Changing stuff in /usr is not a good idea if you're on linux.
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 28, 2016, 02:22:29 am
What OS are you running?
Changing stuff in /usr is not a good idea if you're on linux.

Fedora 22. I know, but i'm trying to see what i can do other then say "this doesn't work" that might help you to make thing more robust.
Title: Re: CB and Arduino 1.6.x
Post by: oBFusCATed on June 28, 2016, 10:37:04 am
Have you followed all the steps in the README?
Can you paste the output of these two commands:
find ~/.config/codeblocks/ -ls
find ~/.local/share/codeblocks/ -ls
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 28, 2016, 02:54:46 pm
Have you followed all the steps in the README?
Can you paste the output of these two commands:
find ~/.config/codeblocks/ -ls
find ~/.local/share/codeblocks/ -ls

I renamed config to config1 to be able to load the CB.
Here you go:
Code
[az@toshiba arduino]$ find /home/az/.local/share/codeblocks/ -ls
8929285    4 drwxr-xr-x   5 az       az           4096 Jun 26 13:05 /home/az/.local/share/codeblocks/
8929286    4 drwxr-xr-x   2 az       az           4096 Apr 16 00:12 /home/az/.local/share/codeblocks/plugins
8929287    4 drwxr-xr-x   2 az       az           4096 Apr 16 00:12 /home/az/.local/share/codeblocks/scripts
9964835    4 drwxr-xr-x   3 az       az           4096 Jun 17 16:56 /home/az/.local/share/codeblocks/templates
9964836    4 drwxr-xr-x   2 az       az           4096 Jun 27 20:24 /home/az/.local/share/codeblocks/templates/wizard
9962694    0 lrwxrwxrwx   1 az       az             41 Jun 26 13:06 /home/az/.local/share/codeblocks/templates/wizard/arduino -> /home/az/work/Arduino/cb_arduino_template
9962693    4 -rw-rw-r--   1 az       az             82 Jun 27 20:23 /home/az/.local/share/codeblocks/templates/wizard/config.script1


and :
Code
[az@toshiba arduino]$ find /home/az/.config/codeblocks/ -ls
8929288    8 drwxr-xr-x   3 az       az           4096 Jun 27 20:24 /home/az/.config/codeblocks/
8913529   40 -rw-rw-r--   1 az       az          35735 Jun 11 11:27 /home/az/.config/codeblocks/cbKeyBinder10.ini.bak
8923417    8 -rw-rw-r--   1 az       az            282 Jun 21 16:34 /home/az/.config/codeblocks/default.workspace.layout
8914275    8 -rw-rw-r--   1 az       az            231 Jun 26 13:54 /home/az/.config/codeblocks/DragScroll.ini
8912998   40 -rw-rw-r--   1 az       az          35672 Jun 26 13:40 /home/az/.config/codeblocks/cbKeyBinder10.ini
8913560    8 -rw-rw-r--   1 az       az            128 Jun 11 11:27 /home/az/.config/codeblocks/BrowseTracker.ini
8915296    4 -rw-rw-r--   1 az       az              0 Jun 26 13:54 /home/az/.config/codeblocks/en_US_personaldictionary.dic
8914276  136 -rw-rw-r--   1 az       az         131347 Jun 27 20:24 /home/az/.config/codeblocks/default.conf
8913557    8 -rw-rw-r--   1 az       az            223 Apr 21 19:11 /home/az/.config/codeblocks/default.workspace.save
8914251    8 -rw-rw-r--   1 az       az            233 Jun 26 13:54 /home/az/.config/codeblocks/codesnippets.ini
9964829    8 drwxrwxr-x   3 az       az           4096 Jun 16 15:40 /home/az/.config/codeblocks/share
9964830    8 drwxrwxr-x   3 az       az           4096 Jun 16 15:40 /home/az/.config/codeblocks/share/codeblocks
9964831    8 drwxrwxr-x   3 az       az           4096 Jun 16 15:40 /home/az/.config/codeblocks/share/codeblocks/templates
9964832    8 drwxrwxr-x   2 az       az           4096 Jun 16 15:41 /home/az/.config/codeblocks/share/codeblocks/templates/wizard
9964797    0 lrwxrwxrwx   1 az       az             54 Jun 16 15:41 /home/az/.config/codeblocks/share/codeblocks/templates/wizard/cb_arduino_template-master -> /home/az/.config/codeblocks/cb_arduino_template-master

now i removed the /home/az/.config/codeblocks/share/codeblocks/templates/wizard/cb_arduino_template-master abd renamed config1 to config - same errors persist even if i have only one line in the config:
Code
[az@toshiba wizard]$ ls -l
total 4
lrwxrwxrwx 1 az az 41 Jun 26 13:06 arduino -> /home/az/work/Arduino/cb_arduino_template
-rw-rw-r-- 1 az az 82 Jun 27 20:23 config.script
[az@toshiba wizard]$ cat ./config.script
RegisterWizard(wizTarget,  _T("arduino"), _T("Arduino"),_T("Embedded Systems"));

[az@toshiba wizard]$



codeblocks-contrib:
Code
[az@toshiba wizard]$ rpm -qa | grep codebl
codeblocks-16.01.svn.10868-1.fc22.x86_64
codeblocks-libs-16.01.svn.10868-1.fc22.x86_64
codeblocks-contrib-libs-16.01.svn.10827-1.fc22.x86_64

[az@toshiba wizard]$ rpm -ql codeblocks-contrib-libs-16.01.svn.10827-1.fc22.x86_64
/usr/lib64/codeblocks/wxContribItems/libwxchartctrl.so.0
/usr/lib64/codeblocks/wxContribItems/libwxchartctrl.so.0.0.1
/usr/lib64/codeblocks/wxContribItems/libwxcustombutton.so.0
/usr/lib64/codeblocks/wxContribItems/libwxcustombutton.so.0.0.1
/usr/lib64/codeblocks/wxContribItems/libwxflatnotebook.so.0
/usr/lib64/codeblocks/wxContribItems/libwxflatnotebook.so.0.0.1
/usr/lib64/codeblocks/wxContribItems/libwximagepanel.so.0
/usr/lib64/codeblocks/wxContribItems/libwximagepanel.so.0.0.1
/usr/lib64/codeblocks/wxContribItems/libwxkwic.so.0
/usr/lib64/codeblocks/wxContribItems/libwxkwic.so.0.0.1
/usr/lib64/codeblocks/wxContribItems/libwxled.so.0
/usr/lib64/codeblocks/wxContribItems/libwxled.so.0.0.1
/usr/lib64/codeblocks/wxContribItems/libwxmathplot.so.0
/usr/lib64/codeblocks/wxContribItems/libwxmathplot.so.0.0.1
/usr/lib64/codeblocks/wxContribItems/libwxspeedbutton.so.0
/usr/lib64/codeblocks/wxContribItems/libwxspeedbutton.so.0.0.1
/usr/lib64/codeblocks/wxContribItems/libwxtreelist.so.0
/usr/lib64/codeblocks/wxContribItems/libwxtreelist.so.0.0.1
/usr/lib64/libwxsmithlib.so.0
/usr/lib64/libwxsmithlib.so.0.0.1
/usr/share/doc/codeblocks-contrib-libs
/usr/share/doc/codeblocks-contrib-libs/AUTHORS
/usr/share/doc/codeblocks-contrib-libs/BUGS
/usr/share/doc/codeblocks-contrib-libs/COMPILERS
/usr/share/doc/codeblocks-contrib-libs/COPYING
/usr/share/doc/codeblocks-contrib-libs/ChangeLog
/usr/share/doc/codeblocks-contrib-libs/NEWS
/usr/share/doc/codeblocks-contrib-libs/README
/usr/share/doc/codeblocks-contrib-libs/TODO
Title: Re: CB and Arduino 1.6.x
Post by: stahta01 on June 28, 2016, 02:59:12 pm
Are you smart enough to read the code in config.script?

Are you smart enough to add the lines inside the function RegisterWizards()?

Tim S.
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 28, 2016, 04:46:04 pm
Are you smart enough to read the code in config.script?

Are you smart enough to add the lines inside the function RegisterWizards()?

Tim S.

Tim,
what are you trying to say?
Title: Re: CB and Arduino 1.6.x
Post by: stahta01 on June 29, 2016, 04:32:30 am
Are you smart enough to read the code in config.script?

Are you smart enough to add the lines inside the function RegisterWizards()?

Tim S.

Tim,
what are you trying to say?

In your prior post you basically said you deleted function X and now you get errors when you call function X.
Your post implied that you have no idea about what you are doing! Therefore, I ask what you did!

Edit: I just re-read your posts; and on Linux the file seems to be missing for you; since, I am a Windows User, I have no idea if this is normal or NOT.
I do know; I have trouble editing this file, config.script, on Windows.

FYI: The function you are calling is defined in config.script; so, when you deleted it. You broke the function!

Tim S.
Title: Re: CB and Arduino 1.6.x
Post by: stahta01 on June 29, 2016, 05:09:02 am
Try these two commands; to create the file and then try editing it. I am mainly a windows person; so, these may or may NOT work.

Tim S.

Code
mkdir -p ~/.local/share/codeblocks/templates/wizard
cp /usr/share/codeblocks/templates/wizard/config.script ~/.local/share/codeblocks/templates/wizard/config.script
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 29, 2016, 06:21:49 am
Are you smart enough to read the code in config.script?

Are you smart enough to add the lines inside the function RegisterWizards()?

Tim S.

Tim,
what are you trying to say?

In your prior post you basically said you deleted function X and now you get errors when you call function X.
Your post implied that you have no idea about what you are doing! Therefore, I ask what you did!

Edit: I just re-read your posts; and on Linux the file seems to be missing for you; since, I am a Windows User, I have no idea if this is normal or NOT.
I do know; I have trouble editing this file, config.script, on Windows.

FYI: The function you are calling is defined in config.script; so, when you deleted it. You broke the function!

Tim S.

You are right - i have no idea how any of these scripts work nor i have a clue about the architecture of the internal workings of CB.
I did see the call " RegisterWizard(wizProject,     _T("arduino"),      _T("Arduino Project"),       _T("Embedded Systems"));" in the main config.script. So i removed the what i thought maybe a duplicate from the local config.script. I'm sorry if it was not clear.

Now, i saw your pull with added step 3a. It does address the issue with the "index" error. Nice work Tim!

Unfortunately, i still get the "Arduino Project has failed to load XRC resource..." warning/error and the "global variable" dialog runs wild (creates tons of windows) and eventually terminates the CB.
Title: Re: CB and Arduino 1.6.x
Post by: stahta01 on June 29, 2016, 06:36:40 am
Unfortunately, i still get the "Arduino Project has failed to load XRC resource..." warning/error and the "global variable" dialog runs wild (creates tons of windows) and eventually terminates the CB.

I get the "Arduino Project has failed to load XRC resource..." warning/error on Windows (it uses wx2.8 ); I am guessing it is a wxWidgets 2.8 issue; I have NOT had time to confirm it.

No idea why you get "global variable" dialog runs wild on Linux; I was thinking only Windows used a CB "global variable" while Linux used a linked file/directory solution.

How did you do the linked file/directory solution?

Here is my notes on what I used recently on Linux (Debian testing).
Note: I am NOT sure this code below is good or NOT.

Code
cd ~/.codeblocks

ln -s ~/sketchbook sketches

## If self built arduino IDE
cd ~/.codeblocks
ln -s ~/devel/open_source_code/version_control/arduino_ide-git/build/linux/work ~/.codeblocks/arduino

pwd  # /home/stahta01/.codeblocks

## If used Debian Installer for arduino IDE
su
ln -s /usr/share/arduino /home/stahta01/.codeblocks/arduino
exit  # su mode

Tim S.
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 29, 2016, 07:17:07 am
Unfortunately, i still get the "Arduino Project has failed to load XRC resource..." warning/error and the "global variable" dialog runs wild (creates tons of windows) and eventually terminates the CB.

I get the "Arduino Project has failed to load XRC resource..." warning/error on Windows (it uses wx2.8 ); I am guessing it is a wxWidgets 2.8 issue; I have NOT had time to confirm it.

No idea why you get "global variable" dialog runs wild on Linux; I was thinking only Windows used a CB "global variable" while Linux used a linked file/directory solution.

How did you do the linked file/directory solution?

Here is my notes on what I used recently on Linux (Debian testing).
Note: I am NOT sure this code below is good or NOT.

Code
cd ~/.codeblocks

ln -s ~/sketchbook sketches

## If self built arduino IDE
cd ~/.codeblocks
ln -s ~/devel/open_source_code/version_control/arduino_ide-git/build/linux/work ~/.codeblocks/arduino

pwd  # /home/stahta01/.codeblocks

## If used Debian Installer for arduino IDE
su
ln -s /usr/share/arduino /home/stahta01/.codeblocks/arduino
exit  # su mode

Tim S.

> How did you do the linked file/directory solution?

I followed the read.me to the dot.
here is what i have :
Code
[az@toshiba wizard]$ pwd
/home/az/.local/share/codeblocks/templates/wizard
[az@toshiba wizard]$ ls -la
total 20
drwxr-xr-x 2 az az 4096 Jun 29 00:03 .
drwxr-xr-x 3 az az 4096 Jun 17 16:56 ..
lrwxrwxrwx 1 az az   41 Jun 29 00:03 arduino -> /home/az/work/Arduino/cb_arduino_template
-rw-r--r-- 1 az az 6258 Jun 29 00:02 config.script

ls -la /home/az/.local/share/codeblocks/
total 24
drwxr-xr-x   5 az az 4096 Jun 26 13:05 .
drwxr-xr-x. 19 az az 4096 Jun 29 00:17 ..
drwxr-xr-x   2 az az 4096 Apr 16 00:12 plugins
drwxr-xr-x   2 az az 4096 Apr 16 00:12 scripts
drwxr-xr-x   3 az az 4096 Jun 17 16:56 templates

all dirs but "templates" are empty.
I don't have any links to sketches.

To avoid recreation of the dialog i have to click "NO" as many time as it pops up. And managed to set the directory and save that. If i'm lucky i get the CB working fine, if not - "process terminated"
Title: Re: CB and Arduino 1.6.x
Post by: stahta01 on June 29, 2016, 12:25:36 pm
I see your problem; somewhere recently he changed the Wizard to use an CB "Global Variable" instead of Linking file/folder solution; but, I did NOT do that change on Linux.
(But, I forgot if I tested the wizard on Linux or not after he asked.)

I will see what the Global Variable is supposed to be.

The base location of the Global Variable needed to be "/home/stahta01/devel/open_source_code/version_control/arduino_ide-git" for me.
( I just tested this location "/home/stahta01/devel/open_source_code/version_control/arduino_ide-git/build/linux/work" and it also worked for me.)

Code
ls /home/stahta01/devel/open_source_code/version_control/arduino_ide-git

The results of the above list needs to contain at least the folders "hardware" and "libraries".
My folders below.
Quote
app  arduino-core  build  examples_formatter.conf  format.every.sketch.sh  hardware  libraries  lib_sync  license.txt  README.md  work

In doing my solution I had to edit an header search path in the Wizard created project
from "$(ARDUINO_DIR)/hardware/arduino/avr/libraries/HID/src"
to "$(ARDUINO_DIR)/hardware/arduino/avr/libraries/HID"


Sorry, about the confusion; I missed when he did the change to Global Variable under Linux.

To create a CB "Global Variable" use
Setting -> "Global Variables ..."
Click on "New" (By the current variable) enter "arduino" for the name of the variable.

I have attached an image of the window below.

Tim S.

 

Title: Re: CB and Arduino 1.6.x
Post by: oBFusCATed on June 29, 2016, 09:26:32 pm
In doing my solution I had to edit an header search path in the Wizard created project
from "$(ARDUINO_DIR)/hardware/arduino/avr/libraries/HID/src"
to "$(ARDUINO_DIR)/hardware/arduino/avr/libraries/HID"

What version of Arduino do you have?

p.s. the new readme has info about the global variable.
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 30, 2016, 05:46:17 am
>ln -s ~/devel/open_source_code/version_control/arduino_ide-git/build/linux/work ~/.codeblocks/arduino
you created a link to the arduino's IDE as opposite to the wizard?

// I'm just trying to make sense of the differences and what i maybe doing wrong. Looks like Teodor got the wizard to work and it is me struggling with fat fingers here.
Title: Re: CB and Arduino 1.6.x
Post by: oBFusCATed on June 30, 2016, 09:35:42 am
>ln -s ~/devel/open_source_code/version_control/arduino_ide-git/build/linux/work ~/.codeblocks/arduino
you created a link to the arduino's IDE as opposite to the wizard?
This command is no longer needed. Just point the arduino global variable to point to your arduino installation's root. (Settings -> Global variable -> arduino -> set base).
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 30, 2016, 02:37:56 pm
>ln -s ~/devel/open_source_code/version_control/arduino_ide-git/build/linux/work ~/.codeblocks/arduino
you created a link to the arduino's IDE as opposite to the wizard?
This command is no longer needed. Just point the arduino global variable to point to your arduino installation's root. (Settings -> Global variable -> arduino -> set base).

right, that is what i was doing. Any idea why i'm getting that dilalog created few dozen times?
Title: Re: CB and Arduino 1.6.x
Post by: AZ on June 30, 2016, 07:09:51 pm
aha! i think i might be onto something.

I'm not getting "global dialog" nightmare anymore - what did i do?

1. Update to the latest codeblocks.x86_64 16.01.svn.10869-1.fc22
2. instead of setting global variable to the "the path to the root of the Arduino project." (https://github.com/obfuscated/cb_arduino_template) , i set it to the arduino install directory. In my case it is  ~/bin/arduino-1.6.9/.

I was able to build a few elementary projects. I'll do more testing today just to be sure.

The "XRC" error is still present when create a new arduino project.
Title: Re: CB and Arduino 1.6.x
Post by: stahta01 on July 01, 2016, 05:35:52 pm
In doing my solution I had to edit an header search path in the Wizard created project
from "$(ARDUINO_DIR)/hardware/arduino/avr/libraries/HID/src"
to "$(ARDUINO_DIR)/hardware/arduino/avr/libraries/HID"

What version of Arduino do you have?

p.s. the new readme has info about the global variable.


self built 1.6.8 from git repo branch ide-1.5.x.

Edit: https://github.com/arduino/Arduino.git

Tim S.
Title: Re: CB and Arduino 1.6.x
Post by: oBFusCATed on July 01, 2016, 10:13:34 pm
Try this one: https://github.com/arduino/Arduino/releases/tag/1.6.9
Title: Re: CB and Arduino 1.6.x
Post by: stahta01 on July 02, 2016, 03:33:29 pm
Try this one: https://github.com/arduino/Arduino/releases/tag/1.6.9

Did NOT have to edit the include path with that one.

Tim S.
Title: Re: CB and Arduino 1.6.x
Post by: oBFusCATed on July 04, 2016, 01:54:34 am
The "XRC" error is still present when create a new arduino project.
It seems like a bug in wx2.8, but as far as I see this is just a message box and the wizard works just fine.
Title: Re: CB and Arduino 1.6.x
Post by: AZ on July 04, 2016, 06:40:09 pm
The "XRC" error is still present when create a new arduino project.
It seems like a bug in wx2.8, but as far as I see this is just a message box and the wizard works just fine.
Yes.  Great job.
I created a pull request to update the doc. Hope you find it useful.
Title: Re: CB and Arduino 1.6.x
Post by: DanRR on July 12, 2016, 08:44:19 am
Hi,
I've install cb_arduino_template, created a test project and compiled it with no errors. When I attempted uploading it (I pressed 'Run', is that the way to do it?) I got a terminal window with the following error:
Code
/home/.../cb_arduino_wizard_test/bin/uno/cb_arduino_wizard_test.elf: 1: /home/.../cb_arduino_wizard_test/bin/uno/cb_arduino_wizard_test.elf: Syntax error: "(" unexpected

System info:
Xubuntu 16.04
CB 16.01
Arduino 1.6.9

Thanks
Title: Re: CB and Arduino 1.6.x
Post by: oBFusCATed on July 12, 2016, 09:03:00 am
No, uploading happens as post-build step.
Do you have the UPLOAD_PORT variable set?
And keep in mind that uploading is not very reliable on atmega32u4 based arduinos.
Title: Re: CB and Arduino 1.6.x
Post by: DanRR on July 15, 2016, 02:45:53 am
Thanks oBFusCATed,
I've tried setting UPLOAD_PORT and rebuild with no change, I can't see any upload attempt.
I'm using Uno board.
Title: Re: CB and Arduino 1.6.x
Post by: stahta01 on July 15, 2016, 03:23:32 am
Thanks oBFusCATed,
I've tried setting UPLOAD_PORT and rebuild with no change, I can't see any upload attempt.
I'm using Uno board.

Do you have "avrdude" installed?
If not, try installing it.

Tim S.


Title: Re: CB and Arduino 1.6.x
Post by: oBFusCATed on July 15, 2016, 07:55:43 am
Thanks oBFusCATed,
I've tried setting UPLOAD_PORT and rebuild with no change, I can't see any upload attempt.
I'm using Uno board.
You have to rebuild and make sure the arduino is connected to the usb.
Can you please post a full rebuild log?
Title: Re: CB and Arduino 1.6.x
Post by: AZ on November 17, 2016, 05:22:05 am
Tim,
 i got so frustrated with my inability to get CB working with Arduino , that i pretty much gave up in June. I went with Atom + PlatformIO. (Latter is real good btw). But Atom is just not cutting for me.

I just ran the latest CB (svn 10912) with oBFusCATed's wizard and "Blink" example worked -wizard worked great, file structures, build just fine. In my iternal wizdom i didn't select "upload to board once compiled" flag. So now i'm trying to figure out how to do just that.