tommie / esptool-ck

The ESP8266 build helper tool by Christian Klippel
GNU General Public License v2.0
35 stars 9 forks source link

Compile on Mac #2

Open 0xPIT opened 9 years ago

0xPIT commented 9 years ago

With this patch, it will compile on Mac OS 10.10:

diff --git a/binimage/esptool_binimage.c b/binimage/esptool_binimage.c
index 6879cbb..1231059 100644
--- a/binimage/esptool_binimage.c
+++ b/binimage/esptool_binimage.c
@@ -156,7 +156,7 @@ int binimage_write_close(uint32_t padsize)
             iprintf(-1, "cant write data block for segment  #%i to binimage file, aborting\r\n", cnt);
             close(b_image.image_file);
             b_image.image_file = 0;
-            return;
+            return 0;
         }

         total_size += b_image.segments[cnt].size;
diff --git a/elf/esptool_elf_object.c b/elf/esptool_elf_object.c
index a53cf03..69f9d82 100644
--- a/elf/esptool_elf_object.c
+++ b/elf/esptool_elf_object.c
@@ -22,6 +22,7 @@
  ***
  **/
 #include <stdlib.h>
+#include <string.h>

 #include "infohelper.h"
 #include "esptool_elf.h"
@@ -249,13 +250,13 @@ unsigned char* get_elf_section_bindata(Elf32_Half secnum, uint32_t pad_to)
             if(fseek(e_object.e_file, e_object.sections[secnum-1].offset, SEEK_SET) != 0)
             {
                 iprintf(-1, "can't seek to ELF file section %i binary datai\r\n", secnum);
-                return;
+                return 0;
             }

             if(fread(bindata, 1, e_object.sections[secnum-1].size, e_object.e_file) != e_object.sections[secnum-1].size)
             {
                 iprintf(-1, "can't read section #%i binary data from ELF file\r\n", secnum);
-                return;
+                return 0;
             }
jholster commented 9 years ago

I can confirm that this patch works on OS X Yosemite.

DJManas commented 8 years ago

Not working on ElCapitan, the changes are already there, I hope I am compiling it correctly by use of make. But dunno if these two problems are related:

gcc -Iinfohelper -Ielf -Ibinimage -Iargparse -Iserialport -Iespcomm -std=c99 -Os -Wall -D_POSIX_C_SOURCE=199309L -DLINUX -c serialport/serialport.c -o build/serialport/serialport.o serialport/serialport.c:242:31: error: use of undeclared identifier 'B57600' cfsetispeed(&term,B57600); ^ serialport/serialport.c:243:31: error: use of undeclared identifier 'B57600' cfsetospeed(&term,B57600); ^ serialport/serialport.c:247:31: error: use of undeclared identifier 'B115200' cfsetispeed(&term,B115200); ^ serialport/serialport.c:248:31: error: use of undeclared identifier 'B115200' cfsetospeed(&term,B115200); ^ serialport/serialport.c:252:31: error: use of undeclared identifier 'B230400' cfsetispeed(&term,B230400); ^ serialport/serialport.c:253:31: error: use of undeclared identifier 'B230400' cfsetospeed(&term,B230400); ^ 6 errors generated. make: *\ [build/serialport/serialport.o] Error 1

tommie commented 8 years ago

@0xPIT Sorry I didn't reply to this back in the December. I want to avoid this becoming the place where patches are introduced. I'd hoped CK would have an official repository set up at some point...

@DJManas Looks like they don't define the non-standard baudrate macros. There may be a macro you have to define (I'd be surprised if they don't exist at all).

DJManas commented 8 years ago

Thanks, I have solved it in different manner. I have setup the Arduino IDE for ESP8266 and it works. Thank you for quick reply.