1.. _generic_leon3:
2
3Generic LEON3
4#############
5
6Overview
7********
8
9This board configuration is designed to work with LEON3 processor template
10designs available in the GRLIB GPL distribution.
11It can also be used with the evaluation version of the TSIM3 LEON3 simulator.
12
13Hardware
14********
15
16The board configuration is compatible with most GRLIB LEON3 FPGA template
17designs such as the Digilent Arty A7, Terasic DE0-Nano and Microsemi
18M2GL-EVAL-KIT.
19
20Programming and Debugging
21*************************
22
23Building
24========
25
26Applications for the ``generic_leon3`` board configuration can be built as usual
27(see :ref:`build_an_application`).
28In order to build the application for ``generic_leon3``, set the ``BOARD`` variable
29to ``generic_leon3``.
30
31Running on hardware
32===================
33
34Connect with GRMON, then load and run the application. The example below uses
35the Terasic DE2-115 Cyclone IV FPGA board.
36
37.. code-block:: console
38
39    $ grmon -altjtag -u
40      GRMON debug monitor v3.2.8 eval version
41
42      Copyright (C) 2020 Cobham Gaisler - All rights reserved.
43      For latest updates, go to http://www.gaisler.com/
44      Comments or bug-reports to support@gaisler.com
45
46    JTAG chain (1): EP3C120/EP4CE115
47      GRLIB build version: 4250
48      Detected frequency:  50.0 MHz
49
50      Component                            Vendor
51      LEON3 SPARC V8 Processor             Cobham Gaisler
52      AHB Debug UART                       Cobham Gaisler
53      JTAG Debug Link                      Cobham Gaisler
54      GR Ethernet MAC                      Cobham Gaisler
55      GRDMAC DMA Controller                Cobham Gaisler
56      LEON2 Memory Controller              European Space Agency
57      AHB/APB Bridge                       Cobham Gaisler
58      LEON3 Debug Support Unit             Cobham Gaisler
59      Generic UART                         Cobham Gaisler
60      Multi-processor Interrupt Ctrl.      Cobham Gaisler
61      Modular Timer Unit                   Cobham Gaisler
62      General Purpose I/O port             Cobham Gaisler
63      SPI Controller                       Cobham Gaisler
64      AHB Status Register                  Cobham Gaisler
65
66      Use command 'info sys' to print a detailed report of attached cores
67
68    grmon3> load zephyr/zephyr.elf
69          40000000 text              16.2kB /  16.2kB   [===============>] 100%
70          400040A8 initlevel           40B              [===============>] 100%
71          400040D0 rodata             484B              [===============>] 100%
72          400042B4 datas               20B              [===============>] 100%
73          400042C8 sw_isr_table       256B              [===============>] 100%
74          400043C8 devices             36B              [===============>] 100%
75      Total size: 16.98kB (1.91Mbit/s)
76      Entry point 0x40000000
77      Image zephyr/zephyr.elf loaded
78
79    grmon3> run
80    *** Booting Zephyr OS build zephyr-v2.4.0-30-ga124c31ec4cf  ***
81    Hello World! generic_leon3
82
83
84Running in simulation
85=====================
86
87The same application binary can be simulated with the TSIM3 LEON3 simulator.
88
89.. code-block:: console
90
91    $ tsim-leon3
92     TSIM3 LEON3 SPARC simulator, version 3.0.2 (evaluation version)
93
94     Copyright (C) 2020, Cobham Gaisler - all rights reserved.
95     This software may only be used with a valid license.
96     For latest updates, go to https://www.gaisler.com/
97     Comments or bug-reports to support@gaisler.com
98
99    Number of CPUs: 2
100    system frequency: 50.000 MHz
101    icache: 1 * 4 KiB, 16 bytes/line (4 KiB total)
102    dcache: 1 * 4 KiB, 16 bytes/line (4 KiB total)
103    Allocated 4096 KiB SRAM memory, in 1 bank at 0x40000000
104    Allocated 32 MiB SDRAM memory, in 1 bank at 0x60000000
105    Allocated 2048 KiB ROM memory at 0x00000000
106
107    tsim> load zephyr/zephyr.elf
108      section: text, addr: 0x40000000, size 16552 bytes
109      section: initlevel, addr: 0x400040a8, size 40 bytes
110      section: rodata, addr: 0x400040d0, size 484 bytes
111      section: datas, addr: 0x400042b4, size 20 bytes
112      section: sw_isr_table, addr: 0x400042c8, size 256 bytes
113      section: devices, addr: 0x400043c8, size 36 bytes
114      Read 436 symbols
115    tsim> run
116      Initializing and starting from 0x40000000
117    *** Booting Zephyr OS build zephyr-v2.4.0-30-ga124c31ec4cf  ***
118    Hello World! generic_leon3
119
120References
121**********
122* `GRLIB IP Library and LEON3, GPL version <https://www.gaisler.com/index.php/downloads/leongrlib>`_
123* `TSIM3 LEON3 simulator <https://www.gaisler.com/index.php/products/simulators/tsim3/tsim3-leon3>`_
124* `GRMON3 debug monitor <https://www.gaisler.com/index.php/products/debug-tools/grmon3>`_
125