pcsc-lite for limited (embedded) systems
Limited or embedded systems
Since Linux is working everywhere some of this everywhere is connected to a smart card reader. And of course pcsc-lite is used.
Example of embedded systems
I am not aware of any projects using pcsc-lite. I will just give two examples.
- Android: see the seek for android project trying to bring a Smartcard API for Android
- GCR5500: It is a health care reader for doctors, etc. It is also possible to connect a USB smart card reader and pcsc-lite is used to manage this external reader.
- Many set top boxes (ADSL modem, home routers, etc.) are using Linux. Some of the boxes have a smart card reader.
Starting with pcsc-lite 1.6.0 I worked on memory optimizations. The work is not yet finished since I have other ideas.
Disable unused interfaces
--disable-usboptions to remove code that will not be used.
--disable-serialremoves support of
gain: 8.0kB of .text (12%) and 160 bytes of .bss (4%) for pcscd
--disable-usbremoves support of USB hotplug
gain: 9.7kB of .text (14%) and 960 bytes of .bss (23%) for pcscd
If you use both options (and use a static driver configuration) gain:
17.7kB of .text (26%) and 1152 bytes of .bss (28%) for pcscd
Since the embedded systems are not supposed to be directly administered having logs in /var/log/syslog is not useful.
- Minimal pcsc_stringify_error()
NO_LOGis defined a minimal
pcsc_stringify_error()is used. The function is still available but only the error code in hex is displayed in this case.
Gain: 2kB of .text (10%) for libpcsclite
- No log function
If NO_LOG is defined then no log are displayed. The log functions are defined (they are also used by the drivers) but are empty.
With NO_LOG defined we gain 26% (17 kB) for the .text segment of pcscd and 15% (4 kB) for the .text segment of libpcsclite.so (for i386)
One option to activate the embedded mode
Just use the
--enable-embedded(default is no) configure option to build pcsc-lite for an embedded system. This will activate the NO_LOG option to disable logging and limit RAM and disk consumption.
--enable-embeddedis used and you disable the communication interface you do not use (serial or USB) you can expect a gain of 40% on the code size and then a reduced disk/flash space and memory used.
To be followed...