PYNQ-Z2启动NutShell(果壳处理器)——整理补充原官方文档
原文档链接:https://github.com/OSCPU/NutShell
这篇文章暂时先用原文档的英文版,之后会编写一个中文版文档
Compile chisel code
before start,
git checkout release-21228Install
mill. Refer to the Manual section in this guide.Run
make verilog BOARD=pynqto generate verilog code. The output file isbuild/TopMain.v.
Run programs by simulation
You can either use our ready-to-run image for simulation or build image yourself.
To use ready-to run image (recommended) :
- Run
make emuto launch simulation. Default image is linux kernel.
Run on FPGA
Sub-directories Overview
fpga
├── board # supported FPGA boards and files to build a Vivado project
├── boot # PS boot flow of zynq and zynqmp
├── lib # HDL sources shared by different boards
├── Makefile
├── Makefile.check
└── NutShell.tcl # wrapper of NutShell core in the Vivado project
Build a Vivado project
- Install Vivado 2019.1, and source the setting of Vivado and SDK
- Run the following command to build a Vivado project
cd fpga
make PRJ=myproject BOARD=pynq STANDALONE=true
Change pynq to the target board you want. Supported boards are listed under board/. The project will be created under board/pynq/build/myproject-pynq. Please note that STANDALONE mode is only used in pynq board.
Open the project with Vivado and generate bitstream.
To generate bitstream with vivado 2022.2, please add
(* ram_style = "registers" *)before arraytlbmd_0tlbmd_2tlbmd_3inEmbeddedTLBMDmodule.See here for more details.(* ram_style = "registers" *)
reg [120:0] tlbmd_0 [0:0];
prepare SD card
Stand-Alone Mode
In stand-alone mode, control is directly transferred to PL (Program Logic) through FSBL (First Stage BootLoader) after the board is powered on, so that PL has access to on-board peripherals such as SD card, Ethernet, etc., which is necessary to boot Debian and other OS.
We use PYNQ-Z2 board as example to demonstrate how to prepare SD card in stand-alone mode.
Build BOOT.BIN
BOOT.bin is the default filename of packaged hardware-related binary files. Here is a pre-built and currently-used BOOT.BIN.
You can also build it yourself. Please refer to the following process.
create a project in Vivado and generate bitstream
cd $(NUTSHELL_HOME)/fpga
make PRJ=myprj BOARD=pynq STANDALONE=true vivado
generate hardware description file in Vivado
Vivado -> File -> Export -> Export Hardware
do bootgen initially
cd $(NUTSHELL_HOME)/fpga
make bootgen PRJ=myprj BOARD=pynq STANDALONE=true
# this will report some error messages
If you want to do bootgen with Vivado 22.2 please install Vitis first.
create project-related links
cd $(NUTSHELL_HOME)/fpga/boot/build/zynq
ln -sf $(NUTSHELL_HOME)/fpga/board/pynq/build/myprj-pynq/myprj-pynq.sdk/system_top_wrapper.hdf ps.hdf
ln -sf $(NUTSHELL_HOME)/fpga/board/pynq/build/myprj-pynq/myprj-pynq.runs/impl_1/system_top_wrapper.bit fpga.bit
# modify FSBL_LOC in $(NUTSHELL_HOME)/fpga/resource/fsbl-loader/Makefile like this:
# FSBL_LOC = ../../boot/build/myprj-pynq/fsbl
generate BOOT.BIN
cd $(NUTSHELL_HOME)/fpga
make bootgen PRJ=myprj BOARD=pynq STANDALONE=true
Build RV_BOOT.bin
RV_BOOT.bin is the default filename of linux-kernel image. Here is a pre-built and currently-used image. You can also build it yourself by riscv-pk and riscv-linux (currently not avaliable to the public).
Build rootfs in SD card
Save the contents before the SD card in case of loss
mount -t vfat /dev/mmcblk0p1 /mnt
mkdir sd_card_save
cp /mnt/* sd_card_save
umount /mnt
- Prepare
//umount the SD card
umount /dev/sdb*
- Partition
# creat two partitions in SD card
sudo fdisk /dev/sdb
- Delete the partition before execute the steps

- New partitions

- Or use
sudo cfdisk /dev/sdbto create partition
- Format
mkfs.vfat /dev/sdb1
mkfs -t ext4 /dev/sdb2
if you see the following error report after executing mkfs -t ext4 /dev/sdb2 , you can change partition type by using sudo cfdisk /dev/sdb , see here for more details.
mkfs.ext4: inode_size (128) * inodes_count (0) too big for a
filesystem with 0 blocks, specify higher inode_ratio (-i)
or lower inode count (-N).
- mount
mount -t ext4 /dev/sdb2 /mnt
mkdir /mnt/boot
mount -t vfat /dev/sdb1 /mnt/boot
- copy
copy the files which has been generated before into /dev/sdb1
- BOOT.BIN
- RV_BOOT.BIN
- download the debian base system to
sdb2withqemu-debootstrap, and enter the command below.
sudo su
qemu-debootstrap --arch riscv64 unstable /mnt http://deb.debian.org/debian-ports
chroot /mnt /bin/bash
passwd
apt-get update
apt-get install net-tools openssh-server vim build-essential minicom tmux libreadline-dev
exit
Add a line of
ttyPS0in/mnt/etc/securettyto allow login debian viattyPS0. See here for more details.Add a line of
PermitRootLogin yesin/mnt/etc/ssh/sshd_configto enable root login via ssh. See here for more details.Add the following lines to
/mnt/etc/fstab
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults 0 2
/dev/mmcblk0p2 / ext4 errors=remount-ro 0 1
PYNQ-Z2启动NutShell(果壳处理器)——整理补充原官方文档的更多相关文章
- Es官方文档整理-3.Doc Values和FieldData
Es官方文档整理-3.Doc Values和FieldData 1.Doc Values 聚合使用一个叫Doc Values的数据结构.Doc Values使聚合更快.更高效且内存友好. Doc Va ...
- Es官方文档整理-2.分片内部原理
Es官方文档整理-2.分片内部原理 1.集群 一个运行的Elasticsearch实例被称为一个节点,而集群是有一个或多个拥有相同claster.name配置的节点组成,他们共同承担数据和负 ...
- 微信小程序官方文档错误整理
大致看了一遍微信小程序文档,发现有几处微小的错误,但瑕不掩瑜.记录下,以后发现了还会继续在此添加.如果有记录不对的,请及时指出错误. 1.视图层->WXSS->尺寸单位 明显错误,应该为 ...
- 国家密码标准-商密SM2官方文档整理
SM2官方文档整理 算法原理 SM2算法介绍 我国自主知识产权的商业密码算法,是ECC(椭圆加密算法)的一种,基于椭圆曲线离散对数问题(公钥密码体制所依据的难题主要为大素数分解问题.离散对数问题.椭圆 ...
- [整理] FFmpeg官方文档树
扫了一遍官方文档,整理张官文树. 当然还有很多细节,可以慢慢沿着树根填,有需要可以联系我要ProcessON源文件,我尽量给个最新的出来. 官文 : http://ffmpeg.org/documen ...
- 【原创】官方文档-hive 启动命令
[一起学Hive]之十六-Hive的WEB页面接口-HWI Apache Hive 管网 hive metrics hive常用命令整理 Hive学习之HiveServer2服务端配置与启动 启动hi ...
- 关于 share 音乐分享官方文档补充
例子 音乐分享 /*--------微信朋友圈--------*/ [shareParams SSDKSetupWeChatParamsByText:@"内容" title:@&q ...
- tomcat 5 启动过程官方文档
http://tomcat.apache.org/tomcat-7.0-doc/architecture/startup/serverStartup.txt Licensed to the Apach ...
- openstack liberty 版本按照官方文档手动整合 完成后 基于dashboard-horizon 创建虚拟机报错 用CL却是成功的 网络等验证都是正确的通过启动的虚拟实例测试以成功
- 终端开发补充 : 读 curses模块官方文档...
curses是一个提供终端屏幕打印和键盘处理的库, 我个人的理解就是终端里的gui(当然它是基于文本的)... 写2048的时候用到了这个库, 所以现在过来好好研究一下这个库... 下面是文档内容 : ...
随机推荐
- Nginx 本地代理转发请求 502 Bad Gateway
问题 在使用 yum 安装 nginx 后可能会出现配置完成后却无法访问的问题,查看 audit.log 会发现类似于以下的错误信息 原因 出现此问题的原因是 SELinux 基于最小权限原则默认拦截 ...
- UFT send email
- Golang基础笔记五之结构体
本文首发于公众号:Hunter后端 原文链接:Golang基础笔记五之结构体 本篇笔记介绍 Golang 中的结构体. 在 Go 中,结构体是一种用户自定义的数据类型,可以将不同类型的数据组合在一起. ...
- vue中的div 拖拽
封装指令 const vDraggable = { mounted(el) { let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0; el.onmousedown = ...
- centos+apache安装ssl
默认apache是没有安装SSL模块的,如果网站想以https方式访问,则需要安装并配置ssl模块 第一步:下载ssl证书不做介绍,下载完成后,证书一般包括3个文件_public.crt文件是证书文件 ...
- 前端开发系列051-基础篇之自定义事件和插槽(Vue)
本文是早期学习Vue整理的一些阶段性总结,内容主要关于Vue框架中组件的事件传递和插槽. 一.组件通信(自定义事件) 组件间通信主要涉及到两方面的内容,即父组件(父级标签)向子组件传递数据以及子组件通 ...
- 前端开发系列050-基础篇之组件的概念和使用(Vue)
本文是早期学习Vue整理的一些阶段性总结,内容主要关于Vue框架中组件的概念和数据传递. 一.组件的相关概念 在Vue学习的时候参考了很多文档和书籍,这些文档和书籍中总是充满各种术语(定语),在这里先 ...
- 谷云观点:企业为什么要部署私有化的AI Agent智能体构建平台?
一.引言 在数字化浪潮的推动下,企业正面临着前所未有的机遇与挑战.随着人工智能技术的飞速发展,智能体(AI Agent)逐渐成为企业提升竞争力.实现降本增效的重要工具.然而,与个人开发智能体有所不同, ...
- Economics-Industries-Chemical: 化工+材料 行业 : 海外化工巨头的一步步强大
一文详解:海外化工巨头的一步步强大 详解美国Dow&Dupont.美国3M.德国BASF.Covestro四大海外巨头材料企业, 他们的公司起源.发展历史和竞争战略,提炼企业特征和行业的共性. ...
- POLIR-Society--Networking- {关系、理论与管理}: 权利 - Giving(给于)+Taking(取得)+运用好+"人性"
POLIR-Society--Networking- {关系.理论与管理}: 权利 - Giving(给于)+Taking(取得) 运用好"权利"+"人性" E ...