Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 May 2020 15:13:44 -0700
From:      John-Mark Gurney <jmg@funkthat.com>
To:        freebsd-arm@FreeBSD.org
Subject:   need help w/ Cora-Z7, XC7Z007S Zynq board
Message-ID:  <20200516221344.GH4213@funkthat.com>

next in thread | raw e-mail | index | archive | help
Hello,

Recently got the Cora-Z7 board, and want to get FreeBSD working on it.

With a bit of help from manu, I managed to get FreeBSD booting on it,
but running into issues w/ the clocks.

The issue is that I need to set the clock-frequency for the
global-clock, otherwise I don't have an event timer and the kernel
panics.  I configured it in the dts:
https://www.funkthat.com/~jmg/FreeBSD/cora-z7/zynq-coraz7.dts

But the issue is that time passes approximately 6.25x faster than
it should.  This was measured via pinging a remote host on the
board, and via another machine, observing that it was about 6.23x
difference, and noticing that 50MHz/8MHz is 6.25x.  The 50 MHz
speed was selected because the Cora-Z7 user guide says that the PS_CLK
block is provided a 50 MHz clock, and the dts provided by Digilent
uses 50 MHz as well:
https://github.com/Digilent/u-boot-digilent/blob/master/arch/arm/dts/zynq-coraz7.dts#L41

If I change the clock to 8MHz, it hangs at:
mmcsd0: 16GB <SDHC SC16G 8.0 SN 7C723DFC MFG 04/2018 by 3 SD> at mmc0 50.0MHz/4bit/65535-block
WARNING: WITNESS option enabled, expect reduced performance.
Root mount waiting for: CAM

Anyone have any suggestions on how to proceed?

This is using the latest 13.0-CURRENT GENERICSD snapshot image.

To boot, I did have to use the vendor supplied u-boot, as getting
digilent's u-boot to compile wasn't easy as they haven't updated to
the current version of OpenSSL, and porting their changes over mainline
u-boot was going to be a bit of work.  I was able to extract the
boot.bin from their BSP package, and put that on the FAT file system
(I did end up reformatting the FAT to FAT32, but not sure if this was
needed or not), along w/ the above mentioned dts compiled to dtb.

U-boot commands:
fatload mmc 0 $netstart EFI/BOOT/bootarm.efi
bootefi $netstart

and then loader fails to properly get the boot device set:
   Command line arguments: l                                                                                                                                                
   Image base: 0x10000000      
   EFI version: 2.05                                                                  
   EFI Firmware: Das U-boot (rev 0.00)                                                                                                                                      
   Console: comconsole (0)                                                            
   Load Path: /uEnv.txt                                                                                                                                                     
   Load Device: sdhci@e0100000.blk                                                    
Startup error in /boot/lua/loader.lua:                                                                                                                                      
LUA ERROR: cannot open /boot/lua/loader.lua: no such file or directory.

so, I have to manually load the kernel and dtb with the following
commands:
set currdev=disk0s2a
load /boot/kernel/kernel
set currdev=disk0s1
set hw.ncpu=1
load -t dtb dtb/zynq-coraz7.dtb
set currdev=disk0s2a
boot

The hw.ncpu=1 is necessary as we haven't committed the review that
detects number of cpus by the registers:
https://reviews.freebsd.org/D14429

dmesg: https://www.funkthat.com/~jmg/FreeBSD/cora-z7/dmesg.cora.z7.txt


-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200516221344.GH4213>