HML_FwLib_STC90 is a member component of HML firmware library, providing a group of interface functions for users to operate on-chip resource of STC90 MCUs, including GPIO, ISP, timer, UART, external interrupt and watchdog. The STC90 MCU is a kind of Intel MCS-51 based MCU which released by STC Micro(宏晶). This series MCU have more on-chip resource than classical 8051 MCU.
We intend to provide a lite and easy-use firmware library that can help future developers to complete projects based on STC90 MCUs more easily and quickly. All source codes are written in C language and for SDCC compiler, i.e., it can only be compiled by SDCC. This choice is motivated by the fact that SDCC is free and highly efficient, while there are very few examples of application about SDCC on the Internet. We hope that, as one of the early attempts to develop MCU projects using SDCC, this work will make SDCC become more popular among MCU developers.
Please visit detail page for more information to get started it!
- 🎯Based on SDCC compiler.
- Cover all on-chip resource of STC90 series MCUs.
- Open all source code on Github and licensed under the WTPL2.
- Readable code and provide examples to help you get started it.
Here is a list of the all on-chip peripheral drivers and examples that need to be ported.
Peripheral | Description | Status |
---|---|---|
ADC | analog-to-digital Converter | plan |
extended bus | Intel 8080 bus receiver/transmitter | supported |
EXTI | extern interrupt | supported |
GPIO | I/O peripheral | supported |
ISP | internal EEPROM | supported |
RST | reset control | supported |
TIM | timer | supported |
UART | universal asynchronous receiver/transmitter | supported |
WDT | watchdog | supported |
There are several parameters with compile macro format need to be configured by user manually. They are all defined in hml/conf.h.
In order to ensure the projects based on HML_FwLib_STC90 can be downloaded into the limited on-chip flash space of STC90 MCUs,
the developers can modify value of the macro definition named __CONF_COMPILE_xxx
in hml/conf.h as 1
to specify which piece
of code will take part in compilation, then it will reduce size of final .hex file. If user only use GPIO module, then user just
need to enable __CONF_COMPILE_GPIO
macro in hml/conf.h. Some macros for conditional compilation rely on others. For example,
before you enable the macro definition __CONF_COMPILE_UART
, the macro __CONF_COMPILE_TIM
and __CONF_COMPILE_TIM2
should be
enabled, otherwise the compilation would be failed.
This macro marks frequency of clock source, including extern crystal oscillator or internal RC oscillating circuit, and it's defined in conf.h.
This macro marks the model of target MCU and is defined in hml/conf.h.
We provide two kinds of build system support:
- cmake
- gmake
Run this command for initialization. Add option -GNinja
if you expect to build project via Ninja.
$ cmake -S . -B build
Run this command for building project. Add option --clean-first
if you want to execute clean operation before building.
$ cmake --build build -j$(nproc)
You can execute command cmake --build build -t usage
for usage. If you want to adjust build details, please modify cmake/config.cmake
.
There is a source file named test.c under usr directory, we have put a main function here. Execute this command for building HML_FwLib_STC90 with GNU Make.
$ make -j$(nproc)
You can execute command make help
for usage. If you want to adjust build details, please modify mk/config.mk
.
Welcome suggestions and contribution from you! You can fork it or contact us via mcu@zhishan-iot.tk.
HML_FwLib_STC90 is licensed under the WTFPL2.
member | role | |
---|---|---|
Amy Chung | Testing | zhongliguo@zhishan-iot.tk |
Jiabin Hsu | MCU developer | zsiothsu@zhishan-iot.tk |
Weilun Fong | Director | wlf@zhishan-iot.tk |