Make stacks smaller (#1055)

* remove factually incorrect comment

* shrinky stacky

* shuffle comments
This commit is contained in:
Matthew Kennedy 2019-12-13 13:47:26 -08:00 committed by rusefi
parent aa1b7e2c6b
commit 003c1c17f0
4 changed files with 17 additions and 18 deletions

View File

@ -44,12 +44,11 @@
*
*/
#define PORT_IDLE_THREAD_STACK_SIZE 64/*768*//*1024*/
#define PORT_IDLE_THREAD_STACK_SIZE 32
// rusEfi main processing happens on IRQ so PORT_INT_REQUIRED_STACK has to be pretty large.
// see also a strange comment about PORT_INT_REQUIRED_STACK in global_shared.h
// See global_shared.h notes about stack requirements
// see also http://www.chibios.org/dokuwiki/doku.php?id=chibios:kb:stacks
#define PORT_INT_REQUIRED_STACK 512/*768*/
#define PORT_INT_REQUIRED_STACK 128
#define CHPRINTF_USE_FLOAT TRUE

View File

@ -41,12 +41,11 @@
*
*/
#define PORT_IDLE_THREAD_STACK_SIZE 1024
#define PORT_IDLE_THREAD_STACK_SIZE 32
// rusEfi main processing happens on IRQ so PORT_INT_REQUIRED_STACK has to be pretty large.
// see also a strange comment about PORT_INT_REQUIRED_STACK in global_shared.h
// See global_shared.h notes about stack requirements
// see also http://www.chibios.org/dokuwiki/doku.php?id=chibios:kb:stacks
#define PORT_INT_REQUIRED_STACK 768
#define PORT_INT_REQUIRED_STACK 128
#define CHPRINTF_USE_FLOAT TRUE
@ -605,7 +604,7 @@
* tickless mode.
*/
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE
#define CH_DBG_THREADS_PROFILING TRUE
#endif
/** @} */

View File

@ -41,12 +41,11 @@
*
*/
#define PORT_IDLE_THREAD_STACK_SIZE 1024
#define PORT_IDLE_THREAD_STACK_SIZE 32
// rusEfi main processing happens on IRQ so PORT_INT_REQUIRED_STACK has to be pretty large.
// see also a strange comment about PORT_INT_REQUIRED_STACK in global_shared.h
// See global_shared.h notes about stack requirements
// see also http://www.chibios.org/dokuwiki/doku.php?id=chibios:kb:stacks
#define PORT_INT_REQUIRED_STACK 768
#define PORT_INT_REQUIRED_STACK 128
#define CHPRINTF_USE_FLOAT TRUE

View File

@ -13,11 +13,13 @@
/**
* The following obscurantism is a hack to reduce stack usage, maybe even a questionable performance
* optimization.
*
* rusEfi main processing happens on IRQ so PORT_INT_REQUIRED_STACK has to be pretty large. Problem
* is that PORT_INT_REQUIRED_STACK is included within each user thread stack, thus this large stack multiplies
* and this consumes a lot of valueable RAM. While forcing the compiler to inline helps to some degree,
* it would be even better not to waste stack on passing the parameter.
*
* Of note is that interrupts are NOT serviced on the stack of the thread that was running when the
* interrupt occurred. The only thing that happens on that thread's stack is that its registers are
* pushed (by hardware) when an interrupt occurs, just before swapping the stack pointer out for the
* main stack (currently 0x400=1024 bytes), where the ISR actually runs.
*
* see also http://www.chibios.org/dokuwiki/doku.php?id=chibios:kb:stacks
*
* In the firmware we are using 'extern *Engine' - in the firmware Engine is a signleton
*