Menu

New Compiler Capability: Creation of EEPROM reference data directly

Anobium
2023-11-08
2023-11-21
  • Anobium

    Anobium - 2023-11-08

    You can now create EEPROM reference datasets from within your source program.

    It is very easy. You simply need to add the dataset to your source program using the new EEPROM structure, as follows:

                  EEPROM EEPromBlockName [[,] OffSet Address ]
                          0,1,2,3
                  End EEPROM         
    

    The EEPROM command needs a name and an optional offSet address defaults to 0x00 if not stated.

    The offset address and data block CANNOT overlap another EEPROM structure. EEPROM structures must not overlap TABLE data, and TABLE data has precedence from address 0x00 until the the end of TABLE data.

    The dataset can be numbers, strings, calculations. Just the same as TABLE structures.


    An example.

    #chip 16F886
    #option explicit
    
       #DEFINE USART_BAUD_RATE 9600
       #DEFINE USART_TX_BLOCKING
       #DEFINE USART_DELAY OFF
    
       Dim EEdataaddress, myvar as Byte
       EEdataaddress = 2
    
       Readtable TwoBytes,EEdataaddress,myVar
       HSerPrint myVar
    
    
    // ****************** EXAMPLE EE DATA
    // *                       THIS IS ONLY ACCESSIBLE VIA EPREAD or other EE read functions.
    /*
       Usage:     'EEProm EEPromBlockName [[,] OffSet Address ]  
                   OffSet address defaults to 0x00 if not stated. 
    
                   Addresses and data block CANNOT overlap.
                   Addresses must not overlap TABLE data.
                   TABLE data has precendence from address 0x00 until the the end of TABLE data
    */
    
    
       EEProm EEDataSet1 0x10  // Locate EE Data at address
       3,2,1
       End EEProm
    
       EEProm VersionData 0x20  // Locate EE Data at address
       "    PWM2Laser   "
       "  FABRICE ENGEL "
       "  Version 1.4   "
       "  November 2022 "
       End EEProm
    
       EEProm EEDataSet2 0x0D    // Locate EE Data at address
       1,2,3
       End EEProm
    
       EEProm EEDataSet 0X04   // Locate EE Data at address
       1,2,3
       End EEProm
    
    // **********************  EXAMPLE TABLE DATA BEING LOADED INTO EE BY THE COMIPILER 
    // *                       THIS IS ONLY ACCESSIBLE VIA READTABLE
    
       Table TwoBytes STORE data // EE Data Address Allocated by compiler
          0X55,0XAA,0X55
       End Table
    

    This create ASM as follows which is specific to the target chip.

    ; Data Tables (data memory)
    ORG 0x2100
        TABLETWOBYTES   equ 0
            de 3, 85, 170, 85
    ORG 0x2104
        DATAEEDATASET   equ 4
            de 1, 2, 3
    ORG 0x210D
        DATAEEDATASET2  equ 8
            de 1, 2, 3
    ORG 0x2110
        DATAEEDATASET1  equ 12
            de 3, 2, 1
    ORG 0x2120
        DATAVERSIONDATA equ 16
            de 32, 32, 32, 32, 80, 87, 77, 50, 76, 97, 115, 101, 114, 32, 32, 32, 32, 32, 70, 65, 66, 82, 73, 67, 69, 32, 69, 78, 71, 69, 76, 32, 32, 32, 86, 101, 114, 115, 105, 111, 110, 32, 49, 46, 52, 32, 32, 32, 32, 32, 78, 111, 118, 101, 109, 98, 101, 114, 32, 50, 48, 50, 50, 32
    

    When loaded into the chip ( this case an emulator ), the datasets are loaded in the EEPROM memory space, as follows:


    This is available from build 1296 and onwards.

    Help is ready on GitHub.

    And, GCODE Helpers and Autocomplete will provide support.


    Enjoy this new capability.

     
    😄
    1

    Last edit: Anobium 2023-11-08
  • Anobium

    Anobium - 2023-11-08

    Thanks go to FABRICE ENGEL for the new EEPROM capability.

    He shared how another compiler handled EEPROM datasets and he has help test the solution.

    THANKS


    TO ALL: DONATE HERE

    https://sourceforge.net/p/gcbasic/discussion/579125/thread/c635e2568c/

    The reason to donate is that I can add great features and maintain the tool chain.

    Please donate.

     
    👍
    1
  • Anobium

    Anobium - 2023-11-21

    I have updated the compiler to support AVR with the EEPROM capability. At the moment you have to use AVRASM to create the EEP file ( if you have to ask what this is... then you are probably not using an AVR chip .. it is the EEPROM hex file).

    Preferences editor now supports AVRASM and you can use any AVRASM assembler. This is all configured within Preferences editor.

    I will post a video soon, and, I will post a version of AVRASM to https://sourceforge.net/projects/gcbasic/files/Support%20Files/MicrochipCompilers/ I will post the one I use.


    Donate here

    Please donate to the operational costs of GCBASIC for the coming year - Thank you. paypal.me/gcbasic

     

Log in to post a comment.