loadable binary drivers #22186
gemu2015
started this conversation in
Show and tell
Replies: 1 comment 15 replies
-
Hi, this sounds awesome. I'm not sure to understand where you store the drivers? In flash or in file-system? |
Beta Was this translation helpful? Give feedback.
15 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
a few years ago i did a proof of concept if relocatable drivers can be done in the ESP family #12070
it worked and my sample drivers were in use since that time without any problems.
recently i decided to resume work on this project and implement a better toolchain.
this all just for brain jogging purposes and for fun.
meanwhile i have a working toolchain with python scripts provided for automatically patching linker files,
extracting driver binaries, semi automatic conversion of existing tasmota drivers to the relocatable format etc.
and that for any ESP from ESP8266 1M up to all ESP32 types including RISC.
i converted nearly all sensor and device drivers i use in my house.
i solely use these drivers now in all my ESPs, see list below
even large drivers can be made compatible. i adapted an I2S sound output driver with WAV, MP3 player,
SAM (say) and Webradio. (all libs included in driver itself)
and also the complex sml driver
a software i2c driver can be included in the driver which allows for multiple i2c busses.
this concept has a lot of
advantages:
main binary only needs drivers that are too large or too complex for relocatable format.
all additionally needed drivers may be added or removed later during runtime over the web (no restart needed)
if a driver needs an update the main binary remains unchanged.
it can be mixed in any way with existing drivers
the main binary gets much smaller especially useful on 1M or 4M devices.
not a single Tasmota file has to be changed, only 1 additional plugin loader and management source needed
(adds about 20k of flash)
drivers only allocate memory if initialized, which is freed again on unlink.
thus much more RAM available
the drivers are plain machine code and execute from flash with maximum speed
(btw not related to scripting in any way)
disadvantages:
you need 3 types of driver binaries (ESP8266, ESP32 Tensilica, ESP32 RISC)
the drivers may only use C not C++
it needs some skills to convert or write these drivers.
(however writing a new driver is much easier than converting)
it is absolutely necessary to examine the generated assembly code to find parts that are not relocatable
and rewrite them. (depends on experience of coder)
i currently have no intent to PR this code, just for info what can be done.
some examples
List of already ported drivers:
sml
i2saudio(esp8266) wav player + SAM (say)
i2saudio(esp32) wav + mp3 player + Webradio + SAM (say)
mp3player (extern hardware)
sht3x
bmpx
vl530x
cc1101-eqmax (868 Mhz)
veml6075
rdm6300
pn532 (serial+i2c)
mlx90614
mlx90614 with software i2c
sps30
scd30
sgp30
ccs811
sr04
ads1115
htu21
ds18x20
pcf8574
ld2410
Beta Was this translation helpful? Give feedback.
All reactions