Lattice Mico32
From ErikaWiki
Contents |
Lattice Mico32 support
Lattice Mico32 is the soft processor developed by Lattice for their FPGAs. ERIKA Enterprise supports Lattice Mico32. The support for RT-Druid is now available using the nightly build. Instructions on how to get nightly builds can be found on the Erika web site
The Lattice Mico32 support includes:
- support for lm32-elf-gcc compiler.
- support for single and multi stack configurations.
- ISR interrupt supported.
- support for Lattice Debugger.
- Supported compiler
- lm32-elf-gcc cross compiler and ELF module generation for debugging. The compiler can be downloaded together with the Lattice Mico32 from the Lattice Web site.
We notice that the objdump of debug symbols may fail with a segmentation fault if the binary file was produced using NOLOAD keyword in the linker-script. The webserver camera demo is an example of this problem.
- Mode of operation
- Mono-stack: The Monostack configuration of the ERIKA Kernel models the fact that all tasks and ISRs in the system share the same stack.
- Multistack HAL: Every thread can have its private stack, or it can share it with other threads.
Configuration
ERIKA Enterprise for Lattice Mico32 can be configured with the usual OIL file and RT-Druid workflow. Here the items specific for the Lattice Mico32 support are described.
EEOPTs
- __SPACE__
- Optimize for space
- __USE_CUSTOM_LINKER_SCRIPT__
- Don't use the dafault linker script. Users can direct the linker to use their own linker script by setting the
LDFLAGS
variable. Example:
OS EE { EE_OPT = "__USE_CUSTOM_LINKER_SCRIPT__"; LDFLAGS = "-T my_linker_script.ld"; };
- __USE_CUSTOM_CRT0__
- Don't use Erika default crt0. Users can provide their own crt0 by adding source files in the usual way (APP_SRC in the OIL file).
- __LM32_NOISY_HANDLERS__
- On the FPG-EYE board, exception handlers make the LEDs blink with an error code
- __LM32_VERBOSE_HANDLERS__
- On the FPG-EYE board, exception handlers make the LEDs blink with an error code and print the values of all CPU registers to the serial port (115200, 8N1) when a key is pressed
- __LM32_STANDARD_HANDLERS__
- On the FPG-EYE board, use the standard exception handlers (which call the debugger)
CPU
- The CPU currently supported is the following:
- Lattice Mico32; The LatticeMico32™ is a configurable 32-bit soft processor core for Lattice Field Programmable Gate Array (FPGA) devices. By combining a 32-bit wide instruction set with 32 general-purpose registers, the LatticeMico32 provides the performance and flexibility suitable for a wide variety of markets. Some of the key features of this 32-bit processor include: RISC architecture, 32-bit data path, 32-bit instructions, 32 general-purpose registers, Up to 32 external interrupts, Optional instruction cache, Optional data cache, Dual WISHBONE memory interfaces (instruction and data).
MCU
- Timer support is enabled with the TIMER option:
- DEVICE = TIMER {
- NAME = "freetimer";
- };
- // Also, interrupts are supported:
- DEVICE = TIMER {
- NAME = "timer";
- OPTIONS = TIMER_IRQ_SUPPORT;
- };
- DEVICE = TIMER {
- Uart support is enabled with the UART option:
- DEVICE = UART {
- NAME = "myuart";
- };
- // Also, interrupts are supported:
- DEVICE = UART {
- NAME = "myuart";
- OPTIONS = UART_IRQ_SUPPORT;
- };
- DEVICE = UART {
- SPI support is enabled with the SPI option:
- DEVICE = SPI {
- NAME = "myspi";
- };
- DEVICE = SPI {
- I2C support is enabled with the SPI option:
- DEVICE = I2C {
- NAME = "myi2c";
- };
- DEVICE = I2C {
- GPIO support is enabled with the GPIO option:
- DEVICE = GPIO {
- NAME = "mygpio";
- };
- // Also, interrupts are supported:
- DEVICE = GPIO {
- NAME = "mygpio";
- OPTIONS = GPIO_IRQ_SUPPORT;
- };
- DEVICE = GPIO {
Boards
FPG-EYE board
Item BOARD_DATA = XP2_CAMERA_BOARD of EE in conf.oil. Supported devices:
- Real-time clock. Option RTCLOCK.
- Leds. Option LEDS.
- Power transistors. Option TRANSISTORS.
- Switches and user button. Option SWITCHES.
- RS232 serial interface. Option RS232. IRQ for RS232 can be enabled with RS232_IRQ_SUPPORT.
- HV7131GP Camera. Option CAMERA. IRQ for the camera can be enabled with CAMERA_IRQ_SUPPORT.
- Real-time clock. Option RTCLOCK. IRQ for the real time clock can be enabled with RTCLOCK_IRQ_SUPPORT.
- External SPI master interfaces. Option EXTSPI. IRQ for the external SPIs can be enabled with EXTSPI_IRQ_SUPPORT.
- IEEE 802.15.4 (ZigBee) module. Option ZIGBEE. IRQ for the ZigBee module can be enabled with ZIGBEE_IRQ_SUPPORT. Please note that ZigBee and Ethernet are mutually exclusive.
- ENC28J60 Ethernet interface. Option ETHERNET. IRQ for the Ethernet can be enabled with ETHERNET_IRQ_SUPPORT. Please note that ZigBee and Ethernet are mutually exclusive.
- Everything, included the ZigBee (Ethernet is excluded). Option ALL_ZIGBEE.
- Everything, included the Ethernet (ZigBee is excluded). Option ALL_ETHERNET.
Lattice Standard XP2 Evaluation board
- Leds. Option LEDS.
- RS232 serial interface. Option RS232. IRQ for RS232 can be enabled with RS232_IRQ_SUPPORT.
- HV7131GP Camera. Option CAMERA. IRQ for the camera can be enabled with CAMERA_IRQ_SUPPORT.
Lattice Mico32 OIL example
See the example OIL file for Lattice Mico32