shared_stack: fixed watchpoint placement on shared_stack
This commit is contained in:
parent
c5d05b5c4f
commit
33c9826372
2 changed files with 15 additions and 19 deletions
|
@ -19,7 +19,8 @@
|
||||||
StackType_t * esp_switch_stack_setup(StackType_t *stack, size_t stack_size)
|
StackType_t * esp_switch_stack_setup(StackType_t *stack, size_t stack_size)
|
||||||
{
|
{
|
||||||
#if CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK
|
#if CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK
|
||||||
int watchpoint_place = (((int)stack + 31) & ~31);
|
esp_clear_watchpoint(0);
|
||||||
|
uint32_t watchpoint_place = ((uint32_t)stack + 32) & 0x1f ;
|
||||||
#endif
|
#endif
|
||||||
StackType_t *top_of_stack = (StackType_t *)&stack[0] +
|
StackType_t *top_of_stack = (StackType_t *)&stack[0] +
|
||||||
((stack_size * sizeof(StackType_t)) / sizeof(StackType_t));
|
((stack_size * sizeof(StackType_t)) / sizeof(StackType_t));
|
||||||
|
@ -35,7 +36,7 @@ StackType_t * esp_switch_stack_setup(StackType_t *stack, size_t stack_size)
|
||||||
frame->a1 = (UBaseType_t)top_of_stack;
|
frame->a1 = (UBaseType_t)top_of_stack;
|
||||||
|
|
||||||
#if CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK
|
#if CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK
|
||||||
esp_set_watchpoint(2, (char*)watchpoint_place, 32, ESP_WATCHPOINT_STORE);
|
esp_set_watchpoint(0, (uint8_t *)watchpoint_place, 32, ESP_WATCHPOINT_STORE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return top_of_stack;
|
return top_of_stack;
|
||||||
|
|
|
@ -47,15 +47,10 @@ esp_switch_stack_exit:
|
||||||
#ifndef __XTENSA_CALL0_ABI__
|
#ifndef __XTENSA_CALL0_ABI__
|
||||||
entry sp, 0x10
|
entry sp, 0x10
|
||||||
|
|
||||||
#if CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK
|
|
||||||
movi a6, 2
|
|
||||||
movi a4, esp_clear_watchpoint
|
|
||||||
callx4 a4 /* clear the watchpoint before releasing stack */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
l32i a4, a2, 0 /* recover the original task stack */
|
l32i a4, a2, 0 /* recover the original task stack */
|
||||||
mov a1, a4 /* put it on sp register again */
|
mov a1, a4 /* put it on sp register again */
|
||||||
retw
|
retw
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#error "this code is written for Window ABI"
|
#error "this code is written for Window ABI"
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue