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

Don't misuse COMP1, COMP2 #100

Open
CanastraRF opened this issue Feb 14, 2025 · 0 comments
Open

Don't misuse COMP1, COMP2 #100

CanastraRF opened this issue Feb 14, 2025 · 0 comments
Assignees
Labels
bug Something isn't working cmsis CMSIS-related issue or pull-request. comp Comparator

Comments

@CanastraRF
Copy link

CanastraRF commented Feb 14, 2025

Dear Support

You define in lot of CPU files

#define COMP1 (COMP_TypeDef *) COMP1_BASE
#define COMP2 (COMP_TypeDef *) COMP2_BASE

But CMSIS also use COMP1 or COMP2 in DWT_Type in core_cm4.h

So depending of the include order of above file one of both symbols is not accessible or result in compile errors.

Please don't use preprocessor for most definition

Better use
static COMP_TypeDef * const COMP1 = (COMP_TypeDef *) COMP1_BASE;
static COMP_TypeDef * const COMP2 = (COMP_TypeDef *) COMP2_BASE;

Modern Compiler can remove unused const
Reto Felix

@ALABSTM ALABSTM added enhancement New feature or request cmsis CMSIS-related issue or pull-request. comp Comparator labels Feb 17, 2025
@ALABSTM ALABSTM added bug Something isn't working and removed enhancement New feature or request labels Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cmsis CMSIS-related issue or pull-request. comp Comparator
Projects
Development

No branches or pull requests

3 participants