2019-09-30 01:32 AM
Hi all,
just a short question:
Why does the compiler say that the page is redefined?
#define ADDR_FLASH_PAGE_148 ((uint32_t)0x0804A000)
#define ADDR_FLASH_PAGE_149 ((uint32_t)0x0804A800)
Same page but with small letters and that's ok for the compiler.
#define ADDR_FLASH_PAGE_148 ((uint32_t)0x0804a000)
#define ADDR_FLASH_PAGE_149 ((uint32_t)0x0804a800)
I've got hundreds of warnings within my defines beacuse of that.
Can anyone explain that to me?
Regards,
Enrico
2019-09-30 02:14 AM
It's not the compiler who says that, but the preprocessor.
And it's because the preprocessor is [mostly] a textual processor, it does not understand what's in the macro; so all it can do is to compare the text. And, as C is generally case sensitive, "((uint32_t)0x0804A000)" and "((uint32_t)0x0804a000)" are not the same.
JW
2019-09-30 02:15 AM
Check surrounding # if / # ifdef preprocessor directives.
The multiple sections are probably for different variants, and the compiler is supposed to see only one, by chosing the proper variant define.
Another area where cube creates kind of a hefty mess.
2019-09-30 02:54 AM
Okay, thank you.
I thought the prepropressor had an issue while comparing
#define ADDR_FLASH_PAGE_148 ((uint32_t)0x0804A000)
#define ADDR_FLASH_PAGE_149 ((uint32_t)0x0804A800)
and stopping the comparison after the capital letter. Because the two pages have different addresses and I thought the type of letters doesn't matter for the comparison.
2019-09-30 05:14 AM
It would need to be identical to be the same.
Perhaps it indicates files/lines for the conflicts? You could also find-in-files or grep, and then eliminate the conflicts.