• A working code now outputs an error:

    flushing to eeprom...
    WARNING: If specifying an object, it must be of the form {data : ..., count : N}
    WARNING: If specifying an object, it must be of the form {data : ..., count : N}
    Uncaught Error: Function "set" not found!
     at line 1 col 123
    ...int8Array(r.length+3&-4);a.set(r),r=a­}return r.length&&this....
                                  ^
    in function "_write" called from line 1 col 289
    ...ory!";this._write(r.end,t,e)}
                                  ^
    in function "write" called from line 1 col 96
    ...f.write(this.fileNo,pack(t)),this.ram­=t
                                  ^
    in function "write" called from line 1 col 57
    console.log("flushing to eeprom..."),this.write(this.ram)
                                                            ^
    in function "flush" called from line 1 col 515
    ...atus: ",cfg.ram),cfg.flush()
                                  ^
    in function "logFileInit" called from line 1 col 13
    logFileInit(),limitFilter(),setupIo(),sl­eep(1e3,function(){r...
                ^
    in function called from system
    

    I built Espruino by myself from commit 3d4047bf4fe5ab52f7b583257e41eae24a7fc947­.

    EDIT

    Situation is the same with git checkout tags/RELEASE_1V85

  • Maybe you could strip this down to just one or two functions that exhibit the problem? And also check that is happens on one of our builds - preferably on one of our boards like the Pico.

    If it says WARNING: If specifying an object, it must be of the form {data : ..., count : N} my guess somehow an object is getting passed into one of the functions (like write?)

    But actually my guess is you're building with an out of date firmware, and building for ESP8266 - I saw a regression that looked a bit like this yesterday and fixed it, and you might not have updated since then?

  • Here you are:

    >f = new (require("FlashEEPROM"))(0x076000);
    ={ 
      "flash": function () { [native code] }, 
      "addr": 483328, "endAddr": 487424 }
    >f.read(1)
    =undefined
    >f.write(1, "hello")
    WARNING: If specifying an object, it must be of the form {data : ..., count : N}
    WARNING: If specifying an object, it must be of the form {data : ..., count : N}
    Uncaught Error: Function "set" not found!
     at line 1 col 123
    ...int8Array(r.length+3&-4);a.set(r),r=a­}return r.length&&this....
                                  ^
    in function "_write" called from line 1 col 289
    ...ory!";this._write(r.end,t,e)}
                                  ^
    in function "write" called from line 1 col 19
    f.write(1, "hello")
                      ^
    >
    

    As you might not see my edit in the previous post, the situation is the same with git checkout tags/RELEASE_1V85

    Edit

    Same with current git pull

  • Works fine for me on a Pico with 1v85...

    >f.read(1)
    =undefined
    >f.write(1, "hello")
    =undefined
    >f.read(1)
    =new Uint8Array([104, 101, 108, 108, 111])
    >0x076000
    =483328
    

    edit: moving this to ESP8266 - as this is not an issue with Espruino boards.

  • It's absolutely relevant with my build. How can I trace this issue? What am I doing wrong?

  • When you type process.env.GIT_COMMIT, what does it say?

    Out of interest, why exactly are you doing your own build? Don't the travis ones do what you need?

  • Well, I found the problem. I just forgot to rename new build folder after git pull. Now process.env.GIT_COMMIT="498b9d4cc0f1fc5e­0886c19a3b84ce64279aaf85" and everything works great.

    The reason I build on my own is because both being able to do so, and keep up with your latest fixes :) Nothing related with a hack or something.

  • FYI: I moved these builds to a new repo: https://github.com/aktos-io/aktos-esprui­no-builds

  • Ok - however the absolute latest builds are automatically compiled and put online anyway.

  • @Gordon

    How can we calculate the 0x076000 in new (require("FlashEEPROM"))(0x076000);? It isn't something fixed, right?

    Is it something a little bit more than Espruino size?

    -rw-r--r-- 1 ceremcem ceremcem 477588 Jul 31 15:04 espruino_esp8266_user1.bin
    

    (0x076000 = 483328 > 477588)

  • @ceremcem
    http://www.espruino.com/Reference#l_Flas­h_getFree

    require("flash").getFree()

    This method returns an array of objects of the form {addr : #, length : #}, representing

    contiguous areas of flash memory in the chip that are not used for anything.

  • Note that FlashEEPROM is smart enough that you can just leave the argument out, and it'll automatically use require("flash").getFree()

  • @Gordon

    If I use FlashEEPROM as is (without a parameter), any attempt to write something into EEprom causes load() command to respond with No code in Flash error. I'm using 1v86.66 (compiled by myself)

    process.env.GIT_COMMIT
    ="a82d081a244d09706c3c885add25945008a08b­6d"
    
  • @Gordon

    I figured out the problem: It's all about my bundling script that uses uglifyjs where it drops lastAddr variable in FlashEEPROM by claiming "it's declared but not used". I changed appropriate flag of uglifyjs and all went ok.

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

[SOLVED] Broken library function in FlashEEPROM

Posted by Avatar for ceremcem @ceremcem

Actions