• 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

About

Avatar for asez73 @asez73 started