5 years, 5 months ago.

compiler error mbed src


I am trying to compile mbed library with gcc and eclipse. I get the floowing error

src\mbed\hal/pinmap.h:19:0, from ../mbed/targets/hal/PeripheralPins.h:34, from ../mbed/targets/hal/PeripheralPins.c:31: \src\mbed\targets\hal/PinNames.h:40:58: error: invalid operands to binary << (have 'const struct PinMap *' and 'int')

  1. define STM_PIN_DATA(MODE, PUPD, AFNUM) ((int)(((AFNUM) << 7) | ((PUPD) << 4) | ((MODE) << 0)))

What can be the problem?

Thank you in advance, Dave

1 Answer

5 years, 5 months ago.

It looks like the compiler is viewing the rest of the bit OR operations as a PinMap struct type when trying to operand them with the typecast int, my suggestion would be to double check that you are using compatible variable types. The phrase "invalid operands" would indicate that you are trying to bit OR variables that have no defined bit OR method.

You could try typecasting all of the variables you are operating on to integers, or do the math in multiple lines to more accurately determine which ones are causing the compilation issue.

Accepted Answer

Sorry for late reply. Thank you for your answer. I downloaded the src again using different parameters and finally I got it work. Still don't know what was the problem before. Anyway thx

posted by David Molnar 13 Aug 2015