FPGA Development with wujian100 SoC - Part Two: CDK Toolkit and wujian100 SDK

Introduction to wujian100 sdk and CDK Toolkit.


FPGA Development with wujian100 SoC

Part Two: CDK Develop

Author: 加一(Jiayi)

Something to say

Recently I participate a contest named Integrate Circuit Innovation Contest which requires me to use WJ100 developed by Ali Inc. team t-head and a FPGA develop board with Xlinx XC7A200TR3B Core. It’s not my first time to cope with FPGA but still, I find it difficult to interpret Verilog Code and make the FPGA works. Luckily, with the help of WJ100 Sdk and CDK(C-sky Develop Kit) which developed by Ali Inc. we could jump the Verilog and long waiting synthesizing part directly to use the pre-setted circuit and easy writing C to develop.


About WJ100

T-Head’s Wujian SoC Platform utilizes the cloud-terminal-integration design philosophy that fuses software and hardware. Full stack integration of chips, operating systems and algorithms enables customers to develop chip products that can be mass-production.

Low power consumption: User-defined power consumption scenarios, with standby power consumption of less than 1uA, and operating power consumption of less than 100uA/MHz

According to the official sites of t-head Inc., WJ100 is a low cost and high power efficiency SoC, which barely means that it could be easily deployed on any chips and consumes lower power.

However, as I talked before, it is a open source project and as I believed, the real function of this SoC is to simplify the use of FPGA and to offer the developer a brand new way to develop: integrate Soc and FPGA to deal with some projects which require both power efficiency and fast steady frequency.

How to use WJ100 SoC

This tutorial is for those who utilize vivado to generate bitstream file and CDK to develop your own projects with Windows.


Part 2 CDK Develop on Windows

1. Software and Environment Installation

  1. Prep your CDK desktop which is offered on occ-thead and you could download it directly by click CDK_V2.0.4. Its related toolchain which is offered on t-head could be download directly by click CDK_related_Software.

  2. Install CDK V2.0.4 which is in cdk-windows-V2.0.4-20200106-2123.zip on your desktop.

  3. Install T-Head DebugServer-V5.8.6 which is offered in T-head Tools package.zip.

2. About wujian100 sdk

  1. So far we have successfully install all the software we need to program on your wujian100 SoC. Next let us see what we have got in repo wujian100_open.

  2. Open repo directory on your local computer and go into sdk folder. As we could see in the following structure

    sdk
    ├── board
    ├── csi_core
    ├── csi_driver
    ├── csi_kernel
    ├── libs
    ├── projects
    ├── utilities
    └── VERSION
    
  3. board

    board
     └─wujian100_open_evb
         │  board_init.c
         │  gcc_csky.ld
         │
         └─include
                 pin.h
                 test_driver_config.h
                 test_kernel_config.h
    

    board folder contains hardware initialize files.

    • board_init.c is called before main function. It configures clock timer used as record and delay and usart used as output.
    • gcc_csky.ld is the compilation link configuration, which configures the storage location of each field of the firmware generated by compilation, including i-sram, sram and heap size.
    • pin.h defines pin names used in examples and test projects.
    • test_driver_config.h defines enabilty for test projects.
    • test_kernel_config.h defines names for rtos used in test projects.
  4. csi_core

    csi_core
     └─include
             core_rv32.h
             csi_core.h
             csi_rv32_gcc.h
    
  5. csi_driver

    csi_driver
     ├─include
     │      drv_aes.h
     │      drv_common.h
     │      drv_crc.h
     │      drv_dmac.h
     │      drv_eflash.h
     │      drv_errno.h
     │      drv_gpio.h
     │      drv_i2s.h
     │      drv_iic.h
     │      drv_intc.h
     │      drv_irq.h
     │      drv_pmu.h
     │      drv_pwm.h
     │      drv_rsa.h
     │      drv_rtc.h
     │      drv_sha.h
     │      drv_spi.h
     │      drv_spiflash.h
     │      drv_timer.h
     │      drv_trng.h
     │      drv_usart.h
     │      drv_wdt.h
     │
     └─wujian100_open
         │  devices.c
         │  isr.c
         │  lib.c
         │  novic_irq_tbl.c
         │  pinmux.c
         │  startup.S
         │  system.c
         │  sys_freq.c
         │  trap_c.c
         │  vectors.S
         │  wj_dmac_v2.c
         │  wj_irq.c
         │  wj_oip_gpio.c
         │  wj_oip_timer.c
         │  wj_oip_wdt.c
         │  wj_pwm.c
         │  wj_rtc.c
         │  wj_usi.c
         │  wj_usi_iic.c
         │  wj_usi_spi.c
         │  wj_usi_usart.c
         │  wj_usi_wrap.c
         │
         └─include
                 drv_usi_iic.h
                 drv_usi_spi.h
                 drv_usi_usart.h
                 io.h
                 pinmux.h
                 pin_name.h
                 soc.h
                 sys_freq.h
                 usi_pin_planning.h
                 wj_dmac_v2.h
                 wj_oip_gpio.h
                 wj_oip_timer.h
                 wj_oip_wdt.h
                 wj_pwm.h
                 wj_rtc.h
                 wj_usi.h
                 wj_usi_iic.h
                 wj_usi_spi.h
                 wj_usi_usart.h
    
  6. csi_kernel

    csi_kernel
     ├─include
     │      csi_kernel.h
     │
     └─rhino
         ├─adapter
         │      csi_rhino.c
         │
         ├─arch
         │  ├─include
         │  │      k_config.h
         │  │      k_types.h
         │  │      port.h
         │  │
         │  └─riscv
         │          cpu_impl.c
         │          csky_sched.c
         │          port_c.c
         │          port_s.S
         │
         ├─board
         │      board_cpu_pwr.c
         │      board_cpu_pwr_rtc.c
         │      board_cpu_pwr_systick.c
         │      board_cpu_pwr_timer.c
         │
         ├─common
         │      k_atomic.c
         │      k_atomic.h
         │      k_cpuset.h
         │      k_ffs.c
         │      k_ffs.h
         │      k_fifo.c
         │      k_trace.c
         │
         ├─core
         │  │  k_buf_queue.c
         │  │  k_dyn_mem_proc.c
         │  │  k_err.c
         │  │  k_event.c
         │  │  k_idle.c
         │  │  k_mm.c
         │  │  k_mm_blk.c
         │  │  k_mm_debug.c
         │  │  k_mutex.c
         │  │  k_obj.c
         │  │  k_pend.c
         │  │  k_queue.c
         │  │  k_ringbuf.c
         │  │  k_sched.c
         │  │  k_sem.c
         │  │  k_stats.c
         │  │  k_sys.c
         │  │  k_task.c
         │  │  k_task_sem.c
         │  │  k_tick.c
         │  │  k_time.c
         │  │  k_timer.c
         │  │  k_workqueue.c
         │  │
         │  └─include
         │          k_api.h
         │          k_bitmap.h
         │          k_buf_queue.h
         │          k_critical.h
         │          k_default_config.h
         │          k_endian.h
         │          k_err.h
         │          k_event.h
         │          k_fifo.h
         │          k_hook.h
         │          k_internal.h
         │          k_list.h
         │          k_mm.h
         │          k_mm_blk.h
         │          k_mm_debug.h
         │          k_mm_region.h
         │          k_mutex.h
         │          k_obj.h
         │          k_queue.h
         │          k_ringbuf.h
         │          k_sched.h
         │          k_sem.h
         │          k_soc.h
         │          k_stats.h
         │          k_sys.h
         │          k_task.h
         │          k_task_sem.h
         │          k_time.h
         │          k_timer.h
         │          k_trace.h
         │          k_workqueue.h
         │
         ├─driver
         │      coretim.h
         │      hook_impl.c
         │      hook_weak.c
         │      systick.c
         │      yoc_impl.c
         │
         └─pwrmgmt
                 cpu_pwr_api.h
                 cpu_pwr_config.h
                 cpu_pwr_hal_lib.h
                 cpu_pwr_lib.h
                 cpu_tickless.h
                 dl_list.h
                 pwr_debug.h
                 pwr_state.h
    
  7. libs

    libs
     │  libnewlib_wrap.a
     │
     ├─include
     │  │  errno.h
     │  │  mm.h
     │  │  mm_queue.h
     │  │  syslog.h
     │  │  time.h
     │  │  umm_heap.h
     │  │
     │  ├─ringbuffer
     │  │      ringbuffer.h
     │  │
     │  └─sys
     │          _stdint.h
     │
     ├─libc
     │      clock_gettime.c
     │      malloc.c
     │      minilibc_port.c
     │      _init.c
     │
     ├─mm
     │      dq_addlast.c
     │      dq_rem.c
     │      lib_mallinfo.c
     │      mm_addfreechunk.c
     │      mm_free.c
     │      mm_initialize.c
     │      mm_leak.c
     │      mm_mallinfo.c
     │      mm_malloc.c
     │      mm_size2ndx.c
     │
     ├─ringbuffer
     │      ringbuffer.c
     │
     └─syslog
             syslog.c
    
  8. projects

    projects
     ├─benchmark
     │  ├─coremark
     │  │
     │  └─dhrystone
     │
     ├─examples
     │  ├─core
     │  │  └─vic
     │  │
     │  ├─driver
     │  │  ├─dmac
     │  │  │
     │  │  ├─gpio
     │  │  │
     │  │  ├─timer
     │  │  │
     │  │  ├─usart
     │  │  │
     │  │  └─wdt
     │  │
     │  ├─hello_world
     │  │
     │  └─kernel
     │      ├─event
     │      │
     │      ├─mem_pool
     │      │
     │      ├─message_q
     │      │
     │      ├─mutex
     │      │
     │      ├─sem
     │      │
     │      ├─task
     │      │
     │      ├─time
     │      │
     │      └─timer
     │
     └─tests
         └─driver
    
  9. utilities

    utilities
        aft_build.sh
        flash.init
        gdb.init
    

___________________________________________________________________

This article might be updated in the future, please refer to the original site: https://shieldjy.github.io/post/FPGA-Development-with-WJ100-SoC-P2.html , to avoid misleading by false or out-dated information, and to have a better reading experience.

If you would like to follow my latest blog, please click RSS Subscribe

___________________________________________________________________

知识共享许可协议 This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

It is widely welcomed to copy and redistribute the material in any medium or format as well as remix, transform, and build upon the material, but make sure you have referred Jiayi (And include the url: https://shieldjy.github.io ).

However, You may not use the material for commercial purposes. If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.

If there is any problem, please contact me for further information. (lijiayi19971127@hotmail.com)