Skip to content

Compile error for ESP32 #4

@sohail-bakhtiari

Description

@sohail-bakhtiari

Trying to build the "SimpleCommands" example, while an ESP32 board is selected causes errors and fails to compile:

In file included from /home/sohail/Arduino/libraries/StaticSerialCommands/src/Command.h:12,
                 from /home/sohail/Arduino/libraries/StaticSerialCommands/src/StaticSerialCommands.h:11,
                 from /tmp/.arduinoIDE-unsaved2025029-10026-7zvt3g.714q/SimpleCommands/SimpleCommands.ino:7:
/home/sohail/Arduino/libraries/StaticSerialCommands/src/Arg.h: In static member function 'static const char* impl::ArgConstraint::getTypeNamePgm(ArgType)':
/home/sohail/Arduino/libraries/StaticSerialCommands/src/Arg.h:169:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  169 |     return (PGM_P) pgm_read_word(&(types[(int) type]));
In file included from /home/sohail/.arduino15/packages/esp32/hardware/esp32/3.1.1/cores/esp32/WString.h:26,
                 from /home/sohail/.arduino15/packages/esp32/hardware/esp32/3.1.1/cores/esp32/Arduino.h:192,
                 from /home/sohail/.cache/arduino/sketches/97429D95CFBE6C1E20762264180A589C/sketch/SimpleCommands.ino.cpp:1:
/home/sohail/Arduino/libraries/StaticSerialCommands/src/Command.h: In member function 'const char* Command::getCommandPgm() const':
/home/sohail/.arduino15/packages/esp32/hardware/esp32/3.1.1/cores/esp32/pgmspace.h:40:3: error: invalid conversion from 'short unsigned int' to 'const char* (*)(const void*)' [-fpermissive]
   40 |   ({                                  \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |   |
      |   short unsigned int
   41 |     typeof(addr) _addr = (addr);      \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   42 |     *(const unsigned short *)(_addr); \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   43 |   })
      |   ~~
/home/sohail/Arduino/libraries/StaticSerialCommands/src/Command.h:54:47: note: in expansion of macro 'pgm_read_word'
   54 |       PGM_P (*_getCommandPgmFn)(PGM_VOID_P) = pgm_read_word(&(_command->getCommandPgmFn));
      |                                               ^~~~~~~~~~~~~
/home/sohail/Arduino/libraries/StaticSerialCommands/src/Command.h: In member function 'const char* Command::getDescriptionPgm() const':
/home/sohail/.arduino15/packages/esp32/hardware/esp32/3.1.1/cores/esp32/pgmspace.h:40:3: error: invalid conversion from 'short unsigned int' to 'const char* (*)(const void*)' [-fpermissive]
   40 |   ({                                  \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |   |
      |   short unsigned int
   41 |     typeof(addr) _addr = (addr);      \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   42 |     *(const unsigned short *)(_addr); \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   43 |   })
      |   ~~
/home/sohail/Arduino/libraries/StaticSerialCommands/src/Command.h:59:51: note: in expansion of macro 'pgm_read_word'
   59 |       PGM_P (*_getDescriptionPgmFn)(PGM_VOID_P) = pgm_read_word(&(_command->getDescriptionPgmFn));
      |                                                   ^~~~~~~~~~~~~
/home/sohail/Arduino/libraries/StaticSerialCommands/src/Command.h: In member function 'const impl::ArgConstraint* Command::getArgsPgm(uint8_t*) const':
/home/sohail/.arduino15/packages/esp32/hardware/esp32/3.1.1/cores/esp32/pgmspace.h:40:3: error: invalid conversion from 'short unsigned int' to 'impl::ArgConstraint* (*)(const void*, uint8_t*)' {aka 'impl::ArgConstraint* (*)(const void*, unsigned char*)'} [-fpermissive]
   40 |   ({                                  \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |   |
      |   short unsigned int
   41 |     typeof(addr) _addr = (addr);      \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   42 |     *(const unsigned short *)(_addr); \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   43 |   })
      |   ~~
/home/sohail/Arduino/libraries/StaticSerialCommands/src/Command.h:64:69: note: in expansion of macro 'pgm_read_word'
   64 |       impl::ArgConstraint* (*_getArgsPgmFn)(PGM_VOID_P, uint8_t*) = pgm_read_word(&(_command->getArgsPgmFn));
      |                                                                     ^~~~~~~~~~~~~
/home/sohail/Arduino/libraries/StaticSerialCommands/src/Command.h: In member function 'void Command::runCommand(SerialCommands&, Args&) const':
/home/sohail/.arduino15/packages/esp32/hardware/esp32/3.1.1/cores/esp32/pgmspace.h:40:3: error: invalid conversion from 'short unsigned int' to 'void (*)(SerialCommands&, Args&)' [-fpermissive]
   40 |   ({                                  \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |   |
      |   short unsigned int
   41 |     typeof(addr) _addr = (addr);      \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   42 |     *(const unsigned short *)(_addr); \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   43 |   })
      |   ~~
/home/sohail/Arduino/libraries/StaticSerialCommands/src/Command.h:69:50: note: in expansion of macro 'pgm_read_word'
   69 |       void (*function)(SerialCommands&, Args&) = pgm_read_word(&(_command->function));
      |                                                  ^~~~~~~~~~~~~
/home/sohail/Arduino/libraries/StaticSerialCommands/src/Command.h: In member function 'void Command::getSubCommands(const Command**, uint16_t*) const':
/home/sohail/.arduino15/packages/esp32/hardware/esp32/3.1.1/cores/esp32/pgmspace.h:40:3: error: invalid conversion from 'short unsigned int' to 'const Command*' [-fpermissive]
   40 |   ({                                  \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |   |
      |   short unsigned int
   41 |     typeof(addr) _addr = (addr);      \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   42 |     *(const unsigned short *)(_addr); \
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   43 |   })
      |   ~~
/home/sohail/Arduino/libraries/StaticSerialCommands/src/Command.h:76:19: note: in expansion of macro 'pgm_read_word'
   76 |       *commands = pgm_read_word(&(_command->subcommands));
      |                   ^~~~~~~~~~~~~

exit status 1

Compilation error: exit status 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions