Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E.setBootCode() causes constant reboots on ESP8266 #891

Closed
ceremcem opened this issue Jul 31, 2016 · 5 comments
Closed

E.setBootCode() causes constant reboots on ESP8266 #891

ceremcem opened this issue Jul 31, 2016 · 5 comments
Labels
ESP8266 This is only a problem on ESP8266 devices

Comments

@ceremcem
Copy link

Reproduce

  • Load a code (with function onInit(){...)into ESP(12)

  • Toggle power

  • See your code runs as normal.

  • Run E.setBootCode("console.log('this is bootcode');", true)

  • Toggle power

  • See constant resets:

    ets Jan 8 2013,rst cause:2, boot mode:(3,0)

    load 0x40100000, len 1396, room 16
    tail 4
    chksum 0x89
    load 0x3ffe8000, len 776, room 4
    tail 4
    chksum 0xe8
    load 0x3ffe8308, len 540, room 4
    tail 8
    chksum 0xc0
    csum 0xc0

    2nd boot version : 1.4(b1)
    SPI Speed : 80MHz
    SPI Mode : QIO
    SPI Flash Size & Map: 32Mbit(512KB+512KB)
    jump to run user1 @ 1000

  • Reflash firmware

  • Load an example code

    onInit = function(){console.log("heyyyyyyyyyy");}
    save()
    
  • Toggle power

  • See last code runs as normal at boot.

@tve
Copy link
Contributor

tve commented Aug 7, 2016

The reason is that https://github.com/espruino/Espruino/blob/master/src/jswrap_flash.c#L525 passes the flash address to jspEvaluate but what's needed on the esp8266 is the memory address at which flash is mapped. The following line makes it work: code = (char *)(FLASH_DATA_LOCATION) + 0x40200000; which of course doesn't work on any other platform. (Ticket updated from prior comment).

The following patch fixes it, but I suspect Gordon may want something prettier.
tve@8d2f1b4

@gfwilliams
Copy link
Member

Ahh, good spot - thanks :)

Well, that is a bit of a hack, but in the scheme of things it's not that bad... Adding some kind of AS_FLASH_ADDR macro to https://github.com/espruino/Espruino/blob/master/src/jsutils.h#L58 might be cool, as you could re-use it where you do a similar thing with 0x40200000 in jshardware.c

But to be honest it's fine - some kind of comment might be nice though :)

@gfwilliams gfwilliams added the ESP8266 This is only a problem on ESP8266 devices label Sep 12, 2016
tve added a commit to tve/Espruino that referenced this issue Sep 17, 2016
@MaBecker
Copy link
Contributor

MaBecker commented Dec 9, 2016

@ceremcem - can this be closed ?

@MaBecker
Copy link
Contributor

MaBecker commented Jan 7, 2017

@gfwilliams - fix works - please close this issue

@gfwilliams
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ESP8266 This is only a problem on ESP8266 devices
Projects
None yet
Development

No branches or pull requests

4 participants