I'm using Kolban's esp32 port available here https://github.com/nkolban/esp32-snippe ... embedded_c
Everything compile fine and I'm able to publish into my topics on my remote MQTT server.
However after some time (around 5 minutes) I don't receive messages anymore. I investigated a little into paho sources and I realized that MQTTFreeRTOS.h is never included nor used anywhere when using MQTTClient-C.
Code: Select all
$ rgrep -n MQTTFreeRTOS.h
components/paho_mqtt_embedded_c/MQTTClient-C/src/FreeRTOS/MQTTFreeRTOS.c:18:#include "MQTTFreeRTOS.h"
MQTTClient.h
Code: Select all
/*******************************************************************************
* Copyright (c) 2014, 2015 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Allan Stockdill-Mander/Ian Craggs - initial API and implementation and/or initial documentation
* Ian Craggs - documentation and platform specific header
*******************************************************************************/
#if !defined(__MQTT_CLIENT_C_)
#define __MQTT_CLIENT_C_
#if defined(__cplusplus)
extern "C" {
#endif
#if defined(WIN32_DLL) || defined(WIN64_DLL)
#define DLLImport __declspec(dllimport)
#define DLLExport __declspec(dllexport)
#elif defined(LINUX_SO)
#define DLLImport extern
#define DLLExport __attribute__ ((visibility ("default")))
#else
#define DLLImport
#define DLLExport
#endif
#include "MQTTLinux.h"
#include "MQTTPacket.h"
#include "stdio.h"
#if defined(MQTTCLIENT_PLATFORM_HEADER)
/* The following sequence of macros converts the MQTTCLIENT_PLATFORM_HEADER value
* into a string constant suitable for use with include.
*/
#define xstr(s) str(s)
#define str(s) #s
#include xstr(MQTTCLIENT_PLATFORM_HEADER)
#endif
Code: Select all
#include "MQTTLinux.h"
Code: Select all
#include "MQTTFreeRTOS.h"
Code: Select all
$ make
CC MQTTClient-C/src/MQTTClient.o
In file included from <project_path>/components/paho_mqtt_embedded_c/MQTTClient-C/src/MQTTClient.h:35:0,
from <project_path>/components/paho_mqtt_embedded_c/MQTTClient-C/src/MQTTClient.c:16:
<project_path>/components/paho_mqtt_embedded_c/MQTTClient-C/src/FreeRTOS/MQTTFreeRTOS.h:20:22: fatal error: FreeRTOS.h: No such file or directory
compilation terminated.
<esp-idf_path>/make/component_wrapper.mk:202 : la recette pour la cible « MQTTClient-C/src/MQTTClient.o » a échouée
make[1]: *** [MQTTClient-C/src/MQTTClient.o] Erreur 1
<esp-idf_path>/make/project.mk:386 : la recette pour la cible « paho_mqtt_embedded_c-build » a échouée
make: *** [paho_mqtt_embedded_c-build] Erreur 2
Code: Select all
#include <esp_wifi.h>
#include <freertos/FreeRTOS.h>
#include <freertos/event_groups.h>
#include <lwip/sockets.h>
#include <nvs_flash.h>
#include "driver/i2c.h"
Code: Select all
#include "FreeRTOS.h"
#include "FreeRTOS_Sockets.h"
#include "FreeRTOS_IP.h"
#include "semphr.h"
#include "task.h"
How can I include freertos directory without having to modify esp-idf makefiles ?
Is that normal that paho doesn't use MQTTFreeRTOS.h by default ? Or at least is surrounded with #ifdef #endif to use freeRTOS sources when deployed on freeRTOS ?
Am I doing the good thing to use freeRTOS paho sources instead of linux ones ?
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Moreover, I also realized that FreeRTOS.h is including files that doesn't exit on my computer, so external sources which are FreeRTOS_Sockets.h FreeRTOS_IP.h.
Where can I find those files ?
Thanks in advance