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

Modifying Descriptors on the Fly in FX2

The newbie problem I have is that I want, at run time, to modify my USB descriptors which in the Cypress examples are in a file called dscr.a51. They are declared in a segment called CODE, and I assume this is why attempts to modify them from the code are called illegal, even though they are actually in RAM on the FX2

Can anyone give me a quick nudge towards the best way to get round this? I'm familiar with C but not in an embedded environment.

Parents
  • Thanks for the suggestions. In the end I found a sample of (Cypress) code which I have made use of. The technique seems to be to cast a pointer to the 'constant' which must be altered, as xdata. It seemed to generate the right SRC code. I want to experiment with using xdata for the original declaration, but I haven't yet figured out how to control the linker to decide where the data actually goes in the address spaces.


    pHighSpeedConfigDscr = (WORD)&HighSpeedConfigDscr;
    
    *((BYTE xdata *)pHighSpeedConfigDscr+7) |= 0x40;

Reply
  • Thanks for the suggestions. In the end I found a sample of (Cypress) code which I have made use of. The technique seems to be to cast a pointer to the 'constant' which must be altered, as xdata. It seemed to generate the right SRC code. I want to experiment with using xdata for the original declaration, but I haven't yet figured out how to control the linker to decide where the data actually goes in the address spaces.


    pHighSpeedConfigDscr = (WORD)&HighSpeedConfigDscr;
    
    *((BYTE xdata *)pHighSpeedConfigDscr+7) |= 0x40;

Children
No data