AVR8

From ERIKA WIKI
Revision as of 11:36, 22 December 2017 by Nicola (talk | contribs) (Compiler Path)
Jump to: navigation, search

Synopsys

This manual describes the porting details of the ERIKA Enterprise v3 kernel(s) for the Atmel (now Microchip) families of microcontrollers which supports 8/16-bit RISC AVR cores (aka AVR8).

  • AVR8 integration features
    • Support for AVR8 GCC compiler;
    • Support for the following families Atmel (now Microchip) MCUs:
    • Support for following boards
    • List of functions:

Configuration and Programming

ERIKA Enterprise is configured through RT-Druid and an OIL file. Here are listed, after the information to set compiler path, the OIL fields customized for Atmel (now Microchip) AVR8 architecture.

Compiler Path

It is possible to choose the path of the compiler in three different ways:

  • PATH enviornment variable: You can put compilers bin directories in PATH and the environmet can use them from here.
  • Compiler specific environment variables:
    • AVR8 GCC toolchain: You can specify the compiler path for AVR8 GCC with the AVR_TOOLS.
  • RT-Druid configuration file see RT-Druid configuration#Generator_properties_paths:
    • preference_avr8__path_for_gcc_compiler set GCC compiler path for AVR8

Here is an example of RT-Druid configuration file.

CPU

CPU_DATA must be set to AVR8.

Example of a CPU_DATA section:

   CPU_DATA = AVR8 {
     ...
   };

MCU

MCU_DATA supports for now the MEGA value only.

MODEL attribute of MCU_DATA supports for now the MEGA_328p value only.

 MCU_DATA = MEGA {
   MODEL = MEGA_328p;
 };

BOARD

For now there is no NATIVE board support for AVR8 Architecture. The ONLY supported board is Arduino by Arduino SDK 1.8.5.

Interrupt Handling

Interrupt Handling is microcontroller dependent so for each supported Atmel (now Microchip) AVR8 microcontroller family, the ISRs configuration of ERIKA Enterprise v3 is shown below.

MEGA Family

The MEGA family of AVR8 microcontrollers has an interrupt vector table which is stored in the flash memory. The lowest addresses of the interrupt vector table is allocated to the RESET and to the interrupt vectors. Interrupt handlers placed at lower addresses have higher hardware priorities than interrupt handlers placed at higher addresses so the PRIORITY attribute of the ISR object in the OIL is USELESS. The complete list of SOURCE entries is shown below.

  • RESET: External Pin, Power-on Reset, Brown-out Reset and Watchdog System Reset
  • INT0: External Interrupt Request 0
  • INT1: External Interrupt Request 1
  • PCINT0: Pin Change Interrupt Request 0
  • PCINT1: Pin Change Interrupt Request 1
  • PCINT2: Pin Change Interrupt Request 2
  • WDT: Watchdog Time-out Interrupt
  • TIMER2_COMPA: Timer/Counter2 Compare Match A
  • TIMER2_COMPB: Timer/Counter2 Compare Match B
  • TIMER2_OVF: Timer/Counter2 Overflow
  • TIMER1_CAPT: Timer/Counter1 Capture Event
  • TIMER1_COMPA: Timer/Counter1 Compare Match A
  • TIMER1_COMPB: Timer/Coutner1 Compare Match B
  • TIMER1_OVF: Timer/Counter1 Overflow
  • TIMER0_COMPA: Timer/Counter0 Compare Match A
  • TIMER0_COMPB: Timer/Counter0 Compare Match B
  • TIMER0_OVF: Timer/Counter0 Overflow
  • SPI_STC: SPI Serial Transfer Complete
  • USART_RX: USART Rx Complete
  • USART_UDRE: USART, Data Register Empty
  • USART_TX: USART, Tx Complete
  • ADC_ADC: Conversion Complete
  • EE_READY: EEPROM Ready
  • ANALOG_COMP: Analog Comparator
  • TWI: 2-wire Serial Interface
  • SPM_READY: Store Program Memory Ready

EEOPT

The following EEOPTs are specific of AVR8 Architecture:

  • __AVR8_GCC_C99__: Enables C99 compiler option.

OSEK/VDX Extensions

This Section contains information about the OSEK/VDX Extensions (or optional features) that have been implemented for the AVR8 support.

System Timer

System Timer is microcontroller dependent so for each supported Atmel (now Microchip) AVR8 microcontroller family, the System Timer configuration of ERIKA Enterprise v3 is shown below.

MEGA Family

For the MEGA family of AVR8 microcontrollers the System Timer is linked to TIMER1 so the DEVICE attribute MUST be se to TIMER1_COMPA as shown below.


 COUNTER SystemTimer {
   MINCYCLE = 1;
   MAXALLOWEDVALUE = 65535;
   TICKSPERBASE = 1;
   TYPE = HARDWARE {
     DEVICE = "TIMER1_COMPA";
     SYSTEM_TIMER = TRUE;
   };
   SECONDSPERTICK = 0.001;
 };

Additional Notes

T.B.D.