mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 16:25:16 +03:00
Interrupt stack size reduced to 1kB, enabled painting and display of free interrupt stack space
This commit is contained in:
parent
785a814e68
commit
a5e8c85557
8 changed files with 40 additions and 14 deletions
|
@ -149,12 +149,14 @@ void menuStatisticsDebug(uint8_t event)
|
||||||
lcd_puts(lcdLastPos, MENU_DEBUG_Y_MIXMAX, "ms");
|
lcd_puts(lcdLastPos, MENU_DEBUG_Y_MIXMAX, "ms");
|
||||||
|
|
||||||
lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB);
|
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, "[M]", 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, "[X]", SMLSIZE);
|
||||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(1), UNSIGN|LEFT);
|
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(1), UNSIGN|LEFT);
|
||||||
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[Audio]", SMLSIZE);
|
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[A]", SMLSIZE);
|
||||||
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(2), UNSIGN|LEFT);
|
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(2), UNSIGN|LEFT);
|
||||||
|
lcd_putsAtt(lcdLastPos+2, MENU_DEBUG_Y_RTOS+1, "[I]", SMLSIZE);
|
||||||
|
lcd_outdezAtt(lcdLastPos, MENU_DEBUG_Y_RTOS, stack_free(255), UNSIGN|LEFT);
|
||||||
|
|
||||||
lcd_puts(3*FW, 7*FH+1, STR_MENUTORESET);
|
lcd_puts(3*FW, 7*FH+1, STR_MENUTORESET);
|
||||||
lcd_status_line();
|
lcd_status_line();
|
||||||
|
|
|
@ -720,7 +720,7 @@ extern uint8_t flightModeTransitionLast;
|
||||||
extern int _end;
|
extern int _end;
|
||||||
extern int _estack;
|
extern int _estack;
|
||||||
extern int _main_stack_start;
|
extern int _main_stack_start;
|
||||||
#define getAvailableMemory() ((unsigned int)((unsigned char *)&_estack - heap))
|
#define getAvailableMemory() ((unsigned int)((unsigned char *)&_main_stack_start - heap))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms);
|
void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms);
|
||||||
|
@ -940,6 +940,7 @@ extern uint16_t lastMixerDuration;
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
uint32_t stack_free(uint32_t tid);
|
uint32_t stack_free(uint32_t tid);
|
||||||
|
void stack_paint();
|
||||||
#else
|
#else
|
||||||
uint16_t stack_free();
|
uint16_t stack_free();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -313,6 +313,8 @@ void *main_thread(void *)
|
||||||
try {
|
try {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
stack_paint();
|
||||||
|
|
||||||
s_current_protocol[0] = 255;
|
s_current_protocol[0] = 255;
|
||||||
|
|
||||||
g_menuStackPtr = 0;
|
g_menuStackPtr = 0;
|
||||||
|
|
|
@ -53,10 +53,8 @@
|
||||||
|
|
||||||
#undef errno
|
#undef errno
|
||||||
extern int errno;
|
extern int errno;
|
||||||
extern int _end;
|
extern int _end;
|
||||||
extern int _estack;
|
extern int _main_stack_start;
|
||||||
|
|
||||||
#define RAM_END (unsigned char *)&_estack
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------
|
/*----------------------------------------------------------------------------
|
||||||
* Exported functions
|
* Exported functions
|
||||||
|
@ -68,7 +66,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 < RAM_END-4096) {
|
if (heap + nbytes < (unsigned char *)&_main_stack_start) {
|
||||||
unsigned char *prev_heap = heap;
|
unsigned char *prev_heap = heap;
|
||||||
heap += nbytes;
|
heap += nbytes;
|
||||||
return (caddr_t) prev_heap;
|
return (caddr_t) prev_heap;
|
||||||
|
|
|
@ -98,10 +98,23 @@ 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 */
|
/* Call C++ constructors for static objects */
|
||||||
bl __libc_init_array
|
bl __libc_init_array
|
||||||
|
|
||||||
/* Call the application's entry point.*/
|
/* Call the application's entry point.*/
|
||||||
bl main
|
bl main
|
||||||
bx lr
|
bx lr
|
||||||
|
|
|
@ -37,7 +37,10 @@ _estack = 0x20020000; /* end of 128K SRAM */
|
||||||
|
|
||||||
/* 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 */
|
||||||
_Min_Stack_Size = 0x200; /* required amount of stack */
|
_Main_Stack_Size = 1024; /* required amount of stack for interrupt stack (Main stack) */
|
||||||
|
|
||||||
|
/*Main stack end*/
|
||||||
|
_main_stack_start = _estack - _Main_Stack_Size;
|
||||||
|
|
||||||
/* Specify the memory areas */
|
/* Specify the memory areas */
|
||||||
MEMORY
|
MEMORY
|
||||||
|
@ -150,7 +153,7 @@ SECTIONS
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
. = . + _Min_Heap_Size;
|
. = . + _Min_Heap_Size;
|
||||||
. = . + _Min_Stack_Size;
|
. = . + _Main_Stack_Size;
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} >RAM
|
} >RAM
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,10 @@ _estack = 0x20020000; /* end of 128K SRAM */
|
||||||
|
|
||||||
/* 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 */
|
||||||
_Min_Stack_Size = 0x200; /* required amount of stack */
|
_Main_Stack_Size = 1024; /* required amount of stack for interrupt stack (Main stack) */
|
||||||
|
|
||||||
|
/*Main stack end*/
|
||||||
|
_main_stack_start = _estack - _Main_Stack_Size;
|
||||||
|
|
||||||
/* Specify the memory areas */
|
/* Specify the memory areas */
|
||||||
MEMORY
|
MEMORY
|
||||||
|
@ -129,7 +132,7 @@ SECTIONS
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
. = . + _Min_Heap_Size;
|
. = . + _Min_Heap_Size;
|
||||||
. = . + _Min_Stack_Size;
|
. = . + _Main_Stack_Size;
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} >RAM
|
} >RAM
|
||||||
|
|
||||||
|
|
|
@ -99,11 +99,15 @@ uint32_t stack_free(uint32_t tid)
|
||||||
stack = audioStack;
|
stack = audioStack;
|
||||||
size = AUDIO_STACK_SIZE;
|
size = AUDIO_STACK_SIZE;
|
||||||
break;
|
break;
|
||||||
#if 0 // defined(PCBTARANIS) && !defined(SIMU)
|
#if defined(PCBTARANIS)
|
||||||
case 255:
|
case 255:
|
||||||
|
#if defined(SIMU)
|
||||||
|
return 1024;
|
||||||
|
#else
|
||||||
// main stack
|
// main stack
|
||||||
stack = (OS_STK *)&_main_stack_start;
|
stack = (OS_STK *)&_main_stack_start;
|
||||||
size = ((unsigned char *)&_estack - (unsigned char *)&_main_stack_start) / 4;
|
size = ((unsigned char *)&_estack - (unsigned char *)&_main_stack_start) / 4;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue