PULP(pulp-sdk) ubuntu18.04环境搭建

PULP = Parallel Ultra Low Power

第一个坑:切换为python为默认的python3

我这里简单粗暴的直接创建软链接 python3.6 到python

 重要参考文档:NBruschi_gvsoc_tutorial_part1.pdf

第二个坑,github,不是墙的问题,当然可以解决问题,可以参考我的配置

1. 修改.ssh/config为如下:

root@ubuntu:/opt# cat ~/.ssh/
config       id_rsa       id_rsa.pub   known_hosts  
root@ubuntu:/opt# cat ~/.ssh/config 
Host github.com
HostName ssh.github.com  #
User git
Port 443
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa

 2. 在/etc/hosts中添加github.com的域名解析

root@ubuntu:/opt# cat /etc/hosts
127.0.0.1	localhost
127.0.1.1	ubuntu

20.205.243.166  github.com

修改完成后,代码下载飞快,否则,估计很多人第一步代码下载就会卡上好几天。

编译toolchain

$sudo apt-get install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev

$git clone https://github.com/pulp-platform/pulp-riscv-gnu-toolchain
$git submodule update --init --recursive

$rm -rf riscv-dejagnu/
qiao@ubuntu:~/riscv/pulp-riscv-gnu-toolchain$ git clone https://gitee.com/mirrors/riscv-dejagnu
$rm -rf riscv-newlib
$git clone https://gitee.com/mirrors/riscv-newlib

$./configure --prefix=/opt/pulp-riscv-gnu-toolchain --with-arch=rv32imc --with-cmodel=medlow --enable-multilib
$make

 编译完成后,查看/opt/pulp-riscv-gnu-toolchain.

编译pulp-sdk

sudo apt-get install -y build-essential git libftdi-dev libftdi1 doxygen python3-pip
libsdl2-dev curl cmake libusb-1.0-0-dev scons gtkwave libsndfile1-dev rsync autoconf
automake texinfo libtool pkg-config libsdl2-ttf-dev
pip install argcomplete pyelftools six

To install the PULP-SDK follow these steps:
 $ git clone https://github.com/pulp-platform/pulp-sdk
 $ export PULP_RISCV_GCC_TOOLCHAIN=
 $ cd pulp-sdk
 $ source configs/pulp-open.sh
 $ make build

test程序

qiao@ubuntu:~/riscv/pulp-sdk/tests/hello$ ls
BUILD  compile_commands.json  Makefile  test.c  test.c.bak
qiao@ubuntu:~/riscv/pulp-sdk/tests/hello$  make clean all
RM  /home/qiao/riscv/pulp-sdk/tests/hello/BUILD/PULP/GCC_RISCV/
CC  test.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/kernel/fll-v1.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/kernel/freq-domains.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/pulp/kernel/chips/pulp/soc.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pmsis/pmsis_bsp/fs/read_fs/read_fs.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pmsis/pmsis_bsp/fs/host_fs/semihost.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pmsis/pmsis_bsp/fs/host_fs/host_fs.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pmsis/pmsis_bsp/fs/fs.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pmsis/pmsis_bsp/bsp/pulp.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/lib/libc/minimal/io.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/lib/libc/minimal/fprintf.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/lib/libc/minimal/prf.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/lib/libc/minimal/sprintf.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/lib/libc/minimal/semihost.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/kernel/init.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/kernel/kernel.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/kernel/device.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/kernel/task.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/kernel/alloc.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/kernel/alloc_pool.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/kernel/irq.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/kernel/soc_event.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/kernel/log.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/kernel/time.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/pulp/drivers/uart/uart-v1.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/pulp/drivers/udma/udma-v3.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/pulp/drivers/cluster/cluster.c
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/kernel/crt0.S
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/kernel/irq_asm.S
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/kernel/task_asm.S
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/kernel/time_asm.S
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/common/kernel/soc_event_v2_itc.S
CC  /home/qiao/riscv/pulp-sdk/rtos/pulpos/pulp/drivers/cluster/pe-eu-v3.S
LD  /home/qiao/riscv/pulp-sdk/tests/hello/BUILD/PULP/GCC_RISCV//test/test
gapy --target=pulp --platform=gvsoc --work-dir=/home/qiao/riscv/pulp-sdk/tests/hello/BUILD/PULP/GCC_RISCV/ --config-opt=cluster/nb_pe=8    run --image --binary=/home/qiao/riscv/pulp-sdk/tests/hello/BUILD/PULP/GCC_RISCV//test/test 
gapy --target=pulp --platform=gvsoc --work-dir=/home/qiao/riscv/pulp-sdk/tests/hello/BUILD/PULP/GCC_RISCV/ --config-opt=cluster/nb_pe=8    run --flash --binary=/home/qiao/riscv/pulp-sdk/tests/hello/BUILD/PULP/GCC_RISCV//test/test

openocd

install openocd
$git clone https://github.com/riscv/riscv-openocd.git
$ cd riscv-openocd/
$ git clone https://github.com/syntacore/libjaylink.git
$ make
$ ./bootstrap
$./configure --prefix=$RISCV --enable-remote-bitbang --enable-jtag_vpi --disable-werror --enable-jlink
$make
$sudo make install
 run
$qiao@ubuntu:~/riscv/pulp-sdk/tests$ sudo openocd -f pulp_riscv.cfg
Open On-Chip Debugger 0.12.0+dev-01363-gc7d1f0dda (2023-10-19-01:56)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select '.
Info : J-Link V9 compiled May  7 2021 16:26:12
Info : Hardware version: 9.60
Info : VTarget = 3.327 V
Info : clock speed 1000 kHz
Info : JTAG tap: riscv.unknown0 tap/device found: 0x10102001 (mfg: 0x000 (), part: 0x0102, ver: 0x1)
Info : JTAG tap: riscv.cpu tap/device found: 0x249511c3 (mfg: 0x0e1 (Wintec Industries), part: 0x4951, ver: 0x2)
Info : datacount=2 progbufsize=8
Info : Examined RISC-V core; found 1024 harts
Info :  hart 992: XLEN=32, misa=0x40901124
Info : starting gdb server for riscv.cpu on 3333
Info : Listening on port 3333 for gdb connections
Ready for Remote Connections

 GDB debug

/opt/pulp-riscv-gnu-toolchain/bin/riscv32-unknown-elf-gdb  ./uart/loopback/BUILD/PULP/GCC_RISCV/test/test
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
warning: Target-supplied registers are not supported by the current architecture
0x1a000080 in ?? ()
(gdb) load
Loading section .data_tiny_fc, size 0x850 lma 0x1c000004
Loading section .init_array, size 0x18 lma 0x1c000854
Loading section .fini_array, size 0xc lma 0x1c00086c
Loading section .data, size 0x40 lma 0x1c001080
Loading section .vectors, size 0x9c lma 0x1c008000
Loading section .text, size 0xaf4 lma 0x1c00809c
Loading section .l2_data, size 0x388 lma 0x1c010000
Loading section .data_tiny_l1, size 0x18 lma 0x1c010388
Start address 0x1c008080, load size 6116
Transfer rate: 2 KB/sec, 764 bytes/write.
(gdb) continue
Continuing.

后续更新....

你可能感兴趣的:(risc-v)