-
Notifications
You must be signed in to change notification settings - Fork 13
Home
Welcome to the stm8_libs wiki!
Goals and philosophy: My goal with these libraries is to get the smallest and fastest code for the STM8 CPU family. They are lightweight so that even the stm8s103 with only 8K of Flash can do very useful things. I use inline assembly when the compiler output looks bloated, or I want to get the device timings correct.
My philosophy is that main program code SHOULD NOT use inline assembly. It would be harder to maintain, even for the original author. Main program code should be maintainable by anybody. Library code, however, will be left alone after debugging. It will be used by many projects, and any improvements in size or speed will echo through every project that uses it. So libary code MAY use inline assembly in carefully selected parts. In some cases, the size savings can be great. Ten bytes here, twenty there, multiplied by the number of libraries used in a project can make it worthwhile. An extreme example is my AES-128 encryption/decryption code. It would be hideously larger and slower without inline assembly.
I want the libraries to be easy to use. Just add #include "lib_xxxx.h"
and don't worry about interrupts. Initialization is with a function called xxxx_init()
. Options are described in the .h file. Generally, configuration settings go in the .h file so that the C source file avoids changes if possible.
Also, I want the library functions to be easily used WITHOUT needing to look up details in the data sheet.
I use both the stm8s103 and stm8s105 chips, so I have a main libs/ directory with -DSTM8103 to compile for the -103. And I have a separate libs_105/ directory full of symlinks to the main libs/ directory and they compile with -DSTM8105. It works for me.
I have some test and example code for the libraries in stm8_tests.