-
Notifications
You must be signed in to change notification settings - Fork 3k
stack_size_unification test: set expected stack sizes from config #12979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -31,19 +31,11 @@ extern osThreadAttr_t _main_thread_attr; | |||||||||||
#endif | ||||||||||||
extern uint32_t mbed_stack_isr_size; | ||||||||||||
|
||||||||||||
#if !defined(MBED_CONF_RTOS_PRESENT) | ||||||||||||
#define EXPECTED_ISR_STACK_SIZE (4096) | ||||||||||||
#else | ||||||||||||
#define EXPECTED_ISR_STACK_SIZE (1024) | ||||||||||||
#endif | ||||||||||||
#define EXPECTED_ISR_STACK_SIZE (MBED_CONF_TARGET_BOOT_STACK_SIZE) | ||||||||||||
|
||||||||||||
#if defined(TARGET_NUCLEO_F070RB) || defined(TARGET_STM32F072RB) || defined(TARGET_TMPM46B) || defined(TARGET_TMPM066) | ||||||||||||
#define EXPECTED_MAIN_THREAD_STACK_SIZE (3072) | ||||||||||||
#else | ||||||||||||
#define EXPECTED_MAIN_THREAD_STACK_SIZE (4096) | ||||||||||||
#endif | ||||||||||||
#define EXPECTED_MAIN_THREAD_STACK_SIZE (MBED_CONF_RTOS_MAIN_THREAD_STACK_SIZE) | ||||||||||||
|
||||||||||||
#define EXPECTED_USER_THREAD_DEFAULT_STACK_SIZE (4096) | ||||||||||||
#define EXPECTED_USER_THREAD_DEFAULT_STACK_SIZE (MBED_CONF_RTOS_THREAD_STACK_SIZE) | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the test case below, we use this macro to verify
where mbed-os/rtos/source/TARGET_CORTEX/mbed_rtx_conf.h Lines 31 to 35 in 9a8c9e2
The trouble is, to get the assertion to pass in all scenarios, our expectation needs to be conditional in the same way. But isn't it a duplication? I'm not sure there's any value in comparing two macros in a Greentea test to begin with... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In my opinion, we should remove this assertion from the test case - which is out of this PR's initial scope (i.e. fixing line 34). But still this line of diff doesn't make things worse than before (i.e. hardcoded 4096). @0xc0170 If this PR blocks any release, maybe we can get it in as it is? |
||||||||||||
|
||||||||||||
#if ((MBED_RAM_SIZE - MBED_BOOT_STACK_SIZE) <= (EXPECTED_MAIN_THREAD_STACK_SIZE + EXPECTED_ISR_STACK_SIZE)) | ||||||||||||
#error [NOT_SUPPORTED] Insufficient stack for staci_size_unification tests | ||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,9 @@ | |
"STM32F072RB": { | ||
"main-thread-stack-size": 3072 | ||
}, | ||
"TMPM46B": { | ||
"main-thread-stack-size": 3072 | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need to specify this per target? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checking RAM size is ideal, and we do have The trouble is, we only have it defined for a few targets. For most other targets, the RAM and ROM sizes are hardcoded in the linker scripts (e.g. scatter files) - only the linker knows the RAM, not the application/libraries/... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, 17 targets have it defined: https://github.com/ARMmbed/mbed-os/blob/master/targets/targets.json There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree, thanks for clarifying it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Personally I'd like to see the sizes defined - it can help us to disable certain Greentea test cases for ultra-constrained targets for which we even struggle to compile some very basic tests... @evedon There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The best would be to generate the linker script (having set per toolchain and that is it) so having the size defined is one way forward there :) |
||
"NUVOTON": { | ||
"idle-thread-stack-size-debug-extra": 512 | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,10 +25,6 @@ | |
#ifndef INITIAL_SP | ||
#define INITIAL_SP (0x20080000UL) | ||
#endif | ||
#ifdef MBED_CONF_RTOS_MAIN_THREAD_STACK_SIZE | ||
#undef MBED_CONF_RTOS_MAIN_THREAD_STACK_SIZE | ||
#endif | ||
#define MBED_CONF_RTOS_MAIN_THREAD_STACK_SIZE 3072 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: This affects only TMPM46B - see a few lines above. |
||
|
||
#endif | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of NUCLEO_F070RB, STM32F072RB and TMPM46B have thread stack sizes overriden in rtos/source/TARGET_CORTEX/mbed_lib.json, so we don't need target-dependent code here. As for TARGET_TMPM066, it's not supported anymore).