Menu

Developer Help Needed

Anobium
2024-01-11
2024-05-04
<< < 1 2 3 > >> (Page 2 of 3)
  • Anobium

    Anobium - 2024-02-04

    Ah... the confusion is actually a constraint of the compiler.
    The #includes are not processed conditionally. Think of them as always being processed, so, they will always be loaded.

    18 months ago I changed the overall behaviour of conditional compilation so constants are actually processed correctly. But, #includes are always processed.


    I am not sure, yet, why a file called glcdx.h is issuing the messages. What is glcdx.h ? Is this the issue ?

     
  • Jim giordano

    Jim giordano - 2024-02-04

    no, rather than modifying the real glcd.h, I just made an experimental version, glcdx.h, and included it in the test program instead of glcd.h, so I could easily switch between the two.

     
  • Anobium

    Anobium - 2024-02-04

    Maybe this is still the issue.

    Where is glcdx.h getting loaded? If this is loaded then glcd.h is loaded then as the two files are different things would go wrong.

    Delete glcdx.h and reset.

    You can always get the latest build by using GCStudio and force an update. You would have to ensure your .BAS and BI are safely stored away... as these will be replaced.

     
  • Jim giordano

    Jim giordano - 2024-02-04

    So, a conditional include would probably be something to look into in the future.

    You said:
    Change the For RF- Next loop to a Do While RF <= SourceFiles Loop
    Set RF = 0 before the new Do-Loop. And, increment RF each time throught the loop
    In the #DEFINE test, if the usersource program and the GLCD_TYPE constant exists, add the code to extract the correct GLCD library from GLCD.DAT and then add this filename to the sourcefile array, incrementing the SourceFiles variables.
    Now the new Do While RF <= SourceFiles Loop will open only this specfic GLCD library.

    This seems like a lot of special processing hard coded into the compiler just for glcd's.

     
    • Anobium

      Anobium - 2024-02-04

      It looks specific to GLCD but I think we can extend this approach to essentially prune 'lowlevel.dat'. I have just removed all the GLCDs, pruned the 'lowlevel.dat'. Got this compiler from 7.2s to 2.062s. 'Lowlevel.dat' costs 0.5-0.6secs on my SSD drive.

      This would have a much impact on a hard drive in terms of end to end timing.

      GLCD would be the first step.

       
  • Jim giordano

    Jim giordano - 2024-02-04

    Sounds pretty good to me.

    I've been working on finding why I was getting the errors I mentioned above.

    It seem that if I comment out any of these includes-
    glcd_ssd1289.h
    glcd_st7920.h
    glcd_ili9326.h

    then I get error comments.
    So there is something in those files that the ILI9341 needs that should probably be in the glcd_ili9341.h file.

     

    Last edit: Jim giordano 2024-02-04
  • Anobium

    Anobium - 2024-02-04

    I took a clean install. Commented put the includes in GLCD.H, and, then add the specific back to my source - that works.

     
  • Jim giordano

    Jim giordano - 2024-02-04

    Excellent.

    Something else I found-

    if I convert the following "If" statement a "#if" in glcd.h, eg.

    #If GLCD_TYPE = GLCD_TYPE_SSD1351 Then
    
     //#include <glcd_ssd1351.h>
      InitGLCD = InitGLCD_SSD1351
      GLCDCLS = GLCDCLS_SSD1351
      GLCDDrawChar = GLCDDrawChar_SSD1351
      GLCDDrawString = GLCDDrawString_SSD1351
      FilledBox = FilledBox_SSD1351
      Pset = Pset_SSD1351
      GLCDRotate = GLCDRotate_SSD1351
      GLCDSetContrast = SetContrast_SSD1351
      glcd_type_string = "SSD1351"
      GLCD_WIDTH = 128
      GLCD_HEIGHT = 128
      SSD1351_GLCD_HEIGHT = GLCDDeviceHeight
      SSD1351_GLCD_WIDTH = GLCDDeviceWidth
    #EndIf
    

    then the compile fails.
    This makes no sense to me, since the if will fail at execution time and none of the sets will execute anyway. I've done this over and over, and it runs when it's not a #if.

     
  • Anobium

    Anobium - 2024-02-04

    The scripts that you edited do not have #IF only IF. Scripts are not conditional and always happen.

    So, changing a script from if to #if will fail to compile.

     
  • Jim giordano

    Jim giordano - 2024-02-04

    Well gee. Wish I had known that hours ago :(

    Perhaps this part of the compiler that handles scripts should be able to ignore includes in a non-executed if.

     
    • Anobium

      Anobium - 2024-02-04

      Was there no meaningful error message?

       
  • Jim giordano

    Jim giordano - 2024-02-04

    This wasn't really meaningful to me, if just meant the last thing I did was an error, and that was making that if a #if.

    zzztest.gcb (284): Error: Syntax Error
    zzztest.gcb (286): Error: Syntax Error
    zzztest.gcb (298): Error: ,BANKEDSyntax Error
    zzztest.gcb (302): Error: Syntax Error
    zzztest.gcb (305): Error: Syntax Error
    zzztest.gcb (308): Error: Syntax Error
    zzztest.gcb (326): Error: Array/Function GLCDDRAWCHAR_SSD1351 has not been
    declared
    zzztest.gcb (326): Error: Syntax Error
    zzztest.gcb (330): Error: Syntax Error
    glcdx.h * (2078): Error: Syntax Error (Library Include)
    glcdx.h * (2088): Error: Syntax Error (Library Include)

     
    • Anobium

      Anobium - 2024-02-04

      I had a look at these errors.

      If a script has #IF but no #END IF then it would throw a meaningful error.
      If a script has #IF and #END IF then is seemed to compile with no error.

      I will add more syntax checking to prevent #IF usage in scripts.

       
  • Jim giordano

    Jim giordano - 2024-02-04

    So I'm guessing we're done here, right?

     
    • Anobium

      Anobium - 2024-02-04

      I think your analysis has shown a huge time saving opportunity.

      I can make the changes and if I get to you can you test?

      1. Implement a test regime where we just prove the concept
      2. Implement the glcd.dat reference file and the lookup for the correct library.

      I should be able to do step 1 tomorrow.

      You up to test?

       
  • Jim giordano

    Jim giordano - 2024-02-05

    I'll give it a try, so long as you aren't expecting something "professional".

    Also it just dawned on me how to make a conditional include so you wouldn't have to make such a big change in the future if a similar situation comes up.

    #define mylib dummy 'where dummy is some file always included
    #if somecondition
        #undefine mylib
        #define mylib LibIReallyWant
    #endif
    #include mylib   ' will be dummy or LibIReallyWant
    
     

    Last edit: Jim giordano 2024-02-05
  • Anobium

    Anobium - 2024-02-05

    This should be a simple test - is it faster by 2 seconds?


    That conditional will work. I like that.


    I am running the tests here on the new faster build. There take many hours and if there are issues then I have to resolve before posting to here.

    The build is faster by 2 ish seconds. It is proven not only by the clock... but look at the number of subroutines being processed! was 1024 now 523, program lines are down.. hugely.

    This is before

    Program compiled successfully (Compile time: 5.001 seconds)
    
    Summary:
         Compiled:
              Program lines: 32943
              Subroutines:  User: 2 ; System: 44 of 1024 ; Total: 46
         Chip resource usage:
              Program Memory: 5904/16384 words (36.04%)
              RAM: 436/2048 bytes (21.29%)
              OSC: HFINTOSC_1MHZ, 64Mhz (Internal oscillator)
    

    Now

    Program compiled successfully (Compile time: 3.375 seconds)
    
    Summary:
         Compiled:
              Program lines: 11080
              Subroutines:  User: 2 ; System: 44 of 526 ; Total: 46
         Chip resource usage:
              Program Memory: 5904/16384 words (36.04%)
              RAM: 436/2048 bytes (21.29%)
              OSC: HFINTOSC_1MHZ, 64Mhz (Internal oscillator)
    
     
  • Jim giordano

    Jim giordano - 2024-02-05

    Excellent.

    And, of course, my simple idea doesn't work. This-

     #CHIP 16f1765
    
     #define mystuff "zdummy.gcb"
     #include mystuff
    

    gives error-
    [{
    "resource": "/k:/gcbasic-code-r1580-GCBASIC-trunk/zprog.gcb",
    "owner": "gcb",
    "severity": 4,
    "message": "Cannot find #include mystuff",
    "source": "gcb",
    "startLineNumber": 4,
    "startColumn": 1,
    "endLineNumber": 4,
    "endColumn": 2147483647
    }]

    Such a simple concept.

     
    • Anobium

      Anobium - 2024-02-05

      Ah ... that idea will not work. I am sorry but it obvious after the fact. :-(

      The #include is process before the #define constants, and, there is no constant replacement of #include statements.

      So, nice idea. Will not work.


      The new compiler failed on test. I am fixing now. The issue is the cross library GLCD dependencies. In the past as all libraries were loaded, all methods were available... not the case in the new compiler. So, I need to figure out how to support cross library GLCD dependencies.

       
  • Jim giordano

    Jim giordano - 2024-02-05

    Sounds like a real can of worms.
    Is there anyway to write a program to read the include files to see which devices needs which items, or is it just something you have to know about the device when you are programming it?

    Is this going to require a complete restructuring of the libraries putting all common items in glcd.h and removing them from the specific device files?

    I mean isn't this what you are already doing? It just not perfect yet?

     

    Last edit: Jim giordano 2024-02-05
    • Anobium

      Anobium - 2024-02-05

      The new method requires no changes to the libraries, only glcd.h to comment out the includes.

      An example will help.

      29,glcd_type_epd_epd7in5,epd_epd7in5.h&epd_epd2in13d.h&glcd_ssd1289.h

      The is GLCD entry 29, named 'glcd_type_epd_epd7in5' and it required the libraries 'epd_epd7in5.h&epd_epd2in13d.h&glcd_ssd1289.h' - now i had no idea the these GLCD needed the ssd1289 library. Makes sense now.

      So, the glcd.dat has all the information required information. glcd.dat is can be extended with ease, so no code changes.


      Running the tests nows.

       
  • Jim giordano

    Jim giordano - 2024-02-05

    Sounds like all this is still just because we don't have a conditional #include. If we did the original glcd.h would have worked as intended. (assuming you updated the individual device files to have the needed includes). It can still have a great deal of unnecessary things included. eg.- glcd_type_epd_epd7in5 may only need a few of the things in glcd_ssd1289.h, I'm not familiar enough with these to know.
    But the glcd.dat file seems easier to maintain rather than updating the individual library files, so still a good idea.

     
    • Anobium

      Anobium - 2024-02-05

      I fully take onboard and agree with your point re conditional includes.

      The task to make is work would be huge, see https://github.com/GreatCowBASIC/Help/wiki/development_guide_for_gcbasic_exe_compiler step 3.i This is where all the includes are handled, ifdefs are at 3.xiv

      I documented this process when I change the conditional operations in 2022. That was a lot of work. Essentially, the #defines were ignore before that change.

      The change would be to some how to process steps 3.i to 3.xi then using rerun again from step 3.i but this time using the conditions determined from the first run. Could work it would lot of work but it could work. Added to the list!

       

      Last edit: Anobium 2024-02-05
  • Anobium

    Anobium - 2024-02-05

    Here is a URL to the build. It is the gcbasic folder structure.

    Please extract to your gcbasic folder and test.

    https://1drv.ms/u/s!Ase-PX_n_4cvhNtxrrcy5O65-0xieQ?e=QzrnbN

    Once you have downloaded, let me know and I will delete.

     

    Last edit: Anobium 2024-02-05
  • Anobium

    Anobium - 2024-02-05

    AMAZING... the static tests that took nearly three hours... now 47 mins.

    Jim this is huge saving.

    It will just be nice and fast for the users!

    Started @ 16:32:19.02 
    "C:\GCstudio\gcbasic\demos\GLCD_Solutions\GLCD_Nextion_Solutions\NX8084P070\nexionNX8048P070_gcb_glcd_primitives_demo.gcb"
        nexionNX8048P070_gcb_glcd_primitives_demo.gcb (149): Error: Variable ST7735_NAVY was not explicitly declared
    "C:\GCstudio\gcbasic\demos\GLCD_Solutions\GLCD_Random_Box_Draw_Routines\GLCD_Lines_Demonstration_ATMegas2560_for_SSD1289@16.gcb"
        GLCD_Lines_Demonstration_ATMegas2560_for_SSD1289@16.gcb (55): Error: Variable ILI9481_BLUE was not explicitly declared
    Completed @ 17:19:25.14 
    

    Ignore the errors.. they are because these programs are using incorrect color constants.

     
<< < 1 2 3 > >> (Page 2 of 3)

Log in to post a comment.