Menu

#include with gcb@syn

Help
2015-04-04
2015-04-05
  • Fondy Heat Robotics

    I am having issues with including header files when using gcb@syn. For example this program to flash an LED on pin 2 will not upload because AVRdude throws a "AT#CHIP" not found error. Of course, the chip is specified in the UNO_mega328p.h files which is SUPPOSED to be included.

    #include <UNO_mega328p.h>

    start:
    set DIGITAL_2 on
    wait 500 ms
    set DIGITAL_2 off
    wait 500 ms
    goto Start

    The program uploads fine if I just tack it onto the UNO_mega328p.h and hex/flash.

    What am I doing wrong?

     
  • Anobium

    Anobium - 2015-04-04

    Hi.

    What version of GCB?

    I am assuming the new version 0.94? I have the same build here on a new build PC and I do have the same issues.

    Do you do a complete install of the Hot Release? Creating a new folder structure and then moving or recreating your flashAVR.bat and/or your flashPIC.bat to the new folder structure.

    Have you tried on of the Mega328p demos? Do any of these work?

    All should be working ok.

     
    • Fondy Heat Robotics

      I'm not exactly sure of the version of GCB, but I just downloaded the newest "hot release" and I am having the same issue as the older version I downloaded a few weeks ago.

      It seems Synwrite only compiles the file that is currently selected and does not pass along the #include directive? Or, looks for chip def in the top lines, does not find and errors out. I believe GCB tacks #include files to the bottom of the code.

      I read somewhere about setting up multiple files as a "project" and setting "main" files in synwrite, but I cannot figure out how to do that.

       
      • Fondy Heat Robotics

        I just found that if I set the chip model in the file I'm working on + in the header file, it seems to work- like this:

        #chip mega328p, 16
        #include <UNO_mega328p.h>

        start:
        set DIGITAL_2 on
        wait 500 ms
        set DIGITAL_2 off
        wait 500 ms

        goto Start

        seems it need that chip model to finish compiling and flashing....

        Works great with my Arduino Uno 328p, by the way.

        Gonna be WAY easier teaching middle school kids BASIC rather than Arduino's C++.

         
  • Anobium

    Anobium - 2015-04-04

    I am pleased you have it compiling.

    Can you help resolve the underlying issue?

    In the GCB@Syn IDE. Select your file, right hand mouse, select GCB version. What is shown in the outout window?

    And, are you using the GCB@Syn IDE build and create your hex files? or, are you doing this outside of the IDE?

    Version of OS?

     
  • Fondy Heat Robotics

    GCB version .94
    I am using GCB@Syn IDE 6.16.1970
    Windows 7 32 bit

    I have just noticed the project options I did not see in the earlier version.... I think setting my files up at projects and selecting my main file as the one with the #chip directive will solve my issue.

    I will let you know.

     
  • Anobium

    Anobium - 2015-04-04

    Please try. This is puzzling. I build all the packing as well as developing the software so I really puzzled. Please help.

    I do not think setting up as a project will fix the issue. It may. :-)

    Check a few things for me.
    Did you copy the zip, all of it?
    Did you move any files to your own locations?
    Did you edit any of the ini files?

    Can you locate makehex.bat  in your GCB@Syn\G@Stools folder?  change the compile command line to 'gcbasic.exe /NP /K:A  /v /A:GCASM %1' (adds the /V).  What is the result?
    
     
  • Fondy Heat Robotics

    I changed the makehex.bat as directed, still does not find chip model

    I did change the flashAVR.bat to "AVRdude\avrdude.exe" -c arduino -P COM10 -b 115200 -p AT%2 -U flash:w:%1:i

    That is the only mod I made

     
  • Anobium

    Anobium - 2015-04-04

    When you create the hex can you send me the output of the windows in gcb@syn please. You make have to put an error in your code so this window does not close upon completion.

    Please attach the information to a posting as the file may be very long.

    Most puzzling.

     
  • Fondy Heat Robotics

    Is this what you are looking for?

    makeHEX.bat

    Great Cow BASIC (0.94 2015-04-02)

    Compiling C:\Users\Mildred\Desktop\GCB@Syn\junky.gcb ...

    Finding source files:
    C:\Users\Mildred\Desktop\GCB@Syn\junky.gcb: found
    C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\include\UNO_mega328p.h: found
    C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\INCLUDE\LOWLEVEL\a-d.h: found
    C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\INCLUDE\LOWLEVEL\pwm.h: found
    C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\INCLUDE\LOWLEVEL\rs232.h: found
    C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\INCLUDE\LOWLEVEL\eeprom.h: found
    C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\INCLUDE\LOWLEVEL\sound.h: found
    C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\INCLUDE\LOWLEVEL\stdbasic.h: found
    C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\INCLUDE\LOWLEVEL\7segment.h: found
    C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\INCLUDE\LOWLEVEL\lcd.h: found
    C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\INCLUDE\LOWLEVEL\ps2.h: found
    C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\INCLUDE\LOWLEVEL\timer.h: found
    C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\INCLUDE\LOWLEVEL\system.h: found
    C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\INCLUDE\LOWLEVEL\hwspi.h: found
    C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\INCLUDE\LOWLEVEL\keypad.h: found
    C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\INCLUDE\LOWLEVEL\random.h: found
    C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\INCLUDE\LOWLEVEL\string.h: found
    C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\INCLUDE\LOWLEVEL\usart.h: found
    C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\INCLUDE\LOWLEVEL\i2c.h: found
    C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\INCLUDE\LOWLEVEL\hwi2c.h: found
    Loading source files ... 5% 10% 15% 20% 25% 30% 35% 40% 45% 50% 55% 60% 65% 70% 75% 80% 85% 90% 95% 100%
    Reading compiler directives ...
    An error has been found:

    Error: Chip model not specified! GCBASIC cannot continue

    The message has been logged to the file Errors.txt.

     
  • Anobium

    Anobium - 2015-04-04

    Please re-install. There is an error happening after 'Reading compiler directives ...'
    Something is happening as the chip data is not being read. Should read as follows:

    Reading compiler directives ...
    Reading chip data ...
    D:\Others\GCB@Syn\GreatCowBasic\chipdata\MEGA328P.dat

     

    Last edit: Anobium 2015-04-04
    • Fondy Heat Robotics

      When you say re-install, do you mean re-unzip the GCB@Syn.zip file?
      I just unzip to the desktop & run it from there. Is this not the way to "install"?

      When I put the chip model near the top of any file I am working on,
      Like this:

      chip mega328p, 16

      include <UNO_mega328p.h>

      it works as you state-

      Reading compiler directives ...
      Reading chip data ...
      C:\Users\Mildred\Desktop\GCB@Syn\GreatCowBasic\chipdata\MEGA328P.dat

      But if I rely on the UNO_mega328p.h to provide the chip directive, it does not.

      It is the same problem on a number of 32 bit Windows 7 machines I have here...

       
  • Anobium

    Anobium - 2015-04-04

    I have retested here. On two more computers, and one 64-bit server. No issues.

    We did have am issue during development with Avast anti-virus but they fixed the scanning software to resolve the issue.

    Still puzzled.

     
  • Anobium

    Anobium - 2015-04-04

    Ok. Leave it for today. I will investigate further.

    Use the workaround please.

     
  • Anobium

    Anobium - 2015-04-04

    Please send me a personal message with your email address so I can follow up.

    Evan

     
  • William Roth

    William Roth - 2015-04-05

    I tried here on a Win7 machine and a fresh install of the hot release. The only modification was to the flashAVR.bat.

    I have the same behavior. AVRDUDE will not flash the chip if the chip is not defined in the main program.

    With the chip directive absent from the main program and only in the include file, avrdude returns the following error message:

    avrdude.exe: AVR Part "AT#CHIP" not found.

    So it seems that in this scenario that what is being passed to AVRDUDE by %2 in the flashAVR.bat file is "#CHIP" instead of "mega328P"

    The workaround is easy enough. Put the chip directive in the main program.

     
  • Anobium

    Anobium - 2015-04-05

    I have found the root cause of the issue. It requires two changes to resolve. I will open a support ticket.

    Meanwhile. If you are using the GCB@SYN IDE you MUST (Mandated) put #chip in the main program. There is NO requirement to remove #chip commands from .H files.

    This will be resolved in the next release.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.