Simple example about PicoRV on nano 9K

Edit on 2022.04.14

Preface

There ia an example about picoRV in Tang Nano 9K github repository.
In this turtial we just describe how to run the example .

Environment

  • Python
  • Gowin IDE

Steps

Program FPGA

  • Open picotiny.gprj file which is in TangNano-9K-example\picotiny\project dictionary to open picotiny project.
  • Tick Use MSPI as regular IO in Project->Configuration->Place&Route->Dual-Purpose Pin which can be found in the top menu bar
  • Right-click Place&Route which is in Process interface and choose Clean&Rerun All
  • Download the generated .fs file to the Embedded Flash of Nano 9K

Then we can use the FPGA like a mcu.

Download firmware

  • Execute the following command in TangNano-9K-example\picotiny directory
python .\sw\pico-programmer.py .\example-fw-flash.v COM13

The COM13 at the end of command line refers to the serial port number of the development board in the system.
For example, if it is allocated COM14 in your system, you need change it into COM14.

There is a countdown shows - Waiting for reset - when you succeed excute the command, in which time it's required to press the S1 button of the development board to complete the programming.
The succeed done log is as below:

\TangNano-9K-example\picotiny> python .\sw\pico-programmer.py .\example-fw-flash.v COM13
Read program with 11760 bytes
  - Waiting for reset -
    ...
Total sectors 3
Total pages 46
Flashing 1 / 3
Flashing 2 / 3
Flashing 3 / 3

Flashing completed

Then we can use serial port tools to execute command and use HDMI to display the code interface.

End

Other knowledge like cross-compile is not mentioned here, so you should learn to use it by yourself.