Ubuntu installs riscv-gnu-toolchain compilation chain and spike, pk usage guide

riscv-gnu-toolchain compilation chain and spike, pk installation and usage guide 1. Environment: Ubuntu18.04 2. Install dependency packages (needed for various compilations): $ sudo apt install autoconf automake autotools-dev curl python3 libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev 3. Differentiate between downloading riscv-gnu-toolchain and riscv-tools As for why we […]

MCU soft core 2. Running tinyriscv on Xilinx Artix7

0. Environment -ubuntu18 – win10 + vivado 2018.3 – git desktop – XC7A35TV12 core board – ft2232hl small board (for program burning) 1. git clone source code Git Desktop -> File -> Clone repository -> -> URL: https://gitee.com/liangkangnan/tinyriscv/ -> Local path: D:\Workspaces\GitHub\tinyriscv 2. vivado creates project Create Project -> Next -> -> Project name: tinyriscv […]

Source code compilation of risc-v virtual machine and compiler riscv-gnu-toolchain and riscv-tools in ubuntu 22.04

1. Compile riscv-gnu-toolchain 1.1 Preparation environment $ sudo apt-get install autoconf automake autotools-dev curl python3 libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev 1.2 Download source code https://github.com/riscv-collab/riscv-gnu-toolchain git clone –recursive https://github.com/riscv-collab/riscv-gnu-toolchain.git 1.3 Compile elf tool cd riscv-gnu-toolchain/ for riscv64-unknown-elf-gcc: ./configure –prefix=/opt/riscv sudo make -j 1.4 Compilation linux tools […]

riscv64 bare metal programming practice and analysis

riscv64 bare metal programming practice and analysis 1 Overview 2. The composition of the minimum project 3. Link script 4. Executable program source code analysis 5. Compile and run 5.1 Compile 5.2 run 5.3 Debugging 6. Summary 1. Overview Any chip needs a piece of assembly code before it starts, and some architectural design features […]

Detailed comments on the clint.v module (interrupt management module) in the tinyriscv project

`include “defines.v” // core local interruptor module // Core interrupt management, arbitration module module clint( input wire clk, input wire rst, // from if_id input wire[`INT_BUS] int_flag_i, // peripheral interrupt signal // from id input wire[`InstBus] inst_i, // the instruction currently being executed input wire[`InstAddrBus] inst_addr_i, // the address of the instruction currently being executed […]

arm32 arm64 riscv32 riscv64 stack backtracking unwind based on fp

Article directory fp-based stack backtracking source code stack backtracking method Calling Convention and Example Analysis Stack Backtracking Abstraction Principle of stack backtracking Stack backtracking implementation architecture independent code Architecture Dependency Code Stack backtrace instance run Use stack backtracking knowledge to debug Fp-based stack backtracking source code arm32 arm64 riscv32 riscv64 Stack backtracking method 1. fp-based […]

RISCV SOC development environment 4 – code debugging (openocd + gdb)

Download Gdb is already available with the toolchain, just download openocd. Clone from the domestic mirror image, git clone https://gitee.com/mirrors/openocd.git Install When installing, use the adapter driver that can be used, such as –enable-ftdi, etc. cd openocd ./bootstrap # (when building from the git repository) ./configure –prefix=$RISCV –enable-remote-bitbang –enable-jtag_vpi –disable-werror make sudo make install Example […]

OpenOCD flashing FLASH code structure analysis (based on RISCV)

1. Analysis of the corresponding commands in the configuration file Generally, when we enable the flashing function of OpenOCD, we need to add the following two statements in the cfg file of OpenOCD: (1) $_TARGETNAME configure -work-area-phys 0xaaaaaaaa -work-area-size 0xbbbbbbbb -work-area-backup 0 (2) flash bank spi_flash fespi 0xcccccccc 0 0 0 $_TARGETNAME 0xdddddddd These two […]

21 Yiwen learns to make riscvCPU (fourth bullet)

One article will make riscvCPU In this section, we will introduce how to implement alu ALU module alu ( /* ALU port */ input [`XLEN-1:0] alu_a_i, input [`XLEN-1:0] alu_b_i, input [`ALUOP_LEN-1:0] alu_op_i, output [`XLEN-1:0] alu_out, //compare command output output compare_out ); Input bit width Output bit width alu_a_i (the first operand of ALU) 64 alu_out […]