Building and Booting Zephyr Hello World on the SCU200 Platform
Overview
The SCU200 board carries a MicroBlaze V processor, the AMD RISC-V soft processor implemented in programmable logic. This page covers the build and boot flow for the Zephyr hello-world sample application on a 32-bit MicroBlaze V design on that board.
Zephyr support for MicroBlaze V targets the 32-bit mbv32 Zephyr
board, so the hardware design loaded into the
programmable logic has to instantiate a 32-bit MicroBlaze V
core. The 64-bit mbv64-scu200-sdt Linux machine was a different
design and a different Yocto machine, and its BSP is withdrawn
from this release; see
SCU200 MicroBlaze V Linux BSP Withdrawal.
Prerequisites
A working AMD EDF Yocto build environment. See Setting Up the Yocto Environment and Operating System Integration and Development.
The Zephyr layers in
bblayers.conf:meta-zephyr-coreandmeta-zephyr-bspfrommeta-zephyr, together withmeta-amd-zephyrfrommeta-xilinx. The defaultbblayers.conf.samplealready lists all three, so confirm they are present rather than adding them. The layer roles are described in Yocto Project Zephyr Build.A JTAG cable between the build host and the board, and a serial terminal attached to the board console.
Building the Hello-World Application
The mbv32-scu200-zephyr-sdt machine ships committed in the
EDF BSP layer, meta-amd-adaptive-socs-bsp, together
with its machine include and its device trees, so
MACHINE=mbv32-scu200-zephyr-sdt works from a plain repo-fetched
tree with no generation step. gen-machine-conf produced that machine
from the SDT for the SCU200 MicroBlaze V design, which is why
the application is built against the hardware description rather than
against the in-tree Zephyr board files. For background on the generator
and on the Yocto Zephyr layer roles, see
Overview of gen-machine-conf and
Yocto Project Zephyr Build.
No multiconfig is involved: the machine is selected directly on the
bitbake command line.
$ MACHINE=mbv32-scu200-zephyr-sdt DISTRO=amd-zephyr bitbake sdt-artifacts zephyr-helloworld
Both parts of that command line are load-bearing:
DISTRO=amd-zephyris mandatory for this machine. The machine configuration carries aXILINX_DEPRECATEDentry warning that the configuration is only intended for use withDISTROset toamd-zephyrand is likely to fail with other configurations, and the EDF default isDISTRO ?= "amd-edf". The distro is not cosmetic: it selectsTCLIBC = "newlib"andZEPHYR_TOOLCHAIN_VARIANT = "zephyr".sdt-artifactshas to be named explicitly. It deploys the SDT bundle that contains the PDI used by the JTAG procedure below, and nothing in thezephyr-helloworlddependency chain pulls it in. Leave it off and the PDI is never deployed.
The build deploys the application into
${TMPDIR}/deploy/images/${MACHINE} as
zephyr-helloworld-mbv32-scu200-zephyr-sdt.elf and its .bin
counterpart. Both names are symlinks to the build-stamped files
written next to them, so the unversioned names always point at the
current build. sdt-artifacts writes the PDI holding the
32-bit MicroBlaze V design to the system-dt/ subdirectory of the
same deploy directory, as system-dt/scu200_zephyr_32bit.pdi.
Booting the Application Over JTAG
This section covers the JTAG bring-up path, which loads the hardware design and the application straight from the build host into the target, so no flash device has to be programmed.
Start XSDB, connect to the hardware server, and list the targets. Before the design is loaded, only the device and the programmable logic control RISC-V target at PMCL are present:
$ xsdb xsdb% connect xsdb% ta 1* xcsu200p 2 BSCAN JTAG at PMCL 3 RISC-V at PMCL 4 Hart #0 (Running)
tais the abbreviated form oftargets. The target numbers are assigned dynamically, so use the numbers your own session reports rather than the ones shown here.Select the device and configure the programmable logic with the PDI that contains the 32-bit MicroBlaze V design:
xsdb% ta 1 xsdb% dev p system-dt/scu200_zephyr_32bit.pdi 100% 6MB 0.7MB/s 00:09
dev pis the abbreviated form ofdevice program. The path is relative to the deploy directory listed above.List the targets again until the MicroBlaze V core in the user design appears. The debug hub and the
RISC-V at USER2target are enumerated after the PDI is loaded, and may take an extratato show up:xsdb% ta 1* xcsu200p 2 BSCAN JTAG at PMCL 7 BSCAN JTAG at USER2 8 Legacy Debug Hub 3 RISC-V at PMCL 4 Hart #0 (Running) xsdb% ta 1* xcsu200p 2 BSCAN JTAG at PMCL 7 BSCAN JTAG at USER2 8 Legacy Debug Hub 3 RISC-V at PMCL 4 Hart #0 (Running) 9 RISC-V at USER2 10 Hart #0 (Running)
RISC-V at USER2is the MicroBlaze V core of the design. Do not load the application onto theRISC-V at PMCLtarget.Select that core and reset it:
xsdb% ta 10 xsdb% rst -proc Info: Hart #0 (target 10) Stopped at 0x0 (Reset catch)
Download the Zephyr ELF file and release the core:
xsdb% dow -force zephyr-helloworld-mbv32-scu200-zephyr-sdt.elf Downloading Program -- <path-to>/zephyr-helloworld-mbv32-scu200-zephyr-sdt.elf section, rom_start: 0x80000000 - 0x8000000f section, reset: 0x80000010 - 0x80000013 section, exceptions: 0x80000014 - 0x80000189 section, text: 0x8000018c - 0x80003d81 section, initlevel: 0x80003d84 - 0x80003dfb section, device_area: 0x80003dfc - 0x80003f7b section, sw_isr_table: 0x80003f7c - 0x80004003 section, eeprom_driver_api_area: 0x80004004 - 0x8000400f section, gpio_driver_api_area: 0x80004010 - 0x80004033 section, i2c_driver_api_area: 0x80004034 - 0x8000404b section, clock_control_driver_api_area: 0x8000404c - 0x80004067 section, uart_driver_api_area: 0x80004068 - 0x800040b3 section, tbss: 0x800040b4 - 0x800040b7 section, rodata: 0x800040b4 - 0x8000485f section, datas: 0x80004860 - 0x800048a7 section, device_states: 0x800048a8 - 0x800048bf section, k_heap_area: 0x800048c0 - 0x800048d3 section, bss: 0x800048d8 - 0x80004c53 section, noinit: 0x80004c60 - 0x80006a5f 100% 0MB 0.0MB/s 00:00 Setting PC to Program Start Address 0x80000000 Successfully downloaded <path-to>/zephyr-helloworld-mbv32-scu200-zephyr-sdt.elf xsdb% con Info: Hart #0 (target 10) Running
The section addresses report where the application is linked; the program counter is set to the program start address by
dow, soconstarts execution at0x80000000.
The hello-world message from the sample then appears on the board serial console. Nothing is persisted across a board reset, so reload the design and the application after every reset.