AUTOSAR-like MCU Driver

From ErikaWiki

Revision as of 07:52, 16 July 2013 by Eguidieri (Talk | contribs)
Jump to: navigation, search

Contents

Synopsis

The MCU driver provides services for basic microcontroller initialization, power down functionality, reset and microcontroller specific functions required by other MCAL [Microcontroller Abstraction Layer] software modules. The initialization services allow a flexible and application related MCU initialization in addition to the start-up code (see figure below). The start-up code is very MCU specific. The start-up code is provided by Evidence Srl within Erika Enterprise.

Startup Code.png

MCU driver Features:

  • Initialization of MCU clock, PLL, clock prescalers and MCU clock distribution
  • Initialization of RAM sections
  • Activation of μC reduced power modes
  • Activation of a μC reset
  • Provides a service to get the reset reason from hardware

The MCU driver accesses the microcontroller hardware directly and is located in the Microcontroller Abstraction Layer.

File Structure

MCU Driver File structure.png

Configuration

Build

To enable AUTOSAR-like MCU Driver in Erika Enterprise compiler toolchain, the following EE_OPT attribute is needed in the OS object of the OSEK/VDX configuration:

 EE_OPT = "__AS_MCU_DRIVER__";

The configuration C header file inclusion is done by CFLAGS attribute in the OS object of the OSEK/VDX configuration:

 CFLAGS = "-I<PATH>";

Where <PATH> is the absolute or relative directory path which configuration C header file is stored.

Instead the configurations C source file is added to the compilation process by APP_SRC attribute in the CPU_DATA object of the OSEK/VDX configuration:

 APP_SRC = "<PATH>/Mcu_Cfg.c";

Where <PATH> is the absolute or relative directory path which configuration C source file is stored.

API Specification

Imported Types

typedef uint8 Std_ReturnType

 #include "Std_Types.h"

Standard Return Type.

This type can be used as standard API return type which is shared between AUTOSAR-like modules.

The Std_ReturnType shall normally be used with value E_OK or E_NOT_OK. If those return values are not sufficient user specific values can be defined by using the 6 least specific bits.

struct Std_VersionInfoType

 #include "Std_Types.h"

Standard Version Informations Type.

This type shall be used to request the version of a AUTOSAR module using the <Module name>_GetVersionInfo() function.

Field Documentation

uint16 Std_VersionInfoType::moduleID Module Identifier.

uint8 Std_VersionInfoType::sw_major_version Software Version Major Number.

uint8 Std_VersionInfoType::sw_minor_version Software Version Minor Number.

uint8 Std_VersionInfoType::sw_patch_version Software Version Patch Number.

uint16 Std_VersionInfoType::vendorID Vendor Identifier.

Examples

Usage examples of the AUTOSAR-like MCU Driver for can be found at examples/cortex_mx/lm4f232xxxx/as

Personal tools