Avatar for Ragtime

Ragtime

Member since Aug 2020 • Last active Sep 2020
  • 2 conversations
  • 8 comments

Most recent activity

  • in ESP32
    Avatar for Ragtime

    Thanks a lot!

    Do you know if Espruino generates any map file when building the firmware? (I'm trying to get how much ROM space the Espruino engine alone is taking up without Espressif and other underlying modules.)

  • in ESP32
    Avatar for Ragtime

    On the Espruino ESP32 page , it says the factory partition is for the initial Espruino firmware.

    And on the FAQ page it says

    Espruino uses between 100kb and 200kb of Flash,

    But the esptool.py says it actually takes around 1.33 MB instead of 200 KB when I flash the firmware to ESP32.

    Wrote 1397712 bytes (903419 compressed) at 0x00010000 in 12.3 seconds (effective 907.6 kbit/s)...
    

    My question is:
    Does the factory partition also include ESP32 firmwares and other underlying drivers utilized by Espruino? If that's true, is it possible to get the exact flash space used by Espruino engine itself?

  • in General
    Avatar for Ragtime

    Good idea! I tried debugger; with print manually. Looks like a good way. Will try some plugins or modifying the debugger code later to test on larger programs :D

  • in General
    Avatar for Ragtime

    Understood! Thanks :)

  • in General
    Avatar for Ragtime

    Understood! Thanks a lot for your help :)

  • in General
    Avatar for Ragtime

    Another example of fibonacci:

    print(`Initial: ${JSON.stringify(process.memory())}`);
    function fibonacci(num) {
      print(`num ${num}: ${JSON.stringify(process.memory())}`);
      if (num <= 1) return 1;
    
      return fibonacci(num - 1) + fibonacci(num - 2);
    }
    print(`Before: ${JSON.stringify(process.memory())}`);
    fibonacci(5);
    print(`After: ${JSON.stringify(process.memory())}`);
    

    Result:

    Initial: {"free":2379,"usage":121,"total":2500,"h­istory":0}
    Before: {"free":2373,"usage":127,"total":2500,"h­istory":0}
    num 5: {"free":2366,"usage":134,"total":2500,"h­istory":0}
    num 4: {"free":2360,"usage":140,"total":2500,"h­istory":0}
    num 3: {"free":2354,"usage":146,"total":2500,"h­istory":0}
    num 2: {"free":2348,"usage":152,"total":2500,"h­istory":0}
    num 1: {"free":2342,"usage":158,"total":2500,"h­istory":0}
    num 0: {"free":2341,"usage":159,"total":2500,"h­istory":0}
    num 1: {"free":2347,"usage":153,"total":2500,"h­istory":0}
    num 2: {"free":2353,"usage":147,"total":2500,"h­istory":0}
    num 1: {"free":2347,"usage":153,"total":2500,"h­istory":0}
    num 0: {"free":2346,"usage":154,"total":2500,"h­istory":0}
    num 3: {"free":2359,"usage":141,"total":2500,"h­istory":0}
    num 2: {"free":2353,"usage":147,"total":2500,"h­istory":0}
    num 1: {"free":2347,"usage":153,"total":2500,"h­istory":0}
    num 0: {"free":2346,"usage":154,"total":2500,"h­istory":0}
    num 1: {"free":2352,"usage":148,"total":2500,"h­istory":0}
    After: {"free":2373,"usage":127,"total":2500,"h­istory":0}
    

    It's fun to see how the RAM usage grows, but I don't find how I can get the peak RAM usage of the program without putting process.memory() on every step...

  • in General
    Avatar for Ragtime

    Thanks a lot for your help! :)
    I played with process.memory() for a while on some toy code, but still no sure what usage and history mean.
    For example:

    const ramBefore = process.memory();
    const helloWorld = `${JSON.stringify(process.memory())} Hello, world!`;
    const ramAfter = process.memory();
    
    print(`RAM Before: ${JSON.stringify(ramBefore)}`);
    print(`RAM Middle: ${helloWorld}`);
    print(`RAM After: ${JSON.stringify(ramAfter)}`);
    

    Result:

    RAM Before: {"free":2383,"usage":117,"total":2500,"h­istory":6,"gc":0,"gctime":3.47900390625,­"blocksize":16,"stackEndAddress":5369295­92,"flash_start":0,"flash_binary_end":44­3732,"flash_code_start":446464,"flash_le­ngth":524288}
    RAM Middle: {"free":2336,"usage":164,"total":2500,"h­istory":11,"gc":0,"gctime":3.57055664062­,"blocksize":16,"stackEndAddress":536929­592,"flash_start":0,"flash_binary_end":4­43732,"flash_code_start":446464,"flash_l­ength":524288} Hello, world!
    RAM After: {"free":2330,"usage":170,"total":2500,"h­istory":19,"gc":0,"gctime":3.57055664062­,"blocksize":16,"stackEndAddress":536929­592,"flash_start":0,"flash_binary_end":4­43732,"flash_code_start":446464,"flash_l­ength":524288}
    

    If I understand the document correctly, then usage is the number of currently used blocks of RAM, and history is the number blocks used by all the the commands (JS statements) until inclusive the current statement, right?

  • in General
    Avatar for Ragtime

    Hello there,

    Does anyone know how I can get the heap or RAM usage of a program on Pixl?

    I'm trying to find out how much RAM or heap can be saved from applying the Performance Notes. Also trying to see how much RAM is used by the Espruino engine itself and by my program.

    Any help will be appreciated.

Actions