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

Can't enable debug on esp32. #137

Open
TECH7Fox opened this issue Jan 8, 2023 · 7 comments
Open

Can't enable debug on esp32. #137

TECH7Fox opened this issue Jan 8, 2023 · 7 comments
Assignees
Labels
PN532 Label for PN532 UAY Unassigned yet

Comments

@TECH7Fox
Copy link

TECH7Fox commented Jan 8, 2023

Using a ESP32 Dev Module.
If I uncomment #define DEBUG to enable debug I get this:

In file included from C:\Users\Jordy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6/tools/sdk/include/newlib/stdio.h:47:0,
                 from C:\Users\Jordy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\cores\esp32/Arduino.h:27,
                 from C:\Users\Jordy\Documents\Arduino\libraries\PN532\PN532_debug.h:6,
                 from C:\Users\Jordy\Documents\Arduino\libraries\PN532\emulatetag.cpp:10:
C:\Users\Jordy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6/tools/sdk/include/newlib/sys/reent.h:463:10: error: #if with no expression
In file included from C:\Users\Jordy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6/tools/sdk/include/newlib/stdio.h:47:0,
                 from C:\Users\Jordy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\cores\esp32/Arduino.h:27,
                 from C:\Users\Jordy\Documents\Arduino\libraries\PN532\PN532_debug.h:6,
                 from C:\Users\Jordy\Documents\Arduino\libraries\PN532\llcp.cpp:3:
C:\Users\Jordy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6/tools/sdk/include/newlib/sys/reent.h:463:10: error: #if with no expression
In file included from C:\Users\Jordy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6/tools/sdk/include/newlib/stdio.h:47:0,
                 from C:\Users\Jordy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\cores\esp32/Arduino.h:27,
                 from C:\Users\Jordy\Documents\Arduino\libraries\PN532\PN532_debug.h:6,
                 from C:\Users\Jordy\Documents\Arduino\libraries\PN532\mac_link.cpp:3:
C:\Users\Jordy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6/tools/sdk/include/newlib/sys/reent.h:463:10: error: #if with no expression
In file included from C:\Users\Jordy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6/tools/sdk/include/newlib/stdio.h:47:0,
                 from C:\Users\Jordy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6\cores\esp32/Arduino.h:27,
                 from C:\Users\Jordy\Documents\Arduino\libraries\PN532\PN532_debug.h:6,
                 from C:\Users\Jordy\Documents\Arduino\libraries\PN532\snep.cpp:3:
C:\Users\Jordy\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6/tools/sdk/include/newlib/sys/reent.h:463:10: error: #if with no expression

exit status 1

Compilation error: exit status 1

Anyone else got this?

@qbonenfant
Copy link

qbonenfant commented Feb 20, 2023

Hi,
I got the same issue on a CubeCell HTCC-AB02.
In my case, there was a conflict with the board library, which also use a DEBUG statement in its debug.h, with a IFNDEF DEBUG to avoid redundancy.
Using such common names in a library is poor practice and should be fixed ASAP (on both side really).

To solve the issue, you can modify the redundancy checks in PN532_debug.h

Here is what my file looks like:

#ifndef __DEBUG_PN532_H_
#define __DEBUG_PN532_H_

#define DEBUG_532

#include "Arduino.h"

#ifdef DEBUG_532
#define DMSG(args...)       Serial.print(args)
#define DMSG_STR(str)       Serial.println(str)
#define DMSG_HEX(num)       Serial.print(' '); Serial.print((num>>4)&0x0F, HEX); Serial.print(num&0x0F, HEX)
#define DMSG_INT(num)       Serial.print(' '); Serial.print(num)
#else
#define DMSG(args...)
#define DMSG_STR(str)
#define DMSG_HEX(num)
#define DMSG_INT(num)
#endif

#endif

I hope it will work for you too.
This fix may need to be propagated to other files if there is an update of the library, but should work for now.
I should really make a PR to fix this, but don't have time RN (maybe later... if i remember)

@alireza-tabatabaee
Copy link

As a quick and dirty fix you can comment out
#define SERIAL 0x0
in line 50 of Arduino.h which is located at %localappdata%/Arduino15/packages/esp32/hardware/esp32/2.0.8/cores/esp32/Arduino.h

@MatthewJeffson MatthewJeffson added UAY Unassigned yet PN532 Label for PN532 and removed UAY Unassigned yet labels Oct 9, 2024
@Cincinnatu
Copy link

Hello, I will check soon whether this issue still exists. If it does, I will work on fixing it.

@Lesords Lesords moved this from Todo to In Progress in Issues and PR Assemble Nov 4, 2024
@Lesords Lesords assigned Lesords and unassigned Cincinnatu Dec 24, 2024
@Lesords
Copy link

Lesords commented Jan 6, 2025

Hello,

I'm very sorry to have kept you waiting so long.

Do you still have this problem now?

If so, can you try the latest code?

If the latest code also has your problem, can you tell me the board name you are using and the corresponding sketch?

@Lesords Lesords moved this from In Progress to Todo in Issues and PR Assemble Jan 6, 2025
@qbonenfant
Copy link

Hi,
I do have a project that will require a PN532 pretty soon. I will keep you updated.

@Lesords
Copy link

Lesords commented Jan 7, 2025

Hi, I got the same issue on a CubeCell HTCC-AB02. In my case, there was a conflict with the board library, which also use a DEBUG statement in its debug.h, with a IFNDEF DEBUG to avoid redundancy. Using such common names in a library is poor practice and should be fixed ASAP (on both side really).

To solve the issue, you can modify the redundancy checks in PN532_debug.h

Here is what my file looks like:

#ifndef __DEBUG_PN532_H_
#define __DEBUG_PN532_H_

#define DEBUG_532

#include "Arduino.h"

#ifdef DEBUG_532
#define DMSG(args...)       Serial.print(args)
#define DMSG_STR(str)       Serial.println(str)
#define DMSG_HEX(num)       Serial.print(' '); Serial.print((num>>4)&0x0F, HEX); Serial.print(num&0x0F, HEX)
#define DMSG_INT(num)       Serial.print(' '); Serial.print(num)
#else
#define DMSG(args...)
#define DMSG_STR(str)
#define DMSG_HEX(num)
#define DMSG_INT(num)
#endif

#endif

I hope it will work for you too. This fix may need to be propagated to other files if there is an update of the library, but should work for now. I should really make a PR to fix this, but don't have time RN (maybe later... if i remember)

I don't have this board

Is the problem you encounter only the DEBUG macro conflict?

Does this code snippet solve all your problems?

@Lesords
Copy link

Lesords commented Jan 7, 2025

@qbonenfant By the way, we welcome your PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PN532 Label for PN532 UAY Unassigned yet
Projects
Status: Todo
Development

No branches or pull requests

6 participants