Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#define IR conflicts with STM32G4 series HAL #137

Open
lroop opened this issue Sep 8, 2023 · 0 comments
Open

#define IR conflicts with STM32G4 series HAL #137

lroop opened this issue Sep 8, 2023 · 0 comments

Comments

@lroop
Copy link

lroop commented Sep 8, 2023

The definition of IR to refer to the Wizchip's interrupt register causes build errors when trying to build for an STM32G4xx series microcontroller using ST's HAL and CMSIS common code.

If you look at
https://github.com/STMicroelectronics/STM32CubeG4/blob/c4132af65fe74ddd7f54aced85a0f4acce736405/Drivers/CMSIS/Device/ST/STM32G4xx/Include/stm32g474xx.h#L271
you'll see that IR is the name of a variable inside a struct for the STM's CAN-FD controller, but the #define in Wiznet's code at

#define IR (_W5500_IO_BASE_ + (0x0015 << 8) + (WIZCHIP_CREG_BLOCK << 3))
causes this variable name to be replaced with a numeric constant by the C preprocessor. It is generally considered best practice to namespace #defines in libraries to avoid this, for instance this define in the Wiznet code could be named WIZCHIP_REG_IR or similar instead of just IR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant