This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Static Base Relative Warning on PADK

Hi,

I am running an XDAIS compliant algorithm on PADK and am getting below warning:

"xyz.c", line 164 (approximate): warning: relocation type is static base-relative, but references symbol "_xyz_abc_a1" defined in section ".far"; references to section ".far" are not relative to any static base, so this relocation cannot be performed (type = 'R_C60BASE' (80), file = "algLib\temp.lib<xyz.obj>", offset = 0x0000052c, section = ".text:filter")

Variable "xyz_abc_a1" is defined as global

#pragma DATA_SECTION(xyz_abc_a1, ".far:temp_obj")

float xyz_abc_a1;

I am ot sure why I am getting above warning. If I put the varaible "xyz_abc_a1" in bss section, the warning goes away, but then the algorithm doesnt remain XDAIS compliant (as a rule for XDAIS compliant says that all the global variables should be in far or const section)

Please let me know if someone has any ideas.

Thanks

Megha

 

  • Try putting the "far" modifier in front of your variable declaration:

    far float xyz_abc_a1;

  • For the full background on this, see http://tiexpressdsp.com/index.php/C6000_Memory_models .

    Thanks and regards,

    -George

     

  • Hi Randy,

    I did try putting far at the beginning of definition like you mentioned, but it gives the same warning.

    Please let me know if there is anything else I can try to avoiid this warning.

    Thanks,

    Megha

     

  • Hi George,

    Thanks for the information. But I still am not sure why is the section accessed by the varaible a near data reference.

    From this url I understand that the warning is occuring cause a far is getting accessed in near section. But I dont undertsand how is the reference in near section.

    Please let me know if I am missing anything.

    Thanks

    Megha

     

  • I think you changed the definition of the problem global variable.  You also need to change the declaration.

    -George

     

  • Hi George,

    I did only change the definition as follows:

    far float xyz_abc_a1;

    I get following build errors if I try to change it in the declaration (far extern float xyz_abc_a1):

    "error: more than one storage class may not be specified"

    Megha

  • You have to write it

    extern far float xyz_abc_a1;

    I don't know why.

    -George

     

  • Hi George,

    Thanks that works. I dont get the warning any more.

    Could you please explain why declaring the varaible as far this way works and the way i was declaring before doesnt work.

    Thanks

    Megha

  • In the article that georgem pointed you to, about half-way down is a section titled "Definition & Access, Near & Far" with a table that shows your case and that it will fail. The following sections discuss why there is a limitation ("Drawbacks of near") and why there is a cost associated with near vs. far ("Costs: near vs. far Accesses").

  • Hi Randy,

    Thanks. I went through the doc again and it makes sense now.

    I had one more question regarding the declaration. Right now the way we define and declare it goes in the .far section. How can I put this into a specifiac self defined section which is located in far.

    I know that with #data_section i can do it as below:

    #pragma DATA_SECTION(abc_coeff, ".far:abc_obj")

    float abc_coeff,;

    But I am not sure how to do it when I define it as

    far float abc_coeff,;

    Thanks,

    Megha

     

     

  • It is not clear to me what exactly you want to do with this float variable. 

    For the question of how to place it in a specific self-defined section, the answer is to use #pragma DATA_SECTION().

    If you use the far keyword on the declaration, it will be placed in the ".far" section.

    You cannot place one section inside another section, but you can place two sections separately within a memory region. You do this by including the new section on a line in the SECTIONS part of the linker command file and point it to the memory region you want to use.

    Can you give an example of how you want this variable placed in memory, relative to .far or to other variables or what you want to do?

  • I want to put the variable in a self defined section which will finally be part of the IRAM memory section.

    I know two approaches through which I can do this:

    1. definition:

    #pragma DATA_SECTION(abc_coeff, ".abc_section")
    float abc_coeff;

    declaration:

    extern float abc_coeff;

    and then in the linker file put the "abc_obj" section under IRAM memory as below:

    .abc_section: > IRAM

    This metod is not correct as per XDAIS rules and regulations. XDAIS rules and regulations say that each variable should be in far or const section. Hence I foolowed method 2.

    2. definition:

    #pragma DATA_SECTION(abc_coeff, ".far:abc_section")
    float abc_coeff;

    declaration:

    extern float abc_coeff;

    As .far is already in IRAM, these variables will get located in IRAM and can be easily distinguished in the map file. But we saw that this method gave us the warning for static base relative, and hence I followed the method suggested in this thread (method 3)

    3. definition:

    far float abc_coeff;

    declaration:

    extern far float abc_coeff;

    But with this method I am unable to create the self defined section. I wanted to know how can I avoid the warning and still define the variable in self defined section.

    Please let me know if I am not clear.

    Thanks

    Megha

  • Combine 2 & 3 ...

    definition:

    #pragma DATA_SECTION(abc_coeff, ".far:abc_section")
    float abc_coeff;

    declaration:

    extern far float abc_coeff;

    Hope this helps ...

    -George

     

  • Thanks that works,

    Megha