• I have some errors when trying the example below on an original Espruino Rev 1.4b.

    var c = E.compiledC(`
        // int sum(int, int)
        int sum(int len, unsigned char *data){
          int s = 0;
          while (len--)
            s += *(data++);
          return s;
        }
        `);
        var str  = E.toString("\1\2\3\4\5\6"); // create a flat string
        print(c.sum(str.length, E.getAddressOf(str,true)));
    

    It goes well, see first and second logs below, if I disconnect from webide, then upload the very same example, reconnecting at the prompt from wedide (0.68.5) just before it uploads the source. There no need to disconnect physically the board.

    No error or just warnings, and a correct result of 21.

    Note that printing process.env.EXPORTS gave once a truncated string with no closing " and no ending } and no prompt for the next command until I press the Enter key on the left side of the WebIde. Then I get the rest of the strings, json closed and prompt. This is also true on the error case.
    On the other hand, process.env sends a full JSON with everything apparently correct.

    >
     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v95 Copyright 2017 G.Williams
    >21
    =undefined
    >process.env.EXPORTS
    ={ "jsvLock": 131929, "jsvLockAgainSafe": 131915, "jsvUnLock": 131889, "jsvSkipName": 19429,
      "jsvMathsOp": 24927, "jsvMathsOpSkipNames": 24977, "jsvNewFromFloat": 132269, "jsvNewFromInteger": 132305, "jsvNewFromString": 133473,
      "jsvNewFromBool": 132289, "jsvGetFloat": 19713, "jsvGetInteger": 17081, "jsvGetBool": 20437, "jspeiFindInScopes": 31009,
      "jspReplaceWith": 31069, "jspeFunctionCall": 35349, "jspGetNamedVariable": 188129, "jspGetNamedField": 189697, "jspGetVarNamedField": 189293,
      "jsvNewWithFlags": 132085 }
    > process.env
    ={
      "VERSION": "1v95",
      "BUILD_DATE": "Dec 15 2017",
      "BUILD_TIME": "17:07:34",
      "GIT_COMMIT": "7dbffcf5da09570bd95714b2386a12ab25ab1d50",
      "BOARD": "ESPRUINOBOARD",
      "CHIP": "STM32F103RCT6",
      "CHIP_FAMILY": "STM32F1",
      "FLASH": 262144, "RAM": 49152,
      "SERIAL": "34ffdb05-42573838-24631743",
      "CONSOLE": "USB",
      "EXPORTS": { "jsvLock": 131929, "jsvLockAgainSafe": 131915, "jsvUnLock": 131889, "jsvSkipName": 19429,
        "jsvMathsOp": 24927, "jsvMathsOpSkipNames": 24977, "jsvNewFromFloat": 132269, "jsvNewFromInteger": 132305, "jsvNewFromString": 133473,
        "jsvNewFromBool": 132289, "jsvGetFloat": 19713, "jsvGetInteger": 17081, "jsvGetBool": 20437, "jspeiFindInScopes": 31009,
        "jspReplaceWith": 31069, "jspeFunctionCall": 35349, "jspGetNamedVariable": 188129, "jspGetNamedField": 189697, "jspGetVarNamedField": 189293,
        "jsvNewWithFlags": 132085 }
     }
    > 
    

    Ide log corresponding:
    ```
    ERROR: RECEIVE ERROR: {"connectionId":1,"error":"device_lost"}
    Disconnect callback...
    WARNING: [notify_warn] Disconnected

    Disconnected
    Connecting...
    ForceThrottle option is set - set Slow Write = true
    [object Object]
    Connected [object Object]
    Found a prompt... great!
    Sending...
    ---> "\u0010console.log(\"<\",\"<<\",JSON.stringify(process.env),\">>\",\">\")\n"
    Sent
    Got "< << {\"VERSION\":\"1v95\",\"BUILD_DATE\":\"Dec 15 2017\",\"BUILD_TIME\":\"17:07:34\",\"GIT_COMMIT\":\"7dbffcf5da09570bd95714b2386a12ab25ab1d50\",\"BOARD\":\"ESPRUINOBOARD\",\"CHIP\":\"STM32F103RCT6\",\"CHIP_FAMILY\":\"STM32F1\",\"FLASH\":262144,\"RAM\":49152,\"SERIAL\":\"34ffdb05-42573838-24631743\",\"CONSOLE\":\"USB\",\"EXPORTS\":{\"jsvLock\":131929,\"jsvLockAgainSafe\":131915,\"jsvUnLock\":131889,\"jsvSkipName\":19429,\"jsvMathsOp\":24927,\"jsvMathsOpSkipNames\":24977,\"jsvNewFromFloat\":132269,\"jsvNewFromInteger\":132305,\"jsvNewFromString\":133473,\"jsvNewFromBool\":132289,\"jsvGetFloat\":19713,\"jsvGetInteger\":17081,\"jsvGetBool\":20437,\"jspeiFindInScopes\":31009,\"jspReplaceWith\":31069,\"jspeFunctionCall\":35349,\"jspGetNamedVariable\":188129,\"jspGetNamedField\":189697,\"jspGetVarNamedField\":189293,\"jsvNewWithFlags\":132085}} >> >\r\n"
    Loading http://www.espruino.com/json/ESPRUINOBOARD.json
    Searching for json/ESPRUINOBOARD.json
    json/ESPRUINOBOARD.json found in offline archive
    Board JSON loaded
    Firmware >1.43 supports faster writes over USB
    ForceThrottle option is set - set Slow Write = true
    FIRMWARE: Current 1v95, Available 1v95
    Device found (connectionId=2)
    [success] Connected to port /dev/ttyACM0
    Connected to port /dev/ttyACM0
    WARNING: [notify_warn] Errors while minifying - sending unminified code.
    Found a prompt... great!
    Sending...
    ---> "\u0010reset();\n\u0010setTime(1518684180.54);\n\u0010var c = (function(){\u001b\n var bin=atob(\"ChgAIJFCA9AR+AE7GET553BHAAA=\");\u001b\n return {\u001b\n sum:E.nativeCall(1, \"int(int, int)\", bin),\u001b\n };\u001b\n})();\n\u0010var str = E.toString(\"\1\2\3\4\5\6\");\n\u0010print(c.sum(str.length, E.getAddressOf(str,true)));\n\n"
    Splitting at "reset();\n", delay 250
    ERROR: [notify_error] Input_0:8: ERROR

  • Better logs for this problem:

    A- Success if disconnecting WebIde before uploading, thus it reconnects itself. I just choose the serial link for the board.

    Connected
    >
    >
     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v95 Copyright 2017 G.Williams
    >21
    =undefined
    > 
    
    We have chrome.serial - not using 'serialport' module
    serial_audio: Audio Sample rate : 44100
    serial_audio: Audio Serial Baud 9600 Bit time 4.59375
    GET chrome.storage.sync = {"AUTO_SAVE_CODE":true,"BAUD_RATE":9600,"BLOCKLY_EXTENSIONS":"|bluetooth|robot|","BLOCKLY_LANGUAGE":"en","BLOCKLY_TO_JS":false,"BOARD_JSON_URL":"http://www.espruino.com/json","CODE":"    var c = E.compiledC(`\n    // int sum(int, int)\n    int sum(int len, unsigned char *data){\n      int s = 0;\n      while (len--)\n        s += *(data++);\n      return s;\n    }\n    `);\n    var str  = E.toString(\"\\1\\2\\3\\4\\5\\6\"); // create a flat string\n    print(c.sum(str.length, E.getAddressOf(str,true)));","COMPILATION":true,"COMPILATION_URL":"http://www.espruino.com:32766","DISABLE_CODE_HINTS":false,"ENABLE_Testing":true,"ENV_ON_CONNECT":true,"FONT_SIZE":12,"FREQUENCY_Testing":1000,"MINIFICATION_DeadCode":true,"MINIFICATION_LEVEL":"SIMPLE_OPTIMIZATIONS","MINIFICATION_Literal":true,"MINIFICATION_Mangle":true,"MINIFICATION_Unreachable":true,"MINIFICATION_Unused":true,"MODULE_AS_FUNCTION":false,"MODULE_EXTENSIONS":".min.js|.js","MODULE_MINIFICATION_LEVEL":"SIMPLE_OPTIMIZATIONS","MODULE_PROXY_ENABLED":false,"MODULE_PROXY_PORT":"","MODULE_PROXY_URL":"","MODULE_URL":"http://www.espruino.com/modules","NPM_MODULES":false,"OFFLINE_DATA":"","OFFLINE_DATA_DOWNLOAD":"","OFFLINE_DATA_UPLOAD":"","OFFLINE_ENABLED":true,"RESET_BEFORE_SEND":true,"SAVE_ON_SEND":false,"SERIAL_AUDIO":"0","SERIAL_TCPIP":"","SERIAL_THROTTLE_SEND":true,"SET_TIME_ON_WRITE":true,"SHOW_CODE_LINK_ICON":true,"SHOW_RELOAD_ICON":true,"SHOW_WEBCAM_ICON":true,"STORE_LINE_NUMBERS":false,"Sound_Error":"","Sound_Info":"","Sound_Success":"","Sound_Warning":"","Speak_Error":false,"Speak_Info":false,"Speak_Success":false,"Speak_Warning":false,"UI_MODE":"compact","WEBCAM_CONSTRAINTS":0,"WEB_BLUETOOTH":true,"projectEntry":"645CE808FCEC404709C322927E633191:Espruino pico"}
    Initialising SettingsConsole
    Initialising Utils
    Initialising Config
    Initialising Notifications
    Initialising Status
    Initialising App
    Initialising File
    Initialising Code
    Initialising Serial
      - Initialising Serial Chrome Serial
      - Initialising Serial Chrome Socket
      - Initialising Serial Web Audio
      - Initialising Serial Web Bluetooth
    Initialising Terminal
    Initialising CodeWriter
    Initialising Modules
    Initialising Env
    Initialising Flasher
    Initialising EditorBlockly
    Initialising EditorJavaScript
    Initialising Send
    Initialising MenuPortSelector
    Initialising MenuSettings
    Initialising MenuFlasher
    Initialising SettingsAbout
    Initialising SettingsFlasher
    Initialising BoardJSON
    Initialising VersionChecker
    Initialising Compiler
    Initialising Assembler
    Initialising GetGitHub
    Initialising SetTime
    Initialising Unicode
    Initialising Minify
    Initialising SaveOnSend
    Initialising Tutorial
    Initialising Webcam
    Initialising FontSize
    Initialising UiMode
    Initialising URLHandler
    Initialising CodeLink
    Initialising Project
    Initialising Testing
    Initialising Notification_Sound
    Initialising Tern
    Initialising Debugger
    Initialising Tour
    Initialising SettingsProfile
    Initialising HelpLinks
    Initialising Offline
    Loaded code from storage.
    GET chrome.storage.local.OFFLINE_DATA = 497080 bytes
    No navigator.bluetooth - Web Bluetooth not enabled
    >>> Connecting...
    ForceThrottle option is set - set Slow Write = true
    [object Object]
    Connected [object Object]
    Found a prompt... great!
    >>> Sending...
    ---> "\u0010console.log(\"<\",\"<<\",JSON.stringify(process.env),\">>\",\">\")\n"
    >>> Sent
    Got "< << {\"VERSION\":\"1v95\",\"BUILD_DATE\":\"Dec 15 2017\",\"BUILD_TIME\":\"17:07:34\",\"GIT_COMMIT\":\"7dbffcf5da09570bd95714b2386a12ab25ab1d50\",\"BOARD\":\"ESPRUINOBOARD\",\"CHIP\":\"STM32F103RCT6\",\"CHIP_FAMILY\":\"STM32F1\",\"FLASH\":262144,\"RAM\":49152,\"SERIAL\":\"34ffdb05-42573838-24631743\",\"CONSOLE\":\"USB\",\"EXPORTS\":{\"jsvLock\":131929,\"jsvLockAgainSafe\":131915,\"jsvUnLock\":131889,\"jsvSkipName\":19429,\"jsvMathsOp\":24927,\"jsvMathsOpSkipNames\":24977,\"jsvNewFromFloat\":132269,\"jsvNewFromInteger\":132305,\"jsvNewFromString\":133473,\"jsvNewFromBool\":132289,\"jsvGetFloat\":19713,\"jsvGetInteger\":17081,\"jsvGetBool\":20437,\"jspeiFindInScopes\":31009,\"jspReplaceWith\":31069,\"jspeFunctionCall\":35349,\"jspGetNamedVariable\":188129,\"jspGetNamedField\":189697,\"jspGetVarNamedField\":189293,\"jsvNewWithFlags\":132085}} >> >\r\n"
    Loading http://www.espruino.com/json/ESPRUINOBOARD.json
    Searching for json/ESPRUINOBOARD.json
    json/ESPRUINOBOARD.json found in offline archive
    Board JSON loaded
    Firmware >1.43 supports faster writes over USB
    ForceThrottle option is set - set Slow Write = true
    FIRMWARE: Current 1v95, Available 1v95
    Device found (connectionId=1)
    [success] Connected to port /dev/ttyACM0
    >>> Connected to port /dev/ttyACM0
    WARNING: [notify_warn] Errors while minifying - sending unminified code.
    Found a prompt... great!
    >>> Sending...
    ---> "\u0010reset();\n\u0010setTime(1518687384.349);\n\u0010var c = (function(){\u001b\n  var bin=atob(\"ChgAIJFCA9AR+AE7GET553BHAAA=\");\u001b\n  return {\u001b\n    sum:E.nativeCall(1, \"int(int, int)\", bin),\u001b\n  };\u001b\n})();\n\u0010var str  = E.toString(\"\\1\\2\\3\\4\\5\\6\");\n\u0010print(c.sum(str.length, E.getAddressOf(str,true)));\n\n"
    Splitting at "reset();\n", delay 250
    ERROR: [notify_error] Input_0:8: ERROR - This style of octal literal is not supported in strict mode.
    ERROR: [notify_error] var str  = E.toString("\1\2\3\4\5\6"); // create a flat string
    ERROR: [notify_error] ^
    >>> Sent
    
  • This seems to be an issue with communications with the board rather than with the compiler.

    Do you have a Web IDE log for what happens when it's not working?

    Specifically I'm interested in the bits right after:

    >>> Sending...
    ---> "\u0010console.log(\"<\",\"<<\",JSON.str­ingify(process.env),\">>\",\">\")\n"
    

    In all the logs so far you've only posted it when it was working correctly.

    Please can you also just reboot your PC, and reconnect the Espruino board with a different USB cable (just in case). It could just be that the USB driver has got in a weird state.

  • B- Now, just uploaded the very same source after the success posted above, this time the borad is not recognised:

     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v95 Copyright 2017 G.Williams
    >Uncaught Error: Function "compiledC" not found!
     at line 1 col 11
    var c = E.compiledC(`
              ^
    Uncaught Error: Field or method "sum" does not already exist, and can't create it on undefined
     at line 1 col 8
    print(c.sum(str.length, E.getAddressOf(str,true)));
           ^
    =undefined
    >process.env
    ={
      "VERSION": "1v95",
      "BUILD_DATE": "Dec 15 2017",
      "BUILD_TIME": "17:07:34",
      "GIT_COMMIT": "7dbffcf5da09570bd95714b2386a12ab25ab1d50",
      "BOARD": "ESPRUINOBOARD",
      "CHIP": "STM32F103RCT6",
      "CHIP_FAMILY": "STM32F1",
      "FLASH": 262144, "RAM": 49152,
      "SERIAL": "34ffdb05-42573838-24631743",
      "CONSOLE": "USB",
      "EXPORTS": { "jsvLock": 131929, "jsvLockAgainSafe": 131915, "jsvUnLock": 131889, "jsvSkipName": 19429,
        "jsvMathsOp": 24927, "jsvMathsOpSkipNames": 24977, "jsvNewFromFloat": 132269, "jsvNewFromInteger": 132305, "jsvNewFromString": 133473,
        "jsvNewFromBool": 132289, "jsvGetFloat": 19713, "jsvGetInteger": 17081, "jsvGetBool": 20437, "jspeiFindInScopes": 31009,
        "jspReplaceWith": 31069, "jspeFunctionCall": 35349, "jspGetNamedVariable": 188129, "jspGetNamedField": 189697, "jspGetVarNamedField": 189293,
        "jsvNewWithFlags": 132085 }
     }
    > 
    
    ---> "\u0010console.log(\"<\",\"<<\",JSON.stringify(process.env),\">>\",\">\")\n"
    >>> Sent
    Got "< << {\"VERSION\":\"1v95\",\"BUILD_DATE\":\"Dec 15 2017\",\"BUILD_TIME\":\"17:07:34\",\"GIT_COMMIT\":\"7dbffcf5da09570bd95714b2386a12ab25ab1d50\",\"BOARD\":\"ESPRUINOBOARD\",\"CHIP\":\"STM32F103RCT6\",\"CHIP_FAMILY\":\"STM32F1\",\"FLASH\":262144,\"RAM\":49152,\"SERIAL\":\"34ffdb05-42573838-24631743\",\"CONSOLE\":\"USB\",\"EXPORTS\":{\"jsvLock\":131929,\"jsvLockAgainSafe\":131915,\"jsvUnLock\":131889,\"jsvSkipName\":19429,\"jsvMathsOp\":24927,\"jsvMathsOpSkipNames\":24977,\"jsvNewFromFloat\":132269,\"jsvNewFromInteger\":132305,\"jsvNewFromString\":133473,\"jsvNewFromBool\":132289,\"jsvGetFloat\":19713,\"jsvGetInteger\":17081,\"jsvGetBool\":20437,\"jspeiFindInScopes\":31009,\"jspReplaceWith\":31069,\"jspeFunctionCall\":35349,\"jspGetNamedVariable\":188129,\"jspGetNamedField\":189697,\"jspGetVarNamedField\":189293,\"jsvNewWithFlags\":132085}} >> >\r\n"
    Loading http://www.espruino.com/json/ESPRUINOBOARD.json
    Searching for json/ESPRUINOBOARD.json
    json/ESPRUINOBOARD.json found in offline archive
    Board JSON loaded
    Firmware >1.43 supports faster writes over USB
    ForceThrottle option is set - set Slow Write = true
    FIRMWARE: Current 1v95, Available 1v95
    Device found (connectionId=2)
    [success] Connected to port /dev/ttyACM0
    >>> Connected to port /dev/ttyACM0
    WARNING: [notify_warn] Errors while minifying - sending unminified code.
    Found a prompt... great!
    >>> Sending...
    ---> "\u0010reset();\n\u0010setTime(1518688159.377);\n\u0010var c = (function(){\u001b\n  var bin=atob(\"ChgAIJFCA9AR+AE7GET553BHAAA=\");\u001b\n  return {\u001b\n    sum:E.nativeCall(1, \"int(int, int)\", bin),\u001b\n  };\u001b\n})();\n\u0010var str  = E.toString(\"\\1\\2\\3\\4\\5\\6\");\n\u0010print(c.sum(str.length, E.getAddressOf(str,true)));\n\n"
    Splitting at "reset();\n", delay 250
    ERROR: [notify_error] Input_0:8: ERROR - This style of octal literal is not supported in strict mode.
    ERROR: [notify_error] var str  = E.toString("\1\2\3\4\5\6"); // create a flat string
    ERROR: [notify_error] ^
    >>> Sent
    
  • In the IDE log you just posted above, it has worked just fine!

    Please post the IDE log that corresponds with what appeared on the terminal.

  • Ok, rebooted, changed cable and full log IT failed!

    Connected
    >Loading 1389 bytes from flash...
    >
    >
     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v95 Copyright 2017 G.Williams
    >Uncaught Error: Function "compiledC" not found!
     at line 1 col 11
    var c = E.compiledC(`
              ^
    Uncaught Error: Field or method "sum" does not already exist, and can't create it on undefined
     at line 1 col 8
    print(c.sum(str.length, E.getAddressOf(str,true)));
           ^
    =undefined
    > 
    
    
    We have chrome.serial - not using 'serialport' module
    serial_audio: Audio Sample rate : 44100
    serial_audio: Audio Serial Baud 9600 Bit time 4.59375
    GET chrome.storage.sync = {"AUTO_SAVE_CODE":true,"BAUD_RATE":9600,"BLOCKLY_EXTENSIONS":"|bluetooth|robot|","BLOCKLY_LANGUAGE":"en","BLOCKLY_TO_JS":false,"BOARD_JSON_URL":"http://www.espruino.com/json","CODE":"    var c = E.compiledC(`\n    // int sum(int, int)\n    int sum(int len, unsigned char *data){\n      int s = 0;\n      while (len--)\n        s += *(data++);\n      return s;\n    }\n    `);\n    var str  = E.toString(\"\\1\\2\\3\\4\\5\\6\"); // create a flat string\n    print(c.sum(str.length, E.getAddressOf(str,true)));","COMPILATION":true,"COMPILATION_URL":"http://www.espruino.com:32766","DISABLE_CODE_HINTS":false,"ENABLE_Testing":true,"ENV_ON_CONNECT":true,"FONT_SIZE":12,"FREQUENCY_Testing":1000,"MINIFICATION_DeadCode":true,"MINIFICATION_LEVEL":"SIMPLE_OPTIMIZATIONS","MINIFICATION_Literal":true,"MINIFICATION_Mangle":true,"MINIFICATION_Unreachable":true,"MINIFICATION_Unused":true,"MODULE_AS_FUNCTION":false,"MODULE_EXTENSIONS":".min.js|.js","MODULE_MINIFICATION_LEVEL":"SIMPLE_OPTIMIZATIONS","MODULE_PROXY_ENABLED":false,"MODULE_PROXY_PORT":"","MODULE_PROXY_URL":"","MODULE_URL":"http://www.espruino.com/modules","NPM_MODULES":false,"OFFLINE_DATA":"","OFFLINE_DATA_DOWNLOAD":"","OFFLINE_DATA_UPLOAD":"","OFFLINE_ENABLED":true,"RESET_BEFORE_SEND":true,"SAVE_ON_SEND":false,"SERIAL_AUDIO":"0","SERIAL_TCPIP":"","SERIAL_THROTTLE_SEND":true,"SET_TIME_ON_WRITE":true,"SHOW_CODE_LINK_ICON":true,"SHOW_RELOAD_ICON":true,"SHOW_WEBCAM_ICON":true,"STORE_LINE_NUMBERS":false,"Sound_Error":"","Sound_Info":"","Sound_Success":"","Sound_Warning":"","Speak_Error":false,"Speak_Info":false,"Speak_Success":false,"Speak_Warning":false,"UI_MODE":"compact","WEBCAM_CONSTRAINTS":0,"WEB_BLUETOOTH":true,"projectEntry":"645CE808FCEC404709C322927E633191:Espruino pico"}
    Initialising SettingsConsole
    Initialising Utils
    Initialising Config
    Initialising Notifications
    Initialising Status
    Initialising App
    Initialising File
    Initialising Code
    Initialising Serial
      - Initialising Serial Chrome Serial
      - Initialising Serial Chrome Socket
      - Initialising Serial Web Audio
      - Initialising Serial Web Bluetooth
    Initialising Terminal
    Initialising CodeWriter
    Initialising Modules
    Initialising Env
    Initialising Flasher
    Initialising EditorBlockly
    Initialising EditorJavaScript
    Initialising Send
    Initialising MenuPortSelector
    Initialising MenuSettings
    Initialising MenuFlasher
    Initialising SettingsAbout
    Initialising SettingsFlasher
    Initialising BoardJSON
    Initialising VersionChecker
    Initialising Compiler
    Initialising Assembler
    Initialising GetGitHub
    Initialising SetTime
    Initialising Unicode
    Initialising Minify
    Initialising SaveOnSend
    Initialising Tutorial
    Initialising Webcam
    Initialising FontSize
    Initialising UiMode
    Initialising URLHandler
    Initialising CodeLink
    Initialising Project
    Initialising Testing
    Initialising Notification_Sound
    Initialising Tern
    Initialising Debugger
    Initialising Tour
    Initialising SettingsProfile
    Initialising HelpLinks
    Initialising Offline
    Loaded code from storage.
    GET chrome.storage.local.OFFLINE_DATA = 497080 bytes
    No navigator.bluetooth - Web Bluetooth not enabled
    >>> Connecting...
    ForceThrottle option is set - set Slow Write = true
    [object Object]
    Connected [object Object]
    Found a prompt... great!
    >>> Sending...
    ---> "\u0010console.log(\"<\",\"<<\",JSON.stringify(process.env),\">>\",\">\")\n"
    >>> Sent
    Got "< << {\"VERSION\":\"1v95\",\"BUILD_DATE\":\"Dec 15 2017\",\"BUILD_TIME\":\"17:07:34\",\"GIT_COMMIT\":\"7dbffcf5da09570bd95714b2386a12ab25ab1d50\",\"BOARD\":\"ESPRUINOBOARD\",\"CHIP\":\"STM32F103RCT6\",\"CHIP_FAMILY\":\"STM32F1\",\"FLASH\":262144,\"RAM\":49152,\"SERIAL\":\"34ffdb05-42573838-24631743\",\"CONSOLE\":\"USB\",\"EXPORTS\":{\"jsvLock\":131929,\"jsvLockAgainSafe\":131915,\"jsvUnLock\":131889,\"jsvSkipName\":19429,\"jsvMathsOp\":24927,\"jsvMathsOpSkipNames\":24977,\"jsvNewFromFloat\":132269,\"jsvNewFromInteger\":132305,\"jsvNewFromString\":133473,\"jsvNewFromBool\":132289,\"jsvGetFloat\":19713,\"jsvGetInteger\":17081,\"jsvGetBool\":20437,\"jspeiFindInScopes\":31009,\"jspReplaceWith\":31069,\"jspeFunctionCall\":35349,\"jspGetNamedVariable\":188129,\"jspGetNamedField\":189697,\"jspGetVarNamedField\":189293,\"jsvNewWithFlags\":132085}} >> >\r\n"
    Loading http://www.espruino.com/json/ESPRUINOBOARD.json
    Searching for json/ESPRUINOBOARD.json
    json/ESPRUINOBOARD.json found in offline archive
    Board JSON loaded
    Firmware >1.43 supports faster writes over USB
    ForceThrottle option is set - set Slow Write = true
    FIRMWARE: Current 1v95, Available 1v95
    Device found (connectionId=1)
    [success] Connected to port /dev/ttyACM0
    >>> Connected to port /dev/ttyACM0
    ERROR: [notify_error] Compiler not active as no process.env.EXPORTS/EXPTR available.<br/>Is your board supported and firmware up to date?
    WARNING: [notify_warn] Errors while minifying - sending unminified code.
    Found a prompt... great!
    >>> Sending...
    ---> "\u0010reset();\n\u0010setTime(1518688740.932);\n\u0010var c = E.compiledC(`\n    // int sum(int, int)\n    int sum(int len, unsigned char *data){\n      int s = 0;\n      while (len--)\n        s += *(data++);\n      return s;\n    }\n    `);\n\u0010var str  = E.toString(\"\\1\\2\\3\\4\\5\\6\");\n\u0010print(c.sum(str.length, E.getAddressOf(str,true)));\n\n"
    Splitting at "reset();\n", delay 250
    ERROR: [notify_error] Input_0:11: ERROR - This style of octal literal is not supported in strict mode.
    ERROR: [notify_error] var str  = E.toString("\1\2\3\4\5\6"); // create a flat string
    ERROR: [notify_error] ^
    >>> Sent
    
    
  • Now disconnected and uploaded again:

    Disconnected
    Connected
    >
    >
     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v95 Copyright 2017 G.Williams
    >21
    =undefined
    > 
    

    And full log after first fail and second success:

    Initialising Terminal
    Initialising CodeWriter
    Initialising Modules
    Initialising Env
    Initialising Flasher
    Initialising EditorBlockly
    Initialising EditorJavaScript
    Initialising Send
    Initialising MenuPortSelector
    Initialising MenuSettings
    Initialising MenuFlasher
    Initialising SettingsAbout
    Initialising SettingsFlasher
    Initialising BoardJSON
    Initialising VersionChecker
    Initialising Compiler
    Initialising Assembler
    Initialising GetGitHub
    Initialising SetTime
    Initialising Unicode
    Initialising Minify
    Initialising SaveOnSend
    Initialising Tutorial
    Initialising Webcam
    Initialising FontSize
    Initialising UiMode
    Initialising URLHandler
    Initialising CodeLink
    Initialising Project
    Initialising Testing
    Initialising Notification_Sound
    Initialising Tern
    Initialising Debugger
    Initialising Tour
    Initialising SettingsProfile
    Initialising HelpLinks
    Initialising Offline
    Loaded code from storage.
    GET chrome.storage.local.OFFLINE_DATA = 497080 bytes
    No navigator.bluetooth - Web Bluetooth not enabled
    >>> Connecting...
    ForceThrottle option is set - set Slow Write = true
    [object Object]
    Connected [object Object]
    Found a prompt... great!
    >>> Sending...
    ---> "\u0010console.log(\"<\",\"<<\",JSON.stringify(process.env),\">>\",\">\")\n"
    >>> Sent
    Got "< << {\"VERSION\":\"1v95\",\"BUILD_DATE\":\"Dec 15 2017\",\"BUILD_TIME\":\"17:07:34\",\"GIT_COMMIT\":\"7dbffcf5da09570bd95714b2386a12ab25ab1d50\",\"BOARD\":\"ESPRUINOBOARD\",\"CHIP\":\"STM32F103RCT6\",\"CHIP_FAMILY\":\"STM32F1\",\"FLASH\":262144,\"RAM\":49152,\"SERIAL\":\"34ffdb05-42573838-24631743\",\"CONSOLE\":\"USB\",\"EXPORTS\":{\"jsvLock\":131929,\"jsvLockAgainSafe\":131915,\"jsvUnLock\":131889,\"jsvSkipName\":19429,\"jsvMathsOp\":24927,\"jsvMathsOpSkipNames\":24977,\"jsvNewFromFloat\":132269,\"jsvNewFromInteger\":132305,\"jsvNewFromString\":133473,\"jsvNewFromBool\":132289,\"jsvGetFloat\":19713,\"jsvGetInteger\":17081,\"jsvGetBool\":20437,\"jspeiFindInScopes\":31009,\"jspReplaceWith\":31069,\"jspeFunctionCall\":35349,\"jspGetNamedVariable\":188129,\"jspGetNamedField\":189697,\"jspGetVarNamedField\":189293,\"jsvNewWithFlags\":132085}} >> >\r\n"
    Loading http://www.espruino.com/json/ESPRUINOBOARD.json
    Searching for json/ESPRUINOBOARD.json
    json/ESPRUINOBOARD.json found in offline archive
    Board JSON loaded
    Firmware >1.43 supports faster writes over USB
    ForceThrottle option is set - set Slow Write = true
    FIRMWARE: Current 1v95, Available 1v95
    Device found (connectionId=1)
    [success] Connected to port /dev/ttyACM0
    >>> Connected to port /dev/ttyACM0
    ERROR: [notify_error] Compiler not active as no process.env.EXPORTS/EXPTR available.<br/>Is your board supported and firmware up to date?
    WARNING: [notify_warn] Errors while minifying - sending unminified code.
    Found a prompt... great!
    >>> Sending...
    ---> "\u0010reset();\n\u0010setTime(1518688740.932);\n\u0010var c = E.compiledC(`\n    // int sum(int, int)\n    int sum(int len, unsigned char *data){\n      int s = 0;\n      while (len--)\n        s += *(data++);\n      return s;\n    }\n    `);\n\u0010var str  = E.toString(\"\\1\\2\\3\\4\\5\\6\");\n\u0010print(c.sum(str.length, E.getAddressOf(str,true)));\n\n"
    Splitting at "reset();\n", delay 250
    ERROR: [notify_error] Input_0:11: ERROR - This style of octal literal is not supported in strict mode.
    ERROR: [notify_error] var str  = E.toString("\1\2\3\4\5\6"); // create a flat string
    ERROR: [notify_error] ^
    >>> Sent
    Disconnect callback...
    WARNING: [notify_warn] Disconnected
    >>> Disconnected
    >>> Connecting...
    ForceThrottle option is set - set Slow Write = true
    [object Object]
    Connected [object Object]
    Found a prompt... great!
    >>> Sending...
    ---> "\u0010console.log(\"<\",\"<<\",JSON.stringify(process.env),\">>\",\">\")\n"
    >>> Sent
    Got "< << {\"VERSION\":\"1v95\",\"BUILD_DATE\":\"Dec 15 2017\",\"BUILD_TIME\":\"17:07:34\",\"GIT_COMMIT\":\"7dbffcf5da09570bd95714b2386a12ab25ab1d50\",\"BOARD\":\"ESPRUINOBOARD\",\"CHIP\":\"STM32F103RCT6\",\"CHIP_FAMILY\":\"STM32F1\",\"FLASH\":262144,\"RAM\":49152,\"SERIAL\":\"34ffdb05-42573838-24631743\",\"CONSOLE\":\"USB\",\"EXPORTS\":{\"jsvLock\":131929,\"jsvLockAgainSafe\":131915,\"jsvUnLock\":131889,\"jsvSkipName\":19429,\"jsvMathsOp\":24927,\"jsvMathsOpSkipNames\":24977,\"jsvNewFromFloat\":132269,\"jsvNewFromInteger\":132305,\"jsvNewFromString\":133473,\"jsvNewFromBool\":132289,\"jsvGetFloat\":19713,\"jsvGetInteger\":17081,\"jsvGetBool\":20437,\"jspeiFindInScopes\":31009,\"jspReplaceWith\":31069,\"jspeFunctionCall\":35349,\"jspGetNamedVariable\":188129,\"jspGetNamedField\":189697,\"jspGetVarNamedField\":189293,\"jsvNewWithFlags\":132085}} >> >\r\n"
    Loading http://www.espruino.com/json/ESPRUINOBOARD.json
    Searching for json/ESPRUINOBOARD.json
    json/ESPRUINOBOARD.json found in offline archive
    Board JSON loaded
    Firmware >1.43 supports faster writes over USB
    ForceThrottle option is set - set Slow Write = true
    FIRMWARE: Current 1v95, Available 1v95
    Device found (connectionId=2)
    [success] Connected to port /dev/ttyACM0
    >>> Connected to port /dev/ttyACM0
    WARNING: [notify_warn] Errors while minifying - sending unminified code.
    Found a prompt... great!
    >>> Sending...
    ---> "\u0010reset();\n\u0010setTime(1518688966.433);\n\u0010var c = (function(){\u001b\n  var bin=atob(\"ChgAIJFCA9AR+AE7GET553BHAAA=\");\u001b\n  return {\u001b\n    sum:E.nativeCall(1, \"int(int, int)\", bin),\u001b\n  };\u001b\n})();\n\u0010var str  = E.toString(\"\\1\\2\\3\\4\\5\\6\");\n\u0010print(c.sum(str.length, E.getAddressOf(str,true)));\n\n"
    Splitting at "reset();\n", delay 250
    ERROR: [notify_error] Input_0:8: ERROR - This style of octal literal is not supported in strict mode.
    ERROR: [notify_error] var str  = E.toString("\1\2\3\4\5\6"); // create a flat string
    ERROR: [notify_error] ^
    >>> Sent
    
  • You are very reactive and some of our posts got unsynced.
    Thank you for that.
    Anyway, everythings is shown above.
    I don't think it is related to the webide itself, or at least not the last version.
    It seems, just an opinion, to be related to serial buffering as I mentionned some cases, which did not appeared here, showed some strings not displayed on the left pane of the webide until I pressed the Enter key.

  • Ok, I reflashed with the new cable and it seems to work now...
    Sorry for the disturbance!

    So I closed the discussion and can't add more posts....
    Things are tricking:
    Turning off minimification and offline mode imposed me to disconnect and reconnect the board in order to have success. Otherwise, the errors went back as described above.

    Then, setting back offline mode does impose the same disconnection/reconnection once only and the problem seems not to reappear: Non errors nor warnings and correct result of 21.

    Then turning minimification back to Espruima offline on, did imposed also disconecting/reconnecting once only the board.

    Then turning minimification back to Closure online (whitespace only) on, did imposed also disconecting/reconnecting once only the board.

    So it could be a problem of stored configuration in the web ide finaly???

  • Thanks - it's very strange though - from the log it seems like the IDE has parsed the JSON response just fine but for some reason hasn't picked up the EXPORTS variable.

    Could you try turning off 'minifcation' as well as 'offline mode'. Both of those appear to be turned on, and I guess could be causing problems somehow?

  • Just managed to reproduce this - if you open the settings window and close it, it wipes out the data received from the board. So if you just connect and upload it'll be fine - it's just an issue if you connect, enter settings, and then upload.

    I'll fix it for the next IDE release.

  • Good, so, i'll disconnect / reconnect after any change in the settings.
    Thanks again for your follow up.

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

WebIde not compiling code at upload time if already connected except if reconnection at upload?

Posted by Avatar for asez73 @asez73

Actions