arch/arm/src/armv7-m: Add ARMv7-M setjmp/longjump functions.

This commit is contained in:
David S. Alessio 2019-08-06 15:59:19 -06:00 committed by Gregory Nutt
parent ec5120f69e
commit ced0dc1e16
27 changed files with 497 additions and 7 deletions

34
Kconfig
View File

@ -425,11 +425,11 @@ config ARCH_STDARG_H
bool "stdarg.h"
default n
---help---
There is also a redirecting version of stdarg.h in the source tree
as well. It also resides out-of-the-way at include/nuttx/lib/stdarg.h.
This is because you should normally use your toolchain's stdarg.h
file. But sometimes, your toolchain's stdarg.h file may have other
header file dependencies and so may not be usable in the NuttX build
There is a redirecting version of stdarg.h in the source tree. It
resides out-of-the-way at include/nuttx/lib/stdarg.h. This is
because you should normally use your toolchain's stdarg.h file. But
sometimes, your toolchain's stdarg.h file may have other header
file dependencies and so may not be usable in the NuttX build
environment. In those cases, you may have to create a architecture-
specific stdarg.h header file at nuttx/arch/<architecture>/include/stdarg.h
@ -440,6 +440,30 @@ config ARCH_STDARG_H
ARCH_STDARG_H=y and providing. If ARCH_STDARG_H, is not defined, then
the stdarg.h header file will stay out-of-the-way in include/nuttx/.
config ARCH_HAVE_SETJMP
bool
default n
config ARCH_SETJMP_H
bool "setjmp.h"
default n
depends on ARCH_HAVE_SETJMP
---help---
There is a redirecting version of setjmp.h in the source tree. It
resides out-of-the-way at include/nuttx/lib/setjmp.h. This is
because you should normally use your toolchain's setjmp.h file. But
sometimes, your toolchain's setjmp.h file may have other header
file dependencies and so may not be usable in the NuttX build
environment. In those cases, you may have to create a architecture-
specific setjmp.h header file at nuttx/arch/<architecture>/include/setjmp.h
If ARCH_SETJMP_H=y is defined, the top-level makefile will copy the
re-directing setjmp.h header file from include/nuttx/lib/setjmp.h to
include/setjmp.h. So for the architectures that cannot use their
toolchain's setjmp.h file, they can use this alternative by defining
ARCH_SETJMP_H=y and providing. If ARCH_SETJMP_H, is not defined, then
the setjmp.h header file will stay out-of-the-way in include/nuttx/.
config ARCH_DEBUG_H
bool "debug.h"
default n

View File

@ -514,6 +514,7 @@ config ARCH_CORTEXM23
config ARCH_ARMV7M
bool
default n
select ARCH_HAVE_SETJMP if ARCH_TOOLCHAIN_GNU
config ARCH_CORTEXM3
bool

98
arch/arm/include/setjmp.h Normal file
View File

@ -0,0 +1,98 @@
/****************************************************************************
* arch/arm/include/setjmp.h
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: David S. Alessio <David@DSA.Consulting>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __ARCH_ARM_INCLUDE_SETJUMP_H
#define __ARCH_ARM_INCLUDE_SETJUMP_H 1
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#ifdef CONFIG_ARCH_ARMV7M
/****************************************************************************
* Public Types
****************************************************************************/
struct setjmp_buf_s
{
/* Note: core registers r0-r3 are caller-saved */
unsigned r4;
unsigned r5;
unsigned r6;
unsigned r7;
unsigned r8;
unsigned r9;
unsigned r10;
unsigned r11;
unsigned ip; /* this is really sp */
unsigned lr;
#ifdef CONFIG_ARCH_FPU
/* note: FPU registers s0-s15 are caller-saved */
float s16;
float s17;
float s18;
float s19;
float s20;
float s21;
float s22;
float s23;
float s24;
float s25;
float s26;
float s27;
float s28;
float s29;
float s30;
float s31;
unsigned fpscr;
#endif
};
/* Traditional typedef for setjmp_buf */
typedef struct setjmp_buf_s jmp_buf[1];
#else
# error "setjmp() not compiled!"
#endif /* CONFIG_ARCH_ARMV7M */
#endif /* __ARCH_ARM_INCLUDE_SETJUMP_H */

View File

@ -0,0 +1,162 @@
/************************************************************************************
* arch/arm/src/armv7-m/gnu/up_setjmp.S
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: David S. Alessio <David@DSA.Consulting>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
/* When this file is assembled, it will require the following GCC options:
*
* -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -meabi=5 -mthumb
*/
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/************************************************************************************
* Public Symbols
************************************************************************************/
.globl setjmp
.globl longjmp
.syntax unified
.thumb
.file "setjmp.S"
/************************************************************************************
* Public Functions
************************************************************************************/
/************************************************************************************
* Name: setjmp
*
* Description:
* Given the pointer to a register save area (in R0), save the state of the
* all callee-saved registers
*
* C Function Prototype:
* int setjmp(jmp_buf env);
*
* Input Parameters:
* env - A pointer to the register save area in which to save the floating point
* registers and core registers. Since setjmp() can not be inlined, we
* only need to save the ABI-specified callee-saved registers.
*
* Returned Value:
* 0 setjmp called directly
* non-0 we justed returned from a longjmp()
*
************************************************************************************/
.thumb_func
.type setjmp, function
setjmp:
/* Store callee-saved Core registers */
mov ip, sp /* move sp to ip so we can save it */
stmia r0!, {r4-r11, ip, lr}
#ifdef CONFIG_ARCH_FPU
vstmia r0!, {s16-s31} /* Save the callee-saved FP registers */
/* Store the floating point control and status register. At the end of the
* vstmia, r0 will point to the FPCSR storage location.
*/
vmrs r1, fpscr /* Fetch the FPCSR */
str r1, [r0], #4 /* Save the floating point control and status register */
// DSA: don't need to inc r0
#endif /* CONFIG_ARCH_FPU */
/* we're done, we're out of here */
mov r0, #0
bx lr
.size setjmp, .-setjmp
/************************************************************************************
* Name: longjmp
*
* Description:
* The longjmp() function used the information saved in env to transfer control
* control back to the point where setjmp() was called and to restore ("rewind")
* the stack to its state at the time of the setjmp() call. When control is
* passed back to where setjmp() had been called, setjmp() will return with
* 'val', the second paramater passed to longjmp().
*
* C Function Prototype:
* void longjmp(jmp_buf env, int val);
*
* Input Parameters:
* jmp_buf env
* int val
*
* Returned Value:
* This function does not return anything explicitly.
*
************************************************************************************/
.thumb_func
.type longjmp, function
longjmp:
/* Load callee-saved Core registers */
ldmia r0!, {r4-r11, ip, lr}
mov sp, ip /* restore sp */
#ifdef CONFIG_ARCH_FPU
/* Load callee-saved floating point registers. */
vldmia r0!, {s16-s31} /* Restore FP context */
/* Load the floating point control and status register. */
ldr r2, [r0], #4 /* Fetch the floating point control and status register */
/* DSA: don't need to inc r0 */
vmsr fpscr, r2 /* Restore the FPCSR */
#endif /* CONFIG_ARCH_FPU */
mov r0, r1 /* return val */
bx lr
.size longjmp, .-longjmp
.end

View File

@ -40,6 +40,12 @@ HEAD_ASRC =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += up_testset.S vfork.S
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CMN_ASRCS += up_setjmp.S
endif
endif
CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c
CMN_CSRCS += up_createstack.c up_mdelay.c up_udelay.c up_exit.c
CMN_CSRCS += up_initialize.c up_initialstate.c up_interruptcontext.c

View File

@ -41,6 +41,12 @@ CMN_UCSRCS =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CMN_ASRCS += up_setjmp.S
endif
endif
CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copyfullstate.c
CMN_CSRCS += up_createstack.c up_doirq.c up_exit.c up_hardfault.c
CMN_CSRCS += up_initialize.c up_initialstate.c up_interruptcontext.c

View File

@ -41,6 +41,12 @@ HEAD_ASRC =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CMN_ASRCS += up_setjmp.S
endif
endif
CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c
CMN_CSRCS += up_createstack.c up_mdelay.c up_udelay.c up_exit.c
CMN_CSRCS += up_initialize.c up_initialstate.c up_interruptcontext.c

View File

@ -41,6 +41,12 @@ CMN_UCSRCS =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CMN_ASRCS += up_setjmp.S
endif
endif
CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c up_createstack.c
CMN_CSRCS += up_mdelay.c up_udelay.c up_exit.c up_initialize.c up_memfault.c
CMN_CSRCS += up_initialstate.c up_interruptcontext.c up_modifyreg8.c

View File

@ -43,6 +43,12 @@ CMN_UCSRCS =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += vfork.S
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CMN_ASRCS += up_setjmp.S
endif
endif
CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c
CMN_CSRCS += up_createstack.c up_mdelay.c up_udelay.c up_exit.c
CMN_CSRCS += up_initialize.c up_initialstate.c up_interruptcontext.c

View File

@ -45,6 +45,12 @@ CMN_UCSRCS =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CMN_ASRCS += up_setjmp.S
endif
endif
CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c up_createstack.c
CMN_CSRCS += up_mdelay.c up_udelay.c up_exit.c up_initialize.c up_memfault.c
CMN_CSRCS += up_initialstate.c up_interruptcontext.c up_modifyreg8.c

View File

@ -38,6 +38,12 @@ HEAD_ASRC =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CMN_ASRCS += up_setjmp.S
endif
endif
CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c up_createstack.c
CMN_CSRCS += up_doirq.c up_exit.c up_hardfault.c up_initialize.c
CMN_CSRCS += up_initialstate.c up_interruptcontext.c up_mdelay.c

View File

@ -38,6 +38,12 @@ HEAD_ASRC =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CMN_ASRCS += up_setjmp.S
endif
endif
CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c up_createstack.c
CMN_CSRCS += up_doirq.c up_exit.c up_hardfault.c up_initialize.c
CMN_CSRCS += up_initialstate.c up_interruptcontext.c up_mdelay.c

View File

@ -40,6 +40,12 @@ HEAD_ASRC =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CMN_ASRCS += up_setjmp.S
endif
endif
CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copyfullstate.c
CMN_CSRCS += up_createstack.c up_doirq.c up_exit.c up_hardfault.c
CMN_CSRCS += up_initialize.c up_initialstate.c up_interruptcontext.c

View File

@ -38,6 +38,12 @@ HEAD_ASRC =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += up_testset.S vfork.S
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CMN_ASRCS += up_setjmp.S
endif
endif
CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c
CMN_CSRCS += up_createstack.c up_doirq.c up_exit.c up_hardfault.c
CMN_CSRCS += up_initialize.c up_initialstate.c up_interruptcontext.c

View File

@ -46,6 +46,12 @@ CMN_UCSRCS =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CMN_ASRCS += up_setjmp.S
endif
endif
CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c up_createstack.c
CMN_CSRCS += up_doirq.c up_exit.c up_hardfault.c up_initialize.c
CMN_CSRCS += up_initialstate.c up_interruptcontext.c up_mdelay.c

View File

@ -45,6 +45,12 @@ CMN_UCSRCS =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CMN_ASRCS += up_setjmp.S
endif
endif
CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copyfullstate.c
CMN_CSRCS += up_createstack.c up_exit.c up_initialize.c up_initialstate.c
CMN_CSRCS += up_interruptcontext.c up_mdelay.c up_memfault.c up_modifyreg8.c

View File

@ -46,6 +46,12 @@ CMN_UCSRCS =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CMN_ASRCS += up_setjmp.S
endif
endif
CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c up_createstack.c
CMN_CSRCS += up_doirq.c up_exit.c up_hardfault.c up_initialize.c
CMN_CSRCS += up_initialstate.c up_interruptcontext.c up_mdelay.c

View File

@ -41,6 +41,12 @@ CMN_UCSRCS =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CMN_ASRCS += up_setjmp.S
endif
endif
CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c up_createstack.c
CMN_CSRCS += up_exit.c up_hardfault.c up_initialize.c up_initialstate.c
CMN_CSRCS += up_interruptcontext.c up_mdelay.c up_memfault.c up_modifyreg8.c

View File

@ -46,6 +46,12 @@ CMN_UCSRCS =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CMN_ASRCS += up_setjmp.S
endif
endif
CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c up_createstack.c
CMN_CSRCS += up_doirq.c up_exit.c up_hardfault.c up_initialize.c
CMN_CSRCS += up_initialstate.c up_interruptcontext.c up_mdelay.c

View File

@ -46,6 +46,12 @@ CMN_UCSRCS =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += up_testset.S vfork.S
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CMN_ASRCS += up_setjmp.S
endif
endif
CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c up_createstack.c
CMN_CSRCS += up_doirq.c up_exit.c up_hardfault.c up_initialize.c
CMN_CSRCS += up_initialstate.c up_interruptcontext.c up_mdelay.c up_memfault.c

View File

@ -47,6 +47,12 @@ CMN_UCSRCS =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CMN_ASRCS += up_setjmp.S
endif
endif
CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c up_createstack.c
CMN_CSRCS += up_doirq.c up_exit.c up_hardfault.c up_initialize.c
CMN_CSRCS += up_initialstate.c up_interruptcontext.c up_mdelay.c up_memfault.c

View File

@ -39,6 +39,12 @@ HEAD_ASRC =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CMN_ASRCS += up_setjmp.S
endif
endif
CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c up_createstack.c
CMN_CSRCS += up_doirq.c up_exit.c up_hardfault.c up_initialize.c
CMN_CSRCS += up_initialstate.c up_interruptcontext.c up_mdelay.c

View File

@ -41,6 +41,12 @@ CMN_UCSRCS =
CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S
CMN_ASRCS += up_testset.S up_fetchadd.S vfork.S
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y)
CMN_ASRCS += up_setjmp.S
endif
endif
CMN_CSRCS = up_assert.c up_blocktask.c up_copyfullstate.c up_createstack.c
CMN_CSRCS += up_doirq.c up_exit.c up_initialize.c up_initialstate.c
CMN_CSRCS += up_hardfault.c up_interruptcontext.c up_memfault.c up_mdelay.c

1
include/.gitignore vendored
View File

@ -4,6 +4,7 @@
/math.h
/float.h
/stdarg.h
/setjmp.h
/features.h
/uClibc++
/libcxx

View File

@ -0,0 +1,64 @@
/****************************************************************************
* include/nuttx/lib/setjmp.h
*
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_LIB_SETJMP_H
#define __INCLUDE_NUTTX_LIB_SETJMP_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/* If CONFIG_ARCH_SETJMP_H is defined, then the top-level Makefile will copy
* this header file to include/setjmp.h where it will become the system
* setjmp.h header file. In this case, the architecture specific code must
* provide an arch/<architecture>/include/setjmp.h file which will be
* included below:
*/
#ifdef CONFIG_ARCH_SETJMP_H
# include <arch/setjmp.h>
#endif
/****************************************************************************
* Type Definitions
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#endif /* __INCLUDE_NUTTX_LIB_SETJMP_H */

View File

@ -240,6 +240,18 @@ else
include/stdarg.h:
endif
# Target used to copy include/nuttx/lib/setjmp.h. If CONFIG_ARCH_SETJMP_H is
# defined, then there is an architecture specific setjmp.h header file
# that will be included indirectly from include/lib/setjmp.h. But first, we
# have to copy setjmp.h from include/nuttx/. to include/.
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
include/setjmp.h: include/nuttx/lib/setjmp.h
$(Q) cp -f include/nuttx/lib/setjmp.h include/setjmp.h
else
include/setjmp.h:
endif
# Targets used to build include/nuttx/version.h. Creation of version.h is
# part of the overall NuttX configuration sequence. Notice that the
# tools/mkversion tool is built and used to create include/nuttx/version.h
@ -341,7 +353,7 @@ dirlinks: include/arch include/arch/board include/arch/chip $(ARCH_SRC)/board $(
# the config.h and version.h header files in the include/nuttx directory and
# the establishment of symbolic links to configured directories.
context: check_context staging include/nuttx/config.h include/nuttx/version.h include/math.h include/float.h include/stdarg.h dirlinks
context: check_context staging include/nuttx/config.h include/nuttx/version.h include/math.h include/float.h include/stdarg.h include/setjmp.h dirlinks
$(Q) for dir in $(CONTEXTDIRS) ; do \
$(MAKE) -C $$dir TOPDIR="$(TOPDIR)" context; \
done
@ -358,6 +370,7 @@ clean_context:
$(call DELFILE, include/nuttx/version.h)
$(call DELFILE, include/math.h)
$(call DELFILE, include/stdarg.h)
$(call DELFILE, include/setjmp.h)
$(Q) $(DIRUNLINK) include/arch/board
$(Q) $(DIRUNLINK) include/arch/chip
$(Q) $(DIRUNLINK) include/arch

View File

@ -235,6 +235,18 @@ else
include\stdarg.h:
endif
# Target used to copy include\nuttx\setjmp.h. If CONFIG_ARCH_SETJMP_H is
# defined, then there is an architecture specific setjmp.h header file
# that will be included indirectly from include\setjmp.h. But first, we
# have to copy setjmp.h from include\nuttx\. to include\.
ifeq ($(CONFIG_ARCH_SETJMP_H),y)
include\setjmp.h: include\nuttx\setjmp.h
$(Q) cp -f include\nuttx\setjmp.h include\setjmp.h
else
include\setjmp.h:
endif
# Targets used to build include\nuttx\version.h. Creation of version.h is
# part of the overall NuttX configuration sequence. Notice that the
# tools\mkversion tool is built and used to create include\nuttx\version.h
@ -363,7 +375,7 @@ dirlinks: include\arch include\arch\board include\arch\chip $(ARCH_SRC)\board $(
# the config.h and version.h header files in the include\nuttx directory and
# the establishment of symbolic links to configured directories.
context: check_context staging include\nuttx\config.h include\nuttx\version.h include\math.h include\float.h include\stdarg.h dirlinks
context: check_context staging include\nuttx\config.h include\nuttx\version.h include\math.h include\float.h include\stdarg.h include\setjmp.h dirlinks
$(Q) for %%G in ($(CONTEXTDIRS)) do ( $(MAKE) -C %%G TOPDIR="$(TOPDIR)" context )
# clean_context
@ -378,6 +390,7 @@ clean_context:
$(call DELFILE, include\nuttx\version.h)
$(call DELFILE, include\math.h)
$(call DELFILE, include\stdarg.h)
$(call DELFILE, include\setjmp.h)
$(call DELDIR, include\arch\board)
$(call DELDIR, include\arch\chip)
$(call DELDIR, include\arch)