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 · 2 comments
Open

Can't enable debug on esp32. #137

TECH7Fox opened this issue Jan 8, 2023 · 2 comments

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

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

3 participants