Development Tip

작은 메모리에서 실행되는 사용 가능한 대화 형 언어는 무엇입니까?

yourdevel 2020. 10. 27. 23:36
반응형

작은 메모리에서 실행되는 사용 가능한 대화 형 언어는 무엇입니까?


범용 프로그래밍 언어를 찾고 있습니다.

  • 대화 형 (라이브 코딩) 프롬프트
  • 32KB RAM 자체 또는 컴파일러가 별도의 시스템에서 호스팅되는 경우 8KB에서 작업
  • 총 8-32KB RAM (MMU없이)의 마이크로 컨트롤러에서 실행됩니다.

아래는 지금까지 내 목록입니다. 무엇을 놓치고 있습니까?

  • Python : PyMite VM에는 64K 플래시, 8K RAM이 필요합니다. 8K 이상의 LPC, SAM7 및 ATmega를 대상으로합니다. 호스팅.
  • Lua : eLua FAQ는 256K 플래시, 64K RAM을 권장합니다.
  • FORTH : amforth 는 ATmega에 8K 플래시, 150 바이트 RAM, 30 바이트 EEPROM이 필요합니다.
  • 구성표 : 겨드랑이 구성표 가장 작은 목표는 32K 플래시, 4K SRAM이있는 LPC2103입니다.
  • C : 인터랙티브 C 는 플래시 및 32K SRAM없이 68HC11에서 실행됩니다. 호스팅.
  • C : picoc 오픈 소스, 크로스 컴파일, 인터랙티브 C 시스템. AVR 용으로 컴파일하면 63K 플래시, 8K RAM이 필요합니다. 테이블을 플래시로 유지하려는 노력으로 RAM을 줄일 수 있습니다.
  • C ++ : AngelScript 는 오픈 소스, 바이트 코드 기반의 C / C ++와 같은 스크립트 언어로 간편한 네이티브 호출을 지원합니다.
  • Tcl : TinyTCL 은 DOS, 60K 바이너리에서 실행됩니다. 이식하기 쉬운 것 같습니다.
  • BASIC : TinyBasic : 64K 힙으로 초기화되며 조정 가능할 수 있습니다.
  • Lisp
  • PostScript : (아직 메모리 부족에 대한 FOSS 구현을 찾지 못했습니다)
  • Shell : bitlash : Arduino (ATmega) 용 대화 형 명령 셸입니다. AVRSH를 참조하십시오 .

홈브류 Forth 런타임은 실제로 매우 적은 메모리로 구현할 수 있습니다. 나는 1970 년대에 Cosmac에서 하나를 만든 사람을 알고 있습니다. 핵심 런타임은 30 바이트 에 불과했습니다 .


CHIP-8, XPL0, PicoC 및 Objective Caml이 그래프 계산기로 이식되었다고 들었습니다. Wikipedia "Lego Mindstorms"기사에는 Lego RCX 또는 Lego NXT 플랫폼에서 실행되는 것으로 추정되는 여러 프로그래밍 언어가 나열되어 있습니다. 그들 중 어떤 것이 당신의 "라이브 코딩"기준을 충족합니까?

Forth wiki에서 다른 마이크로 컨트롤러 Forths를 확인하고 싶을 수도 있습니다. Atmel AVR에 대해 최소 4 개의 Forth를 나열합니다 : amforth (이미 언급 했음), PFAVR, avrforth 및 ByteForth.
(해당 인터프리터에 대한 링크와이 StackOverflow 질문은 " Embedded Systems "위키 북에 포함되어 있습니다.)


LUA (또는 eLUA http://www.eluaproject.net/ )를 추천합니다. 저는 LUA를 Cortex-M3로 "포팅"했습니다. 내 머리 꼭대기에서 플래시 크기가 60 ~ 100KB 였고 실행하려면 약 20KB RAM이 필요했습니다. 필자는 필수 요소를 제거했지만 애플리케이션에 따라 충분할 수 있습니다. 특히 RAM 요구 사항에 대한 최적화의 여지는 여전히 있지만 8KB에서 편안하게 실행할 수 있을지 의심됩니다.


일부 AVR 인터프리터 / VM :

  1. http://www.cqham.ru/tbcgroup/index_eng.htm
  2. http://www.jcwolfram.de/projekte/avr/chipbasic2/main.php
  3. http://www.jcwolfram.de/projekte/avr/chipbasic8/main.php
  4. http://www.jcwolfram.de/projekte/avr/main.php
  5. http://code.google.com/p/python-on-a-chip/
  6. http://www.avrfreaks.net/index.php?module=Freaks%20Academy&func=viewItem&item_id=688&item_type=project
  7. http://www.avrfreaks.net/index.php?module=Freaks%20Academy&func=viewItem&item_id=626&item_type=project
  8. http://www.avrfreaks.net/index.php?module=Freaks%20Academy&func=viewItem&item_id=460&item_type=project
  9. http://www.harbaum.org/till/nanovm/index.shtml

Wren 은 기준에 적합합니다. 기본적으로 4k RAM 만 사용하도록 구성되어 있습니다. AFAIK 내가 쓴 사람은 결국 대상 시스템에서 완전히 실행되는 인터프리터가 필요하지 않다고 결정했기 때문에 실제 사용을 보지 못했습니다.

언어는 ML과 Forth의 영향을 가장 많이받습니다.


당신은 생각 해 봤나 C의 포트작은 기본 ? 아니면 UCSD Pascal p-machine을 Z-80의 아키텍처로 다시 작성 하시겠습니까?

진지하게도 JavaScript는 좋은 임베디드 스크립팅 언어를 만들 수 있지만 VM + GC에 대한 최소 메모리 요구 사항이 무엇인지, OS 종속성을 제거하는 것이 얼마나 어려운지 전혀 모릅니다. 나는 NJS오래전에 놀았 는데, 아마도 당신의 필요에 맞을 수 있습니다. 이것은 컴파일러가 자바 스크립트 (자체 호스팅)로 작성되었다는 점에서 흥미 롭습니다.


매우 강력한 AVR 용 AvrCo 멀티 태스킹 Pascal을 살펴볼 수 있습니다. http://www.e-lab.de 에서 시도해 볼 수 있습니다 . MEGA8 / 88 버전은 무료입니다. JTAG 디버거가있는 수많은 드라이버와 시뮬레이터가 있으며 모든 표준 장치 (LCDCHAR, LCDGRAPH, 7SEG, 14SEG, LEDDOT, KEYBOARD, RC5, SERVO, STEPPER ...)의 멋진 라이브 또는 시뮬레이션 시각화가 있습니다.


당신은 EmbedVM, 홈페이지 놓치고있어 여기 , svn의 REPO 여기를 . 첫 페이지에서 [ 1 , 2 ] 비디오를 모두 확인 하십시오;)

홈페이지에서 :

EmbedVM은 C와 유사한 언어 프런트 엔드를 사용하는 마이크로 컨트롤러 용 내장형 소형 가상 머신입니다. GCC 및 AVR 마이크로 컨트롤러로 테스트되었습니다. 그러나 가상 머신은 다소 단순하므로 다른 아키텍처로 쉽게 이식 할 수 있습니다.

VM은 최대 64kB의 메모리에 액세스 할 수있는 16 비트 CPU를 시뮬레이션합니다. 16 비트 값과 16 비트 및 8 비트 값의 배열에서만 작동 할 수 있습니다. 복잡한 데이터 구조 (구조, 객체 등)에 대한 지원이 없습니다. 함수는 최대 32 개의 지역 변수와 32 개의 인수를 가질 수 있습니다.

VM을위한 메모리, VM 상태를 유지하는 작은 구조, 스택에서 EmbedVM 기능에 필요한 적절한 양의 메모리 외에 VM에 대한 추가 메모리 요구 사항이 없습니다. 특히 VM은 동적 메모리 관리에 의존하지 않습니다.

EmbedVM은 실행 속도가 아닌 크기와 단순성에 최적화되어 있습니다. VM 자체는 AVR 마이크로 컨트롤러에서 약 3kB의 프로그램 메모리를 차지합니다. 16MHz로 실행되는 AVR ATmega168에서 VM은 밀리 초당 약 75 개의 VM 명령을 실행할 수 있습니다.

VM이 수행하는 모든 메모리 액세스는 사용자 콜백 함수를 사용하여 구문 분석됩니다. 따라서 외부 메모리 장치, 플래시 메모리 등에 VM 메모리의 일부 또는 전체를 갖거나 VM에 대한 "메모리 맵"하드웨어 기능을 가질 수 있습니다.

The compiler is a UNIX/Linux commandline tool that reads in a *.evm file and generates bytecode in vaious formats (binary file, intel hex, C array initializers and a special debug output format). It also generates a symbol file that can be used to access data in the VM memory from the host application.

The C-like language looks like this: http://svn.clifford.at/embedvm/trunk/examples/numberquizz/vmcode.evm


I would recommend MY-BASIC, runs with in minimum 8 KB RAM, and easy to port.


There's also JavaScript, via Espruino.

This is built specifically for Microcontrollers and there are builds for various different chips (mainly STM32s) that fit a full system into as little as 8kB RAM.


Have you considered simply using the /bin/sh supplied by busybox? Or on of the smaller scripting languages they recommend?


Prolog - http://www.gprolog.org/

According to a google search "prolog small" the size of the executable can be made quite small by avoiding linking the built-in predicates.


I would suggest use python. But now the only problem is the memory overhead right? So I have great idea for people who may be stuck in this problem later on.

First thing's first, write a bf interpreter(or just get source code from somewhere). The interpreter will be really small. Also bf is a Turing complete language. Now you need to write your code in python and then transpiler it to bf using bfpy( https://github.com/felko/bfpy/blob/master/README.md ). I've given you the solution with the least overhead and I am pretty sure a bf interpreter will easily stay under 10KB of ram usage.


None of the languages in the list in the question or in the answers proved satisfactory for the requirement of super easy compilation and integration into an existing micro controller project (disclosure: I didn't actually try every single one of the suggestions).

I found instead tinyscript which is a single .c+.h file that compiled with the rest of the source files on my project with the only additional configuration required being to provide a void outchar(int c) which can be empty if you don't require output from the scripts.

For me speed of execution is far less important than ease of build and integration and interop with C, as my use case is mainly just calling some C functions in order.


I have been using in my previous work busybox on a BlackFin.

we compiled perl + php for it, after changing s/fork/vfork/g it worked pretty good... more or less. Not having an MMU is not a good idea. The memory fragmentation will kill the server pretty easily. All I did was:

for i in `seq 1 100`; do wget http://black-fin-ip/test.php; done

It died while I was walking to my boss and telling him that the server is going to die in production :)


Erlang - http://erlang.org/

it can fit in 2MB

http://www.experts123.com/q/is-erlang-small-enough-for-embedded-systems.html

참고URL : https://stackoverflow.com/questions/1082751/what-are-the-available-interactive-languages-that-run-in-tiny-memory

반응형