Merge pull request #15 from mysterywolf/test

[rt-thread] 接管内存分配,实现命令行启动pika方式(用于后续支持终端键入)
This commit is contained in:
Lyon 2021-12-09 09:00:56 +08:00 committed by GitHub
commit 6a196c66f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -11,6 +11,10 @@
#include <rtthread.h>
#include "pikaPlatform.h"
#ifndef RT_USING_HEAP
#error "Please enable heap in the RT-Thread configuration"
#endif
int __platform_sprintf(char* buff, char* fmt, ...) {
va_list args;
int res;
@ -25,3 +29,9 @@ int __platform_vsprintf(char* buff, char* fmt, va_list args){
int __platform_vsnprintf(char* buff, size_t size, const char* fmt, va_list args){
return rt_vsnprintf(buff, size, fmt, args);
}
void* __platform_malloc(size_t size) {
return rt_malloc(size);
}
void __platform_free(void* ptr) {
rt_free(ptr);
}

View File

@ -10,7 +10,7 @@
#include <rtthread.h>
#include <pikaScript.h>
#if 0
#define PIKASCRIPT_STACK_SIZE 4096
#define PIKASCRIPT_STACK_PRIO 20
@ -40,3 +40,12 @@ static int rt_pika_init(void)
}
INIT_APP_EXPORT(rt_pika_init);
#else
static int pika(int argc, char *argv[])
{
pikaScriptInit();
return 0;
}
MSH_CMD_EXPORT(pika, run pikascript);
#endif