A new RISC-V version of uLisp

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

内容简介: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.

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

查看所有标签

猜你喜欢:

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

新零售进化论

新零售进化论

陈欢、陈澄波 / 中信出版社 / 2018-7 / 49.00

本书主要介绍了新零售的进化现象和规律,提出了新零售的第一性原理是物理数据二重性,即在新零售时代,所有的人、货、场既是物理的也是数据的。 通过这个原点,进一步衍生出了新零售的八大核心算法,并用大量的辅助观点和新零售案例来揭示新零售背后的算法逻辑。 综合一系列的理论推演和案例讲解,作者重点回答了以下3个问题: ● 我们是行业的强者,如果跟不上新零售的潮流,会不会被淘汰? ● 我......一起来看看 《新零售进化论》 这本书的介绍吧!

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具