background image

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

11

www.cobhamaes.com/gaisler

  

grmon3> forward enable uart0

  I/O forwarding to uart0 enabled

grmon3> dtb board.dtb

  DTB will be loaded to the stack

grmon3> run

hello, world

  CPU 0:  Forced into debug mode

          0x4001607c: 00100073  ebreak  <_CPU_Fat36>

  CPU 1:  Interrupted!

          0x40011018: 10500073  wfi     <_CPU_Thread_Id0>

The line 

hello, world

 is the program output which is forwarded to the GRMON terminal.

4.9. Debugging with GDB

It possible to connect the GDB debugger to GRMON to be able to debug programs at source level. Either start
GRMON with the 

-gdb

 flag or enter the 

gdb

 command in GRMON.

grmon3> gdb

  Started GDB service on port 2222.

    

GDB is included with the RTEMS toolchain as 

riscv-rtems5-gdb

:

user@workstation:~$ riscv-rtems5-gdb

GNU gdb (GDB) 8.3

Copyright (C) 2019 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.

Type "show copying" and "show 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 "word".

(gdb)

    

Specify the filename of the image to debug using the 

file

 command:

(gdb) file /home/user/riscv/demo/hello/hello.exe

Reading symbols from /home/user/riscv/demo/hello/hello.exe...

    

Connect to GRMON using 

target extended-remote

:

(gdb) target extended-remote :2222

Remote debugging using :2222

0x0000000000000000 in ?? ()

    

The  image  can  be  loaded  onto  the  target  using  the 

load

  command.  This  needs  to  be  done  before  starting  or

restarting the program.

(gdb) load

Loading section .start, size 0x4c lma 0x40000000

Loading section .text, size 0x132e8 lma 0x4000004c

Loading section .rodata, size 0x120a0 lma 0x40013338

Loading section .sdata2, size 0x30 lma 0x400253d8

Loading section .eh_frame, size 0x4 lma 0x40025408

Loading section .init_array, size 0x8 lma 0x40025410

Loading section .fini_array, size 0x8 lma 0x40025418

Loading section .rtemsroset, size 0x68 lma 0x40025420

Summary of Contents for NOEL-ARTYA7-EX

Page 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 ...

Page 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 ...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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 ...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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 ...

Page 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...

Page 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...

Page 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...

Page 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 ...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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 ...

Page 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...

Page 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...

Page 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...

Page 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...

Reviews: