Topics

It Builds! (Re: Building from the source files. Library location.)

Dave_G0WBX
 

Hello again.

Many thanks David, Carl, Gary and Raj of course.

It's compiling now without error, using the ide version 1.8.10, running on Mint 19.2 64 bit.

I get this in the status text window when it's done:-

Sketch uses 22892 bytes (74%) of program storage space. Maximum is 30720 bytes.
Global variables use 1338 bytes (65%) of dynamic memory, leaving 710 bytes for local variables. Maximum is 2048 bytes.

So only two bytes different (I know, could be make or break.)  I set the system to build for Arduino Nano, using the old bootloader (as some sacrificial clones I have use that.)

It even loads into one of those Nano clones without complaint, plus if you look at the serial monitor, its spits out:-

*Antuino v2.1
*hf_open:-1
4294967295

After the Reset button is pressed.

So, other than the total lack of any attached hardware, I guess it's running!...

One more question, re the glcd library used here.  Does the file 'ks0108_Arduino.h' "Need" to be in the glcd lib' folder, or as it is an included file within the sketch, and sketch folder, will the configuration be picked up from there?

Related:  If I should use that library for other projects, using 'standard' interconnections, is that "modified" library OK for that, or should I use the Adafuit version from the IDE download site?   If so, how best to keep them segregated?

Thanks to All again.    Lets get all this documented so others can follow.

73 to All.

Dave G8KBV  (  Lunch hour just ends..  )


On 23/10/2019 12:19, David S wrote:
Dave

HI

I think you've got the ols sketch version 1, the correct code is here https://github.com/afarhan/antuinov2.1 

Probably teaching you to suck eggs but download all files via the green Clone or download button on the right just above the list of files.

Having got that, unzipped the files wherever you prefer into a SINGLE directory called antenna_analyzer_p3 (that's all important) , the main (starting) file is antenna_analyzer_p3.ino and the IDE requires the same directory name.  The first line in that file is the display library    #include <glcd.h>

The <.file name..> means you have to install the library into the Arduino IDE, I think you may have already done that though. If not when you try to compile you will get an error cant find xxx, you can install zipped libraries from within the IDE, just point the IDE to the directory your using.


I can compile under  1.18.10 without problems but do have to use the old bootloader option.  I get a compiles size od 22890 bytes and it needs 1338 bytes of memory.  So it can be done, just get the latest file and start over.

Regards

David G8DJM


-- 
Created on and sent from a Unix like PC running and using free and open source software:

Garry48
 

Dave G8KBV,

Reference:

One more question, re the glcd library used here.  Does the file
'ks0108_Arduino.h' "Need" to be in the glcd lib' folder, or as it is an included file within the >sketch, and sketch folder, will the configuration be picked up from there?

The file 'ks0108_Arduino.h' should be placed in the glcd/include subdirectory.  It is code specific to the glcd library.  Mr. Farhan should have already re-compiled the glcd library. Dependencies in the glcd library should cause it to be re-compiled it any changes are made to the files that build the glcd library. At least that is what should happen.

When compiling and linking there is an order to the search paths.  Here is the gcld example:

ResolveLibrary(glcd.h)
  -> candidates: [glcd]
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\eightanaloginputs" "-IC:\\Users\\MyUser\\Documents\\Arduino\\Sketches\\libraries\\glcd" "C:\\Users\\MyUser\\AppData\\Local\\Temp\\arduino_build_976861\\sketch\\antenna_analyzer_p3.ino.cpp" -o nul

The include paths are defined as follow using the -I directive:

"-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino"

"-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\eightanaloginputs"

"-IC:\\Users\\MyUser\\Documents\\Arduino\\Sketches\\libraries\\glcd"

So to get glcd built properly, the 'ks0108_Arduino.h' file should be placed in the glcd subdirectory structure.  Since there is an include subdirectory, I dropped it in with all of the other include files.  Somehow the compiler & linker knows how to find it; since it compiles and links without errors.

Related:  If I should use that library for other projects, using
'standard' interconnections, is that "modified" library OK for that, or should I use the Adafuit >version from the IDE download site?   If so, how best to keep them segregated?

The glcd library was included in the antuino 2.1 sketch 'only'! It is not available for any other sketches you may compile.  My suggestion is to use the library manager (TOOLS ->  MANAGE LIBRARIES) and install the 'latest distribution' glcd or lcd library for the display you are using.  This insures you are NOT using an outdated/modified library (in this case the glcd included in the Antuino archive).  Using old or modified libraries will cause you hours of chasing/hunting 'undefined symbols, routines', etc!  It is not worth the effort!

Yes, keep them segregated!  The worst thing you can do is mix two versions together.  Ultimately you will end up erasing both and downloading them again (or extracting them out of your configuration management system) and recompiling/linking.

HTH

Garry / WD0DUD, Ex real-time Lead Software Engineer (Flight Simulation)

Dave_G0WBX
 

OK Gary.

I renamed the Aidafruit GLCD library, and copied in the specific one for the Antuino.

The search path pattern on Windows is somewhat different I think to how it works on Linux, but point taken.  I'm sure that will be of use to others.

Anyway.  The project built OK (this time, on the shack PC, also Mint 19.2, with the 1.8.10 Arduino IDE.)

With breath held, I connected the cable, checked that the device showed up, told the IDE the port (and still specifying the use of the old bootloader) and selected "Sketch, Upload".

During the upload process, part of the display gets corrupted, but once the upload has ended and the Nano restarted, it's business as usual!.

So, I did it again, after changing the Title line to have my call-sign showing (instead of "Antuino") more to prove to myself that this all works, than for any plagiarism.  (I also changed the version to v2.1x.)

That is set in the 'gui' module:-  Line 506 onwards.


void updateScreen(){

  // draw the title bar
//  strcpy(b, "#Antuino - ");
  strcpy(b, "# G8KBV - ");

  GLCD.ClearScreen();
  switch (mode){
    case MODE_ANTENNA_ANALYZER:
      strcat(b, "SWR");
      break;
    case MODE_MEASUREMENT_RX:
      strcat(b, "PWR");
      break;
    case MODE_NETWORK_ANALYZER:
     strcat(b, "SNA");
     break;
  }

//  strcat(b, "   v2.1");
  strcat(b, "  v2.1x");


As you can see, the original versions are still there for later.  Anyway, again, it built and uploaded just fine.

I'm happy, now I can play and see what I can do with the SWR plot etc.   Still lots to read and learn, but that's the fun part.

Thanks to everyone for the invaluable help and advice.

73.

Dave G0WBX.


On 24/10/2019 18:55, Garry48 wrote:
Dave G8KBV,

Reference:

>One more question, re the glcd library used here.  Does the file 'ks0108_Arduino.h' "Need" to be in the glcd lib' folder, or as it is an included file within the >sketch, and sketch folder, will the configuration be picked up from there?

The file 'ks0108_Arduino.h' should be placed in the glcd/include subdirectory.  It is code specific to the glcd library.  Mr. Farhan should have already re-compiled the glcd library. Dependencies in the glcd library should cause it to be re-compiled it any changes are made to the files that build the glcd library. At least that is what should happen.

When compiling and linking there is an order to the search paths.  Here is the gcld example:

ResolveLibrary(glcd.h)
  -> candidates: [glcd]
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\eightanaloginputs" "-IC:\\Users\\MyUser\\Documents\\Arduino\\Sketches\\libraries\\glcd" "C:\\Users\\MyUser\\AppData\\Local\\Temp\\arduino_build_976861\\sketch\\antenna_analyzer_p3.ino.cpp" -o nul

The include paths are defined as follow using the -I directive:

"-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino"

"-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\eightanaloginputs"

"-IC:\\Users\\MyUser\\Documents\\Arduino\\Sketches\\libraries\\glcd"

So to get glcd built properly, the 'ks0108_Arduino.h' file should be placed in the glcd subdirectory structure.  Since there is an include subdirectory, I dropped it in with all of the other include files.  Somehow the compiler & linker knows how to find it; since it compiles and links without errors.

>Related:  If I should use that library for other projects, using 'standard' interconnections, is that "modified" library OK for that, or should I use the Adafuit >version from the IDE download site?   If so, how best to keep them segregated?

The glcd library was included in the antuino 2.1 sketch 'only'! It is not available for any other sketches you may compile.  My suggestion is to use the library manager (TOOLS ->  MANAGE LIBRARIES) and install the 'latest distribution' glcd or lcd library for the display you are using.  This insures you are NOT using an outdated/modified library (in this case the glcd included in the Antuino archive).  Using old or modified libraries will cause you hours of chasing/hunting 'undefined symbols, routines', etc!  It is not worth the effort!

Yes, keep them segregated!  The worst thing you can do is mix two versions together.  Ultimately you will end up erasing both and downloading them again (or extracting them out of your configuration management system) and recompiling/linking.

HTH

Garry / WD0DUD, Ex real-time Lead Software Engineer (Flight Simulation)




-- 
Created on and sent from a Unix like PC running and using free and open source software: