test for board type in build_jswrapper.py

Posted on
  • Hi,
    I want to generate conditional code for the ESP8266 in build_wrapper.py:151

    if board == 'ESP8266'
     codeOut("static JswSymPtr jswSymbols_"+codeName+"[] __attribute__((section(\".irom.literal\"­))) __attribute__((aligned(4))) = {\n  "+",\n  ".join(listSymbols)+"\n};");
    else
       codeOut("static const JswSymPtr jswSymbols_"+codeName+"[] = {\n  "+",\n  ".join(listSymbols)+"\n};");
    

    If unsure how to read the command line args and what the board test string would be.

    if board == 'ESP8266'

    at the moment there doesn't appear to be any conditional board code?

  • That's a good point - I wonder if it actually knows... I know it's supplied with a bunch of definitions on the command-line that you could check, so ("-DESP8266" in sys.argv) might work.

  • python scripts/build_jswrapper.py src/jswrap_array.c src/jswrap_arraybuffer.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_serial.c src/jswrap_spi_i2c.c src/jswrap_stream.c src/jswrap_string.c src/jswrap_waveform.c libs/math/jswrap_math.c libs/network/jswrap_net.c libs/network/http/jswrap_http.c libs/network/js/jswrap_jsnetwork.c libs/network/esp8266/jswrap_esp8266_netw­ork.c targets/esp8266/jswrap_esp8266.c targets/esp8266/jswrap_nodemcu.c libs/network/telnet/jswrap_telnet.c libs/crypto/jswrap_crypto.c -DGIT_COMMIT=682807245a4f21ffc5fd48502d8­4c22e23194ffd -DBUILDNUMBER="41" -DUSE_DEBUGGER -DUSE_TAB_COMPLETE -DUSE_HEATSHRINK -DUSE_MATH -DUSE_NET -DUSE_ESP8266 -DUSE_TELNET -DUSE_CRYPTO -DUSE_OPTIMIZE_PRINTF -D__ETS__ -DICACHE_FLASH -DXTENSA -DUSE_US_TIMER -DEMBEDDED -DESP8266 -BESP8266_BOARD
    

    Reading up on the getopt module....

  • This works:

    import sys;
    
    print ("-BESP8266_BOARD" in sys.argv)
    
  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

test for board type in build_jswrapper.py

Posted by Avatar for Wilberforce @Wilberforce

Actions