Building for esp32 on Mac OS question

Posted on
  • I need to use SD card and disable FlashFS so I followed the instructions on https://www.espruino.com/ESP32. When I run make make clean && BOARD=ESP32 make, I hit error:
    espruino/Espruino/xtensa-esp32-elf/bin//xtensa-esp32-elf-gcc: cannot execute binary file

    I suspect this is related to not having the build tools needed for Mac. If so what do I need in order to run make?

  • Try source scripts/provision.sh ESP32. That should download & set up the toolchain.

  • Thanks, that was what I did. It downloaded the idf and extensa stuff into folders, but running make command printed a couple of the ‘cannot execute binary file’ errors.

    The ESP32 page in Espruino mentioned getting build tools beforehand but
    apt-get build-tools as example given does not run on Mac OS. I wonder if I’m missing that step.

  • Tried to use Vagrant and the vagrantfile in the repo folder. All pre-req scripts ran fine. But when I tried to do a make I get errors... :( :

    Is making your own build is a requirement to use SD card on ESP32?

    Bash output when I try to do a make from the VM (I'm totally clueless about non-web build systems):

    vagrant@vagrant-ubuntu-trusty-64:/vagrant$ sudo make clean && BOARD=ESP32 make
    Cleaning targets
    
    Generating platform configs
    Generating pin info
    Generating JS wrappers
    WRAPPERSOURCES = src/jswrap_array.c src/jswrap_arraybuffer.c src/jswrap_dataview.c src/jswrap_date.c src/jswrap_error.c src/jswrap_espruino.c src/jswrap_flash.c src/jswrap_functions.c src/jswrap_interactive.c src/jswrap_io.c src/jswrap_json.c src/jswrap_modules.c src/jswrap_pin.c src/jswrap_number.c src/jswrap_object.c src/jswrap_onewire.c src/jswrap_pipe.c src/jswrap_process.c src/jswrap_promise.c src/jswrap_regexp.c src/jswrap_serial.c src/jswrap_storage.c src/jswrap_spi_i2c.c src/jswrap_stream.c src/jswrap_string.c src/jswrap_waveform.c libs/compression/jswrap_heatshrink.c libs/filesystem/jswrap_fs.c libs/filesystem/jswrap_file.c libs/math/jswrap_math.c libs/graphics/jswrap_graphics.c libs/network/jswrap_net.c libs/network/http/jswrap_http.c libs/network/js/jswrap_jsnetwork.c libs/network/jswrap_wifi.c libs/network/esp32/jswrap_esp32_network.c targets/esp32/jswrap_esp32.c libs/network/telnet/jswrap_telnet.c libs/bluetooth/jswrap_bluetooth.c libs/crypto/jswrap_crypto.c libs/neopixel/jswrap_neopixel.c
    DEFINES = -DGIT_COMMIT=1921e46 -DBUILDNUMBER="274" -DESP_PLATFORM -DESP32=1 -DJSVAR_MALLOC -DUSE_DEBUGGER -DUSE_TAB_COMPLETE -DUSE_HEATSHRINK -DUSE_FILESYSTEM -DUSE_FLASHFS -DUSE_MATH -DUSE_GRAPHICS -DUSE_NET -DUSE_ESP32 -DUSE_TELNET -DBLUETOOTH -DUSE_CRYPTO -DMBEDTLS_CIPHER_MODE_CTR -DMBEDTLS_CIPHER_MODE_CBC -DMBEDTLS_CIPHER_MODE_CFB -DUSE_SHA256 -DUSE_SHA512 -DUSE_TLS -DUSE_AES -DUSE_NEOPIXEL -DESP32 -DEMBEDDED
    CC libs/compression/heatshrink/heatshrink_encoder.o
    CC libs/compression/heatshrink/heatshrink_decoder.o
    CC libs/compression/compress_heatshrink.o
    In file included from libs/compression/heatshrink/heatshrink_decoder.h:7:0,
                     from libs/compression/heatshrink/heatshrink_decoder.c:3:
    libs/compression/heatshrink/heatshrink_decoder.c: In function 'heatshrink_decoder_sink':
    libs/compression/heatshrink/heatshrink_config.h:8:45: warning: conversion to 'size_t {aka unsigned int}' from 'int' may change the sign of the result [-Wsign-conversion]
     [#define](https://forum.espruino.com/search/?q=%23define) HEATSHRINK_STATIC_INPUT_BUFFER_SIZE 32
                                                 ^
    libs/compression/heatshrink/heatshrink_decoder.h:37:5: note: in expansion of macro 'HEATSHRINK_STATIC_INPUT_BUFFER_SIZE'
         HEATSHRINK_STATIC_INPUT_BUFFER_SIZE
         ^
    libs/compression/heatshrink/heatshrink_decoder.c:101:18: note: in expansion of macro 'HEATSHRINK_DECODER_INPUT_BUFFER_SIZE'
         size_t rem = HEATSHRINK_DECODER_INPUT_BUFFER_SIZE(hsd) - hsd->input_size;
                      ^
    libs/compression/heatshrink/heatshrink_decoder.c:111:24: warning: conversion to 'uint16_t {aka short unsigned int}' from 'size_t {aka unsigned int}' may alter its value [-Wconversion]
         hsd->input_size += size;
                            ^
    libs/compression/heatshrink/heatshrink_decoder.c: In function 'st_yield_literal':
    libs/compression/heatshrink/heatshrink_decoder.c:210:21: warning: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Wconversion]
             uint8_t c = byte & 0xFF;
                         ^
    libs/compression/heatshrink/heatshrink_decoder.c: In function 'st_backref_index_msb':
    libs/compression/heatshrink/heatshrink_decoder.c:223:35: warning: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Wconversion]
         uint16_t bits = get_bits(hsd, bit_ct - 8);
                                       ^
    libs/compression/heatshrink/heatshrink_decoder.c:226:25: warning: conversion to 'uint16_t {aka short unsigned int}' from 'int' may alter its value [-Wconversion]
         hsd->output_index = bits << 8;
                             ^
    libs/compression/heatshrink/heatshrink_encoder.c: In function 'heatshrink_encoder_sink':
    libs/compression/heatshrink/heatshrink_decoder.c: In function 'st_backref_count_msb':
    libs/compression/heatshrink/heatshrink_decoder.c:245:35: warning: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Wconversion]
         uint16_t bits = get_bits(hsd, br_bit_ct - 8);
                                       ^
    libs/compression/heatshrink/heatshrink_decoder.c:248:25: warning: conversion to 'uint16_t {aka short unsigned int}' from 'int' may alter its value [-Wconversion]
         hsd->output_count = bits << 8;
                             ^
    libs/compression/heatshrink/heatshrink_encoder.c:149:29: warning: conversion to 'uint16_t {aka short unsigned int}' from 'int' may alter its value [-Wconversion]
         uint16_t write_offset = get_input_offset(hse) + hse->input_size;
                                 ^
    libs/compression/heatshrink/heatshrink_encoder.c:151:20: warning: conversion to 'uint16_t {aka short unsigned int}' from 'int' may alter its value [-Wconversion]
         uint16_t rem = ibs - hse->input_size;
                        ^
    libs/compression/heatshrink/heatshrink_encoder.c:152:22: warning: conversion to 'uint16_t {aka short unsigned int}' from 'size_t {aka unsigned int}' may alter its value [-Wconversion]
         uint16_t cp_sz = rem < size ? rem : size;
                          ^
    libs/compression/heatshrink/heatshrink_decoder.c: In function 'st_yield_backref':
    libs/compression/heatshrink/heatshrink_decoder.c:282:30: warning: conversion to 'uint16_t {aka short unsigned int}' from 'size_t {aka unsigned int}' may alter its value [-Wconversion]
             hsd->output_count -= count;
                                  ^
    libs/compression/heatshrink/heatshrink_encoder.c:156:24: warning: conversion to 'uint16_t {aka short unsigned int}' from 'int' may alter its value [-Wconversion]
         hse->input_size += cp_sz;
                            ^
    libs/compression/heatshrink/heatshrink_decoder.c: In function 'get_bits':
    libs/compression/heatshrink/heatshrink_decoder.c:317:25: warning: conversion to 'uint16_t {aka short unsigned int}' from 'int' may alter its value [-Wconversion]
             accumulator <<= 1;
                             ^
    libs/compression/heatshrink/heatshrink_encoder.c: In function 'st_step_search':
    libs/compression/heatshrink/heatshrink_encoder.c:276:20: warning: conversion to 'uint16_t {aka short unsigned int}' from 'int' may alter its value [-Wconversion]
         uint16_t end = input_offset + msi;
                        ^
    libs/compression/heatshrink/heatshrink_encoder.c:277:22: warning: conversion to 'uint16_t {aka short unsigned int}' from 'int' may alter its value [-Wconversion]
         uint16_t start = end - window_length;
                          ^
    libs/compression/heatshrink/heatshrink_encoder.c:281:24: warning: conversion to 'uint16_t {aka short unsigned int}' from 'int' may alter its value [-Wconversion]
             max_possible = hse->input_size - msi;
                            ^
    libs/compression/heatshrink/heatshrink_encoder.c: In function 'st_yield_tag_bit':
    libs/compression/heatshrink/heatshrink_encoder.c:311:34: warning: conversion to 'uint16_t {aka short unsigned int}' from 'int' may alter its value [-Wconversion]
                 hse->outgoing_bits = hse->match_pos - 1;
                                      ^
    libs/compression/heatshrink/heatshrink_encoder.c: In function 'st_yield_br_inde':
    libs/compression/heatshrink/heatshrink_encoder.c:337:34: warning: conversion to 'uint16_t {aka short unsigned int}' from 'int' may alter its value [-Wconversion]
                 hse->outgoing_bits = hse->match_length - 1;
                                      ^
    libs/compression/heatshrink/heatshrink_encoder.c: In function 'st_yield_br_length':
    libs/compression/heatshrink/heatshrink_encoder.c:353:38: warning: conversion to 'uint16_t {aka short unsigned int}' from 'int' may alter its value [-Wconversion]
                 hse->match_scan_index += hse->match_length;
                                          ^
    libs/compression/heatshrink/heatshrink_encoder.c: In function 'find_longest_match':
    libs/compression/heatshrink/heatshrink_encoder.c:492:14: warning: conversion to 'int16_t {aka short int}' from 'int' may alter its value [-Wconversion]
         for (pos=end - 1; pos - (int16_t)start >= 0; pos--) {
                  ^
    libs/compression/heatshrink/heatshrink_encoder.c:505:31: warning: conversion to 'uint16_t {aka short unsigned int}' from 'int16_t {aka short int}' may change the sign of the result [-Wsign-conversion]
                     match_index = pos;
                                   ^
    libs/compression/heatshrink/heatshrink_encoder.c:524:16: warning: conversion to 'uint16_t {aka short unsigned int}' from 'int' may alter its value [-Wconversion]
             return end - match_index;
                    ^
    libs/compression/heatshrink/heatshrink_encoder.c: In function 'push_outgoing_bits':
    libs/compression/heatshrink/heatshrink_encoder.c:535:16: warning: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Wconversion]
             bits = hse->outgoing_bits >> (hse->outgoing_bits_count - 8);
                    ^
    libs/compression/heatshrink/heatshrink_encoder.c:538:16: warning: conversion to 'uint8_t {aka unsigned char}' from 'uint16_t {aka short unsigned int}' may alter its value [-Wconversion]
             bits = hse->outgoing_bits;
                    ^
    libs/compression/heatshrink/heatshrink_encoder.c:544:37: warning: conversion to 'uint8_t {aka unsigned char}' from 'int' may alter its value [-Wconversion]
             hse->outgoing_bits_count -= count;
                                         ^
    libs/compression/heatshrink/heatshrink_encoder.c: In function 'push_literal_byt':
    libs/compression/heatshrink/heatshrink_encoder.c:581:33: warning: conversion to 'uint16_t {aka short unsigned int}' from 'int' may alter its value [-Wconversion]
         uint16_t processed_offset = hse->match_scan_index - 1;
                                     ^
    libs/compression/heatshrink/heatshrink_encoder.c:582:29: warning: conversion to 'uint16_t {aka short unsigned int}' from 'int' may alter its value [-Wconversion]
         uint16_t input_offset = get_input_offset(hse) + processed_offset;
                                 ^
    libs/compression/heatshrink/heatshrink_encoder.c: In function 'save_backlog':
    libs/compression/heatshrink/heatshrink_encoder.c:598:20: warning: conversion to 'uint16_t {aka short unsigned int}' from 'size_t {aka unsigned int}' may alter its value [-Wconversion]
         uint16_t rem = input_buf_sz - msi; // unprocessed bytes
                        ^
    libs/compression/heatshrink/heatshrink_encoder.c:599:25: warning: conversion to 'uint16_t {aka short unsigned int}' from 'size_t {aka unsigned int}' may alter its value [-Wconversion]
         uint16_t shift_sz = input_buf_sz + rem;
                             ^
    libs/compression/heatshrink/heatshrink_encoder.c:606:24: warning: conversion to 'uint16_t {aka short unsigned int}' from 'size_t {aka unsigned int}' may alter its value [-Wconversion]
         hse->input_size -= input_buf_sz - rem;
                            ^
    CC libs/filesystem/fat_sd/fattime.o
    In file included from libs/compression/compress_heatshrink.c:15:0:
    /vagrant/src/jsutils.h:124:22: fatal error: esp_attr.h: No such file or directory
    compilation terminated.
    make: *** [libs/compression/compress_heatshrink.o] Error 1
    make: *** Waiting for unfinished jobs....
    libs/compression/heatshrink/heatshrink_decoder.c: At top level:
    cc1: warning: unrecognized command line option '-Wno-expansion-to-defined'
    In file included from /vagrant/src/jsvar.h:17:0,
                     from /vagrant/src/jswrap_date.h:14,
                     from libs/filesystem/fat_sd/fattime.c:6:
    /vagrant/src/jsutils.h:124:22: fatal error: esp_attr.h: No such file or directory
    compilation terminated.
    make: *** [libs/filesystem/fat_sd/fattime.o] Error 1
    libs/compression/heatshrink/heatshrink_encoder.c: At top level:
    cc1: warning: unrecognized command line option '-Wno-expansion-to-defined'
    make: *** wait: No child processes.  Stop.
    
    
  • Turned out I had a bad install of esp-idf so the includes weren’t resolving. After I fixed that, I managed to build and output the binaries for flashing.

  • How to build for esp32on Mac OS question, I want to setup esp32on on my mac Can I download or plugin on my macOS from the iTunes pc store? or any other way to install esp32on on macOS? because when I am trying to download anything from iTunes I had faced iTunes Error 4013 it only happens if anything downloads from iTunes on mac pc.

  • @MacChristmas are you trying to install standard Espruino onto your esp32 board? Or are you trying to build your own custom Espruino to install onto your esp32 board?

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Building for esp32 on Mac OS question

Posted by Avatar for n00b @n00b

Actions