diff --git a/components/esp_common/include/esp_expression_with_stack.h b/components/esp_common/include/esp_expression_with_stack.h index 4d337f3fd9..d23e7e833e 100644 --- a/components/esp_common/include/esp_expression_with_stack.h +++ b/components/esp_common/include/esp_expression_with_stack.h @@ -1,3 +1,17 @@ +// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + #ifndef __ESP_EXPRESSION_WITH_STACK_H #define __ESP_EXPRESSION_WITH_STACK_H diff --git a/components/xtensa/expression_with_stack_xtensa.S b/components/xtensa/expression_with_stack_xtensa.S index 78e30b9e49..fdac7fadae 100644 --- a/components/xtensa/expression_with_stack_xtensa.S +++ b/components/xtensa/expression_with_stack_xtensa.S @@ -1,5 +1,16 @@ -#include -#include +// Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. .text /** @@ -9,12 +20,17 @@ .type esp_switch_stack_enter,@function .align 4 esp_switch_stack_enter: - entry sp, 0x10 - mov a4, a1 - s32i a4, a3, 0 /* on a3 there is a safe place to save the current stack */ - l32i a4, a2, 0 /* obtains the user allocated stack buffer */ - mov a1, a4 /* sp register now contains caller specified stack */ - retw + + #ifndef __XTENSA_CALL0_ABI__ + entry sp, 0x10 + mov a4, a1 + s32i a4, a3, 0 /* on a3 there is a safe place to save the current stack */ + l32i a4, a2, 0 /* obtains the user allocated stack buffer */ + mov a1, a4 /* sp register now contains caller specified stack */ + retw + #else + #error "this code is written for Window ABI" + #endif /** * extern void switch_stack_exit(portSTACK_TYPE *backup_stack); @@ -23,7 +39,12 @@ esp_switch_stack_enter: .type esp_switch_stack_exit,@function .align 4 esp_switch_stack_exit: - entry sp, 0x10 - l32i a4, a2, 0 /* recover the original task stack */ - mov a1, a4 /* put it on sp register again */ - retw \ No newline at end of file + + #ifndef __XTENSA_CALL0_ABI__ + entry sp, 0x10 + l32i a4, a2, 0 /* recover the original task stack */ + mov a1, a4 /* put it on sp register again */ + retw + #else + #error "this code is written for Window ABI" + #endif