whitequark / libfx2

Chip support package for Cypress EZ-USB FX2 series microcontrollers
BSD Zero Clause License
73 stars 26 forks source link

Add support for modifying USB strings during runtime #3

Closed jedrzejboczar closed 4 years ago

jedrzejboczar commented 4 years ago

This is to allow FX2 to set some USB strings that are being read from other devices.

jedrzejboczar commented 4 years ago

Travis fails while linking boot-dfu because there is not enough RAM space, but I cannot reproduce this when building with exactly the same flags. Could it be related to SDCC version?

whitequark commented 4 years ago

You don't need any new code for this, just cast away the __code const qualifiers like here and replace them with __xdata. (Of course, this is only legal to do on the FX2, since 8051 code and xdata spaces don't have to address the same memory in general.)

That's a bit dirty, and perhaps it would be better to have all descriptors mutable and __xdata in the first place. But I think it should be one of those two options rather than adding any new code.

jedrzejboczar commented 4 years ago

Thanks. This is of course much better solution. In fact I tried to do this, but missed the __xdata specifier. Should have known that with small memory model it is needed.