Skip to content

nsitexe/akaria-ns31-arty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Akaria NS31A CPU family sample softwares readme

Overview

This is sample softwares for Akaria NS31A CPU family. To use this sample softwares, you need the Akaria bmetal library.

Contents

  • CUI Menu Demo (akaria_menu_demo/)

    • A simple example demo of CUI.

  • Flash Write sample (flash_write/)

    • A simple example how to write boot program to Pmod SF3 (SPI Flash).

  • Blinking LED sample (sample_blink_led/)

    • A simple example of blinking LEDs on the board.

  • Timer sample (sample_timer/)

    • Prints sys clock to terminal.

How to use

Clone SDK and sample code from github

  1. Clone Akaria bmetal library from github

    $ mkdir work && cd work
    $ git clone git@github.com:nsitexe/akaria-bmetal.git
  2. Clone this sample code from github

    $ cd akaria-bmetal/test/
    $ git clone git@github.com:nsitexe/akaria-ns31-arty.git

Building the sample code

Run the command below to build the sample code.

example (akaria_menu_demo/)
$ cd work/akaria-bmetal
$ rm -r build     #if the build directory already exists
$ mkdir build && cd build
$ cmake ../ -G Ninja -DARCH=riscv -DCROSS_COMPILE=riscv64-unknown-elf- -DCC=gcc -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=../test/sysroot/ -DDEFCONF=riscv_nsitexe_ns31_arty
$ ninja install
$ cd ../test/akaria-ns31-arty/akaria_menu_demo
$ make

When the build is complete, an ELF file (akaria_ns_bsp.elf) is generated.

Running the sample software

Launching the sample software

  1. Set SW3(Boot ROM SPI) on the Arty-A7 Board to '0', because SW3=1 is reserved

  2. Connect the PC and the Arty-A7 Board with a USB cable

  3. Connect the Arty-A7 Board and Debugger

  4. Launch "Open OCD"

  5. Open Terminal. (Set baudrate to 9600 bps)

  6. Launch GDB.

    $ riscv64-unknown-elf-gdb akaria_ns_bsp.elf
  7. Run the following command on GDB:

    (gdb) set arch riscv:rv32
    (gdb) target remote localhost:3333
    (gdb) monitor reset halt
    (gdb) load
    (gdb) c
    * When "load" is executed, The PC is set to program start address.
  8. Push BTN0 to boot NS31A (When you set SW2=0)

  9. Each sample software starts.

    example(akaria_menu_demo)
    • A menu appears in the terminal. Enter the command you want to run

      Missing program header. AT_PHDR is not available.
      
      #####################################################################
      #                                                                   #
      #   A k a r i a   N S   B o a r d   S u p p o r t   P a c k a g e   #
      #                                                                   #
      #####################################################################
      
       ==== Select ID to execute each function ================
            ID        Discription
       --------------------------------------------------------
          * 0 :        LED test
          * t :        Print system clock
          * h :        Help
       ========================================================
      Akaria>

About

Sample softwares for Akaria NS31A CPU family.

Resources

License

Stars

Watchers

Forks

Packages

No packages published