Chat freely about anything...

User avatar
By fenyvesi
#9160 Back to the Makefile.windows problem: I suggest that the problem is around here:

FW_TOOL ?= $(XTENSA_TOOLS_ROOT)/esptool -- line 75

I corrected to:
FW_TOOL ?= $(ESPTOOL)

The result is not success, somebody with knowledge about makefiles can correct it.

07:59:59 **** Build of configuration Release for project MQTT_lex3 ****
mingw32-make.exe -f C:/Users/Gyuri/workspace/MQTT_lex3/Makefile.windows all
CC driver/uart.c
CC mqtt/proto.c
CC mqtt/wifi.c
CC mqtt/utils.c
CC mqtt/config.c
CC mqtt/mqtt_msg.c
CC mqtt/queue.c
CC mqtt/ringbuf.c
CC mqtt/mqtt.c
CC user/user_main.c
AR build/app_app.a
LD build/app.out
FW firmware/0x00000.bin
env: python: No such file or directory
C:/Users/Gyuri/workspace/MQTT_lex3/Makefile.windows:121: recipe for target 'firmware/0x00000.bin' failed
mingw32-make.exe: *** [firmware/0x00000.bin] Error 127
User avatar
By fenyvesi
#9163 Temporarily I found a solution: modified the standard Makefile in 2 points:

1. Added the extra mqtt include directory:
MODULES = driver mqtt user --line 135
2. Added the extra libs

LIBS = c gcc hal phy pp net80211 lwip wpa upgrade main ssl -line 139
User avatar
By bwhouse
#9170 Hi Tuanpm,

Thanks for all your work on this library it is working really well.

I have what is probably a stupid question because my C is very very rusty, but I had a problem that I think I nailed down to freeing dynamic memory allocation before the MQTT publish queue was complete. Basically I am constructing a bunch of msgs in to a char* pointer using os_sprintf then calling MQTT_Publish to publish the message, then I was calling os_free to free up the memory (see code below). I have noticed under some circumstances (I assume when the queue takes a second or two to publish) this causes the device to crash.

So my question is how should I be doing this? or should the publish queue send be clearing the memory?

Code: Select all   // Announce my existence
   char *helloWorld = "";
   int msg_len = os_sprintf(helloWorld, "Hello My name is %s I am currently located at %s \r\n", sysCfg.device_id, sysCfg.base_path);
   INFO(helloWorld);
   MQTT_Publish(client, "/syslog/", helloWorld , msg_len, 2, 0);
   //os_free(helloWorld);


Cheers,
Ben
User avatar
By tuanpm
#9171
bwhouse wrote:Hi Tuanpm,
So my question is how should I be doing this? or should the publish queue send be clearing the memory?
Cheers,
Ben

You will need to allocate memory for pointer before using:
Code: Select allchar *helloWorld = (char*) os_zalloc(128); /*allocate 128 bytes */
//or
char helloWorld[128];