Avatar for jonreid

jonreid

Member since Nov 2015 • Last active May 2018
  • 11 conversations
  • 89 comments

Most recent activity

    • 11 comments
    • 281 views
  • in JavaScript
    Avatar for jonreid

    So could the compact/rearrange occur during the first eval ? I am not sure if this is the problem, as even if I reboot and try to eval the code later it still fails. So what I was doing originally was

    1. Save bootloader from IDE (not using Save on Send so should be all in RAM ?)
    2. Bootloader runs code ver 1 by eval (This was previously written to storage by bootloader)
    3. Code ver is running, is notified of software update so reboots to bootloader (E.enableWatchdog(1); while(1);)
    4. Bootloader receives code v2 via serial port, writes to Storage
    5. Bootloader eval code v2 but fails due to code errors. Even if I reboot it still fails.

    If I delete code v1 before writing v2 to Storage, it works. Not sure if that shows something I am missing.

    I will try your suggestion of eval to RAM as well

  • in JavaScript
    Avatar for jonreid

    OK so I have my MEDBT42 bootloader up and running now. It loads new code in from another module via the serial port, saves to Storage and then eval.

    What I started with was keeping a copy of the previous working copy also, but I found then on writing the second, new copy of code on eval the code was corrupt and would not run. The code size is 10.5kB.

    I am also saving the bootloader code from the IDE using 'save on send' and I have also observed the bootloader code getting corrupted when saving both copies of main code.

    I would not have thought that I am running out of space with my bootloader of 3k and 2x 10.5kb there would be a size issue that would cause the corruption ? Any thoughts ?

  • in JavaScript
    Avatar for jonreid

    What do you mean by your earlier comment of running from flash that 'it will be pretty efficient' ?

    What are the downsides to running from flash vs loading to RAM ? (Apart from the deletion issue you pointed out)

  • in JavaScript
    Avatar for jonreid

    OK sounds good ! So the Storage lib is just using from flash_code_start onwards ? And so it wont clash with the Flash lib I have set to work between 397312 and 430080

  • in JavaScript
    Avatar for jonreid

    I think I have another issue which is available flash space. Currently I have
    FlashEEPROM start_address = 393216
    Flash start_address = 397312, end_address = 430080

    But process.memory().flash_code_start is reported as 442368. So I only have 12kb of space left which is not going to be enough for storing 2 copies of code. So I may have to rethink my strategy a bit if I cant get a little more free flash space.

    Is there a way to alter .flash_code_start ? As the only initially saved() code would be my small bootloader

  • in JavaScript
    Avatar for jonreid

    On the MDBT42 currently I use Flash (for a circular logging buffer where some bytes are written twice before erase) and FlashEEPROM for storing a couple of params. I make sure they don't overlap by doing the following:

    flashEEPROM = new (require("FlashEEPROM"))();
    flashEEPROM.endAddr = flashEEPROM.addr+PAGE_SIZE;
      
    flash = require("Flash");
    logStartAddress = flashEEPROM.endAddr;
    logEndAddress = logStartAddress + NUM_LOG_PAGES*PAGE_SIZE;
    

    I am interested in swapping out flashEEPROM for the new Storage Library as want to store downloaded code to run and it seems a nice way to handle it. Can I get it to run alongside the Flash library ? If not I will just use the Flash lib to store the code.

  • in Porting to new Devices
    Avatar for jonreid

    How far away are you from having the mdbt42q modules for sale ? We need some more !

  • in Other Boards
    Avatar for jonreid

    Oh i did not think to check that. I just assumed the external pads were free. Easy to swap over.

Actions