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的时候用到了这个库, 所以现在过来好好研究一下这个库... 下面是文档内容 : ...
随机推荐
- tensor_scatter_add算子异同点
技术背景 在MindSpore的ops下实现了一个tensor_scatter_add算子.这个算子的作用为,例如给定一个shape为(1,2,3,4)的原始tensor,因为这个tensor有4个维 ...
- Server-sent-events与 WebSocket的区别是什么?
SSE 与 WebSocket 作用相似,都是建立浏览器与服务器之间的通信渠道,然后服务器向浏览器推送信息.总体来说,WebSocket更强大和灵活.因为它是全双工通道,可以双向通信:SSE是单向通道 ...
- Docker 一键安装部署 JumpServer 堡垒机
一.环境准备 bash # 更新系统 sudo apt update && sudo apt upgrade -y # 安装 Docker sudo apt install -y ...
- Xamarin.Android -- EditText输入无法实时显示问题
参考文章:EditText输入内容不显示_edittext输入没有显示-CSDN博客 https://blog.csdn.net/guodashen007/article/details/108768 ...
- iOS开发UI篇—自定义瀑布流控件(接口设计)
iOS开发UI篇-自定义瀑布流控件(接口设计) 一.简单说明 1.关于瀑布流 电商应用要展示商品信息通常是通过瀑布流的方式,因为每个商品的展示图片,长度和商都都不太一样. 如果不用瀑布流的话,展示这样 ...
- Esbuild-新一代极速前端构建打包工具
什么是 Esbuild? Esbuild 是由 Figma 的 CTO 「Evan Wallace」基于 Golang 开发的一款打包工具,相比传统的打包工具,主打性能优势,在构建速度上可以快 10~ ...
- [转载]Quantum Logic and Probability Theory
Origin: https://plato.stanford.edu/entries/qt-quantlog/ Quantum Logic and Probability Theory First p ...
- ICEE-家电-电饭锅原理: MCU交互与程控(弱电)+强电(NTC温控+继电器+电阻发热管)
客户需求与竞争情报.董事会决策. 市场调研.试制预研.商业计划. 组织管理.人才招聘培训. 样品与采购.研发生产与量产. 市场营销与推广.客户服务与反馈. firmware.软件.电路硬件.机械与材料 ...
- Linguistics-English-Psychology-Minds: WholePurposeOfLife + Success +
different pronunciation: fear feel felt mortal motel motor Speech of Emily Esfaha: I used to think t ...
- SciTech-EECS-用MCU的 GPIO 或 OpAmp运放的Output 适配驱动 高电压 的 MOS管/IGBT/可控硅 甚至是 220V及以上的 阻性/感性/容性负载的
TRIAC是"双向可控硅",SCR是"单向可控硅": 有半导体产商为直接驱动TRIAC与SCR而设计的配对光耦, 可以极大简化驱动电路设计.非常方便的用MCU信 ...