Coder Social home page Coder Social logo

skyformat99 / lua2rtt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from liu2guang/lua2rtt

0.0 2.0 0.0 0 B

The lua library (based on eLua-5.1.4) adapts rt-thread3.0 (support env online PKG). | lua库(基于elua -5.1.4版本)适配RT-Thread3.0(支持env online pkg).

License: MIT License

Python 0.20% C 97.73% C++ 2.07%

lua2rtt's Introduction

Lua on RT-Thread

简介

RT-Thread中的Lua修改自eLua的Lua-5.1.4版本。 采用gcc工具链时,Lua依赖于newlib库,采用keil时,Lua依赖于arm的标准c库。 启动lua的RAM占用情况 - 标准的lua 17.1904296875 KB - 优化的lua 5.01953125 KB 注:数据来自print(collectgarbage('count'))的输出 优化是指采用一个lua patch --- Lua Tiny RAM

使用

在RT-Thread的finsh中,调用lua()获得一个lua解释器。 在lua解释器中 - 可以调用lua标准库中的函数,如:print('hello, lua on rt-thread') - 可以执行脚本文件,如:dofile('/hello.lua') - 可以定义新的函数,如:function sinc(x) return math.sin(x)/x end - etc.

配置

1.通过在rtconfig.h中定义RT_USING_LUA加入lua组件
2.可以定义RT_LUA_OPTRAM减少RAM占用
3.可以定义RT_LUS_USE_EXLIBS而添加外部库,如arduino的常用函数封装为一个arduino库
3.更多的配置项可以在luaconf.h中找到

开发相关

- lua组件依赖于libc,需要在rtconfig.h中定义RT_USING_LIBC
- 开启编译器对C99的支持,如MDK中,在C/C++选项的Misc Controls输入框中添加--c99
- 使用gcc时,需要在链接脚本中定义_stext和_etext,.ordata*放在两者之间。用于判断数据是read-only和writable  
  使用keil时,需要在分散加载文件中把rodata放在ER_IROM1区
- 添加新的模块,参见exlibs/lexamplelib.c

目录说明

- lua:从eLua获得Lua-5.1.4版本代码
- exlibs:external libraries,外部库代码,如example库
- applications:Lua应用代码,如finsh中lua()
- test:测试代码

lua2rtt's People

Contributors

liu2guang avatar

Watchers

skyformat99 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.