Skip to content

Commit

Permalink
Merge pull request #40 from Avnet/image_v2.5
Browse files Browse the repository at this point in the history
Image v2.5 is live!
  • Loading branch information
FredKellerman authored Oct 15, 2019
2 parents e3d0b9b + cce6a6c commit b436e99
Show file tree
Hide file tree
Showing 26 changed files with 3,037 additions and 916 deletions.
85 changes: 51 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

This repository contains source files and instructions for building PYNQ to run on the
[Ultra96 board](http://zedboard.org/product/ultra96). Users can leverage the included
Petalinux 2018.3 BSPs to build the images on their own.
Petalinux BSPs to build the images on their own.

## Quick Start

Expand All @@ -19,20 +19,22 @@ Building PYNQ for Ultra96 can take many hours to complete. Plan accordingly!
* Roughly 60GB of free hard drive space if you have the Xilinx tools installed
* You may be able to get away with less free hard drive space, YMMV
* At least 8GB of RAM (more is better)
* Xilinx PetaLinux 2018.3, read Xilinx UG1144 for PetaLinux setup requirements
* A free Xilinx developer account to obtain and license the tools: https://www.xilinx.com/registration/create-account.html
* Xilinx PetaLinux (find the version compatible to a specific PYNQ release at
[Xilinx Tool Version](https://pynq.readthedocs.io/en/latest/pynq_sd_card.html));
read Xilinx UG1144 for PetaLinux setup requirements
* [Create a Xilinx account](https://www.xilinx.com/registration/create-account.html) to obtain and license the tools.

Retrieve the Ultra96 PYNQ board git into a NEW directory somewhere outside the PYNQ git directory.

```shell
git clone https://github.com/Avnet/Ultra96-PYNQ.git <LOCAL ULTRA96>
```

Setup Ultra96-PYNQ git to work on branch `image_v2.4_v2`.
Setup Ultra96-PYNQ git to work on a branch (for example,`image_v2.5`).

```shell
cd <LOCAL ULTRA96>
git checkout origin/image_v2.4_v2
git checkout origin/image_v2.5
```

## Using Included BSPs
Expand All @@ -52,23 +54,27 @@ cp -f sensors96b/sensors96b.hwh.vX sensors96b/sensors96b.hwh
```

Retrieve the main PYNQ repo into a NEW directory somewhere outside the Ultra96-PYNQ directory.

```shell
git clone https://github.com/Xilinx/PYNQ.git <LOCAL PYNQ>
```

Setup PYNQ git to work on branch `image_v2.4`.
Setup PYNQ git to work on a branch (for example, `image_v2.5`).

```shell
cd <LOCAL PYNQ>
git checkout origin/image_v2.4
git checkout origin/image_v2.5
```

Configure and install build tools, this will take some effort and will be an iterative process. Install on your own any missing tools.
Configure and install build tools, this will take some effort and will be an iterative process. Run `setup_host.sh` to install missing tools, `make checkenv` to check if all tools are installed.

```shell
cd sdbuild
./scripts/setup_host.sh
make checkenv
```

In your PYNQ repository go to the directory "sdbuild" and run make.
In your PYNQ repository go to the directory `sdbuild` and run make.

**IMPORTANT: For the BOARDDIR path setting it should be absolute not relative, you have been warned!**

Expand All @@ -77,7 +83,9 @@ make clean
make BOARDDIR=<LOCAL ULTRA96>
```

Once the build has completed (it will take a long long time), if successful an SD card image will be available under the PYNQ git directory here: `./sdbuild/output/Ultra96_v2.4.img`.
Once the build has completed (it will take a long long time), if successful an SD card image will be available under the PYNQ git directory `sdbuild/output`.
Depending on the PYNQ release, the image may have different names;
as an example, for PYNQ v2.5, the image is `Ultra96-2.5.img`.

Use Etcher or Win32DiskImager to write this image to an SD card.
Insert card, PYNQ should boot up on the Ultra96!
Expand All @@ -89,25 +97,44 @@ to the [online documentation](https://ultra96-pynq.readthedocs.io/en/latest/).

Note this is optional; it is needed only if you have good reason not to use the included BSP.

Obtain and install Xilinx Vivado or SDx and PetaLinux v2018.3 on Ubuntu 16.04 LTS. If you are installing the Xilinx tools for the first time on your existing setup you must read Xilinx UG1144 for PetaLinux setup requirements. If you prefer, you can also setup all the tools on a VirtualBox VM (e.g. using [Vagrant software](https://pynq.readthedocs.io/en/latest/pynq_sd_card.html#prepare-the-building-environment)).
If you purchase an Ultra96 board, a free voucher for the full-version Xilinx SDX tool suite and PetaLinux 2018.3 is included.

Use the Xilinx SDx or Vivado tools to generate the hardware design. The hardware design source files contain a PL (Xilinx Programmable Logic) design that will enable PYNQ to interact with a Grove mezzanine board. The hardware design also contains Ultra96 board specific settings. After building the hardware design, it will be manually imported into the PetaLinux BSP to be used for PYNQ. To build the hardware design that PetaLinux will boot up with:
Obtain and install Xilinx Vivado or SDx and PetaLinux on Ubuntu 16.04
LTS. For Xilinx tools, you will need a version compatible to the PYNQ release
(for Xilinx tool compatibility, please find information at
[Xilinx Tool Version](https://pynq.readthedocs.io/en/latest/pynq_sd_card.html).
If you are installing the Xilinx tools for the first time on your
existing setup you must read Xilinx UG1144 for PetaLinux setup requirements.

If you prefer, you can also setup all the tools on a VirtualBox VM
(e.g. using [Vagrant software](https://pynq.readthedocs.io/en/latest/pynq_sd_card.html#prepare-the-building-environment)).
If you purchase an Ultra96 board, a free voucher for the full-version Xilinx
SDX tool suite and PetaLinux is included.

Use the Xilinx SDx or Vivado tools to generate the hardware design.
The hardware design source files contain a PL (Xilinx Programmable Logic)
design that will enable PYNQ to interact with a Grove mezzanine board.
The hardware design also contains Ultra96 board specific settings.
After building the hardware design, it will be manually imported into the
PetaLinux BSP to be used for PYNQ. To build the hardware design that
PetaLinux will boot up with:

```shell
cd <LOCAL ULTRA96>/Ultra96/sensors96b
cp -f sensors96b.tcl.vX sensors96b.tcl
make
```

After the hardware design has finished building and you have installed PetaLinux 2018.3 then create the Ultra96 BSP by executing PetaLinux cmds FROM the TOP DIRECTORY of the Ultra96 PYNQ board git. You may see a couple warnings after the -config, those are normal:
After the hardware design has finished building and you have installed
PetaLinux then create the Ultra96 BSP by executing PetaLinux commands from the
ROOT DIRECTORY of the Ultra96 PYNQ board git. You may see a couple warnings
after the -config, those are normal:

```shell
cd <LOCAL ULTRA96>
mkdir bsp
cd bsp
petalinux-create -t project -n sensors96b --template zynqMP
cd sensors96b
petalinux-config --get-hw-description=../../Ultra96/sensors96b/sensors96b/sensors96b.sdk
petalinux-config --get-hw-description=../../Ultra96/sensors96b
```

After the system config menus appear you need to set the following case-sensitive values, after completion exit and save:
Expand All @@ -117,36 +144,26 @@ After the system config menus appear you need to set the following case-sensitiv
* Image Packaging Configuration → Root filesystem type → (SD card)
* Yocto Settings → YOCTO_MACHINE_NAME → (ultra96-zynqmp)

To work around a bug for Ultra96 that prevents including your own hardware design you must edit `<LOCAL ULTRA96>/bsp/sensors96b/project-spec/meta-user/conf/petalinuxbsp.conf`.
Add the following line at the bottom of the file:
To work around a bug for Ultra96 that prevents including your own hardware
design you must edit `<LOCAL ULTRA96>/bsp/sensors96b/project-spec/meta-user/conf/petalinuxbsp.conf`.
Add the following line at the bottom of the file:
```
MACHINE_FEATURES_remove_ultra96-zynqmp = "mipi"
```

OPTIONAL: configure u-boot to decrease the boot delay.
```shell
petalinux-config -c u-boot
```

Optionally change "delay in seconds before automatically booting", default is 4 seconds then exit and save.

For V2 you may want to remove the TI WiFi driver module. Search through device drivers, networking, wireless and deselect the Texas Instrument drivers:
For V2 you may want to remove the TI WiFi driver module. Search through
device drivers, networking, wireless and deselect the Texas Instrument drivers:
```shell
petalinux-config -c kernel
```

Finish creating the BSP by packaging it up into a single BSP file and placing it for PYNQ to find. 'X' should be set to '1' or '2' for U96 v1 or v2:
Finish creating the BSP by packaging it up into a single BSP file and placing
it for PYNQ to find. 'X' should be set to '1' or '2' for U96 v1 or v2:

```shell
cd <LOCAL ULTRA96>/bsp
rm ../Ultra96/sensors96b_vX.bsp
petalinux-package --bsp -p sensors96b --hwsource ../Ultra96/sensors96b/sensors96b --output ../Ultra96/sensors96b_vX.bsp
```

Note: The Microchip wilc driver used for U96 V2 has been pre-built and resides in the pre-stage PYNQ package area (wilc3000). To rebuild the `wilc-sdio.ko` driver you will need to wait for a PYNQ build to finish, then go back under the `<LOCAL PYNQ>/sdbuild/build/Ultra96/petalinux_bsp/sensors96b` the base directory of the PYNQ built BSP and manually run:

```shell
petalinux-build -c rootfs
```

This will build the device driver with the correct Linux kernel `#defines`. After the rootfs has finished building you will need to locate the file `wilc-sdio.ko` and manually copy it over to the U96 PYNQ rootfs and update the git file version of it under the `<LOCAL ULTRA96>/Ultra96/packages/wilc3000` folder and then rebuild the SD image after which will contain and startup the Microchip wifi driver.
Note: The PYNQ packages scripts and extra files will pull in v2 critical changes such as the wifi driver.
6 changes: 4 additions & 2 deletions Ultra96/packages/wilc3000/pre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ sudo cp $script_dir/wpa_ap.service $target/lib/systemd/system
sudo cp -r $script_dir/wpa_ap $target/usr/local/share/
sudo mkdir $target/wilc_bld
sudo mkdir -p $target/lib/firmware/mchp
sudo mkdir -p $target/lib/modules/4.14.0-xilinx-v2018.3/extra
sudo cp $script_dir/wilc-sdio.ko $target/lib/modules/4.14.0-xilinx-v2018.3/extra/
cd $BUILD_ROOT/${PYNQ_BOARD}/petalinux_project
petalinux-build -c wilc
sudo mkdir -p $target/lib/modules/4.19.0-xilinx-v2019.1/extra
sudo cp -rf build/tmp/sysroots-components/*/wilc/lib/modules/4.19.0-xilinx-v2019.1/extra/wilc-sdio.ko $target/lib/modules/4.19.0-xilinx-v2019.1/extra/
Binary file removed Ultra96/packages/wilc3000/wilc-sdio.ko
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#Add debug for PMUFW
#XSCTH_BUILD_DEBUG = "1"

ULTRA96_VERSION = "1"
YAML_COMPILER_FLAGS_append_ultra96-zynqmp = "-DENABLE_MOD_ULTRA96 -DENABLE_SCHEDULER"
YAML_COMPILER_FLAGS_append_ultra96-zynqmp = "${@bb.utils.contains('ULTRA96_VERSION', '2', ' -DULTRA96_VERSION=2', ' -DULTRA96_VERSION=1', d)}"

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CONFIG_NET=y
CONFIG_NET_TFTP_VARS=y
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_CMD_NET=y
CONFIG_CMD_PING=y
CONFIG_CMD_DHCP=y
CONFIG_CMD_TFTPPUT=y
CONFIG_CMD_NFS=y
CONFIG_BOOTDELAY=2
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <configs/platform-auto.h>
#define CONFIG_SYS_BOOTM_LEN 0xF000000

#define DFU_ALT_INFO_RAM \
"dfu_ram_info=" \
"setenv dfu_alt_info " \
"image.ub ram $netstart 0x1e00000\0" \
"dfu_ram=run dfu_ram_info && dfu 0 ram 0\0" \
"thor_ram=run dfu_ram_info && thordown 0 ram 0\0"

#define DFU_ALT_INFO_MMC \
"dfu_mmc_info=" \
"set dfu_alt_info " \
"${kernel_image} fat 0 1\\\\;" \
"dfu_mmc=run dfu_mmc_info && dfu 0 mmc 0\0" \
"thor_mmc=run dfu_mmc_info && thordown 0 mmc 0\0"

/*Required for uartless designs */
#ifndef CONFIG_BAUDRATE
#define CONFIG_BAUDRATE 115200
#ifdef CONFIG_DEBUG_UART
#undef CONFIG_DEBUG_UART
#endif
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

SRC_URI += "file://platform-top.h"
SRC_URI += "file://bsp.cfg"
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,8 @@ CONFIG_USB_UAS=y
#
CONFIG_SPI_SPIDEV=y

#
# Networking configurations
#
CONFIG_NF_TPROXY_IPV4=m
CONFIG_NF_TPROXY_IPV6=m
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/include/ "system-conf.dtsi"
/ {
// This is already in U96 V1 DT except for on delay, so we'll merge it in
sdio_pwrseq: sdio_pwrseq {
compatible = "mmc-pwrseq-simple";
/*post-power-on-delay-ms = <10>;*/
reset-gpios = <&gpio 7 1>; /* MIO[7] RESETN for WILC3000 active low */
/* reset-gpios = <&gpio 78 1>; // device pin A3 for RESETN, Active low, JT5 strapped to pins 1-2 */
chip_en-gpios = <&gpio 8 1>; // This REQUIRES a patched pwrseq_simple.c to have it use this pin properly for the WILC3000 wifi part
sdio_pwrseq: sdio_pwrseq {
compatible = "mmc-pwrseq-simple";
// MIO[7] RESETN for WILC3000 active low
reset-gpios = <&gpio 7 1>;
// requires a patched pwrseq_simple.c for WILC3000
chip_en-gpios = <&gpio 8 1>;
};

// Remove V1 Power ON/OFF controller from U96 V1 DT
Expand All @@ -22,32 +21,13 @@
/delete-property/gpio-line-names;
};

// This is what is in sdhci1 DT from V1, it will merge with below:
//
// bus-width = <0x4>;
// non-removable;
// disable-wp;
// cap-power-off-card;
// mmc-pwrseq = <&sdio_pwrseq>;
// vqmmc-supply = <&wmmcsdio_fixed>;
// #address-cells = <1>;
// #size-cells = <0>;
// wlcore: wifi@2 {
// compatible = "ti,wl1831";
// reg = <2>;
// interrupt-parent = <&gpio>;
// interrupts = <76 1>; /* MIO76 WLAN_IRQ 1V8 */
// };
//
&sdhci1 {
max-frequency = <50000000>;
/delete-property/cap-power-off-card; // This is not compatible with the WILC3000 and means the WILC will always be powered on
// cap-power-off-card not compatible with WILC3000
/delete-property/cap-power-off-card;
wilc_sdio@1 {
compatible = "microchip,wilc3000", "microchip,wilc3000";
compatible = "microchip,wilc3000";
reg = <0>;
// interrupt-parent = <&gpio>; // WILC driver does NOT use gpio IRQ
// interrupts = <76 2>; /* MIO76 WILC IRQ 1V8 */ // WILC driver does NOT use gpio IRQ
// irq-gpios = <&gpio 76 0>; // WILC driver does NOT use gpio IRQ
bus-width = <0x4>;
status = "okay";
};
Expand Down Expand Up @@ -77,10 +57,3 @@
};
};

/////////////////////////////////////////////////////////////////////////////////
//
// NOTE: This content is redundant (a duplicate of what is in the PetaLinux bsp)
// because the PYNQ build process over-writes the system-user.dtsi that
// is in the meta-user layer of a PetaLinux bsp
//
/////////////////////////////////////////////////////////////////////////////////
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#Add debug for PMUFW
#XSCTH_BUILD_DEBUG = "1"

ULTRA96_VERSION = "2"
YAML_COMPILER_FLAGS_append_ultra96-zynqmp = "-DENABLE_MOD_ULTRA96 -DENABLE_SCHEDULER"
YAML_COMPILER_FLAGS_append_ultra96-zynqmp = "${@bb.utils.contains('ULTRA96_VERSION', '2', ' -DULTRA96_VERSION=2', ' -DULTRA96_VERSION=1', d)}"

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

#
# Enable usb gadget
#
Expand Down Expand Up @@ -55,3 +56,8 @@ CONFIG_USB_UAS=y
#
CONFIG_SPI_SPIDEV=y

#
# Networking configurations
#
CONFIG_NF_TPROXY_IPV4=m
CONFIG_NF_TPROXY_IPV6=m
Loading

0 comments on commit b436e99

Please sign in to comment.