A new RISC-V version of uLisp

栏目: IT技术 · 发布时间: 4年前

内容简介:A new RISC-V version of uLisp is designed to support microcontroller boards based on the RISC-V processor.RISC-V is a free, open RISC Instruction Set Architecture that began development in 2010 at the University of California, Berkeley. A range of boards h

Sipeed Maixduino RISC-V board

A new RISC-V version of uLisp is designed to support microcontroller boards based on the RISC-V processor.

RISC-V is a free, open RISC Instruction Set Architecture that began development in 2010 at the University of California, Berkeley. A range of boards has been developed by Sipeed based on the K210, a RISC-V chip manufactured by Canaan Inc. of Beijing, China.

The first RISC-V board supported by uLisp is the Sipeed Maixduino . The RISC-V version of uLisp includes graphics extensions, to allow you to plot points, lines, shapes, and text to the Maixduino colour TFT display. It also includes a RISC-V assembler that allows you to generate machine-code functions, integrated with Lisp, written in RISC-V code. The assembler itself is written in Lisp to make it easy to extend it or add new instructions.

RISC-V assembler

For an overview of the RISC-V assembler and details of how to install it see: RISC-V assembler overview .

For a summary of the instructions in the RISC-V assembler see: RISC-V assembler instructions .

For example programs see: RISC-V assembler examples .

Sipeed Maixduino

A new RISC-V version of uLisp

The Sipeed Maixduino is an Arduino Uno form factor board based on a Kendryte K210 RISC-V Dual Core 64 bit 400 MHz processor with Neural Network Processor (KPU) and Floating-Point Processor (FPU). It includes 8 Mbytes RAM, 16 Mbytes flash, a Micro SD card slot, and a LCD interface, making it an ideal platform for running uLisp.

Additional peripherals, some of which are not yet fully supported, include an ESP32 module to offer 2.4 GHz WiFi and Bluetooth 4.2, a MEMS microphone, a DVP camera, and an I2S audio output driving a 3W audio amplifier.

It's available with or without a compatible 320x240 Colour LCD display from Seeedor Unmanned Tech in the UK.

Setting up the Sipeed Maixduino

The Maixduino board is fitted with a USB-C socket. If your computer only has USB-A then you can use it with a USB-C cableand USB-C Female to Type A USB 3.0 Male Adapter.

You can install the RISC-V version of uLisp on a Sipeed Maixduino using the Arduino IDE as follows:

  • Download the RISC-V version of uLisp from the downloads page: Download uLisp.
  • Open the Boards Manager…  from the Board  item on the Tools menu, search for  Maixduino , and install Maixduino (K210) by Sipeed .
  • Connect the Maixduino board to your computer using a USB cable.
  • Select Sipeed Maixduino Board from the Maixduino section on the  Board menu.
  • Set Port to /dev/cu.usbserial-495223D74D0  or similar.
  • Set Programmer to k-flash .

You can leave the other options at their defaults.

Updating the Arduino core

There is one change I recommend you make to the Maixduino Arduino core before uploading uLisp; without this change the Serial Monitor drops characters if you paste more than a few lines into the input field:

  • Locate the file:
David/Library/Arduino15/packages/Maixduino/hardware/k210/0.3.11/cores/arduino/RingBuffer.h

replacing David by the name of your user folder, and 0.3.11 by the version of Maixduino you have installed.

  • Edit the file in a text editor, and change the line:
#define RING_BUFFER_SIZE 64

to:

#define RING_BUFFER_SIZE 1024

Installing uLisp

You should now be able to upload uLisp to the Maixduino.

Follow the instructions inUsing uLispto interact with uLisp on the Maixduino.

Pin connections

A new RISC-V version of uLisp

Digital inputs and outputs

The Maixduino provides 13 digital inputs or outputs accessible on the headers labelled 0 to 13. Each of these can be configured as an output, or an input with an optional pullup or pulldown. Note that unlike on Arduino boards, a pin won't operate as an input until pinmode has been called.

Analogue outputs

Any of the I/O pins can also be used as a PWM analogue output, using analogwrite with a value between 0 and 255.

Analogue inputs

The Maixduino Arduino core hasn't yet implemented the analogue inputs.

TFT display

The Maixduino board provides a connector for a 320x240 Colour LCD TFT display:

A new RISC-V version of uLisp

For information about the graphics extensions in RISC-V uLisp seeGraphics extensions.

The following program draws the above colour demo display:

(defun rgb (r g b)
  (logior (ash (logand r #xf8) 8) (ash (logand g #xfc) 3) (ash b -3)))

(defun plot ()
  (dotimes (xx 320)
    (let ((x (- xx 160)))
      (dotimes (yy 240)
        (let* ((y (- yy 120))
               (f (truncate (+ (* x (+ x y)) (* y y)) 8)))
          (draw-pixel xx yy (rgb (+ f 160) f (+ f 80))))))))
  1. Sipeed Maixduino for RISC-V AI + IoT on Seeed.
  2. Sipeed Maixduino RISC-V Development Board on Unmanned Tech.
  3. Apple USB-C Charge Cable on Amazon.
  4. USB-C Female to Type A USB 3.0 Male Adapter on Amazon.

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

谁排第一

谁排第一

Amy N. Langville、Carl D. Meyer / 郭斯羽 / 机械工业出版社 / 2014-6 / 49

《谁排第一?关于评价和排序的科学》是首个关于评分和排名科学的著作。它是搜索排序姊妹篇的第二本。本书主要内容有:排名概述、梅西法、科利法、基纳法、埃洛体系、马尔可夫法、攻防评分法、基于重新排序的排名方法、分差、用户偏好评分、处理平局、加入权重、“假如……会怎样”的问题与敏感性、排名聚合、比较排名的方法、数据等。 《谁排第一?关于评价和排序的科学》可作为数学、计算机、网络技术、管理学和数据科学等......一起来看看 《谁排第一》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

URL 编码/解码
URL 编码/解码

URL 编码/解码

MD5 加密
MD5 加密

MD5 加密工具