Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Me No Dev
@me-no-dev
and we wrap it this way :)
Clemens Kirchgatterer
@everslick
-Wl,-wrap,system_restart_local AHH
abviously th linker adds _wrap by itself ?
Me No Dev
@me-no-dev
yes and __real_[method name]
Clemens Kirchgatterer
@everslick
thats what ivan mentioned above
now i get it
Me No Dev
@me-no-dev
that coresponds to the original function
Clemens Kirchgatterer
@everslick
so i have to declare extern void ___real_malloc(size_t) and implement void ___wrap_malloc(size_t)
and set the linker flag -Wl,wrap,malloc and be done
argl this chat swallows all kind of symbols :(
Me No Dev
@me-no-dev
extern void * __real_malloc(size_t);
void * __wrap_malloc(size_t len){
  ets_printf("trying to mallog %u bytes\n", len);
  return __real_malloc(len);
}
Clemens Kirchgatterer
@everslick
nice, cut'n paste for me! THX!!! :-)
Me No Dev
@me-no-dev
:)
but... since we are using umm_malloc, you might need to wrap actually umm_malloc(size_t) ninstead
I have not checked how umm maps it['s functions to malloc/free and so on
Clemens Kirchgatterer
@everslick
it just adds defines i.e. umm_malloc malloc ...
so yes, i guess i have to wrap umm*
marksev1
@marksev1
https://www.youtube.com/watch?v=fPDBZUztAhY here i found code so that the gesture sensor can work with esp8266 :)
Clemens Kirchgatterer
@everslick
hmpf, slight annoyance: my __wrap_malloc functions get mangled even though i declare them extern "C"
Mario Mikočević
@mozgy
sigh, #1916 stolen code ..
Michael Miller
@Makuna
@mozgy stolen? They had copied code and made it into a usable Arduino Library, code that is not marked with any license, and they gave accreditation to that original code. What are you seeing that I didn't?
Clemens Kirchgatterer
@everslick
is there a way to get the number of bytes sent over a network interface? like e.g. ifconfig ?
LWIP_STATS_DISPLAY is not enabled in lwIP config, so IP_STATS_DISPLAY() functions will not work
Ivan Grokhotkov
@igrr
ah, my bad. LWIP_STATS is disabled in default build of lwIP
But you can change that line locally and use lwIP built from source.
To do that, you need to be using git version of the core, and select "Core Development Module" board from Tools menu. It will have an additional option to select lwIP variant used.

Just tried that myself, seems to be working fine.
Add

extern "C" {
  #include <lwip/stats.h>
}

to the sketch

Ivan Grokhotkov
@igrr
lwip_stats.ip.xmit returns something sane, lwip_stats.etharp.xmit and lwip_stats.link.xmit do not seem to work
Clemens Kirchgatterer
@everslick
thank you very much. any chance that those stats could be made available in the default build? i open a can of worms, if i have to redo those changes every time i update esp8266/Arduino. :-/
IMHO performance measures are painfully missing
with your help i can now track heap memory (with the malloc wrapper) but my cpu load measurment is very cumbersum. i count the number of yield and delay calls and estimate some cpu load from that :-(
it would also be interesting how much cpu time is spent in the core and how much in 'user space'.
or is there something like a 'idle' time (sleeping) ?
Ivan Grokhotkov
@igrr
First we need to check how much RAM does enabling stats consume... Then, if the value is not huge (or if we can enable just a portion of these stats), we can make this change once we switch to GCC-built lwip as the default one.
#1926
Clemens Kirchgatterer
@everslick
IC
looks promising. :)
Me No Dev
@me-no-dev
@igrr see there was a point of adding source build option not just for me :)
Ivan Grokhotkov
@igrr
@me-no-dev yeah, i see the point :)
since i was building from the command line, it was never actually a trouble for me to do make -C path/to/lwip all install && ./build-sketch.py
but it is good to be able to do that from the IDE :)
Clemens Kirchgatterer
@everslick
what was the make option to set a define from command line?
Ivan Grokhotkov
@igrr
make CPPFLAGS=-DLWIP_STATS=1
Clemens Kirchgatterer
@everslick
or i could use sed to chang that particular define in lwipopts.h
thx, will try this first :)
Ivan Grokhotkov
@igrr
maybe it needs some quotes around -DLWIP_STATS=1
Mario Mikočević
@mozgy
@me-no-dev yes, thats a copy and one that do not even work on all OLEDs, I don't like when people put their names in credits for something copied and barely functional
there are several OLED libraries that are way better than this, imnho the best is https://github.com/squix78/esp8266-oled-ssd1306