Although a single library is used for BER, DER, PER, UPER, CER, CXER, and XER, the appropriate functions are extracted from the library based on the encoding rules that you select. For example, if you chose -per -ber, you will see that after linking the size of the resulting executable is quite different compared to your specifying just -ber or -per.
If size is a major concern, consider specifying the option -minimize. The effect of this option is that it suppresses use of all capabilities not critical to correctly encoding and decoding values (e.g., runtime strong constraint checking is suppressed.)
Another way to keep size to a minimum is to use the lean encoder/decoder library. Not only are the functions in this library --which was built specifically for embedded systems-- much smaller and faster than the space-optimized library functions (SOED), it is possible for you to purchase the source for it and do your own custom builds. By default the library includes many capabilities, but if you purchase the source you will be able to #define constants which produce minimal builds that more closely meet your individual needs than the build that OSS does.
Caveat: The lean encoder/decoder library gets its minimal size and speed increase by selecting how ASN.1 types will be locally represented. If you have already written your application then there is a good chance that you will need to make code changes since the C representations that you are using may not be the same as those selected by the lean encoder/decoder. If you have not gotten far in your implementation then the lean encoder/decoder is more likely to be ideal for you.
The samples included with some of the Knowledge Center answers are meant for your general understanding of the OSS products. Different versions of the products might produce slightly different outputs. Consult the products documentation and samples for the most up-to-date products information and code examples.
Test drive the OSS Nokalva ASN.1, LTE, and XML Tools now! Your trial includes complete software, documentation, sample programs, free 24x7 technical support and more.
Our expert personnel can help you learn ASN.1!
We offer 4-day ASN.1 courses at our headquarters or your premises.