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

compiling mcb2300 usb examples in GCC

Hi All,

I downloaded the Keil USB Examples for the MCB2300 board on the website. All examples worked well (except USBMem, because of the 16 kb limit for the evaluation version) when with the default compiler.

I adapted the code to work with the GCC compiler (that also came with the evaluation tools), but I had problems:

When I run the examples, Windows XP "almost" recognizes the board (almost = you hear the "dong-ding" but the "USB Device not recognized" little window popped up).

I suspect I made some mistakes on the 'translation' ; something with the __packed & __inline keywords.

1) Does anybody have a clue about what is happening?

2) I translated __packed to __attribute__(__packed__)) , but had to put the keyword after "struct" (when I left it at the left of struct I got a warning saying that __packed__ was ignored. And the device did not even made XP do the "dong-ding". Is this correct? I read in somewhere that in GCC even if you pack a structure or every item on the structure, the structure itself has its size aligned (even if the members inside are packed).

3) __inline is the same as "static" ? (I defined a macro #define __inline static ), Is this correct?

Thank you very much for any help!!
Sergio P. Sider

Parents
  • "the code is far from portable"

    Did it ever claim to be?

    It was, presumably, supplied as sample code for the Keil compiler?

    Therefore, one would expect it do demonstrate the particular features of that compiler - and this would naturally make it non-portable, wouldn't it...?

Reply
  • "the code is far from portable"

    Did it ever claim to be?

    It was, presumably, supplied as sample code for the Keil compiler?

    Therefore, one would expect it do demonstrate the particular features of that compiler - and this would naturally make it non-portable, wouldn't it...?

Children
  • Hi again,

    Just to clarify: When I said "GCC does not correctly handle unaligned packed pointers". I was saying that the keyword "__attribute__((__packed__))" was not doing what it was intended to do.

    About portable code, I did not mention it originally.
    If the code is portable or not, I really don't care. I am not a believer in 'portable code' for embedded systems anyway. ;-)

    IMHO the code was supplied as sample code for the Keil product (not just the compiler, as it claims to work with GCC also) and the MCB2300 board that they sell (and I bought, so I am not stealing code). I was trying to make it work in one of its available configurations.

    Regards,
    Sergio.