Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 28 additions & 23 deletions examples/legacy_apps/machine/xlnx/README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,45 @@
# Steps to generate inputs for AMD-Xilinx RPU Firmware Demos

Dependencies:
1. Lopper : https://github.com/devicetree-org/lopper.git
2. System Device Tree generated from design : https://docs.amd.com/r/en-US/ug1647-porting-embeddedsw-components/Generating-a-System-Device-Tree-Using-SDTGen
Below is sample run for SOM KV260 platform

Below is sample run for Versal Gen 1 platform
## Generate OpenAMP RPU Device Tree
## Pick up System Device Tree

```sh
wget https://edf.amd.com/sswreleases/rel-v2025.2/sdt/2025.2/2025.2_1115_1_11150857/external/k26-smk-kv-sdt/k26-smk-kv-sdt_2025.2_1115_1_11150857.tar.gz
tar xvf k26-smk-kv-sdt_2025.2_1115_1_11150857.tar.gz
export SDT=$PWD/k26-smk-kv-sdt_2025.2_1115_1_11150857/system-top.dts
```

## Set up Lopper

```sh
git clone https://github.com/devicetree-org/lopper.git
python3 -m venv .venv
source .venv/bin/activate
pip3 install -r lopper/requirements.txt
pip3 install lopper

export LOPPER_PY=$PWD/lopper/lopper.py
```

## Apply Domain YAML to System Device Tree
SDT is the System Device Tree generated from design

```sh
export LOPPER_DTC_FLAGS="-b 0 -@"
python3 $LOPPER_PY -f --enhanced -x '*.yaml' -i $YAML $SDT yaml_applied.dts
python3 $LOPPER_PY -f --enhanced yaml_applied.dts rpu.dts -- gen_domain_dts psu_cortexr5_0 --openamp_no_header

python3 lopper.py -f --enhanced \
-x '*.yaml' \
-i $YAML $SDT yaml_applied.dts

python3 lopper.py -f --enhanced \
yaml_applied.dts rpu.dts \
-- gen_domain_dts psu_cortexr5_0 --openamp_no_header
export RPU_DTS=$PWD/rpu.dts
```
The above Device Tree "rpu.dts" will be used for configuration of the app's interrupts, shared memory and linker script.

## Generate OpenAMP App config header

```sh
export LOPPER_DTC_FLAGS="-b 0 -@"
export CONFIG_DTFILE=rpu.dts

cd openamp-system-reference/examples/legacy_apps/machine/zynqmp_r5
python3 lopper.py -O -f -v --enhanced --permissive \
-O . ${CONFIG_DTFILE} -- openamp --openamp_header_only \
--openamp_output_filename=amd_platform_info.h \
--openamp_remote=psv_cortexr5_0
cd -
python3 lopper.py -O -f --enhanced --permissive -O . ${RPU_DTS} -- openamp --openamp_header_only \
--openamp_output_filename=amd_platform_info.h --openamp_remote=psu_cortexr5_0
```
The output amd_platform_info.h needs to be in the location denoted above of "openamp-system-reference/examples/legacy_apps/machine/zynqmp_r5" BEFORE
cmake configure step.
Expand All @@ -41,8 +48,6 @@ cmake configure step.

```sh
export LOPPER_DTC_FLAGS="-b 0 -@"
export CONFIG_DTFILE=rpu.dts
python3 lopper.py -O ${S} rpu.dts \
-- baremetallinker_xlnx psv_cortexr5_0 <output location> openamp
python3 lopper.py -O . $RPU_DTS -- baremetallinker_xlnx psu_cortexr5_0 . openamp
```
The RPU Application Linker config object needs to be pointed to with cmake variable LINKER_METADATA_FILE at cmake configure step.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@
#include "xparameters.h"
#include "xscugic.h"

#define FREERTOS_BSP_IRQ_OFFSET 32

int xlnx_hw_to_bsp_irq(int sys_irq)
{
return sys_irq - FREERTOS_BSP_IRQ_OFFSET;
}

/* Interrupt Controller setup */
int system_interrupt_register(int int_num, void (*intr_handler)(void *),
void *data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@

static XScuGic xInterruptController;

int xlnx_hw_to_bsp_irq(int sys_irq)
{
return sys_irq;
}

int system_interrupt_register(int intr_num, void (*intr_handler)(void *),
void *data)
{
Expand Down
6 changes: 0 additions & 6 deletions examples/legacy_apps/machine/xlnx/zynqmp_r5/platform_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ extern struct metal_irq_controller xlnx_irq_cntr;
int system_interrupt_register(int int_num, void (*intr_handler)(void *),
void *data);

int xlnx_hw_to_bsp_irq(int sys_irq);

/* RPMsg virtio shared buffer pool */
static struct rpmsg_virtio_shm_pool shpool;

Expand Down Expand Up @@ -263,10 +261,6 @@ static int xlnx_machine_init(void)

metal_dbg("kick device irq id = %d\n", (int)kick_device.irq_info);

/* convert from HW irq number to bsp specific irq */
kick_device.irq_info =
(void *)xlnx_hw_to_bsp_irq((int)kick_device.irq_info);

ret = system_interrupt_register((int)kick_device.irq_info,
xlnx_irq_isr,
(void *)kick_device.irq_info);
Expand Down