diff --git a/components/riscv/include/riscv/rvruntime-frames.h b/components/riscv/include/riscv/rvruntime-frames.h index 1ef8934f14..4a53320b29 100644 --- a/components/riscv/include/riscv/rvruntime-frames.h +++ b/components/riscv/include/riscv/rvruntime-frames.h @@ -1,16 +1,8 @@ -// Copyright 2015-2020 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. +/* + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef __RVRUNTIME_FRAMES_H__ #define __RVRUNTIME_FRAMES_H__ @@ -26,10 +18,18 @@ #endif #if defined(_ASMLANGUAGE) || defined(__ASSEMBLER__) +#ifdef __clang__ +#define STRUCT_BEGIN .set RV_STRUCT_OFFSET, 0 +#define STRUCT_FIELD(ctype,size,asname,name) .set asname, RV_STRUCT_OFFSET; .set RV_STRUCT_OFFSET, asname + size +#define STRUCT_AFIELD(ctype,size,asname,name,n) .set asname, RV_STRUCT_OFFSET;\ + .set RV_STRUCT_OFFSET, asname + (size)*(n); +#define STRUCT_END(sname) .set sname##Size, RV_STRUCT_OFFSET; +#else // __clang__ #define STRUCT_BEGIN .pushsection .text; .struct 0 #define STRUCT_FIELD(ctype,size,asname,name) asname: .space size #define STRUCT_AFIELD(ctype,size,asname,name,n) asname: .space (size)*(n) #define STRUCT_END(sname) sname##Size:; .popsection +#endif // __clang__ #else #define STRUCT_BEGIN typedef struct { #define STRUCT_FIELD(ctype,size,asname,name) ctype name; diff --git a/components/riscv/vectors.S b/components/riscv/vectors.S index 56d0a2c85f..4fdc951126 100644 --- a/components/riscv/vectors.S +++ b/components/riscv/vectors.S @@ -238,14 +238,14 @@ _interrupt_handler: csrr s2, mstatus /* Save the interrupt threshold level */ - la t0, INTERRUPT_CORE0_CPU_INT_THRESH_REG + li t0, INTERRUPT_CORE0_CPU_INT_THRESH_REG lw s3, 0(t0) /* Increase interrupt threshold level */ li t2, 0x7fffffff and t1, s1, t2 /* t1 = mcause & mask */ slli t1, t1, 2 /* t1 = mcause * 4 */ - la t2, INTC_INT_PRIO_REG(0) + li t2, INTC_INT_PRIO_REG(0) add t1, t2, t1 /* t1 = INTC_INT_PRIO_REG + 4 * mcause */ lw t2, 0(t1) /* t2 = INTC_INT_PRIO_REG[mcause] */ addi t2, t2, 1 /* t2 = t2 +1 */ @@ -287,7 +287,7 @@ _interrupt_handler: /* MIE cleared. Nested interrupts are disabled */ /* restore the interrupt threshold level */ - la t0, INTERRUPT_CORE0_CPU_INT_THRESH_REG + li t0, INTERRUPT_CORE0_CPU_INT_THRESH_REG sw s3, 0(t0) fence diff --git a/components/xtensa/include/xtensa/xtensa_context.h b/components/xtensa/include/xtensa/xtensa_context.h index b869a105c6..ee87d2741f 100644 --- a/components/xtensa/include/xtensa/xtensa_context.h +++ b/components/xtensa/include/xtensa/xtensa_context.h @@ -71,10 +71,18 @@ We need to undef due to redefinition from xtruntime.h #if defined(_ASMLANGUAGE) || defined(__ASSEMBLER__) +#ifdef __clang__ +#define STRUCT_BEGIN .set XT_STRUCT_OFFSET, 0 +#define STRUCT_FIELD(ctype,size,asname,name) .set asname, XT_STRUCT_OFFSET; .set XT_STRUCT_OFFSET, asname + size +#define STRUCT_AFIELD(ctype,size,asname,name,n) .set asname, XT_STRUCT_OFFSET;\ + .set XT_STRUCT_OFFSET, asname + (size)*(n); +#define STRUCT_END(sname) .set sname##Size, XT_STRUCT_OFFSET; +#else // __clang__ #define STRUCT_BEGIN .pushsection .text; .struct 0 #define STRUCT_FIELD(ctype,size,asname,name) asname: .space size #define STRUCT_AFIELD(ctype,size,asname,name,n) asname: .space (size)*(n) #define STRUCT_END(sname) sname##Size:; .popsection +#endif // __clang__ #else diff --git a/components/xtensa/include/xtensa/xtruntime-frames.h b/components/xtensa/include/xtensa/xtruntime-frames.h index d0eb368735..b78095e0dd 100644 --- a/components/xtensa/include/xtensa/xtruntime-frames.h +++ b/components/xtensa/include/xtensa/xtruntime-frames.h @@ -31,11 +31,24 @@ /* Macros that help define structures for both C and assembler: */ #if defined(_ASMLANGUAGE) || defined(__ASSEMBLER__) + +#ifdef __clang__ +#define STRUCT_BEGIN .set XT_STRUCT_OFFSET, 0 +#define STRUCT_FIELD(ctype,size,pre,name) .set pre##name, XT_STRUCT_OFFSET; .set XT_STRUCT_OFFSET, pre##name + size +#define STRUCT_AFIELD(ctype,size,pre,name,n) .set pre##name, XT_STRUCT_OFFSET;\ + .set XT_STRUCT_OFFSET, pre##name + (size)*(n); +#define STRUCT_AFIELD_A(ctype,size,align,pre,name,n) .set pre##name, XT_STRUCT_OFFSET\ + .ifgt (align-1); .set pre##name, XT_STRUCT_OFFSET + (align - (XT_STRUCT_OFFSET & (align-1))); .endif\ + .set XT_STRUCT_OFFSET, pre##name + (size)*(n); +#define STRUCT_END(sname) .set sname##Size, XT_STRUCT_OFFSET; +#else /* __clang__ */ #define STRUCT_BEGIN .pushsection .text; .struct 0 #define STRUCT_FIELD(ctype,size,pre,name) pre##name: .space size #define STRUCT_AFIELD(ctype,size,pre,name,n) pre##name: .if n ; .space (size)*(n) ; .endif #define STRUCT_AFIELD_A(ctype,size,align,pre,name,n) .balign align ; pre##name: .if n ; .space (size)*(n) ; .endif #define STRUCT_END(sname) sname##Size:; .popsection +#endif /* __clang__ */ + #else /*_ASMLANGUAGE||__ASSEMBLER__*/ #define STRUCT_BEGIN typedef struct { #define STRUCT_FIELD(ctype,size,pre,name) ctype name; diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index 3af655d041..56300f8917 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -837,7 +837,6 @@ components/pthread/test/test_pthread_local_storage.c components/riscv/include/riscv/csr.h components/riscv/include/riscv/encoding.h components/riscv/include/riscv/instruction_decode.h -components/riscv/include/riscv/rvruntime-frames.h components/riscv/instruction_decode.c components/sdmmc/sdmmc_common.c components/sdmmc/sdmmc_common.h