RTEMS Development on Zynq 7000 Board
Stanislav Pankevich
s.pankevich at gmail.com
Thu Nov 9 10:09:15 UTC 2023
Hi Florian,
Thanks for asking. I am not working on that project anymore. We definitely
brought up RTEMS to run on ARTY with some tinkering behind it, but we could
not open-source our setup due to lack of time. I am most certain that we
used the xilinx_zynq_zc702 configuration as a base. Now I don't have access
to the working code but only some memories. I am working on another Xilinx
part now, and since the setups are in a way similar, let me share what I
can.
As already indicated in the original RTEMS thread, there are two workflows
possible:
1) Vivado/Vitis/XSDB/GDB
1.1) Create FPGA design in Vivado, export design file.
1.2) Create Platform project in Vitis from the exported design file from
step 1.1.
1.3) Create a SW project in Vitis based on the Platform project in step 1.2.
1.4) Use Vitis to Flash and Debug the software in IDE.
1.5) When the setup is stable, check the log panels of Vitis to understand:
- Which TCL commands Vitis runs to configure the board and flash the
software.
- See the logs that those commands themselves produce to get a better
understanding of the board startup sequence.
>From here on, you copy what Vitis does in the IDE to your command-line
workflow to automate things and not be dependent on the IDE workflow (if
you want).
1.6) Copy the TCL commands that Vitis does to TCL files on your file system
and run the Xilinx XSDB from the command line to reproduce exactly the
steps of what Vitis does during the IDE flash&debug workflow. The result of
this step is that you can do 100% the same things compared to what Vitis
does, but from your own command-line scripts. I am attaching our current
top-level file that does the flashing but the related details of how to
source the TCL files you should figure out yourself, following the Vitis
logs from 1.5.
1.7) Once you can flash with XSDB, you can also connect to it with GDB
because XSDB has a GDB server.
*) Note that there are two ways of starting the SW: with and without the
Xilinx First-Stage Bootloader (FSBL) run in the process. If you just Flash
with your debugger and not boot from Flash memory, running of something
like $VITIS_PATH/scripts/vitis/util/fsbl.tcl should be part of your scripts
or if you include the "FSBL" checkbox in Vitis, also the fsbl binary to be
run before you flash your image. The main point to remember the FSBL
startup sequence has to be run either by the FSBL itself if it gets flashed
or by a corresponding FSBL TCL script. Following the Vitis logs, you should
notice exactly those lines.
This is the workflow that we are using now and everything pretty much
works. In 2021, my colleague skipped the steps 1.6-1.7 and implemented
workflow #2, see below.
2) OpenOCD/GDB
To enable OpenOCD, you should anyway familiarize yourself with the steps
from 1.1-1.6. Instead of copying the Vitis logs commands to TCL files like
in step 1, the action here is to configure OpenOCD and GDB to reproduce
exactly those steps but using OpenOCD/GDB syntax and commands.
You will likely need at least two files:
- OpenOCD config file, something like arty.cfg which you will run with
openocd, like "openocd -f arty.cfg"
- GDB init file which you can run source when you run GDB: gdb -x
rtems.gdb. In that GDB file you can have a function like "flash" which will
reproduce the necessary TCL scripts commands from Vitis.
A general guidance for setting up the workflow #2 can be found here but you
will have to adapt it to your needs:
https://devel.rtems.org/wiki/Debugging/OpenOCD/Xilinx_Zynq.
In the attached Python file, you see our existing Flash routine. All the
TCL and settings files have been recreated from Vitis logs. We are
following workflow #1 only and have not implemented workflow 2 for this
part yet. As a side note, we are using https://www.pyinvoke.org/ to
automate tasks which helps us to write more Python instead of Bash.
I do believe that all these things must be much better documented, so that
we spend time somewhere else. When our current workflow is stable, we will
try to open source as much as we can.
Good luck with porting and let me know if you have any questions.
Stanislav
On Wed, Nov 8, 2023 at 3:36 PM Florian Sommerfeld <
fsommerfeld at stud.hs-bremen.de> wrote:
> Hello Stanislav,
> I am currently researching on how to get RTEMS up and running on a Zybo
> Z7-20 Zynq-7000 ARM/FPGA Board (should be rather similar to your Arty
> Z7) and found your question in the RTEMS users mail archive:
> https://www.mail-archive.com/users@rtems.org/msg03248.html
> Did you ever manage to run RTEMS on your Z7-20 board? I was able to use
> the xilinx_zynq_zedboard BSP to build the RTEMS 5 hello world program,
> but I am having a hard time on how to actually get it onto the board.
> Any help is highly appreciated.
>
> Sincerely,
> Florian
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20231109/e3b612ba/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tasks.py
Type: text/x-python
Size: 1655 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/users/attachments/20231109/e3b612ba/attachment.py>
More information about the users
mailing list