mirror of https://github.com/ARMmbed/mbed-os.git
Make stack sizes configurable by the app
Application can overwrite stack sizes by defining main-stack-size and thread-stack-size in mbed_app.jsonpull/4294/head
parent
abcae6f01e
commit
535ee8ba25
|
|
@ -178,10 +178,12 @@ WEAK void mbed_main(void);
|
|||
void pre_main (void);
|
||||
|
||||
osThreadAttr_t _main_thread_attr;
|
||||
/* The main stack size is hardcoded on purpose, so it's less tempting to change it per platform. As usually it's not
|
||||
* the correct solution to the problem and it makes mbed OS behave differently on different targets.
|
||||
*/
|
||||
MBED_ALIGN(8) char _main_stack[4096];
|
||||
|
||||
/** The main thread's stack size can be configured by the application, if not explicitly specified it'll default to 4K */
|
||||
#ifndef MBED_CONF_APP_MAIN_STACK_SIZE
|
||||
#define MBED_CONF_APP_MAIN_STACK_SIZE 4096
|
||||
#endif
|
||||
MBED_ALIGN(8) char _main_stack[MBED_CONF_APP_MAIN_STACK_SIZE];
|
||||
mbed_rtos_storage_thread_t _main_obj;
|
||||
|
||||
osMutexId_t singleton_mutex_id;
|
||||
|
|
|
|||
|
|
@ -24,14 +24,13 @@
|
|||
|
||||
#include "mbed_rtx.h"
|
||||
|
||||
#ifndef OS_STACK_SIZE
|
||||
#ifndef MBED_SMALL_TARGET
|
||||
#define OS_STACK_SIZE 4096
|
||||
#else
|
||||
#define OS_STACK_SIZE 2048
|
||||
#endif
|
||||
/** The thread's stack size can be configured by the application, if not explicitly specified it'll default to 4K */
|
||||
#ifndef MBED_CONF_APP_THREAD_STACK_SIZE
|
||||
#define MBED_CONF_APP_THREAD_STACK_SIZE 4096
|
||||
#endif
|
||||
|
||||
#define OS_STACK_SIZE MBED_CONF_APP_THREAD_STACK_SIZE
|
||||
|
||||
#define OS_TIMER_THREAD_STACK_SIZE 768
|
||||
#define OS_IDLE_THREAD_STACK_SIZE 256
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue