- Los是一个c/c++语言编译型的虚拟机。它使用llvm/clang作为其前端,losld做后端对源代码进行编译,生成los指令文件。Los虚拟机是100%c语言编写的,其可运行在mcu与pc上。 los(核心)占rom 8Kb左右(mini)。 los提供统一的api接口,实现一次编写,到处运行的好处,提高代码可重复使用率。 Author's mailbox:lgtbp@126.com;QQ:708745662
- 具体请看
│ favicon.ico
│ license-en.md
│ license.md
│ Makefile -编译los.exe的makefile
│ readme.md
│
├─arch -los提供统一的api接口的现实
│
├─bin
│ as.exe
│ clang.exe -los编译器
│ los.exe -los解释器
│ losld.exe -los链接
│ losshell.exe -los的shell
│
├─eclipse-build-los --编译.los可运行eclipse项目
│
│─example --los example
│
├─inc -los提供统一的api接口的头文件
│
├─lib -clang的库文件
│
├─los -los运行的配置文件
│
├─los-mini -这文件是最小实现
│ los.c -los解释核心
│ los.h -los的头文件
│ main.c -los测试文件
│ test.c -los测试文件
├─los-code
│ los.c -los解释核心
│ los_fat_config.c -los的fat api
│ los_fat_config.h
│ los_t.h
│
├─losfat -los的fat文件
│
├─mf-build-los-app --编译.los可运行makefile项目
│
└─test-file -体验文件
los.exe
test_gpu.los
- 将bin文件添加到系统环境,进入los-mini文件夹内
- 执行clang编译:
clang -c test.c
与losld -o test test.o
,生成test.los文件,将test.los文件转换为test[]数组 - 在los-mini文件夹下,输入make命令,生成los.exe文件。运行观看结果
1.mini版本los,只有以下api:具体使用请看los.h文件内注释,以及参考test.c main.c
uint32_t los_quit(losc_t *lp);
void los_arg_clear(losc_t *lp);
uint32_t los_push_arg(losc_t *lp, uint32_t arg);
uint32_t los_call_addr(losc_t *lp, uint32_t addr);
void los_set_function(fun_os f);
uint32_t los_app_first(uint8_t *addr);
- 需要把los.h的内存管理函数实现
#define lpram_malloc malloc
#define lpram_free free
- 运行单个文件,请使用 xxx/los.exe xxx/xx.los的格式运行,或把los后缀的文件,拖到los.exe。
- 运行losfat中的文件可以直接双击los.exe,它会已losfat的文件作为跟目录
- 现提供1个方式
- 使用makefile
- 现提供2个方式-注意把bin文件夹加入系统变量
- 使用eclipse-build-los
- 在mf-build-los-app夹中使用使用make命令
-
不需要管理app功能的,请使用los_app_frist函数作为入口。如los_app_frist("c://test/test.los"),运行rom或ram中的los文件,请使用如los_app_frist("c://test/test@123456") 123456是los在rom或ram中的地址
-
在arch文件中复制一份los_api文件夹,把各文件的api实现。
-
los的库,在lib文件中
- Author's mailbox:lgtbp@126.com.
English Language
- Los is a c/c++-compiled virtual machine. It uses llvm/clang as its front end, and losld does the backend to compile the source code to generate the los directive file. The Los virtual machine is written in 100% c language and runs on mcu and pc. Los (core) accounts for about rom 8Kb (mini). Los provides a unified API interface to achieve the benefits of writing once, running everywhere, and improving code reusability. Author's mailbox: lgtbp@126.com.
- Specific Please See
│ favicon.ico
│ license-en.md
│ license.md
│ Makefile - compile los.exe makefile
│ readme.md
│
├─arch -los provides a unified api interface for reality
│
├─bin
│ as.exe
│ clang.exe -los compiler
│ los.exe -los interpreter
│ losld.exe -los link
│ losshell.exe -los shell
│
├─eclipse-build-los -- compile .los to run the eclipse project
│
├─inc -los provides a unified api interface header file
│
├─lib -clang library file
│
├─los -los running configuration file
│
├─los-mini - this file is the minimum implementation
│ los.c -los explains the core
│ los.h -los header file
│ main.c -los test file
│ test.c -los test file
├─los-code
│ los.c -los explains the core
│ los_fat_config.c -los fat api
│ los_fat_config.h
│ los_t.h
│
├─losfat-los fat file
│
├─mf-build-los-app -- compile .los to run the makefile project
│
└─test-file - experience file
Los.exe
Test_gpu.los
- Add the bin file to the system environment and enter the los-mini folder.
- Execute clang compilation:
clang -c test.c
Withlosld -o test test.o
, generate the test.los file and convert the test.los file to the test[] array. - In the los-mini folder, type the make command to generate the los.exe file. Run the viewing result
1.mini version los, only the following api: please see the comments in the los.h file for specific use, and refer to test.c main.c
Uint32_t los_quit(losc_t *lp);
Void los_arg_clear(losc_t *lp);
Uint32_t los_push_arg(losc_t *lp, uint32_t arg);
Uint32_t los_call_addr(losc_t *lp, uint32_t addr);
Void los_set_function(fun_os f);
Uint32_t los_app_first(uint8_t *addr);
- Need to implement the memory management function of los.h
#define lpram_malloc malloc
#define lpram_free free
- To run a single file, run it in xxx/los.exe xxx/xx.los format, or drag the s suffixed file to los.exe.
- Run the file in losfat and you can double-click los.exe directly, it will be the losfat file as the directory
- 1 way available now Use makefile
* Now provide 2 ways - pay attention to add bin folder to system variables 1. Use eclipse-build-los 2. Use the make command in the mf-build-los-app folder
-
If you don't need to manage the app function, please use the los_app_frist function as the entry. For example, los_app_frist("c://test/test.los"), run the los file in rom or ram, please use los_app_frist("c://test/test@123456") 123456 is los in rom or ram the address of
-
Copy a los_api folder in the archive file and implement the api for each file.
-
los library, in the lib file
- Author's mailbox:lgtbp@126.com.