Shop OBEX P1 Docs P2 Docs Learn Events
Parallax-ESP Module Latest Hack — Parallax Forums

Parallax-ESP Module Latest Hack

I took the liberty of updating the Parallax-ESP firmware code to fix some bugs and add some functions.
New functions:
1) Can hide and unhide the WiFi module from the programmer without rebooting module.
2) Can set IP address, Gateway, Mask and DNS server.
3) Can send and receive UDP packets.
Here is a sample program that demonstrates setting IP address and a UDP packet.
#include "wifi.h"
#include "simpletools.h"

fdserial *fd;
int handle;
char *reply;
char Buffer[1024];
unsigned char NTP[48];
char *Data;
char rqs[] = "time.windows.com";
int Port = 123;
time_t t;
struct tm *x;
int i;
unsigned long t1;


int main()
{
  fd = wifi_start(3, 4, 115200, USB_PGM_TERM);
  wifi_command("SET:station-ipaddr,101.1.1.42&101.1.1.4&255.255.255.0&101.1.1.1\r");
  wifi_join("<your ssid>", "<your password>");
  printi("Joined\r");
  //build udp connect
  sprintf(Buffer, "%c%s,%d\r", 0xDE, rqs, Port);
  reply = wifi_command(Buffer); 
  handle = -1;
  if (reply[1] == 'S')
    handle = reply[3] - '0';
  printi("handle: %d\r", handle);
  NTP[0] = 0x1b;
  wifi_send(handle, NTP, 48);
  pause(1000);
  wifi_recv(handle, NTP, 1024);
  wifi_disconnect(handle);
  for (i=0;i<48;i++)
    printi("%02x ", NTP[i]);
  t1 = NTP[40] << 24 | NTP[41] << 16 | NTP[42] << 8 | NTP[43];
  t1 = t1 - (25567 * 24 * 60 * 60);
  x = localtime(&t1);
  print("Date: %d/%d/%d\n", x->tm_mon+1, x->tm_mday, x->tm_year+1900);
  print("Time: %02d:%02d:%02d\n", x->tm_hour, x->tm_min, x->tm_sec);
  while(1)
  {
    pause(1000);
  } 
}
Since there is no function to do a UDP connection I had to hand code one. Setting the IP address has the following order IP, Gateway, Mask, and DNS.
This firmware is based on Expressif NONOS_SDK version 2.2.1. This is the same version that is used for their Arduino libraries.
To use the firmware just install this OTA file. If things don’t work out you can always load the original firmware back from Parallax’s website.

Mike

Parallax-ESP108.ota
«13456711

Comments

  • iseries wrote: »
    I took the liberty of updating the Parallax-ESP firmware code to fix some bugs and add some functions.
    New functions:
    1) Can hide and unhide the WiFi module from the programmer without rebooting module.
    2) Can set IP address, Gateway, Mask and DNS server.
    3) Can send and receive UDP packets.

    Mike,
    All of these functions are very useful.

    Thanks
    Shawn

  • If you want to share all the individual changed files, I can include these files in my thread.

    The OTA is not that useful for many that customize the module.

    Or you could make a git copy of the original with your changes on your git profile...
    (this makes it easier for users to see the changes also)
    https://github.com/parallaxinc/Parallax-ESP
  • It's been some time since I have looked at this. There are many changes that I needed to make.

    I created a pull request which should show all the changes.

    Mike
  • Oh, cool, I will look it over, thanks!
  • Clock LoopClock Loop Posts: 2,069
    edited 2020-09-03 08:25
    I didn't think the pull request would override the working copy that parallax has, its clearly not a drop in replacement, and requires different compile instructions, but those, were not added to the readme.

    I was hoping to give it a try before it was the master on Parallax-Esp.

    The changes cause problems with my compile instructions, I was hoping you would simply put it on your own git, did @"David Betz" know this would happen?
    make[1]: *** [Makefile:220: build/espfs/espfs.o] Error 1
    make[1]: Leaving directory '/Parallax-ESP/libesphttpd'
    make: *** [Makefile:243: libesphttpd] Error 2
    
    

    I do not know how to fix it, so if you would like to provide instructions on how to compile the Parallax-Esp master, please, tell me what to do.

    For now I will change the instructions I provide to use the old master WORKING copy.
  • Clock Loop wrote: »
    I didn't think the pull request would override the working copy that parallax has, its clearly not a drop in replacement, and requires different compile instructions, but those, were not added to the readme.

    I was hoping to give it a try before it was the master on Parallax-Esp.

    The changes cause problems with my compile instructions, I was hoping you would simply put it on your own git, did @"David Betz" know this would happen?
    make[1]: *** [Makefile:220: build/espfs/espfs.o] Error 1
    make[1]: Leaving directory '/Parallax-ESP/libesphttpd'
    make: *** [Makefile:243: libesphttpd] Error 2
    
    

    I do not know how to fix it, so if you would like to provide instructions on how to compile the Parallax-Esp master, please, tell me what to do.

    For now I will change the instructions I provide to use the old master WORKING copy.
    I guess I don't understand the process of pull requests. I thought you had just cloned our master repository and made some changes that you submitted as a pull request. Given that no one else has made changes in the repository recently, that should mean that after the pull request is merged our repositories should be identical. The why does yours build but ours doesn't?

  • Since the updated SDK includes a number of functions that were not there in the previous release, the 'libesphttpd' project needs to be updated.

    The 'espmissingincludes.h' needs to have a number of function prototypes removed before a clean compile will work.

    Here is an updated file that should work.

    Mike


  • iseries wrote: »
    Since the updated SDK includes a number of functions that were not there in the previous release, the 'libesphttpd' project needs to be updated.

    The 'espmissingincludes.h' needs to have a number of function prototypes removed before a clean compile will work.

    Here is an updated file that should work.

    Mike

    Thanks! I'll try this later today. Thanks for your work on improving the ESP firmware.

  • It still barks about two files.
    /Parallax-ESP/ESP8266_NONOS_SDK/lib/libmain.a(app_main.o): In function `user_uart_wait_tx_fifo_empty':
    (.irom0.text+0x7d8): undefined reference to `user_pre_init'
    /Parallax-ESP/ESP8266_NONOS_SDK/lib/libmain.a(app_main.o): In function `flash_data_check':
    (.irom0.text+0x844): undefined reference to `user_pre_init'
    collect2: error: ld returned 1 exit status
    make: *** [Makefile.ota:51: build/httpd.user1.out] Error 1
    
  • You must be using the wrong version of the SDK. Version 3 and above require you to define user_pre_init to address the partition table functions added in that release. See comment page here under notes: ESP8266_NONOS_SDK

    Mike
  • The first step in the https://github.com/parallaxinc/Parallax-ESP readme states
    Building
    
    As a first step, clone and follow the build instructions for esp-open-sdk:
    
    https://github.com/pfalcon/esp-open-sdk repository.
    
    
  • In your Parallax-ESP folder go into 'ESP8266_NONOS_SDK' and do a git status.

    It should return: 'HEAD detached at v2.2.1'

    Mike
  • Clock LoopClock Loop Posts: 2,069
    edited 2020-09-03 18:50
    This is what I git.
    /Parallax-ESP/ESP8266_NONOS_SDK$ git status
    HEAD detached at 3fe474e
    nothing to commit, working tree clean
    
  • Ok, that is wrong. Try doing a 'git checkout v2.2.1'

    Wrong link on github so that will need to get fixed.

    Mike
  • iseries wrote: »
    Ok, that is wrong. Try doing a 'git checkout v2.2.1'

    Wrong link on github so that will need to get fixed.

    Mike
    I'm now trying to use SDK v2.2.1 and am getting some odd errors about os_free and os_malloc:
    dbetz@Davids-Mac-mini-2 Parallax-ESP % make
    VERSION v1.0 (2020-09-03 14:20:07 29-ge0c7a81)
    SDK_BASE /Users/dbetz/Dropbox/parallax/Parallax-ESP/ESP8266_NONOS_SDK
    CC espfs/espfs.c
    CC espfs/heatshrink_decoder.c
    In file included from ./include/esp8266.h:33:0,
                     from espfs/heatshrink_decoder.c:9:
    /Users/dbetz/Dropbox/parallax/Parallax-ESP/ESP8266_NONOS_SDK/include/mem.h:47:40: error: expected declaration specifiers or '...' before string constant
     #define os_free(s)        vPortFree(s, "", 0)
                                            ^
    /Users/dbetz/Dropbox/parallax/Parallax-ESP/ESP8266_NONOS_SDK/include/mem.h:47:44: error: expected declaration specifiers or '...' before numeric constant
     #define os_free(s)        vPortFree(s, "", 0)
                                                ^
    /Users/dbetz/Dropbox/parallax/Parallax-ESP/ESP8266_NONOS_SDK/include/mem.h:48:43: error: expected declaration specifiers or '...' before string constant
     #define os_malloc(s)      pvPortMalloc(s, "", 0)
                                               ^
    /Users/dbetz/Dropbox/parallax/Parallax-ESP/ESP8266_NONOS_SDK/include/mem.h:48:47: error: expected declaration specifiers or '...' before numeric constant
     #define os_malloc(s)      pvPortMalloc(s, "", 0)
                                                   ^
    make[1]: *** [build/espfs/heatshrink_decoder.o] Error 1
    make: *** [libesphttpd] Error 2
    

  • iseries wrote: »
    Ok, that is wrong. Try doing a 'git checkout v2.2.1'

    Ok.
    Parallax-ESP/ESP8266_NONOS_SDK$ git checkout v2.2.1
    Previous HEAD position was 3fe474e Merge branch 'feature/update_bin' into 'master'
    HEAD is now at 9960ef3 feat(at): Update AT bin version 1.6.2
    

    It compiles ok now.
    /Parallax-ESP$ make
    VERSION v1.0 (2020-09-03 13:48:19 29-ge0c7a81)
    make[1]: Entering directory '/Parallax-ESP/libesphttpd'
    CC espfs/espfs.c
    CC espfs/heatshrink_decoder.c
    CC core/httpd-nonos.c
    CC core/httpd-freertos.c
    CC core/sha1.c
    CC core/httpdespfs.c
    CC core/auth.c
    CC core/base64.c
    CC core/httpd.c
    CC util/cgiwebsocket.c
    CC util/cgiflash.c
    CC util/captdns.c
    CC util/cgiwifi.c
    AR libesphttpd.a
    make[2]: Entering directory '/Parallax-ESP/libesphttpd/espfs/mkespfsimage'
    cc -I../../lib/heatshrink -I../../include -I.. -std=gnu99 -DESPFS_HEATSHRINK   -c -o main.o main.c
    cc -I../../lib/heatshrink -I../../include -I.. -std=gnu99 -DESPFS_HEATSHRINK   -c -o heatshrink_encoder.o heatshrink_encoder.c
    cc -o mkespfsimage main.o heatshrink_encoder.o
    make[2]: Leaving directory '/Parallax-ESP/libesphttpd/espfs/mkespfsimage'
    websocket/index.html (51%, heatshrink)
    logo.png (100%, none)
    settings.html (28%, heatshrink)
    w3.css (30%, heatshrink)
    style.css (40%, heatshrink)
    log.html (57%, heatshrink)
    update-ffs.html (46%, heatshrink)
    ui.js (43%, heatshrink)
    favicon.ico (78%, heatshrink)
    wifi/wifi.html (41%, heatshrink)
    wifi/style.css (94%, heatshrink)
    wifi/140medley.min.js (74%, heatshrink)
    wifi/icons.png (100%, none)
    wifi/connecting.html (52%, heatshrink)
    index.html (58%, heatshrink)
    newpage.html (59%, heatshrink)
    console.js (40%, heatshrink)
    flash/140medley.min.js (74%, heatshrink)
    flash/index.html (50%, heatshrink)
    make[1]: Leaving directory '/Parallax-ESP/libesphttpd'
    CC parallax/sscp-settings.c
    CC parallax/cgiprop.c
    CC parallax/sscp.c
    CC parallax/sscp-fs.c
    CC parallax/user_main.c
    CC parallax/discovery.c
    CC parallax/roffs.c
    CC parallax/sscp-udp.c
    CC parallax/sscp-tcp.c
    CC parallax/sscp-wifi.c
    CC parallax/sscp-ws.c
    CC parallax/sscp-cmds.c
    CC parallax/sscp-http.c
    CC parallax/httpdroffs.c
    CC parallax/proploader.c
    CC esp-link-stuff/crc16.c
    CC esp-link-stuff/log.c
    CC esp-link-stuff/uart.c
    CC esp-link-stuff/config.c
    CC esp-link-stuff/gpio-helpers.c
    CC esp-link-stuff/task.c
    CC esp-link-stuff/status.c
    CC esp-link-stuff/serbridge.c
    AR build/httpd_app.a
    LD build/httpd.user1.out
    LD build/httpd.user2.out
    APPGEN build/httpd.user1.bin
    1897813372
    1897813373
    ** user1.bin uses 324164 bytes of available
    APPGEN build/httpd.user2.bin
    -2132202412
    2132202411
    ** user1.bin uses 324164 bytes of available
    make -C libesphttpd/mkupgimg/
    make[1]: Entering directory '/Parallax-ESP/libesphttpd/mkupgimg'
    cc -o mkupgimg mkupgimg.c
    make[1]: Leaving directory '/Parallax-ESP/libesphttpd/mkupgimg'
    Header: 40 bytes, user1: 324164 bytes, user2: 324164 bytes.
    

    It works now! (for me)
    I did do a 'make clean' before make.
  • David BetzDavid Betz Posts: 14,511
    edited 2020-09-03 19:56
    You're doing better than I am. This is what I'm getting after commented out the heat shrink compressor and heavily modifying espmissingheaders.h. I don''t seem to have libhal. I assume this is because I have some build parameter wrong and I'm using the wrong libraries?
    dbetz@Davids-Mac-mini-2 Parallax-ESP % make
    VERSION v1.0 (2020-09-03 15:54:05 29-ge0c7a81)
    SDK_BASE /Users/dbetz/Dropbox/parallax/Parallax-ESP/ESP8266_NONOS_SDK
    CC espfs/espfs.c
    CC espfs/heatshrink_decoder.c
    CC core/auth.c
    CC core/base64.c
    CC core/httpd-freertos.c
    CC core/httpd-nonos.c
    CC core/httpd.c
    CC core/httpdespfs.c
    CC core/sha1.c
    CC util/captdns.c
    CC util/cgiflash.c
    CC util/cgiwebsocket.c
    CC util/cgiwifi.c
    AR libesphttpd.a
    cc -I../../lib/heatshrink -I../../include -I.. -std=gnu99 -DESPFS_HEATSHRINK   -c -o main.o main.c
    main.c:75:38: warning: passing 'char *' to parameter of type 'uint8_t *' (aka 'unsigned char *') converts between pointers to integer types with different sign [-Wpointer-sign]
                            sres=heatshrink_encoder_sink(enc, inp, insize, &len);
                                                              ^~~
    ../../lib/heatshrink/heatshrink_encoder.h:97:14: note: passing argument to parameter 'in_buf' here
        uint8_t *in_buf, size_t size, size_t *input_size);
                 ^
    main.c:81:38: warning: passing 'char *' to parameter of type 'uint8_t *' (aka 'unsigned char *') converts between pointers to integer types with different sign [-Wpointer-sign]
                            pres=heatshrink_encoder_poll(enc, outp, outsize, &len);
                                                              ^~~~
    ../../lib/heatshrink/heatshrink_encoder.h:102:14: note: passing argument to parameter 'out_buf' here
        uint8_t *out_buf, size_t out_buf_size, size_t *output_size);
                 ^
    2 warnings generated.
    cc -I../../lib/heatshrink -I../../include -I.. -std=gnu99 -DESPFS_HEATSHRINK   -c -o heatshrink_encoder.o heatshrink_encoder.c
    cc -o mkespfsimage main.o heatshrink_encoder.o
    wifi/140medley.min.js (74%, heatshrink)
    wifi/connecting.html (52%, heatshrink)
    wifi/icons.png (100%, none)
    wifi/wifi.html (41%, heatshrink)
    wifi/style.css (94%, heatshrink)
    websocket/index.html (51%, heatshrink)
    ui.js (43%, heatshrink)
    favicon.ico (78%, heatshrink)
    index.html (58%, heatshrink)
    console.js (40%, heatshrink)
    newpage.html (59%, heatshrink)
    flash/index.html (50%, heatshrink)
    flash/140medley.min.js (74%, heatshrink)
    logo.png (100%, none)
    w3.css (30%, heatshrink)
    log.html (57%, heatshrink)
    style.css (40%, heatshrink)
    update-ffs.html (46%, heatshrink)
    settings.html (28%, heatshrink)
    CC parallax/cgiprop.c
    CC parallax/discovery.c
    CC parallax/httpdroffs.c
    CC parallax/proploader.c
    CC parallax/roffs.c
    CC parallax/sscp-cmds.c
    CC parallax/sscp-fs.c
    CC parallax/sscp-http.c
    CC parallax/sscp-settings.c
    CC parallax/sscp-tcp.c
    CC parallax/sscp-udp.c
    CC parallax/sscp-wifi.c
    CC parallax/sscp-ws.c
    CC parallax/sscp.c
    CC parallax/user_main.c
    CC esp-link-stuff/config.c
    CC esp-link-stuff/crc16.c
    CC esp-link-stuff/gpio-helpers.c
    CC esp-link-stuff/log.c
    CC esp-link-stuff/serbridge.c
    CC esp-link-stuff/status.c
    CC esp-link-stuff/task.c
    CC esp-link-stuff/uart.c
    AR build/httpd_app.a
    LD build/httpd.user1.out
    /Users/dbetz/esp8266/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/5.2.0/../../../../xtensa-lx106-elf/bin/ld: cannot find -lhal
    collect2: error: ld returned 1 exit status
    make: *** [build/httpd.user1.out] Error 1
    
  • Is anyone actually using the FREERTOS build option?
  • Clock LoopClock Loop Posts: 2,069
    edited 2020-09-03 20:37
    David Betz wrote: »
    Is anyone actually using the FREERTOS build option?

    I'm not, you can see what I am doing in my thread, super basic.
    https://forums.parallax.com/discussion/comment/1452980/#Comment_1452980

    Except for this test, I am not changing my head. I just do the stuff shown here at that point.

    When I run into issues like that I start deleting entire directories and re getting it all.



    Now I gotta flash it and run it around the block.


    Thanks you guyz.
  • Clock LoopClock Loop Posts: 2,069
    edited 2020-09-03 21:53
    If anyone wants to fix the /Parallax-ESP/release/flash-all.sh so it works with the latest version of esptool.py
    Heres the working script.

    Removed old version, new one below.
  • Clock LoopClock Loop Posts: 2,069
    edited 2020-09-03 21:54
    oh, well we have different files now

    Do I just use the latest versions?

    /Parallax-ESP/ESP8266_NONOS_SDK/bin/boot_v1.7.bin
    /Parallax-ESP/ESP8266_NONOS_SDK/bin/blank.bin
    /Parallax-ESP/ESP8266_NONOS_SDK/bin/esp_init_data_default_v08.bin

    Or does this cause problems?
    none so far.

    And if so, this is the new new flash-all.sh
    # flash the firmware
    # and clear out all settings and the user flash filesystem
    
    PORT=/dev/ttyUSB0
    if [ ! -z $1 ]
    then
      PORT=$1
    fi
    echo Using port $PORT
    
    BAUD=115200
    FLASH_SIZE=4MB          # 16MB, detect, 256KB, 2MB-c1, 8MB, 2MB, 4MB, 512KB, 1MB, 4MB-c1
    FLASH_BLOCK_SIZE=1024
    FLASH_SPEED=80m         # keep,40m,26m,20m,80m
    FLASH_INTERFACE=qio     # keep,qio,qout,dio,dout
    
    BOOT_LOADER=0x000000
    USER1_IMAGE=0x001000
    
    USER_SETTINGS1=0x07E000
    USER_SETTINGS2=0x07F000
    
    if [ $FLASH_SIZE = 1MB ]; then
    WIFI_SETTINGS1=0x0FC000
    WIFI_SETTINGS2=0x0FE000
    WIFI_SETTINGS3=0x0FA000
    elif [ $FLASH_SIZE = 2MB ]; then
    WIFI_SETTINGS1=0x1FC000
    WIFI_SETTINGS2=0x1FE000
    WIFI_SETTINGS3=0x1FA000
    elif [ $FLASH_SIZE = 4MB ]; then
    WIFI_SETTINGS1=0x3FC000
    WIFI_SETTINGS2=0x3FE000
    WIFI_SETTINGS3=0x3FA000
    else
    echo Unsupported flash size $FLASH_SIZE
    exit 1
    fi
    
    #flash filesystem base
    FFS_BASE=0x100000
    
    ./esptool.py \
    --port $PORT \
    --baud $BAUD \
    write_flash \
    --flash_freq $FLASH_SPEED \
    --flash_mode $FLASH_INTERFACE \
    --flash_size $FLASH_SIZE \
    --verify \
    --compress \
    $BOOT_LOADER boot_v1.7.bin \
    $USER1_IMAGE httpd.user1.bin \
    $USER_SETTINGS1 blank.bin \
    $USER_SETTINGS2 blank.bin \
    $WIFI_SETTINGS1 esp_init_data_default_v08.bin \
    $WIFI_SETTINGS2 blank.bin \
    $WIFI_SETTINGS3 blank.bin \
    $FFS_BASE blank.bin
    

    So far so good.

    I see the hide from loader option.
    HideFromLoader.jpg


    Still good, I have uploaded programs to the prop using SimpleIDE, FlexGUI both in windows.
    I uploaded the val-from-micro.html along with its c-code and it works properly.
    I have also uploaded my own test code, working fine.

    The debug port works good, so does changing the reset line to cts...
    AP mode works good, I have yet to test other modes.
    STA + AP scans for networks properly, sees them.
    ...
    So looks like using the new version of flash files is A GO!
    333 x 40 - 8K
  • Are either of you doing this on a Mac? How did you setup your environment? Did you just use esp-open-sdk or did you install the Espressif tools directly? I tried installing the toolchain and the SDK and it mostly works but, as I mentioned, my install seems to be missing libhal.a. I looked into installing esp-open-sdk but it required to install brew and create a case-sensitive filesystem. I haven't finished that process and would rather not have all that baggage on my system. Is that the only approach that works on the Mac?
  • Clock LoopClock Loop Posts: 2,069
    edited 2020-09-03 23:04
    I am on debian 10.

    I used esp-open-sdk.

    And I always forget to do:
    export XTENSA_TOOLS_ROOT=/esp-open-sdk/xtensa-lx106-elf/bin/
    

    Because I am too lazy to look up where to put it so it runs at boot.

    It compiles on a raspberrypi running raspbian, if you have one. (it just takes many hours to compile)
  • I have Ubuntu in Azure in cloud. No hardware.

    Mike
  • Clock LoopClock Loop Posts: 2,069
    edited 2020-09-03 23:40
    Should this file be changed to point to the new files?

    /Parallax-Esp/release/Makefile
    (which i guess is why my old flash-all.sh was not working.

    Also is there a way to make the Makefile get the esptool.py file in the repo and copy it into /Parallax-Esp/release/ ?
    Then it can be copied to the /Parallax-Esp/release/release/ folder so the flash-all.sh works.
    https://raw.githubusercontent.com/espressif/esptool/master/esptool.py
    I am pretty new to all this...

    Makefile
    #SDK=../../esp_iot_sdk_v1.5.2
    #SDK=../esp_iot_sdk_v2.0.0.p1
    SDK=../ESP8266_NONOS_SDK
    
    
    ZIP=parallax-esp-$(shell date "+%Y-%m-%d-%H%M").zip
    $(info ZIP $(ZIP))
    
    IMAGES=\
    release/httpd.user1.bin \
    release/httpd.user2.bin \
    release/Parallax-ESP.ota \
    release/blank.bin \
    release/esp_init_data_default_v08.bin
    
    #IMAGES+=release/boot_v1.5.bin
    #IMAGES+=release/boot_v1.6.bin
    IMAGES+=release/boot_v1.7.bin
    
    CP=cp
    
    # this rule doesn't seem to work but running build followed by zip does
    all:	clean
    	$(MAKE) build
    	$(MAKE) zip
    
    zip:	staged-files
    	cd release; zip -r ../$(ZIP) *
    
    build:
    	$(MAKE) -C .. STA_SSID= STA_PASS= clean
    	$(MAKE) -C .. STA_SSID= STA_PASS=
    
    staged-files:	release release/release-notes.txt $(IMAGES)
    	$(CP) flash-all.sh update-fw.sh clear.sh clear-ffs.sh release
    
    release/release-notes.txt:	release-notes.txt
    	$(CP) release-notes.txt release
    
    release/boot_v1.%.bin:	$(SDK)/bin/boot_v1.%.bin patch
    	./patch $< $@ 2M
    
    release/%:	../build/%
    	$(CP) $< $@
    
    release/Parallax-ESP.ota:	../build/httpd.ota
    	$(CP) $< $@
    
    release/blank.bin:	$(SDK)/bin/blank.bin
    	$(CP) $< $@
    
    #release/esp_init_data_default.bin:	$(SDK)/bin/esp_init_data_default.bin
    release/esp_init_data_default_v08.bin:	$(SDK)/bin/esp_init_data_default_v08.bin
    	$(CP) $< $@
    
    release:
    	mkdir -p release
    
    patch:	patch.c
    	cc -o $@ $<
    
    clean:
    	rm -rf release patch esp-httpd.zip
    
  • iseries wrote: »
    I have Ubuntu in Azure in cloud. No hardware.

    Mike
    I used Ubuntu when I developed the code originally but I'd like to be able to do it on the Mac since that is my main machine. I found a libhal.a that seems to work but now I have to resolve the problem with vPortFree.

  • Clock LoopClock Loop Posts: 2,069
    edited 2020-09-04 00:14
    Does this line in the /Parallax-Esp/release/Makefile
    release/boot_v1.%.bin:	$(SDK)/bin/boot_v1.%.bin patch
    	./patch $< $@ 2M
    

    Need to be changed for 4M???
    release/boot_v1.%.bin:	$(SDK)/bin/boot_v1.%.bin patch
    	./patch $< $@ 4M
    
    Or is that not for RAM...

    Oh it is RAM, I just tried to test for versioning, and it talked about ram.
    So perhaps that needs to be changed also.
  • Clock LoopClock Loop Posts: 2,069
    edited 2020-09-04 00:29
    I changed the /Parallax-Esp/release/Makefile

    So it uses all the new files, uses 4M for flash size (but is that needed?, since @"David Betz" has previously said that only 2M is required for OTA updates)
    That would just make the users be forced to purchase a ParallaxWx module (MWAHAHAHAHAH)
    For now I will just keep it 2M

    I changed the makefile so it looks for esptool the same way it looked for "../../esp_iot_sdk_v1.5.2" previously.
    This means the users would need to run
     git clone --recursive https://github.com/espressif/esptool
    
    Before running the Parallax-Esp git, in the same directory that the Parallax-Esp is git from.
    That seems acceptable due to the sdk needing to be run like that.

    Heres the new /Parallax-Esp/release/Makefile
    #SDK=../../esp_iot_sdk_v1.5.2
    #SDK=../esp_iot_sdk_v2.0.0.p1
    SDK=../ESP8266_NONOS_SDK
    ESPTOOL=../../esptool
    
    
    ZIP=parallax-esp-$(shell date "+%Y-%m-%d-%H%M").zip
    $(info ZIP $(ZIP))
    
    IMAGES=\
    release/httpd.user1.bin \
    release/httpd.user2.bin \
    release/Parallax-ESP.ota \
    release/blank.bin \
    release/esp_init_data_default_v08.bin \
    release/esptool.py
    
    #IMAGES+=release/boot_v1.5.bin
    #IMAGES+=release/boot_v1.6.bin
    IMAGES+=release/boot_v1.7.bin
    
    CP=cp
    
    # this rule doesn't seem to work but running build followed by zip does
    all:	clean
    	$(MAKE) build
    	$(MAKE) zip
    
    zip:	staged-files
    	cd release; zip -r ../$(ZIP) *
    
    build:
    	$(MAKE) -C .. STA_SSID= STA_PASS= clean
    	$(MAKE) -C .. STA_SSID= STA_PASS=
    
    staged-files:	release release/release-notes.txt $(IMAGES)
    	$(CP) flash-all.sh update-fw.sh clear.sh clear-ffs.sh release
    
    release/release-notes.txt:	release-notes.txt
    	$(CP) release-notes.txt release
    
    release/boot_v1.%.bin:	$(SDK)/bin/boot_v1.%.bin patch
    	./patch $< $@ 2M
    
    release/%:	../build/%
    	$(CP) $< $@
    
    release/Parallax-ESP.ota:	../build/httpd.ota
    	$(CP) $< $@
    
    release/blank.bin:	$(SDK)/bin/blank.bin
    	$(CP) $< $@
    
    #release/esp_init_data_default.bin:	$(SDK)/bin/esp_init_data_default.bin
    release/esp_init_data_default_v08.bin:	$(SDK)/bin/esp_init_data_default_v08.bin
    	$(CP) $< $@
    
    release/esptool.py:	$(ESPTOOL)/esptool.py
    	$(CP) $< $@
    
    release:
    	mkdir -p release
    
    patch:	patch.c
    	cc -o $@ $<
    
    clean:
    	rm -rf release patch esp-httpd.zip
    

    Someone can put this on github, I am not familiar on how to suggest/do it, I don't need credit. Its here.
    The readme file should be updated to tell users to GIT esptool.
  • Clock LoopClock Loop Posts: 2,069
    edited 2020-09-04 00:48
    So it all works now.
    :~/Parallax-ESP/release$ make
    ZIP parallax-esp-2020-09-03-1825.zip
    rm -rf release patch esp-httpd.zip
    make build
    make[1]: Entering directory '/Parallax-ESP/release'
    ZIP parallax-esp-2020-09-03-1825.zip
    make -C .. STA_SSID= STA_PASS= clean
    make[2]: Entering directory '/Parallax-ESP'
    VERSION v1.0 (2020-09-03 18:25:35 29-ge0c7a81)
    make[3]: Entering directory '/Parallax-ESP/libesphttpd'
    make[4]: Entering directory '/Parallax-ESP/libesphttpd/espfs/mkespfsimage'
    rm -f mkespfsimage main.o heatshrink_encoder.o
    make[4]: Leaving directory '/Parallax-ESP/libesphttpd/espfs/mkespfsimage'
    make[3]: Leaving directory '/Parallax-ESP/libesphttpd'
    make[2]: Leaving directory '/Parallax-ESP'
    make -C .. STA_SSID= STA_PASS=
    make[2]: Entering directory '/Parallax-ESP'
    VERSION v1.0 (2020-09-03 18:25:35 29-ge0c7a81)
    make[3]: Entering directory '/Parallax-ESP/libesphttpd'
    CC espfs/espfs.c
    CC espfs/heatshrink_decoder.c
    CC core/httpd-nonos.c
    CC core/httpd-freertos.c
    CC core/sha1.c
    CC core/httpdespfs.c
    CC core/auth.c
    CC core/base64.c
    CC core/httpd.c
    CC util/cgiwebsocket.c
    CC util/cgiflash.c
    CC util/captdns.c
    CC util/cgiwifi.c
    AR libesphttpd.a
    make[4]: Entering directory '/Parallax-ESP/libesphttpd/espfs/mkespfsimage'
    cc -I../../lib/heatshrink -I../../include -I.. -std=gnu99 -DESPFS_HEATSHRINK   -c -o main.o main.c
    cc -I../../lib/heatshrink -I../../include -I.. -std=gnu99 -DESPFS_HEATSHRINK   -c -o heatshrink_encoder.o heatshrink_encoder.c
    cc -o mkespfsimage main.o heatshrink_encoder.o
    make[4]: Leaving directory '/Parallax-ESP/libesphttpd/espfs/mkespfsimage'
    websocket/index.html (51%, heatshrink)
    settings.html (28%, heatshrink)
    w3.css (30%, heatshrink)
    style.css (40%, heatshrink)
    log.html (57%, heatshrink)
    update-ffs.html (46%, heatshrink)
    ui.js (43%, heatshrink)
    favicon.ico (42%, heatshrink)
    logo.jpg (100%, none)
    wifi/wifi.html (41%, heatshrink)
    wifi/style.css (94%, heatshrink)
    wifi/140medley.min.js (74%, heatshrink)
    wifi/icons.png (100%, none)
    wifi/connecting.html (52%, heatshrink)
    index.html (58%, heatshrink)
    newpage.html (59%, heatshrink)
    console.js (40%, heatshrink)
    flash/140medley.min.js (74%, heatshrink)
    flash/index.html (50%, heatshrink)
    make[3]: Leaving directory '/Parallax-ESP/libesphttpd'
    CC parallax/sscp-settings.c
    CC parallax/cgiprop.c
    CC parallax/sscp.c
    CC parallax/sscp-fs.c
    CC parallax/user_main.c
    CC parallax/discovery.c
    CC parallax/roffs.c
    CC parallax/sscp-udp.c
    CC parallax/sscp-tcp.c
    CC parallax/sscp-wifi.c
    CC parallax/sscp-ws.c
    CC parallax/sscp-cmds.c
    CC parallax/sscp-http.c
    CC parallax/httpdroffs.c
    CC parallax/proploader.c
    CC esp-link-stuff/crc16.c
    CC esp-link-stuff/log.c
    CC esp-link-stuff/uart.c
    CC esp-link-stuff/config.c
    CC esp-link-stuff/gpio-helpers.c
    CC esp-link-stuff/task.c
    CC esp-link-stuff/status.c
    CC esp-link-stuff/serbridge.c
    AR build/httpd_app.a
    LD build/httpd.user1.out
    LD build/httpd.user2.out
    APPGEN build/httpd.user1.bin
    486513152
    486513153
    ** user1.bin uses 335220 bytes of available
    APPGEN build/httpd.user2.bin
    1965086859
    1965086860
    ** user1.bin uses 335220 bytes of available
    Header: 40 bytes, user1: 335220 bytes, user2: 335220 bytes.
    make[2]: Leaving directory '/Parallax-ESP'
    make[1]: Leaving directory '/Parallax-ESP/release'
    make zip
    make[1]: Entering directory '/Parallax-ESP/release'
    ZIP parallax-esp-2020-09-03-1825.zip
    mkdir -p release
    cp release-notes.txt release
    cp ../build/httpd.user1.bin release/httpd.user1.bin
    cp ../build/httpd.user2.bin release/httpd.user2.bin
    cp ../build/httpd.ota release/Parallax-ESP.ota
    cp ../ESP8266_NONOS_SDK/bin/blank.bin release/blank.bin
    cp ../ESP8266_NONOS_SDK/bin/esp_init_data_default_v08.bin release/esp_init_data_default_v08.bin
    cp ../../esptool/esptool.py release/esptool.py
    cc -o patch patch.c
    ./patch ../ESP8266_NONOS_SDK/bin/boot_v1.7.bin release/boot_v1.7.bin 2M
    cp flash-all.sh update-fw.sh clear.sh clear-ffs.sh release
    cd release; zip -r ../parallax-esp-2020-09-03-1825.zip *
      adding: Parallax-ESP.ota (deflated 24%)
      adding: blank.bin (deflated 100%)
      adding: boot_v1.7.bin (deflated 28%)
      adding: clear-ffs.sh (deflated 33%)
      adding: clear.sh (deflated 58%)
      adding: esp_init_data_default_v08.bin (deflated 46%)
      adding: esptool.py (deflated 66%)
      adding: flash-all.sh (deflated 56%)
      adding: httpd.user1.bin (deflated 24%)
      adding: httpd.user2.bin (deflated 24%)
      adding: release-notes.txt (deflated 29%)
      adding: update-fw.sh (deflated 35%)
    make[1]: Leaving directory '/Parallax-ESP/release'
    


    And the flashing of the module.
    :~/Parallax-ESP/release$ cd release
    :~/Parallax-ESP/release/release$ ./flash-all.sh
    Using port /dev/ttyUSB0
    esptool.py v3.0-dev
    Serial port /dev/ttyUSB0
    Connecting.....
    Detecting chip type... ESP8266
    Chip is ESP8266EX
    Features: WiFi
    Crystal is 26MHz
    MAC: xx:xx:xx:xx:xx:xx
    Uploading stub...
    Running stub...
    Stub running...
    Configuring flash size...
    Flash params set to 0x004f
    Compressed 4080 bytes to 2936...
    Wrote 4080 bytes (2936 compressed) at 0x00000000 in 0.3 seconds (effective 120.0 kbit/s)...
    Hash of data verified.
    Compressed 335220 bytes to 253961...
    Wrote 335220 bytes (253961 compressed) at 0x00001000 in 22.5 seconds (effective 119.0 kbit/s)...
    Hash of data verified.
    Compressed 4096 bytes to 26...
    Wrote 4096 bytes (26 compressed) at 0x0007e000 in 0.0 seconds (effective 2056.6 kbit/s)...
    Hash of data verified.
    Compressed 4096 bytes to 26...
    Wrote 4096 bytes (26 compressed) at 0x0007f000 in 0.0 seconds (effective 2042.5 kbit/s)...
    Hash of data verified.
    Compressed 128 bytes to 75...
    Wrote 128 bytes (75 compressed) at 0x003fc000 in 0.0 seconds (effective 63.7 kbit/s)...
    Hash of data verified.
    Compressed 4096 bytes to 26...
    Wrote 4096 bytes (26 compressed) at 0x003fe000 in 0.0 seconds (effective 2046.8 kbit/s)...
    Hash of data verified.
    Compressed 4096 bytes to 26...
    Wrote 4096 bytes (26 compressed) at 0x003fa000 in 0.0 seconds (effective 2055.2 kbit/s)...
    Hash of data verified.
    Compressed 4096 bytes to 26...
    Wrote 4096 bytes (26 compressed) at 0x00100000 in 0.0 seconds (effective 2041.4 kbit/s)...
    Hash of data verified.
    
    Leaving...
    Verifying just-written flash...
    (This option is deprecated, flash contents are now always read back after flashing.)
    Flash params set to 0x004f
    Verifying 0xff0 (4080) bytes @ 0x00000000 in flash against boot_v1.7.bin...
    -- verify OK (digest matched)
    Verifying 0x51d74 (335220) bytes @ 0x00001000 in flash against httpd.user1.bin...
    -- verify OK (digest matched)
    Verifying 0x1000 (4096) bytes @ 0x0007e000 in flash against blank.bin...
    -- verify OK (digest matched)
    Verifying 0x1000 (4096) bytes @ 0x0007f000 in flash against blank.bin...
    -- verify OK (digest matched)
    Verifying 0x80 (128) bytes @ 0x003fc000 in flash against esp_init_data_default_v08.bin...
    -- verify OK (digest matched)
    Verifying 0x1000 (4096) bytes @ 0x003fe000 in flash against blank.bin...
    -- verify OK (digest matched)
    Verifying 0x1000 (4096) bytes @ 0x003fa000 in flash against blank.bin...
    -- verify OK (digest matched)
    Verifying 0x1000 (4096) bytes @ 0x00100000 in flash against blank.bin...
    -- verify OK (digest matched)
    Hard resetting via RTS pin...
    :~/Parallax-ESP/release/release$ 
    

    Time for a ROOT beer.

    If someone could push this new makefile to github along with the fixes that @iseries found in this thread to make the new sdk work, along with any mac issues @"David Betz" can resolve, then I can change my instructions page to be much more simplified, and don't forget the readme needs to tell users to git the esptool also.

    I would do it, but I have never done that before.
    :)
  • Maybe I should just let you two take this over. I haven't been able to build it myself.
Sign In or Register to comment.