Embedded core written in C for AVR devices based on layered architecture with full integration of FreeRTOS kernel.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
You'll need one of the following tools installed on your machine:
- Atmel Studio 7 - https://www.microchip.com/mplab/avr-support/atmel-studio-7
- Eclipse Embedded CDT with AVR plugin - https://eclipse-embed-cdt.github.io | http://avr-eclipse.sourceforge.net/wiki/index.php/Plugin_Download
You'll also need git to be installed on your machine.
You'll need to do the following:
- clone the repo to your local machine using:
git clone https://github.com/loay-ashraf/OCore-avr.git
- create new project in your IDE.
- add your project root directory to compiler include path (in project toolchain settings).
- add the three main folders from cloned repo folder to the project:
app
,hal
,rtos
. - scale down the layers according to the size of your application by removing unwanted modules (if you are using RTOS, modify the following file:
rtos_config.h
) - see Project Contents. - remove unwanted modules simply by removing their folders in the rtos, ecu and mcu layer - see Project Layout.
- after removing unwanted modules from the project, rebuild the project to check that no errors are thrown by the preprocessor or the linker.
Notice: if using Eclipse IDE, you must add the following line in linker's "other arguments" field: -Wl,--gc-sections
The project contains the following software layers:
- RTOS layer
- Service Layer
- Hardware Abstraction Layer (HAL) which is then divided into: mcu layer and ecu layer
The RTOS layer contains:
- FreeRTOS kernel V10.2.1
- complmentary APIs like tasks, coroutines, queue, etc.
The Service layer contains:
- common functions like
map
- common header files like
std_types.h
The ecu layer contains:
- Distance APIs/drivers - Ultrasonic HC-SR04
- Character LCD API/driver - HD44780 controller
- Graphical LCD API/driver - ST7920 controller
- Keypad matrix API/driver
- RTCC API/driver - DS1307/DS3231 controller
- Servo API/driver
The mcu layer contains:
- softreset API - software reset using watchdog timer
- pwmin API - frequency and pulse width measurment
- dac API - PWM output using timers' fast pwm mode
- ac driver - analog comparator
- adc driver - analog digital converter
- gpio driver - digital I/O with external interrupts
- spi driver - serial peripheral interface
- timer driver - 8-bit timers TIMER0 and TIMER2
- timer16 driver - 16-bit timers TIMER1
- twi driver - two wire interface (I2C bus)
- usart driver - serial interface (USB,RS232)
- wdt driver - watchdog timer
└───OCore-avr
├───app
│ ├───config
│ └───examples
│ ├───include
│ └───source
├───hal
│ ├───ddp
│ │ └───avr8
│ │ └───mega
│ │ └───m16
│ │ ├───ac
│ │ ├───adc
│ │ ├───gpio
│ │ ├───spi
│ │ ├───timer
│ │ ├───timer16
│ │ ├───twi
│ │ ├───usart
│ │ └───wdt
│ ├───ecu
│ │ ├───display
│ │ │ ├───glcd
│ │ │ │ ├───api
│ │ │ │ ├───common
│ │ │ │ └───driver
│ │ │ │ └───ST7920
│ │ │ └───lcd
│ │ │ ├───api
│ │ │ ├───common
│ │ │ └───driver
│ │ │ └───HD44780
│ │ ├───distance
│ │ │ └───ultrasonic
│ │ │ ├───api
│ │ │ ├───common
│ │ │ └───driver
│ │ │ └───HC-SR04
│ │ ├───keypad
│ │ ├───rtcc
│ │ │ ├───api
│ │ │ ├───common
│ │ │ └───driver
│ │ │ └───DS3231
│ │ └───servo
│ └───mcu
│ ├───api
│ │ ├───dac
│ │ ├───pwmin
│ │ └───softreset
│ ├───peripheral
│ ├───startup
│ └───sys
├───rtos
│ ├───config
│ ├───include
│ └───source
└───service
├───include
└───source
- Atmel Studio 7 - The official AVR IDE (for the AVR parts of the code)
- Eclipse Embedded CDT - 2021 - 03
- avr-gcc V5.4 - GNU AVR C compiler
- Make - auto-generated makefile
ATmega16 running at 16MHZ (external crystal oscillator)
Fuse configuration:
- Lfuse: 0xFF
- Hfuse: 0xC9
- Lockbits: 0x3F
Loay Ashraf - loay.ashraf.96@gmail.com
This project is licensed under the MIT License - see the LICENSE.md file for details
Credits goes to:
The FreeRTOS project - https://www.freertos.org/