These are chat archives for esp8266/Arduino

31st
May 2015
chad cormier roussel
@chadouming
May 31 2015 22:59
is it fast to write to eeprom ?<
Me No Dev
@me-no-dev
May 31 2015 23:01
are you asking about this particular EEPROM implementation?
it should be at flash speed
actuall eeproms are slow
chad cormier roussel
@chadouming
May 31 2015 23:01
this one here
Me No Dev
@me-no-dev
May 31 2015 23:02
probably the fastest you can get
remeber that write is done only on close or commit
chad cormier roussel
@chadouming
May 31 2015 23:03
cause i'm thinking about reading the time from an NTP, but only once every hour to stay sync. otherwise i'd just sleep for a certain ammount time
Me No Dev
@me-no-dev
May 31 2015 23:03
untill you call one of those, you are just manilupating the data in the buffer
chad cormier roussel
@chadouming
May 31 2015 23:03
instead of getting time from NTP every time
Me No Dev
@me-no-dev
May 31 2015 23:03
how would that work?
Ivan Grokhotkov
@igrr
May 31 2015 23:03
there are RTC registers which store current time, you may want to use those...
Me No Dev
@me-no-dev
May 31 2015 23:04
on wakeup you reboot
where are those?
chad cormier roussel
@chadouming
May 31 2015 23:10
this indeed looks interesting
Ivan Grokhotkov
@igrr
May 31 2015 23:11
0x6000071C i think
not sure what the units are though
likely microseconds
Me No Dev
@me-no-dev
May 31 2015 23:13
do we have any info on those registers in the begginning of the 0x700 range?
Ivan Grokhotkov
@igrr
May 31 2015 23:13
some info in that archive i sent you at some point
also i have some notes from my own disassembly sessions
but i haven't seen a complete description of RTC regs
chad cormier roussel
@chadouming
May 31 2015 23:14
hmm, this would be the time since the chip has battery ?
Ivan Grokhotkov
@igrr
May 31 2015 23:15
app/include/hw/esp8266.h
this would be the time since sleep started i suppose
so you need to save the "real" UTC time somewhere in RTC memory
and then when you wake up, add the RTC microsecond offset to the time you have saved
that would be the current time
Ivan Grokhotkov
@igrr
May 31 2015 23:30
updated the bootloader to handle commands passed via RTC
not wired from the sketch side yet though
i'm thinking how to make the IDE upload sketches over wifi...
my current thought is as follows:
chad cormier roussel
@chadouming
May 31 2015 23:32
yet another way to make it even more awesome
Ivan Grokhotkov
@igrr
May 31 2015 23:32
1) extend mDNS library with DNS-SD support. this will allow the IDE to find all ESPs on the local network
2) add a listening UDP PCB on the ESP side. it will listen for "get the new sketch!" commands
3) when it gets this command, somehow kill all other TCP and UDP connections (otherwise we risk running in "LmacRxBlk:1" stuff) and start loading the new sketch
4) on the host side, add all the network upload functions to esptool...
Me No Dev
@me-no-dev
May 31 2015 23:36
load the new sketch where?
and why kill all tcp?
Ivan Grokhotkov
@igrr
May 31 2015 23:37
we have a region of flash dedicated to the sketch... part of it is used by the sketch which is already loaded. the rest is free
remember what happened when you were testing file uploads using the webserver?
Me No Dev
@me-no-dev
May 31 2015 23:37
no chance for your bootloader to boot in different sketch?
Ivan Grokhotkov
@igrr
May 31 2015 23:37
and mDNS PCB was not serviced...
Me No Dev
@me-no-dev
May 31 2015 23:37
a small sketch to deal with that update
yeah...
i remember
chad cormier roussel
@chadouming
May 31 2015 23:38
yeah, would be nice to have some kind of upload mode
Ivan Grokhotkov
@igrr
May 31 2015 23:38
regarding booting into a different sketch — well, then the sketch has to be built using a different linker script
chad cormier roussel
@chadouming
May 31 2015 23:38
the command could send the device in "download mode"
Me No Dev
@me-no-dev
May 31 2015 23:39
yeah... how to make it really small though...
network stack takes lots
Ivan Grokhotkov
@igrr
May 31 2015 23:40
anyway
i think of wiring all the network PCBs into a linked list
then i can walk this list and kill all the PCBs one by one
then just go into "upload mode", in which loop() function will no longer run
Me No Dev
@me-no-dev
May 31 2015 23:41
what if there are no loop functions?
gpio interrupts should be disabled
maybe init the pins?
that would stop al communication
Ivan Grokhotkov
@igrr
May 31 2015 23:43
yes, should also bring gpio, timers, UART into known "idle" state
OR
i can download the new sketch in background
and not kill anything until it is downloaded
chad cormier roussel
@chadouming
May 31 2015 23:44
then just install it and reboot
Me No Dev
@me-no-dev
May 31 2015 23:45
you sounded like that was not possible
chad cormier roussel
@chadouming
May 31 2015 23:45
well, sketch size would need to be smaller than available flash, no ?
Ivan Grokhotkov
@igrr
May 31 2015 23:45
no at first i was just thinking about using blocking IO for download
but if i use non-blocking stuff then this can be done in background
Me No Dev
@me-no-dev
May 31 2015 23:46
makes sence to be in BG if nothing can that the user is runnng can break it
Ivan Grokhotkov
@igrr
May 31 2015 23:46
right, (current sketch size) + (uploaded sketch size) should be less than (total area for sketch)
good point
chad cormier roussel
@chadouming
May 31 2015 23:47
C:\Users\chad\Desktop\arduino-1.6.5\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_timer.c:34:1: error: expected identifier or '(' before '/' token
/ ------------------------------------------------------------------ -
^
C:\Users\chad\Desktop\arduino-1.6.5\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_timer.c: In function 'timer1_isr_handler':
C:\Users\chad\Desktop\arduino-1.6.5\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_timer.c:42:9: error: 'timer1_user_cb' undeclared (first use in this function)
if (timer1_user_cb) timer1_user_cb();
^
C:\Users\chad\Desktop\arduino-1.6.5\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_timer.c:42:9: note: each undeclared identifier is reported only once for each function it appears in
C:\Users\chad\Desktop\arduino-1.6.5\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_timer.c: In function 'timer1_attachInterrupt':
C:\Users\chad\Desktop\arduino-1.6.5\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_timer.c:50:5: error: 'timer1_user_cb' undeclared (first use in this function)
timer1_user_cb = userFunc;
^
C:\Users\chad\Desktop\arduino-1.6.5\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_timer.c: In function 'timer1_detachInterrupt':
C:\Users\chad\Desktop\arduino-1.6.5\hardware\esp8266com\esp8266\cores\esp8266\core_esp8266_timer.c:55:5: error: 'timer1_user_cb' undeclared (first use in this function)
Ivan Grokhotkov
@igrr
May 31 2015 23:47
if user does noInterrupts() the this will break
chad cormier roussel
@chadouming
May 31 2015 23:47
i think one the comment was done wrong in your last push
Me No Dev
@me-no-dev
May 31 2015 23:48
yeah noticed too
Me No Dev
@me-no-dev
May 31 2015 23:48
missing /
chad cormier roussel
@chadouming
May 31 2015 23:48
indeed, missing an *
or another /
Ivan Grokhotkov
@igrr
May 31 2015 23:49
yep
sec
Me No Dev
@me-no-dev
May 31 2015 23:49
@igrr any chance to position permanently the libs?
like have them in a linker so as you wanted not needed to be uploaded again
Ivan Grokhotkov
@igrr
May 31 2015 23:50
not possible yet. we need to replace heap initialization with our own function for this to be possible
need to start replacing main() with our own version
Me No Dev
@me-no-dev
May 31 2015 23:51
this apprach could be a real problem on a 512K memory
Ivan Grokhotkov
@igrr
May 31 2015 23:51
yes i think OTA will not work on 512k
but i'm okay with that
at least it will work for >=1M
that's good for a start
chad cormier roussel
@chadouming
May 31 2015 23:52
:(
Ivan Grokhotkov
@igrr
May 31 2015 23:52
then we can implement something more complicated (like pinning the libs)
chad cormier roussel
@chadouming
May 31 2015 23:52
i'll need to buy some esp-12 xD
Me No Dev
@me-no-dev
May 31 2015 23:53
i imagine that most of the size is the libs
sketches are actually not that much
Ivan Grokhotkov
@igrr
May 31 2015 23:53
yes empty sketch is about 46% of sketch memory available on 512k flash
that's 512k - 5 sectors for EEPROM - 16 sectors for SPIFFS
Me No Dev
@me-no-dev
May 31 2015 23:55
where will you start writing the new sketch?
Ivan Grokhotkov
@igrr
May 31 2015 23:55
right where the current one ends
Me No Dev
@me-no-dev
May 31 2015 23:55
block margin I imagine
Ivan Grokhotkov
@igrr
May 31 2015 23:55
well, rounded up to a sector
yes
Me No Dev
@me-no-dev
May 31 2015 23:56
do you know the size of the current loaded sketh?
Ivan Grokhotkov
@igrr
May 31 2015 23:56
i can walk the binary image headers and calculate it, just like the bootloader does it
Me No Dev
@me-no-dev
May 31 2015 23:56
there i think is a variable exported from the linker
chad cormier roussel
@chadouming
May 31 2015 23:58
hmm, are the libs at the beggining or the end ?
Ivan Grokhotkov
@igrr
May 31 2015 23:58
they used to be at the end
now they are at the beginning
Me No Dev
@me-no-dev
May 31 2015 23:58
there is _irom0_text_end
Ivan Grokhotkov
@igrr
May 31 2015 23:58
_irom0_text_end is no longer the end of sketch...
Me No Dev
@me-no-dev
May 31 2015 23:58
_text_end then?
chad cormier roussel
@chadouming
May 31 2015 23:58
cant you just calculate the size and start writing the new sketch from there, thus not needing to write all the libs again ?
Ivan Grokhotkov
@igrr
May 31 2015 23:59
right now the order is
.irom0.text .text .data .rodata
Me No Dev
@me-no-dev
May 31 2015 23:59
what is at the end now?
_rodata_end
Ivan Grokhotkov
@igrr
May 31 2015 23:59
but _rodata_end is an address in the RAM, it doesn't tell you where in the flash _rodata ends
Me No Dev
@me-no-dev
May 31 2015 23:59
there is such thing for any segment