Changeset 75f51d6 in rtems-docs


Ignore:
Timestamp:
Sep 8, 2020, 3:29:42 AM (3 weeks ago)
Author:
Chris Johns <chrisj@…>
Branches:
am, master
Children:
aba4c6b
Parents:
ba9dfcf
Message:

user: Add xilinx-zynq BSP details

File:
1 edited

Legend:

Unmodified
Added
Removed
  • user/bsps/arm/xilinx-zynq.rst

    rba9dfcf r75f51d6  
    11.. SPDX-License-Identifier: CC-BY-SA-4.0
    22
    3 .. Copyright (C) 2019 TBD
     3.. Copyright (C) 2020 Chris Johns (chrisj@rtems.org)
    44
    55xilinx-zynq
    66===========
    77
    8 TODO.
     8This BSP supports the Xilinx Zynq range of devices. This family of
     9devices contain the same ARM hard IP and the different parts have
     10different sizes of programable logic.
     11
     12The BSP defaults may need to be adjusted using ``configure`` BSP
     13options to match the size of memory your board may have.
     14
     15Bootloader
     16----------
     17
     18The bootloader initialises the Zynq device. The Xilinx tool provide an
     19interface to configure the hardware. This is includes the buses,
     20clocks, memory and UART board rate. The output of this is called
     21``ps7_init`` and it a C file. The Xilinx SDK builds a first stage boot
     22loader (FSBL) using this file.
     23
     24The U-Boot boot loader has it's own FSBL called ``MLO`` to initialise
     25the hardware.
     26
     27Clocks
     28------
     29
     30An application can provide a function called:
     31
     32.. code-block:: none
     33
     34    uint32_t a9mpcore_clock_periphclk(void);
     35
     36to return the peripheral clock. Normally this is half the CPU
     37clock. This function is declared ``weak`` so you can override the
     38default behaviour by providing it in your application.
     39
     40Debugging with xilinx_zynq_a9_qemu
     41----------------------------------
     42
     43To debug an application add the QEMU options ``-s``. If you need to
     44debug an initialisation issue also add ``-S``. For example to debug a
     45networking application you could use:
     46
     47.. code-block:: none
     48
     49    qemu-system-arm -M xilinx-zynq-a9 -m 256M -no-reboot -serial \
     50        null -serial mon:stdio -nographic \
     51        -net nic,model=cadence_gem -net vde,id=vde0,sock=/tmp/vde1 \
     52        -kernel myapp.exe \
     53        -s -S
     54
     55Start GDB with the same executable QEMU is running and connect to the
     56QEMU GDB server:
     57
     58.. code-block:: none
     59
     60    (gdb) target remote :1234
     61
     62If your application is crashing set a breakpoint on the fatal error
     63handler:
     64
     65.. code-block:: none
     66
     67    (gdb) b bsp_fatal_extension
     68
     69Enter continue to run the application. Running QEMU loads the
     70executable and initialises the CPU. If the ``-S`` option is provided
     71the CPU is held in reset. Without the option the CPU runs starting
     72RTEMS. Either way you are connecting to set up target and all you need
     73to do is continue:
     74
     75.. code-block:: none
     76
     77    (gdb) c
     78
     79If you have a crash and the breakpoint on ``bsp_fatal_extension`` is
     80hit, load the following a GDB script:
     81
     82.. code-block:: none
     83
     84    define arm-crash
     85     set $code = $arg0
     86     set $r0 = ((const rtems_exception_frame *) $code)->register_r0
     87     set $r1 = ((const rtems_exception_frame *) $code)->register_r1
     88     set $r2 = ((const rtems_exception_frame *) $code)->register_r2
     89     set $r3 = ((const rtems_exception_frame *) $code)->register_r3
     90     set $r4 = ((const rtems_exception_frame *) $code)->register_r4
     91     set $r5 = ((const rtems_exception_frame *) $code)->register_r5
     92     set $r6 = ((const rtems_exception_frame *) $code)->register_r6
     93     set $r7 = ((const rtems_exception_frame *) $code)->register_r7
     94     set $r8 = ((const rtems_exception_frame *) $code)->register_r8
     95     set $r9 = ((const rtems_exception_frame *) $code)->register_r9
     96     set $r10 = ((const rtems_exception_frame *) $code)->register_r10
     97     set $r11 = ((const rtems_exception_frame *) $code)->register_r11
     98     set $r12 = ((const rtems_exception_frame *) $code)->register_r12
     99     set $sp = ((const rtems_exception_frame *) $code)->register_sp
     100     set $lr = ((const rtems_exception_frame *) $code)->register_lr
     101     set $pc = ((const rtems_exception_frame *) $code)->register_pc
     102     set $cpsr = ((const rtems_exception_frame *) $code)->register_cpsr
     103   end
     104
     105Enter the command:
     106
     107.. code-block:: none
     108
     109    (gdb) arm-crash code
     110
     111
     112Enter ``bt`` to see the stack back trace.
     113
     114The script moves the context back to the crash location. You should be
     115able to view variables and inspect the stack.
     116
     117The fatal error handler runs inside an exception context that is not
     118the one than generated the exception.
Note: See TracChangeset for help on using the changeset viewer.