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

Conflict in 'Uid' Variable Definitions Across Different Files #344

Open
wai666 opened this issue Nov 30, 2023 · 1 comment
Open

Conflict in 'Uid' Variable Definitions Across Different Files #344

wai666 opened this issue Nov 30, 2023 · 1 comment

Comments

@wai666
Copy link

wai666 commented Nov 30, 2023

Hello,

I'm currently working on a project involving two C files, ISO15693-A.c and MifareClassic.c, and I've encountered a conflict in the declarations of the Uid variable between these two files. This issue is causing a linker error and I'm seeking assistance to resolve it.

In ISO15693-A.c, the Uid variable is declared as an array of type uint8_t with the size defined by ISO15693_GENERIC_UID_SIZE. However, in MifareClassic.c, the Uid variable is declared as a uint8_t array with a fixed size of 4. The differing sizes of the Uid array in these two files are causing a compilation warning and a linker error, as indicated in the error message below:c:/users/administrator/desktop/avr-gcc-12.1.0-x64-windows/bin/../lib/gcc/avr/12.1.0/../../../../avr/bin/ld.exe: disabling relaxation; it will not work with multiple definitions Application/ISO15693-A.c:6:9: warning: type of 'Uid' does not match original declaration [-Wlto-type-mismatch] 6 | uint8_t Uid[ISO15693_GENERIC_UID_SIZE]; | ^ Application/MifareClassic.c:589:9: note: array types have different bounds 589 | uint8_t Uid[4]; | ^ Application/MifareClassic.c:589:9: note: 'Uid' was previously declared here lto-wrapper.exe: warning: using serial compilation of 2 LTRANS jobs lto-wrapper.exe: note: see the '-flto' option documentation for more information collect2.exe: error: ld returned 1 exit status make: *** [../LUFA/Build/lufa_build.mk:320: Chameleon-RevG.elf] Error 1
I have also checked the header file MifareClassic.h for any relevant declarations, but couldn't find a direct reference to the Uid variable.

I'm unsure whether these files should use the same size for Uid or if they are intended to have different sizes for specific reasons. Could you please provide guidance on how to resolve this conflict? Should I modify the Uid size in one of the files to match the other, or is there a different approach I should consider?

Thank you for your assistance.

@tomaspre
Copy link
Collaborator

Hi,

MFC can have either a 4-byte or a 7-byte UID. For ISO15, the UID size can vary greatly. The error above is expected as ISO14 and ISO15 builds are provided separately.

You could try compiling the MFC files with the UID size set to ISO15693_GENERIC_UID_SIZE. However, keep in mind that some parts of the code might rely on the UID size being an expected number. I'd almost say that this is likely to break completely.

I'd suggest sticking to two different FW builds. But if you decide to fix this, a PR is always appreciated. :-)

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

2 participants