Type: Answers

Area: Embedded



Nios II GCC compiler options: -march, -mbmx, -mno-bmx, -mcdx, -mno-cdx

Description

From nios2-elf-gcc 4.9.2 onwards the Nios® II GCC compiler supports new options:

-march, -mbmx, -mno-bmx, -mcdx, -mno-cdx

 

These options cannot be used with the publicly released versions of the Nios II processor and are set to off by default. These options are currently intended only for internal Altera use.

 

Altera has developed a version of the Nios II processor with a modified instruction set encoding (known as R2) that is currently only intended for internal Altera use. Both the R1 (original) and R2 (new) instruction set encodings are supported by the same Nios II GCC compiler in order to streamline compiler development and maintenance. The Nios II R2 instruction set is largely assembly-language upward compatible with the Nios II R1 instruction set, but supports additional mandatory and optional instructions.

Workaround/Fix

The following GCC Nios II R2 compiler options/switches are currently only intended for internal Altera use:

-march=<arch>

This specifies the revision of the target Nios II architecture/ Instruction Set Architecture (ISA) R1/R2 to be used by the compiler.

GCC uses this name to determine which instruction set it should use when generating assembly code.

Permissible names are: ‘r1’, ‘r2’. The default setting is \'r1\'.

The -march=r2 switch is also accepted by the Nios II assembler, for engineers who are assembling without using the compiler.

 

The following switches require –march=r2 to be specified:

 -mbmx        Enable generation of the architecture-optional Nios II R2 BMX (bit manipulation extension) instructions.

-mno-bmx Disable generation of BMX instructions.  This is the default.

-mcdx          Enable generation of the architecture-optional Nios II R2 CDX (code density extension) instructions.

-mno-cdx   Disable generation of CDX instructions.  This is the default.