Menu

StaticEXIOptions

Anonymous
2015-11-13
2015-11-17
  • Anonymous

    Anonymous - 2015-11-13

    There are a lot of static variables declared in StaticEXIOptions which are placed in RAM when compiling the code for an embedded system. Since RAM is limited in such systems, it would be a good idea to convert them to static constant variables, so that they are placed in ROM instead of RAM. I have already tried this, and saved about 8.5 kB of RAM.
    Wahab

     
  • Rumen Kyusakov

    Rumen Kyusakov - 2015-11-14

    Hi Wahab,

    Thanks for your suggestion and feedback! StaticEXIOptions is the grammar describing the EXI header and making it constant is good idea in almost all scenarios.

    Did you use the #define CONST macro i.e.,

    #define CONST const

    ?

    Please share if there were more tweaks required. I will then add it as a feature request in the tracker.

    Best regards,
    Rumen

     
  • Anonymous

    Anonymous - 2015-11-17

    I did use this macro first, but I received some errors during compilation. Two types of errors were encountered:
    1. The first type of errors occured when trying to initialize non-constant members of structures with constants. Let's take EXIPSchema structure:

    const struct EXIPSchema
    {
        AllocList memList;
        UriTable uriTable;
        EXIGrammar docGrammar;
        SimpleTypeTable simpleTypeTable;
        SchemaGrammarTable grammarTable;
        Index staticGrCount;
        EnumTable enumTable;
    };
    

    As you can see its members are non-constant. And when I tried to initialize them with constant data types, I got errors. I solved these errors by casting consts to non-consts as follows:

    EXIPSchema ops_schema =
    {
        {NULL, NULL},
        {{sizeof(UriEntry), 5, 5}, (UriEntry*)ops_uriEntry, 5},
        {(GrammarRule*)ops_docGrammarRule, 100663296, 2},
        {{sizeof(SimpleType), 67, 67}, (SimpleType*)ops_simpleTypes,67},
        {{sizeof(EXIGrammar), 75, 75}, (EXIGrammar*)ops_grammarTable, 75},
        75,
        {{sizeof(EnumDefinition), 0, 0}, NULL, 0}
    };
    
    1. The second type of error occured, when the values of these constant variables were modified in some places in the code. After some hit-and-trial, I managed to remove those errors by declaring ops_schema, and ops_uri_entry as non-constant, and all other variables as constant.
     
  • Rumen Kyusakov

    Rumen Kyusakov - 2015-11-17

    Great thanks for the detailed instructions!

    This approach can be used for the auto-generated grammars when in schema-mode processing as well so very useful indeed,

    I filed a feature request for that here:
    http://sourceforge.net/p/exip/feature-requests/12/

    Regards,
    Rumen

     

Anonymous
Anonymous

Add attachments
Cancel