The system sdk_system_rtc_clock_cali_proc() is rather noisy, so
this patch calibrates the RTC count to the NTP time responses.
An average of many calls to sdk_system_rtc_clock_cali_proc() is used
for initialization.
The system calibration value is used to limit the calibration value
computed via the ntp times, to 1/16 either way.
A 64 bit RTC counter is implemented, and used in the calculations, but
might be of some use on its own.
The ratio of the ntp time differences and the RTC count differences is
filtered a little to keep the changes relatively stable and to filter
the jitter.
In case of heap corruption or some other major problem, dumping details
in the exception handler can cause a crash loop - so fail out if we seem
to be going in circles.
This commits adds JSON support by adding Jsmn
(http://zserge.com/jsmn.html), a minimalistic JSON parser.
Signed-off-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
Also reduces the IRAM footprint of the fatal exception handler, as only
the prelude (which disables interrupts & enables the flash mapping) is
in IRAM now.
Closes#54, relevant to #133.
Relies on global flags set when the user ISR is executing.
Unclear if this fixes any bugs as ISR code may not have been calling
into LWIP, but the previous implementation was broken.
newlib-xtensa revision cbe80794ed0083
This fixes a crash caused by heap operations occuring inside
ISRs. Particularly noticeable when sending a lot of network
traffic. Probably fixes#119, maybe other crashing bugs.
Configure/compile steps same as previous:
../configure --with-newlib --enable-multilib
--disable-newlib-io-c99-formats --enable-newlib-supplied-syscalls
--enable-target-optspace
--program-transform-name="s&^&xtensa-lx106-elf-&"
--disable-option-checking --with-target-subdir=xtensa-lx106-elf
--target=xtensa-lx106-elf
--prefix=/home/gus/dev/esp/rtos/open-rtos/libc/
--enable-newlib-nano-malloc --enable-newlib-nano-formatted-io --enable-newlib-reent-small --prefix=path_to/esp-open-rtos/libc
CROSS_CFLAGS="-DSIGNAL_PROVIDED -DABORT_PROVIDED" make
make install
This saves 1020 bytes from the text (IRAM) section by preventing
inlining of user_start_phase2() (and dump_flash_config_sectors() as
well) into the IRAM function sdk_user_start().