mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 16:25:16 +03:00
Revert some last changes so that there is no problem with Lua
Conflicts: radio/src/Makefile radio/src/opentx.cpp
This commit is contained in:
parent
47499e9e7d
commit
871e9f0be3
8 changed files with 28 additions and 52 deletions
|
@ -289,10 +289,6 @@ USB = JOYSTICK
|
||||||
# NO - normal behaviour, show real channel values
|
# NO - normal behaviour, show real channel values
|
||||||
CHANNELS_MONITOR_INV_HIDE = NO
|
CHANNELS_MONITOR_INV_HIDE = NO
|
||||||
|
|
||||||
# Use newlib-nano
|
|
||||||
# Values = NO, YES
|
|
||||||
NANO = YES
|
|
||||||
|
|
||||||
#------- END BUILD OPTIONS ---------------------------
|
#------- END BUILD OPTIONS ---------------------------
|
||||||
|
|
||||||
# Define programs and commands.
|
# Define programs and commands.
|
||||||
|
@ -722,12 +718,6 @@ ifeq ($(PCB), TARANIS)
|
||||||
EXTRABOARDSRC += targets/taranis/usbd_storage_msd.cpp
|
EXTRABOARDSRC += targets/taranis/usbd_storage_msd.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(NANO), YES)
|
|
||||||
# use newlib-nano for linking
|
|
||||||
NEWLIB_NANO_FLAGS = --specs=nano.specs -u _printf_float
|
|
||||||
CPPDEFS += -DNANO
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($(LUA), NO)
|
ifneq ($(LUA), NO)
|
||||||
ifeq ($(LUA), YES)
|
ifeq ($(LUA), YES)
|
||||||
CPPDEFS += -DLUA_MODEL_SCRIPTS
|
CPPDEFS += -DLUA_MODEL_SCRIPTS
|
||||||
|
@ -738,7 +728,6 @@ ifeq ($(PCB), TARANIS)
|
||||||
LUASRC = lua/src/lapi.c lua/src/lcode.c lua/src/lctype.c lua/src/ldebug.c lua/src/ldo.c lua/src/ldump.c lua/src/lfunc.c lua/src/lgc.c lua/src/llex.c lua/src/lmem.c \
|
LUASRC = lua/src/lapi.c lua/src/lcode.c lua/src/lctype.c lua/src/ldebug.c lua/src/ldo.c lua/src/ldump.c lua/src/lfunc.c lua/src/lgc.c lua/src/llex.c lua/src/lmem.c \
|
||||||
lua/src/lobject.c lua/src/lopcodes.c lua/src/lparser.c lua/src/lstate.c lua/src/lstring.c lua/src/ltable.c lua/src/ltm.c lua/src/lundump.c lua/src/lvm.c lua/src/lzio.c \
|
lua/src/lobject.c lua/src/lopcodes.c lua/src/lparser.c lua/src/lstate.c lua/src/lstring.c lua/src/ltable.c lua/src/ltm.c lua/src/lundump.c lua/src/lvm.c lua/src/lzio.c \
|
||||||
lua/src/lbaselib.c lua/src/linit.c lua/src/lmathlib.c lua/src/loadlib.c lua/src/lauxlib.c lua/src/ltablib.c lua/src/lcorolib.c lua/src/lbitlib.c
|
lua/src/lbaselib.c lua/src/linit.c lua/src/lmathlib.c lua/src/loadlib.c lua/src/lauxlib.c lua/src/ltablib.c lua/src/lcorolib.c lua/src/lbitlib.c
|
||||||
# lua/src/loslib.c lua/src/lstrlib.c lua/src/liolib.c lua/src/ldblib.c
|
|
||||||
SRC += $(LUASRC)
|
SRC += $(LUASRC)
|
||||||
LUADEP = lua_exports.cpp
|
LUADEP = lua_exports.cpp
|
||||||
endif
|
endif
|
||||||
|
@ -1400,7 +1389,7 @@ OBJS = $(TMP:.s=.o)
|
||||||
@echo
|
@echo
|
||||||
@echo $(MSG_COMPILING) $@
|
@echo $(MSG_COMPILING) $@
|
||||||
$(CC) $(ARMCPPFLAGS) $< -o allsrc.o
|
$(CC) $(ARMCPPFLAGS) $< -o allsrc.o
|
||||||
$(CC) $(OBJS) allsrc.o -mcpu=cortex-m3 -mthumb -nostartfiles -lm -T$(LDSCRIPT) -Wl,-Map=$(TARGET).map,--cref,--no-warn-mismatch,--gc-sections $(NEWLIB_NANO_FLAGS) -o $@
|
$(CC) $(OBJS) allsrc.o -mcpu=cortex-m3 -mthumb -nostartfiles -lm -T$(LDSCRIPT) -Wl,-Map=$(TARGET).map,--cref,--no-warn-mismatch,--gc-sections -o $@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Target: clean project.
|
# Target: clean project.
|
||||||
|
|
|
@ -215,13 +215,14 @@ void menuStatisticsDebug(uint8_t event)
|
||||||
lcd_puts(lcdLastPos, MENU_DEBUG_Y_MIXMAX, "ms");
|
lcd_puts(lcdLastPos, MENU_DEBUG_Y_MIXMAX, "ms");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if 0
|
||||||
lcd_putsLeft(MENU_DEBUG_Y_STACK, STR_FREESTACKMINB);
|
lcd_putsLeft(MENU_DEBUG_Y_STACK, STR_FREESTACKMINB);
|
||||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_STACK, stack_free(255), UNSIGN|LEFT);
|
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_STACK, stack_free(255), UNSIGN|LEFT);
|
||||||
lcd_puts(lcdLastPos, MENU_DEBUG_Y_STACK, "b");
|
lcd_puts(lcdLastPos, MENU_DEBUG_Y_STACK, "b");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
|
lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB);
|
||||||
lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+1, "[Main]", SMLSIZE);
|
lcd_putsAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+1, "[Main]", SMLSIZE);
|
||||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(0), UNSIGN|LEFT);
|
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(0), UNSIGN|LEFT);
|
||||||
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[Mix]", SMLSIZE);
|
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[Mix]", SMLSIZE);
|
||||||
|
|
|
@ -1796,6 +1796,7 @@ void luaDoOneRunStandalone(uint8_t evt)
|
||||||
TRACE("Script finished with status %d", scriptResult);
|
TRACE("Script finished with status %d", scriptResult);
|
||||||
standaloneScript.state = SCRIPT_NOFILE;
|
standaloneScript.state = SCRIPT_NOFILE;
|
||||||
luaState = INTERPRETER_RELOAD_PERMANENT_SCRIPTS;
|
luaState = INTERPRETER_RELOAD_PERMANENT_SCRIPTS;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (luaDisplayStatistics) {
|
else if (luaDisplayStatistics) {
|
||||||
lcd_hline(0, 7*FH-1, lcdLastPos+FW, ERASE);
|
lcd_hline(0, 7*FH-1, lcdLastPos+FW, ERASE);
|
||||||
|
@ -1919,22 +1920,24 @@ void luaDoOneRunPermanentScript(uint8_t evt, int i)
|
||||||
|
|
||||||
void luaDoGc()
|
void luaDoGc()
|
||||||
{
|
{
|
||||||
PROTECT_LUA() {
|
if (L) {
|
||||||
lua_gc(L, LUA_GCSTEP /*LUA_GCCOLLECT*/, 0); // LUA_GCSTEP is enough
|
PROTECT_LUA() {
|
||||||
|
lua_gc(L, LUA_GCSTEP /*LUA_GCCOLLECT*/, 0); // LUA_GCSTEP is enough
|
||||||
#if defined(SIMU) || defined(DEBUG)
|
#if defined(SIMU) || defined(DEBUG)
|
||||||
static int lastgc = 0;
|
static int lastgc = 0;
|
||||||
int gc = luaGetMemUsed();
|
int gc = luaGetMemUsed();
|
||||||
if (gc != lastgc) {
|
if (gc != lastgc) {
|
||||||
lastgc = gc;
|
lastgc = gc;
|
||||||
TRACE("GC Use: %dbytes", gc);
|
TRACE("GC Use: %dbytes", gc);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// we disable Lua for the rest of the session
|
||||||
|
luaDisable();
|
||||||
|
}
|
||||||
|
UNPROTECT_LUA();
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
// we disable Lua for the rest of the session
|
|
||||||
luaDisable();
|
|
||||||
}
|
|
||||||
UNPROTECT_LUA();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void luaTask(uint8_t evt)
|
void luaTask(uint8_t evt)
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "debug.h"
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
* Exported variables
|
* Exported variables
|
||||||
|
@ -54,8 +53,10 @@
|
||||||
|
|
||||||
#undef errno
|
#undef errno
|
||||||
extern int errno;
|
extern int errno;
|
||||||
extern int _end;
|
extern int _end;
|
||||||
extern int _main_stack_start;
|
extern int _estack;
|
||||||
|
|
||||||
|
#define RAM_END (unsigned char *)&_estack
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
* Exported functions
|
* Exported functions
|
||||||
|
@ -67,7 +68,7 @@ extern int _getpid ( void ) ;
|
||||||
unsigned char *heap = (unsigned char *)&_end;
|
unsigned char *heap = (unsigned char *)&_end;
|
||||||
extern caddr_t _sbrk(int nbytes)
|
extern caddr_t _sbrk(int nbytes)
|
||||||
{
|
{
|
||||||
if (heap + nbytes < (unsigned char *)&_main_stack_start) {
|
if (heap + nbytes < RAM_END-4096) {
|
||||||
unsigned char *prev_heap = heap;
|
unsigned char *prev_heap = heap;
|
||||||
heap += nbytes;
|
heap += nbytes;
|
||||||
return (caddr_t) prev_heap;
|
return (caddr_t) prev_heap;
|
||||||
|
@ -141,8 +142,9 @@ extern int _write( int file, char *ptr, int len )
|
||||||
|
|
||||||
extern void _exit( int status )
|
extern void _exit( int status )
|
||||||
{
|
{
|
||||||
TRACE( "Exiting with status %d.\n", status ) ;
|
#if defined(SIMU)
|
||||||
|
printf( "Exiting with status %d.\n", status ) ;
|
||||||
|
#endif
|
||||||
for ( ; ; ) ;
|
for ( ; ; ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,23 +98,8 @@ LoopFillZerobss:
|
||||||
ldr r3, = _ebss
|
ldr r3, = _ebss
|
||||||
cmp r2, r3
|
cmp r2, r3
|
||||||
bcc FillZerobss
|
bcc FillZerobss
|
||||||
|
|
||||||
/*Paint Main Stack */
|
|
||||||
ldr r2, = _main_stack_start
|
|
||||||
PaintMainStack:
|
|
||||||
movs r3, #0x55555555
|
|
||||||
str r3, [r2], #4
|
|
||||||
LoopPaintMainStack:
|
|
||||||
ldr r3, = _estack
|
|
||||||
cmp r2, r3
|
|
||||||
bcc PaintMainStack
|
|
||||||
|
|
||||||
/* Call the clock system intitialization function.*/
|
/* Call the clock system intitialization function.*/
|
||||||
bl SystemInit
|
bl SystemInit
|
||||||
|
|
||||||
/* Call C++ constructors for static objects */
|
|
||||||
bl __libc_init_array
|
|
||||||
|
|
||||||
/* Call the application's entry point.*/
|
/* Call the application's entry point.*/
|
||||||
bl main
|
bl main
|
||||||
bx lr
|
bx lr
|
||||||
|
|
|
@ -34,8 +34,6 @@ ENTRY(Reset_Handler)
|
||||||
|
|
||||||
/* Highest address of the user mode stack */
|
/* Highest address of the user mode stack */
|
||||||
_estack = 0x20020000; /* end of 128K SRAM */
|
_estack = 0x20020000; /* end of 128K SRAM */
|
||||||
_main_stack_size = 0x1000; /*size of main stack*/
|
|
||||||
_main_stack_start = _estack - _main_stack_size;
|
|
||||||
|
|
||||||
/* Generate a link error if heap and stack don't fit into RAM */
|
/* Generate a link error if heap and stack don't fit into RAM */
|
||||||
_Min_Heap_Size = 0; /* required amount of heap */
|
_Min_Heap_Size = 0; /* required amount of heap */
|
||||||
|
|
|
@ -21,8 +21,6 @@ ENTRY(Reset_Handler)
|
||||||
|
|
||||||
/* Highest address of the user mode stack */
|
/* Highest address of the user mode stack */
|
||||||
_estack = 0x20020000; /* end of 128K SRAM */
|
_estack = 0x20020000; /* end of 128K SRAM */
|
||||||
_main_stack_size = 0x1000; /*size of main stack*/
|
|
||||||
_main_stack_start = _estack - _main_stack_size;
|
|
||||||
|
|
||||||
/* Generate a link error if heap and stack don't fit into RAM */
|
/* Generate a link error if heap and stack don't fit into RAM */
|
||||||
_Min_Heap_Size = 0; /* required amount of heap */
|
_Min_Heap_Size = 0; /* required amount of heap */
|
||||||
|
|
|
@ -99,7 +99,7 @@ uint32_t stack_free(uint32_t tid)
|
||||||
stack = audioStack;
|
stack = audioStack;
|
||||||
size = AUDIO_STACK_SIZE;
|
size = AUDIO_STACK_SIZE;
|
||||||
break;
|
break;
|
||||||
#if defined(PCBTARANIS) && !defined(SIMU)
|
#if 0 // defined(PCBTARANIS) && !defined(SIMU)
|
||||||
case 255:
|
case 255:
|
||||||
// main stack
|
// main stack
|
||||||
stack = (OS_STK *)&_main_stack_start;
|
stack = (OS_STK *)&_main_stack_start;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue