background image

NOEL-ARTYA7-EX-QSG
December 2020, Version 1.2

13

www.cobhamaes.com/gaisler

5. RTEMS Real Time Operating System

5.1. Overview

RTEMS is a real time operating system that supports many processor families [RD-3]. Cobham Gaisler distributes
a precompiled RTEMS toolchain for NOEL-V. This section gives the reader a brief introduction on how to use
RTEMS together with the NOEL-ARTYA7-EX design. It will be demonstrated how to install the toolchain and
build an existing sample RTEMS project and run it on the board using GRMON.

The NOEL-V RTEMS distribution includes a prebuilt toolchain with GNU Binutils, GCC and Newlib. The sup-
ported host operating system is Linux. It also contains prebuilt RTEMS kernels for the NOEL-V, including 32-bit
and 64-bit versions. Support is included for the NOEL-ARTYA7-EX interrupt controller, timer and UART.

Sample RTEMS projects are available within the toolchain package, installed in the 

examples

 directory.

5.2. Features

• Kernel:

• BSP variants for 

rv32i

rv32im

rv32ima

rv32imafd

rv64im

rv64ima

 and 

rv64imafd

.

• Uni-processor and SMP kernels available.
• RTEMS POSIX support
• Based on RTEMS master as of June 2020. (Exact 

rtems.git

 commit hash can be found in the 

README

file in the root directory of the toolchain distribution.)

• NOEL-V BSP

• Console driver for APBUART
• Interrupt controller (PLIC and CLINT)
• Clock driver via CLINT 

mtime

• GCC 9.3.0

5.3. Install toolchain and kernel

The toolchain and source can be downloaded from https://www.gaisler.com/NOEL-ARTYA7.

First extract the toolchain and kernel archive into 

/opt

. In order for the compiler to be found, the binary directory

/opt/rtems-noel-1.0.4/bin

 has to be added to the 

PATH

 variable as below:

  $ cd /opt

  $ tar xf rtems-noel-1.0.4.tar.bz2

  $ export PATH=$PATH:/opt/rtems-noel-1.0.4/bin

5.4. Building an RTEMS sample application

Once the toolchain is set up, you can compile and link a sample RTEMS application by doing:

  $ cd /opt/rtems-noel-1.0.4/examples/hello

  $ make

  riscv-rtems5-gcc --pipe -march=rv64ima -mabi=lp64 \

        -B/opt/rtems-noel-1.0.4/kernel/riscv-rtems5/noel64ima/lib \

        -specs bsp_specs -qrtems -c test.c -o test.o

  riscv-rtems5-gcc --pipe -march=rv64ima -mabi=lp64 \

        -B/opt/rtems-noel-1.0.4/kernel/riscv-rtems5/noel64ima/lib \

        -specs bsp_specs -qrtems -Wl,--gc-sections test.o   -o hello.exe

The default load address is at the start of the RAM, i.e. 

0x00000000

.

See Chapter 8 for more information on the available examples.

5.5. Running and debugging with GRMON

Once your executable is compiled, connect to your NOEL-ARTYA7-EX with GRMON. The following log shows
how to load and run an executable. Note that the console output is redirected to GRMON by the use of the 

-u

Содержание NOEL-ARTYA7-EX

Страница 1: ... NOEL ARTYA7 EX Quick Start Guide 2020 User s Manual The most important thing we build is trust NOEL ARTYA7 EX Quick Start Guide NOEL ARTYA7 EX QSG 1 www cobhamaes com gaisler December 2020 Version 1 2 ...

Страница 2: ...ternatives 9 4 4 1 Connecting via the Digilent USB JTAG interface 9 4 4 2 Connecting via the Ethernet debug interfaces 9 4 4 3 Connecting via the serial UART 9 4 5 First steps 9 4 6 Connecting to the board 9 4 7 Get system information 10 4 8 Load a RAM application 10 4 9 Debugging with GDB 11 5 RTEMS Real Time Operating System 13 5 1 Overview 13 5 2 Features 13 5 3 Install toolchain and kernel 13 ...

Страница 3: ...ons 19 6 5 Multilibs 19 6 6 Running and debugging with GRMON 20 7 Linux 21 7 1 Overview 21 7 2 Step by step instructions 21 8 RTEMS Example applications 25 8 1 Basic examples 25 8 1 1 hello 25 8 1 2 tasks 25 8 1 3 dhrystone 25 8 1 4 coremark 25 8 1 5 Creating a custom application 26 8 2 Driver manager examples 26 8 2 1 Introduction 26 8 2 2 Requirements 26 8 2 3 Build 26 8 2 4 Targets 26 8 2 5 Com...

Страница 4: ...the user needs Digilent Arty A7 FPGA Development Board A7 100T version GRMON 3 2 9 evaluation version available at https www gaisler com grmon Xilinx Vivado Design Suite to program the FPGA RD 7 1 4 References Table 1 1 References RD 1 NOEL ARTYA7 EX User s Manual https www gaisler com NOEL ARTYA7 RD 2 GRMON User s Manual https www gaisler com doc grmon3 pdf RD 3 RTEMS homepage https www rtems org...

Страница 5: ...d area efficient FPU or high performance fully pipelined IEEE 754 FPU Machine supervisor and user mode RISC V standard MMU with configurable TLB User level interrupts RISC V standard PLIC platform interrupt controller RISC V standard PMP physical memory protection RISC V standard external debug support Advanced 7 stage dual issue in order pipeline Dynamic branch prediction branch target buffer and...

Страница 6: ...large number of useful userspace applications which can be included in the generated root file system Included in the software development environment is a NOEL ARTYA7 EX BSP for Buildroot which provides the necessary driver support See Chapter 7 for instructions on how to create a Linux image for NOEL ARTYA7 EX with Buildroot 2 4 4 VxWorks 7 Please contact support gaisler com for information abou...

Страница 7: ...ns several bistreams which represent different configurations of the processor EX1 EX2 ecc Select one of the bitstreams described in RD 1 and follow the instructions below to program the FPGA To program the FPGA please follow these instructions 1 Connect the PC and the board using a standard micro USB cable into the connector USB JTAG J10 2 Make sure that Vivado is added to your path variables 3 O...

Страница 8: ...of the GRMON commands available for LEON are also available for NOEL V GRMON commands avail able for NOEL V include load RISC V ELF file support Symbols are loaded from the ELF file and can be used instead of addresses for most commands run cont go step execution control mem wmem read write any on chip address disassemble RISC V instruction disassembly inst CPU instruction trace bp Hardware and so...

Страница 9: ...ave described which debug links are available and how to start using them with GRMON The subsections below assume that GRMON the host computer and the NOEL ARTYA7 EX board have been set up so that GRMON can connect to the board When connecting to the board for the first time it is recommended to get to know the system by inspecting the current configuration and hardware present using GRMON With th...

Страница 10: ... can limit the output to certain cores by specifying the core s name s to the info sys and info reg commands As seen below the memory parameters first UART and first Timer core information is listed grmon3 info sys mig0 mig0 Cobham Gaisler Xilinx MIG DDR3 Controller AHB 40000000 80000000 SDRAM 1024 Mbyte grmon3 info sys uart0 gptimer0 uart0 Cobham Gaisler Generic UART APB 80000100 80000200 IRQ 1 B...

Страница 11: ... warranty for details This GDB was configured as host x86_64 pc linux gnu target riscv rtems5 Type show configuration for configuration details For bug reporting instructions please see http www gnu org software gdb bugs Find the GDB manual and other documentation resources online at http www gnu org software gdb documentation For help type help Type apropos word to search for commands related to ...

Страница 12: ...once the program reaches the Init function gdb run The program being debugged has been started already Start it from the beginning y or n y Starting program home user riscv demo hello hello exe Breakpoint 1 Init ignored 1073914168 at test c 13 13 puts At this stage one can for example step through the program with step or next print the values of variables with p or continue execution with the con...

Страница 13: ...root directory of the toolchain distribution NOEL V BSP Console driver for APBUART Interrupt controller PLIC and CLINT Clock driver via CLINT mtime GCC 9 3 0 5 3 Install toolchain and kernel The toolchain and source can be downloaded from https www gaisler com NOEL ARTYA7 First extract the toolchain and kernel archive into opt In order for the compiler to be found the binary directory opt rtems no...

Страница 14: ...mpilation symbols are loaded automatically by GRMON once you load the executable An example is provided below grmon3 load hello exe Total size 188 86kB 1 12Mbit s Entry point 0x00000000 Image hello exe loaded grmon3 bp Init Software breakpoint 1 at Init grmon3 run Breakpoint 1 hit 0x00000118 1141 addi sp sp 16 Init 0 grmon3 inst 5 TIME L P ADDRESS INSTRUCTION RESULT SYMBOL 593654 1 M 0000705a jalr...

Страница 15: ...ine option and then attach a GDB session to it 5 6 RISC V and NOEL V integration with RTEMS 5 6 1 CSRs RTEMS RISC V executes in machine privilege mode only The following is the set of CSRs which are accessed by the kernel mcause mepc mie mstatus mtvec 5 6 2 Clock tick mtime is used for the RTEMS kernel clock service It relies on the core local interrupt controller clint Note that an RTEMS applicat...

Страница 16: ... by GRMON when using the run command 5 6 8 Symmetric Multiprocessing RTEMS on NOEL V supports Symmetric Multiprocessing SMP This works out of the box with NOEL V and no RTEMS changes are needed for SMP except for giving the option enable smp when configuring the kernel Some of the NOEL V BSP variants in the binary kernel distribution are compiled with SMP support Section 5 6 4 5 7 Device tree 5 7 ...

Страница 17: ... options are described in the GCC User s Manual Some of the commonly used options are repeated below Table 5 1 Common GCC options for rtems noel g generate debugging information must be used for debugging with GDB msoft float emulate floating point must be used if no FPU exists in the system march rv64ima generate code with mul div and atomic instructions O2 or O3 optimize code maximum performance...

Страница 18: ...his patch applied on top of rtems source builder The commit hash is specified in the README of the binary tool chain distribution An example on how to build the tool chain is provided below Example 5 4 export THE_PREFIX opt my rtems noel export THE_RSB_REPO git git rtems org rtems source builder git export THE_RSB_COMMIT 5 1 export THE_RSB_PATCHES opt rtems noel 1 0 4 0001 noel multilibs for gcc 9...

Страница 19: ...he rest of this chapter assumes that the toolchain has been installed and that riscv gaisler elf gcc is available in the PATH environment variable 6 3 Compiling with NCC The following command shows an example of how to compile a typical hello world program with NCC cat hello c include stdio h int main void printf hello world n return 0 riscv gaisler elf gcc O2 g hello c o hello elf It creates a pr...

Страница 20: ...r latest updates go to http www gaisler com Comments or bug reports to support gaisler com grmon3 load hello elf 00000000 text 23 6kB 23 6kB 100 00005E70 data 2 7kB 2 7kB 100 Total size 26 29kB 803 58kbit s Entry point 0x00000000 Image hello elf loaded grmon3 run hello world CPU 0 Program exited normally To debug the compiled program you can insert breakpoints step and continue execution directly ...

Страница 21: ...NOEL ARTYA7 EX which is included in the Buildroot version downloadable from https www gaisler com NOEL ARTYA7 The Buildroot BSP contains additional driver support for Linux 7 2 Step by step instructions Download the Buildroot distribution with the NOEL V BSP from https www gaisler com NOEL ARTYA7 and extract it tar xf noel buildroot tar gz Go into the directory cd noel buildroot Generate the defau...

Страница 22: ...hich can be loaded onto the NOEL system using GRMON The dependency handling for the OpenSBI package is not working correctly If the image does not start or does not include recent changes to the configuration try deleting the output build opensbi directory and rebuild the image Start grmon with u nb to forward the UART output and not break on page faults Then load the image grmon3 load output imag...

Страница 23: ... 258055 0 000000 Kernel command line earlycon sbi console ttyGR0 115200 0 000000 Dentry cache hash table entries 131072 order 8 1048576 bytes linear 0 000000 Inode cache hash table entries 65536 order 7 524288 bytes linear 0 000000 Sorting __ex_table 0 000000 mem auto init stack off heap alloc off heap free off 0 000000 Memory 939104K 1046528K available 16833K kernel code 3895K rwdata 4096K rodata...

Страница 24: ...66 9p Installing v9fs 9p2000 file system support 5 134783 NET Registered protocol family 38 5 137060 Block layer SCSI generic bsg driver version 0 4 loaded major 252 5 139542 io scheduler mq deadline registered 5 141700 io scheduler kyber registered 6 115154 Serial GRLIB APBUART driver 6 118383 80000100 uart ttyGR0 at MMIO 0x80000100 irq 2 base_baud 6250000 is a GRLIB APBUART 6 121925 printk conso...

Страница 25: ...e grmon digilent u grmon3 dtb noel xilinx artya7 dtb grmon3 load hello exe grmon3 run hello world 8 1 2 tasks Demonstrates the use of multiple tasks and the RTEMS directive rtems_clock_get_tod Example 8 3 grmon3 run CLOCK TICK TEST TA1 rtems_clock_get_tod 09 00 00 12 31 1988 TA2 rtems_clock_get_tod 09 00 00 12 31 1988 TA3 rtems_clock_get_tod 09 00 00 12 31 1988 TA1 rtems_clock_get_tod 09 00 04 12 ...

Страница 26: ...driver API software abstraction which allows developing peripheral drivers inde pendent of bus attachment host controller and CPU architecture This abstraction allows sharing the same driv er implementation for GRLIB peripheral among the LEON 32 bit architecture NOEL V 32 bit architecture and NOEL V 64 bit architecture At the time of writing the current driver manager device driver implementations...

Страница 27: ...erride the hardware specific compilation flags Most of the samples include config c which configures drivers and help setting up networking Network in terfaces are assigned a MAC and IP address according to networkconfig h 8 2 5 Comments rtems cdtest is a C application that tests exception handling rtems ttcp is a network test program It implements the receiver part of the TTCP test program The tr...

Страница 28: ...yourself in full including company affiliation and site name and address Please identify exactly what product that is used specifying if it is an IP core with full name of the library distribution archive file component software version compiler version operating system version debug tool version simulator tool version board version etc There is also an open forum available at https grlib communit...

Страница 29: ... in this document is current before using this product Cobham does not assume any responsibility or liability arising out of the application or use of any product or service described herein except as expressly agreed to in writing by Cobham nor does the purchase lease or use of a product or service from Cobham convey a license under any patent rights copyrights trademark rights or any other of th...

Отзывы: