Skip to content

A lite firmware library for 8051 MCU based on SDCC complier | 基於SDCC編譯器實現的針對8051單晶片的輕量級固件庫

Notifications You must be signed in to change notification settings

sdvcn/HML_FwLib_8051

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HML_FwLib_8051

BuildStatus License MCU

What is HML_FwLib_8051

HML_FwLib_8051 is the first member component of HML firmware library, providing a group of interface functions for users to operate on-chip resource of MCS-51 MCUs, including GPIO, external interrupt, timer and UART modules. The 8051 MCUs have been one of the most widely used MCUs since it was produced by Intel in 1981. As amateurs with some experience of 8051 development, we intend to develop a lite and easy-use tool that can help future developers to complete projects based on 8051 MCUs more easily and quickly.

The 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!

Feature

  • 🎯Based on SDCC compiler.
  • Cover all on-chip resource of 8051 MCUs.
  • Open all source code on Github and licensed under the WTPL2.
  • Readable code and provide examples to help you get started it.

Prerequisite

Usage

file structure

HML_FwLib_8051
├─doc      #store related documents about HML_FwLib_8051
├─example  #provide some example files with *.c format to help users learn about HML_FwLib_8051
├─inc      #include all header files(*.h) of HML_FwLib_8051
├─obj      #store all output files, including *.hex,*.ihx,*.lk,*.rel and others during compilation
├─src      #store all source files(*.c) of HML_FwLib_8051
└─usr      #store makefile and a source file which includes main function

configuration

There are several parameters need to be configured by user manually.

_FRE_OSC_

The macro mark frequency of clock source, including extern crystal oscillator, and it's defined in macro.h. The default value is 11059200L.

conditional compilation

In order to ensure the projects based on HML_FwLib_8051 can be downloaded into the limited on-chip store space of 8051 MCUs, the developers can modify the macro definition named ___COMPILE_XXX___ in macro.h to specify which piece of code should be compiled, thus to reduce the size of the HEX file. If user only use GPIO module, then user just need to enable ___COMPILE_GPIO___ macro definition in macro.h. Some macros for conditional compilation rely on others. For example, before you define the macro definition ___COMPILE_UART___, the macro ___COMPILE_TIM___ should be defined, otherwise the compilation would be failed.

code & compilation

There is a source file named test.c under usr directory, we have put a main function here. User can add and modify own code here, then enter make in terminal, the Makefile will work and complete compilation. From version V0R3, you can enter make help to get all usages, and former version makefile only support make, make clean, make mostlyclean(change into make distclean now)

Certainly, you can just add inc and src directory into your project structure, and write your own makefile to build a custom project.

Contributing

Welcome suggestions and contribution from you! You can fork it or contact us via [email protected].

License

HML_FwLib_8051 is licensed under the WTPL2.

Team

This is a one-man project....

member role e-mail
Weilun Fong Developer [email protected]

About

A lite firmware library for 8051 MCU based on SDCC complier | 基於SDCC編譯器實現的針對8051單晶片的輕量級固件庫

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 83.5%
  • Makefile 11.2%
  • C++ 5.3%