ARM Cortex-M

From ERIKA WIKI
Revision as of 14:57, 1 June 2018 by G.serano (talk | contribs) (BOARD)
Jump to: navigation, search

Introduction

This manual describes the porting details of the ERIKA Enterprise v3 kernel(s) for families of microcontrollers which integrate ARM Cortex-M CPUs.

Cortex-M features supported

The following are the main features of the currently implemented support:

Additionally, we are porting ERIKA3 also on a ARM Cortex-M7 CPU on ST 32F746GDISCOVERY board with STM32F746NG MCU.

In the next months, the public code will be delivered through the GitHub repository. In case of urgent need, please contact us.

Tutorials

The following tutorials are available for this architecture:

Configuration and Programming

ERIKA Enterprise is configured through RT-Druid and an OIL file and some other properties.

The following sections describe the properties and OIL fields customized for ARM Cortex-M architecture.

GCC Compiler Path

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

  • Specific environment variables: ARM_TOOLS
    • E.g.: ARM_TOOLS=C:\Program Files (x86)\GNU Tools ARM Embedded\4.9 2015q3
  • RT-Druid Eclipse IDE Property.
  • RT-Druid Configuration File Entry: preference_cortex_m__path_for_gcc_compiler
    • E.g.: preference_cortex_m__path_for_gcc_compiler=C:\Program Files (x86)\GNU Tools ARM Embedded\4.9 2015q3

Here is an example of RT-Druid configuration file.

S32 SDK Path

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

  • Specific environment variables: S32_SDK_FILES
    • E.g.: S32_SDK_FILES=C:\NXP\S32DS_ARM_v2.0\S32DS\S32SDK_S32K14x_EAR_0.8.4
  • RT-Druid Eclipse IDE Property.
  • RT-Druid Configuration File Entry: preference_cortex_m__path_for_s32_sdk
    • E.g.: preference_cortex_m__path_for_s32_sdk=C:\NXP\S32DS_ARM_v2.0\S32DS\S32SDK_S32K14x_EAR_0.8.4

Here is an example of RT-Druid configuration file.

Lauterbach TRACE32 Path

It is possible to choose the path in two different ways:

  • RT-Druid Eclipse IDE Property.
  • RT-Druid Configuration File Entry: preference_lauterbach__path_for_trace32
    • E.g.: preference_lauterbach__path_for_trace32=C:\T32

Here is an example of RT-Druid configuration file.

Lauterbach Emulator Interface

It is possible to choose the path in two different ways:

  • RT-Druid Eclipse IDE Property.
  • RT-Druid Configuration File Entry: preference_lauterbach__emulator_usb_interface
    • E.g.: preference_lauterbach__emulator_usb_interface=true

Here is an example of RT-Druid configuration file.

CPU

CPU_DATA object must be set to CORTEX_M.

Example of a CPU_DATA section:

   CPU_DATA = CORTEX_M {
     ...
   };

MODEL

MODEL attribute of CPU_DATA supports for now the M4 value only. Deafult value is M4.

Example of a MODEL attribute of CPU_DATA section:

   CPU_DATA = CORTEX_M {
     MODEL = M4;
     ...
   };

COMPILER

COMPILER attribute of CPU_DATA supports for now the GCC value only. Deafult value is GCC.

Example of a COMPILER attribute of CPU_DATA section:

   CPU_DATA = CORTEX_M {
     MODEL = M4;
     COMPILER = GCC;
     ...
   };

MINIMAL_OPTS

MINIMAL_OPTS boolean property of COMPILER attribute of CPU_DATA configures the build system with minimal compiling and linking options. The default value is set to FALSE.

Example of a MINIMAL_OPTS property of COMPILER attribute of CPU_DATA section:

   CPU_DATA = CORTEX_M {
     MODEL = M4;
     COMPILER = GCC {
          MINIMAL_OPTS = TRUE;
     };
     ...
   };

EXECUTE_FROM_RAM

EXECUTE_FROM_RAM attribute of CPU_DATA configures the build system generate binary to execute the application in RAM. The default value is set to FALSE.

Example of a COMPILER attribute of CPU_DATA section:

   CPU_DATA = CORTEX_M {
     MODEL = M4;
     EXECUTE_FROM_RAM = TRUE;
     ...
   };

TRACER

TRACER attribute of CPU_DATA configures the build system to generate Lauterbach TRACE32 scripts to enable the tracing support. This attribute make sense in the MCUs that implements ITM and/or ETM hardware. Supported values are OFF, SWO and OFFCHIP. The default value is set to OFF.

Example of a TRACER attribute of CPU_DATA section:

   CPU_DATA = CORTEX_M {
     MODEL = M4;
     TRACER = OFFCHIP;
     ...
   };

SYS_STACK_SIZE

SYS_STACK_SIZE attribute of CPU_DATA configures the size in bytes of the system stack. The default value is set to 1024.

Example of a TRACER attribute of CPU_DATA section:

   CPU_DATA = CORTEX_M {
     MODEL = M4;
     SYS_STACK_SIZE = 2048;
     ...
   };

MCU

MCU_DATA object supports for now the S32K1XX value only.

Example of a MCU_DATA section:

   MCU_DATA = S32K1XX {
     ...
   };

MODEL

MODEL attribute of MCU_DATA supports for now the S32K144 and S32K148 values only. Default value is S32K144.

Example of a MCU_DATA section:

   MCU_DATA = S32K1XX{
     MODEL = S32K148;
     ...
   };

BOARD

BOARD_DATA object supports for now the S32K144EVB_Q100 and S32K148EVB_Q144_Q176 values only. Default value is NO_BOARD.

Example of a BOARD_DATA section:

 BOARD_DATA = S32K148EVB_Q144_Q176;

Interrupt Handling

The Interrupt Handling support is microcontroller dependent. For each supported microcontroller family, the ISRs configuration of ERIKA3 is shown below.

OSEK/VDX Extensions

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

System Timer

System Timer counter is implemented using SysTick of Cortex-M CPUso the DEVICE attribute MUST be se to SYSTICK as shown below.

Example of a System Timer counter:

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

CPU_CLOCK

System Timer need the CPU_CLOCK attribute of CPU_DATA. This value, expressed as MHz, must be set to the configured frequency of the CPU.

Example of a CPU_CLOCK attribute of CPU_DATA section:

   CPU_DATA = CORTEX_M {
     MODEL = M4;
     CPU_CLOCK = 48.0;
     ...
   };