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.

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

查看所有标签

猜你喜欢:

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

深入浅出HTML与CSS、XHTML

深入浅出HTML与CSS、XHTML

[美] 弗里曼 Freeman.E. / 东南大学出版社 / 2006-5 / 98.00元

《深入浅出HTML与CSS XHTML》(影印版)能让你避免认为Web-safe颜色还是紧要问题的尴尬,以及不明智地把标记放入你的页面。最大的好处是,你将毫无睡意地学习HTML、XHTML 和CSS。如果你曾经读过深入浅出(Head First)系列图书中的任一本,就会知道书中展现的是什么:一个按人脑思维方式设计的丰富的可视化学习模式。《深入浅出HTML与CSS XHTML》(影印版)的编写采用了......一起来看看 《深入浅出HTML与CSS、XHTML》 这本书的介绍吧!

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具