Uncle Fungus
Uncle Fungus

Reputation: 3

#define xxxxxx BIT(0) linker error

I'm compiling someone else's code written in C using gcc ARM compiler for STM32F4

#define ESC_CSR_CMD_BUSY         BIT(31)
#define ESC_CSR_CMD_READ         (BIT(31) | BIT(30))
#define ESC_CSR_CMD_WRITE        BIT(31)

and I get an error as it appears to not know what BIT(n) is.

warning: implicit declaration of function 'BIT'; did you mean '__RBIT'?

is there a stdint file somewhere that defines what BIT is...? or an alternate way of writing this please.

Upvotes: 0

Views: 414

Answers (1)

Erlkoenig
Erlkoenig

Reputation: 2754

Although the code should ship with a definition of BIT, I would guess that this is a suitable definition:

#define BIT(n) (1UL << (n))

Upvotes: 1

Related Questions