This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Relocating a structure to external memory

I seem to have an issue when trying to define a structure to exsist at an external memory location. the struct overlays registers in an external chip communicating through through the EMI interface.

the struct needs to start at the base address of Bank 1 (0x62000000)of the external memory and is sequentially addressed from that base address.

I attempted to do it this way

SPC3 spc3 __at(0x62000000);

and this way

typedef struct
{

  char a;
  u8 newvar;
}SPC3 __at(0x62000000);

neither of these methods worked.

this locks up the linker for some time then gives me an error.

is there an easier way to overlay a struct to an external memory location??

Parents Reply Children
  • Thanks

    I forgot to mention that it is relabled the struct in and H file and is relabled in the c file, and is externed in a few diffrent c files.

    SPC3 spc3
    

    all my pointers are spc3.x.x

    How do I get it to accecpt the relabel at that address location withough having to rewrite all my code?

    and I need to make a correction to the struct

    
    typedef struct StagSPC3
    {
      char a;
      u8 newvar
    }SPC3;
    
    


    Thanks so much for your help

  • Thanks for your help

    I got it working,

    I just removed the

    
    SPC3 spc3;
    
    

    and changed the pointer to

    
    #define spc3 (*(SPC3*)0x62000000)
    
    

    and it works perfectly,

    The only draw back is seeing the Symbols during debug it does not show the struct in the symbol table

  • "The only draw back is seeing the Symbols during debug it does not show the struct in the symbol table"

    Right, because there is no longer any data object (i.e., having storage allocated to it) for the linker to deal with.