Why this code gives error?

0

Hello! I'm making software for microcontrollers. For Arduino , everything works ok, but for ESP32 it gives error, it does not compile. Here is the code:

class Program
{
    void(*app_start)(void);

    void *pBin;
public:
    int ProgramSize = 512;

    void SetMachineCode(uint8_t data_bin[])
    {
        int siz = (sizeof(data_bin) / sizeof(*data_bin));
        ProgramSize = siz;
        pBin = malloc(siz);

        pBin = data_bin;
        app_start = pBin; // -> Erro aqui <-
    }

    void Run()
    {
        (*app_start)();
    }
};

void start()
{
   ...
}

void loop()
{
   ...
}

Error: error: invalid conversion from 'void*' to 'void (*)()' [-fpermissive]

    
asked by anonymous 02.06.2018 / 19:08

0 answers