Rename CONFIG_NUTTX_KERNEL to CONFIG_BUILD_PROTECTED; Partially integrate new CONFIG_BUILD_KERNEL

This commit is contained in:
Gregory Nutt 2014-08-29 14:47:22 -06:00
parent 365a3d8466
commit e3ff0689bb
210 changed files with 690 additions and 655 deletions

View File

@ -12,7 +12,7 @@
<h1><big><font color="#3c34ec"> <h1><big><font color="#3c34ec">
<i>NuttX RTOS Porting Guide</i> <i>NuttX RTOS Porting Guide</i>
</font></big></h1> </font></big></h1>
<p>Last Updated: August 24, 2014</p> <p>Last Updated: August 29, 2014</p>
</td> </td>
</tr> </tr>
</table> </table>
@ -486,7 +486,7 @@
kernel-mode NuttX functions. kernel-mode NuttX functions.
This directory must always be provided to prevent compilation errors. This directory must always be provided to prevent compilation errors.
However, it need only contain valid function declarations if the architecture However, it need only contain valid function declarations if the architecture
supports the <code>CONFIG_NUTTX_KERNEL</code> configuration. supports the <code>CONFIG_BUILD_PROTECTED</code> or <code>CONFIG_BUILD_KERNEL</code>configurations.
<ul> <ul>
<li> <li>
<code>uintptr_t sys_call0(unsigned int nbr)</code>: <code>uintptr_t sys_call0(unsigned int nbr)</code>:
@ -1329,7 +1329,7 @@ include/
</p> </p>
<p> <p>
Normally the logic in this file builds to a single library (<code>libc.a</code>). Normally the logic in this file builds to a single library (<code>libc.a</code>).
However, if NuttX is built as a separately compiled kernel (with <code>CONFIG_NUTTX_KERNEL=y</code>), then the contents of this directory are built as two libraries: However, if NuttX is built as a separately compiled kernel (with <code>CONFIG_BUILD_PROTECTED=y</code> or <code>CONFIG_BUILD_KERNEL=y</code>), then the contents of this directory are built as two libraries:
One for use by user programs (<code>libuc.a</code>) and one for use only within the &lt;kernel&gt; space (<code>libkc.a</code>). One for use by user programs (<code>libuc.a</code>) and one for use only within the &lt;kernel&gt; space (<code>libkc.a</code>).
</p> </p>
<p> <p>
@ -1393,7 +1393,7 @@ libc/
<h2>2.14 <a name="DirStructSyscall">nuttx/syscall</a></h2> <h2>2.14 <a name="DirStructSyscall">nuttx/syscall</a></h2>
<p> <p>
If NuttX is built as a separately compiled kernel (with <code>CONFIG_NUTTX_KERNEL=y</code>), If NuttX is built as a separately compiled kernel (with <code>CONFIG_BUILD_PROTECTED=y</code> or <code>CONFIG_BUILD_KERNEL=y</code>),
then the contents of this directory are built. then the contents of this directory are built.
This directory holds a syscall interface that can be used for communication This directory holds a syscall interface that can be used for communication
between user-mode applications and the kernel-mode RTOS. between user-mode applications and the kernel-mode RTOS.
@ -1783,13 +1783,10 @@ The system can be re-made subsequently by just typing <code>make</code>.
<p> <p>
This function may also need to set up processor registers so that the new thread executes This function may also need to set up processor registers so that the new thread executes
with the correct privileges. with the correct privileges.
If <code>CONFIG_NUTTX_KERNEL</code> has been selected in the NuttX configuration, If <code>CONFIG_BUILD_PROTECTED</code> or <code>CONFIG_BUILD_KERNEL</code> have been selected in the NuttX configuration, then special initialization may need to be performed depending on the task type specified in the TCB's flags field:
then special initialization may need to be performed depending on the task type specified
in the TCB's flags field:
Kernel threads will require kernel-mode privileges; Kernel threads will require kernel-mode privileges;
User tasks and pthreads should have only user-mode privileges. User tasks and pthreads should have only user-mode privileges.
If <code>CONFIG_NUTTX_KERNEL</code> has <i>not</i> been selected, If neither <code>CONFIG_BUILD_PROTECTED</code> nor <code>CONFIG_BUILD_KERNEL</code> have been selected, then all threads should have kernel-mode privileges.
then all threads should have kernel-mode privileges.
</p> </p>
<h3><a name="upcreatestack">4.2.4 <code>up_create_stack()</code></a></h3> <h3><a name="upcreatestack">4.2.4 <code>up_create_stack()</code></a></h3>
@ -1839,7 +1836,7 @@ The system can be re-made subsequently by just typing <code>make</code>.
This thread type is normally available in the flags field of the TCB, however, there are certain contexts where the TCB may not be fully initialized when up_create_stack is called. This thread type is normally available in the flags field of the TCB, however, there are certain contexts where the TCB may not be fully initialized when up_create_stack is called.
</p> </p>
<p> <p>
If <code>CONFIG_NUTTX_KERNEL</code> is defined, then this thread type may affect how the stack is allocated. For example, kernel thread stacks should be allocated from protected kernel memory. Stacks for user tasks and threads must come from memory that is accessible to user code. If <code>CONFIG_BUILD_PROTECTED</code> or <code>CONFIG_BUILD_KERNEL</code> are defined, then this thread type may affect how the stack is allocated. For example, kernel thread stacks should be allocated from protected kernel memory. Stacks for user tasks and threads must come from memory that is accessible to user code.
</p> </p>
</li> </li>
</ul> </ul>
@ -1909,7 +1906,7 @@ The system can be re-made subsequently by just typing <code>make</code>.
</li> </li>
</ul> </ul>
<p> <p>
This API is <i>NOT</i> required if <code>CONFIG_NUTTX_KERNEL</code> is undefined or if <code>CONFIG_CUSTOM_STACK</code> is defined. This API is <i>NOT</i> required if <code>CONFIG_BUILD_PROTECTED</code> and <code>CONFIG_BUILD_KERNEL</code> are undefined or if <code>CONFIG_CUSTOM_STACK</code> is defined.
</p> </p>
<p><b>Input Parameters:</b></p> <p><b>Input Parameters:</b></p>
<ul> <ul>
@ -1965,7 +1962,7 @@ The system can be re-made subsequently by just typing <code>make</code>.
This thread type is normally available in the flags field of the TCB, however, there are certain error recovery contexts where the TCB may not be fully initialized when up_release_stack is called. This thread type is normally available in the flags field of the TCB, however, there are certain error recovery contexts where the TCB may not be fully initialized when up_release_stack is called.
</p> </p>
<p> <p>
If <code>CONFIG_NUTTX_KERNEL</code> is defined, then this thread type may affect how the stack is freed. If <code>CONFIG_BUILD_PROTECTED</code> or <code>CONFIG_BUILD_KERNEL</code> are defined, then this thread type may affect how the stack is freed.
For example, kernel thread stacks may have been allocated from protected kernel memory. For example, kernel thread stacks may have been allocated from protected kernel memory.
Stacks for user tasks and threads must have come from memory that is accessible to user Stacks for user tasks and threads must have come from memory that is accessible to user
</p> </p>
@ -2150,7 +2147,7 @@ The system can be re-made subsequently by just typing <code>make</code>.
This function will be called to dynamically set aside the heap region. This function will be called to dynamically set aside the heap region.
</p> </p>
<p> <p>
For the kernel build (<code>CONFIG_NUTTX_KERNEL</code>=y) with both kernel- and user-space heaps (<code>CONFIG_MM_KERNEL_HEAP</code>=y), this function provides the size of the unprotected, user-space heap. For the kernel build (<code>CONFIG_BUILD_PROTECTED=y</code> or <code>CONFIG_BUILD_KERNEL=y</code>) with both kernel- and user-space heaps (<code>CONFIG_MM_KERNEL_HEAP=y</code>), this function provides the size of the unprotected, user-space heap.
If a protected kernel-space heap is provided, the kernel heap must be allocated (and protected) by an analogous <code>up_allocate_kheap()</code>. If a protected kernel-space heap is provided, the kernel heap must be allocated (and protected) by an analogous <code>up_allocate_kheap()</code>.
</p> </p>

67
Kconfig
View File

@ -111,37 +111,79 @@ config APPS_DIR
`-application `-application
| |
`- Makefile `- Makefile
Then you would set APPS_DIR=../application. Then you would set APPS_DIR=../application.
The application direction must contain Makefile and this make The application direction must contain Makefile and this make
file must support the following targets: file must support the following targets:
1)libapps$(LIBEXT) (usually libapps.a). libapps.a is a static 1)libapps$(LIBEXT) (usually libapps.a). libapps.a is a static
library ( an archive) that contains all of application object library ( an archive) that contains all of application object
files. files.
2)clean. Do whatever is appropriate to clean the application 2)clean. Do whatever is appropriate to clean the application
directories for a fresh build. directories for a fresh build.
3)distclean. Clean everything -- auto-generated files, symbolic 3)distclean. Clean everything -- auto-generated files, symbolic
links etc. -- so that the directory contents are the same as links etc. -- so that the directory contents are the same as
the contents in your configuration management system. the contents in your configuration management system.
This is only done when you change the NuttX configuration. This is only done when you change the NuttX configuration.
4)depend. Make or update the application build dependencies. 4)depend. Make or update the application build dependencies.
When this application is invoked it will receive the setting TOPDIR like: When this application is invoked it will receive the setting TOPDIR like:
$(MAKE) -C $(CONFIG_APPS_DIR) TOPDIR="$(TOPDIR)" <target> $(MAKE) -C $(CONFIG_APPS_DIR) TOPDIR="$(TOPDIR)" <target>
TOPDIR is the full path to the NuttX directory. It can be used, for TOPDIR is the full path to the NuttX directory. It can be used, for
example, to include makefile fragments (e.g., .config or Make.defs) example, to include makefile fragments (e.g., .config or Make.defs)
or to set up include file paths. or to set up include file paths.
choice
prompt "Memory organization"
default BUILD_FLAT
config BUILD_FLAT
bool "Flat address space"
---help---
Build NuttX as one large, executable "blob". All of the code
within the blob can interrupt with all of the other code within
the blob. There are no special privileges, protections, or
restraints.
config BUILD_PROTECTED
bool "NuttX protected build"
default n
depends on ARCH_USE_MPU
select LIB_SYSCALL
select BUILD_2PASS
---help---
Builds NuttX and selected applications as two "blobs": A protected, privileged kernel blob and a separate unprivileged, user blob. This require sue of the two pass build with each blob being build on each pass.
NOTE: This build configuration requires that the platform support
a memory protection unit (MPU). Support, however, may not be
implemented on all platforms.
config BUILD_KERNEL
bool "NuttX kernel build"
default n
depends on ARCH_USE_MMU && ARCH_ADDRENV && EXPERIMENTAL
select LIB_SYSCALL
---help---
Builds NuttX as a separately compiled kernel. No applications are
built. All user applications must reside in a file system where
they can be loaded into memory for execution.
NOTE: This build configuration requires that the platform support
a memory management unit (MPU) and address environments. Support,
however, may not be implemented on all platforms.
endchoice # Build configuration
config BUILD_2PASS config BUILD_2PASS
bool "Two pass build" bool "Two pass build"
default n default n
depends on !BUILD_KERNEL
---help--- ---help---
Enables the two pass build options. Enables the two pass build options.
@ -183,17 +225,10 @@ config PASS1_OBJECT
from the PASS1_TARGET. It may be available at link time from the PASS1_TARGET. It may be available at link time
in the arch/<architecture>/src directory. in the arch/<architecture>/src directory.
config NUTTX_KERNEL
bool "NuttX kernel build"
default n
select LIB_SYSCALL
---help---
Builds NuttX as a separately compiled kernel.
config NUTTX_USERSPACE config NUTTX_USERSPACE
hex "Beginning of user-space blob" hex "Beginning of user-space blob"
default 0x0 default 0x0
depends on NUTTX_KERNEL depends on BUILD_PROTECTED
---help--- ---help---
In the kernel build, the NuttX kernel and the user-space blob are In the kernel build, the NuttX kernel and the user-space blob are
built separately linked objects. NUTTX_USERSPACE provides the built separately linked objects. NUTTX_USERSPACE provides the

View File

@ -91,7 +91,7 @@ APPDIR := ${shell if [ -r $(CONFIG_APPS_DIR)/Makefile ]; then echo "$(CONFIG_APP
NUTTX_ADDONS := NUTTX_ADDONS :=
USER_ADDONS := USER_ADDONS :=
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
USER_ADDONS += $(APPDIR) USER_ADDONS += $(APPDIR)
else else
NUTTX_ADDONS += $(APPDIR) NUTTX_ADDONS += $(APPDIR)
@ -117,7 +117,7 @@ CONTEXTDIRS = $(APPDIR)
USERDIRS = USERDIRS =
OTHERDIRS = lib OTHERDIRS = lib
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
USERDIRS += libc mm $(USER_ADDONS) USERDIRS += libc mm $(USER_ADDONS)
ifeq ($(CONFIG_HAVE_CXX),y) ifeq ($(CONFIG_HAVE_CXX),y)
@ -160,9 +160,9 @@ endif
# CLEANDIRS are the directories that will clean in. These are # CLEANDIRS are the directories that will clean in. These are
# all directories that we know about. # all directories that we know about.
# KERNDEPDIRS are the directories in which we will build target dependencies. # KERNDEPDIRS are the directories in which we will build target dependencies.
# If NuttX and applications are built separately (CONFIG_NUTTX_KERNEL), # If NuttX and applications are built separately (CONFIG_BUILD_PROTECTED),
# then this holds only the directories containing kernel files. # then this holds only the directories containing kernel files.
# USERDEPDIRS. If NuttX and applications are built separately (CONFIG_NUTTX_KERNEL), # USERDEPDIRS. If NuttX and applications are built separately (CONFIG_BUILD_PROTECTED),
# then this holds only the directories containing user files. # then this holds only the directories containing user files.
CLEANDIRS = $(NONFSDIRS) $(FSDIRS) $(USERDIRS) $(OTHERDIRS) CLEANDIRS = $(NONFSDIRS) $(FSDIRS) $(USERDIRS) $(OTHERDIRS)
@ -219,7 +219,7 @@ USERLIBS =
# both the kernel- and user-space builds. For now, the memory manager (mm) # both the kernel- and user-space builds. For now, the memory manager (mm)
# is placed in user space (only). # is placed in user space (only).
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
NUTTXLIBS += lib/libstubs$(LIBEXT) lib/libkc$(LIBEXT) lib/libkmm$(LIBEXT) NUTTXLIBS += lib/libstubs$(LIBEXT) lib/libkc$(LIBEXT) lib/libkmm$(LIBEXT)
NUTTXLIBS += lib/libkarch$(LIBEXT) NUTTXLIBS += lib/libkarch$(LIBEXT)
USERLIBS += lib/libproxies$(LIBEXT) lib/libuc$(LIBEXT) lib/libumm$(LIBEXT) USERLIBS += lib/libproxies$(LIBEXT) lib/libuc$(LIBEXT) lib/libumm$(LIBEXT)
@ -236,7 +236,7 @@ endif
# be defined in Make.defs for this to work! # be defined in Make.defs for this to work!
ifeq ($(CONFIG_HAVE_CXX),y) ifeq ($(CONFIG_HAVE_CXX),y)
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
USERLIBS += lib/libcxx$(LIBEXT) USERLIBS += lib/libcxx$(LIBEXT)
else else
NUTTXLIBS += lib/libcxx$(LIBEXT) NUTTXLIBS += lib/libcxx$(LIBEXT)
@ -246,7 +246,7 @@ endif
# Add library for application support. # Add library for application support.
ifneq ($(APPDIR),) ifneq ($(APPDIR),)
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
USERLIBS += lib/libapps$(LIBEXT) USERLIBS += lib/libapps$(LIBEXT)
else else
NUTTXLIBS += lib/libapps$(LIBEXT) NUTTXLIBS += lib/libapps$(LIBEXT)
@ -282,7 +282,7 @@ endif
ifeq ($(CONFIG_NX),y) ifeq ($(CONFIG_NX),y)
NUTTXLIBS += lib/libgraphics$(LIBEXT) NUTTXLIBS += lib/libgraphics$(LIBEXT)
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
NUTTXLIBS += lib/libknx$(LIBEXT) NUTTXLIBS += lib/libknx$(LIBEXT)
USERLIBS += lib/libunx$(LIBEXT) USERLIBS += lib/libunx$(LIBEXT)
else else

View File

@ -84,7 +84,7 @@ APPDIR := ${shell if exist "$(CONFIG_APPS_DIR)\Makefile" echo $(CONFIG_APPS_DIR)
NUTTX_ADDONS := NUTTX_ADDONS :=
USER_ADDONS := USER_ADDONS :=
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
USER_ADDONS += $(APPDIR) USER_ADDONS += $(APPDIR)
else else
NUTTX_ADDONS += $(APPDIR) NUTTX_ADDONS += $(APPDIR)
@ -110,7 +110,7 @@ CONTEXTDIRS = $(APPDIR)
USERDIRS = USERDIRS =
OTHERDIRS = lib OTHERDIRS = lib
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
USERDIRS += libc mm $(USER_ADDONS) USERDIRS += libc mm $(USER_ADDONS)
ifeq ($(CONFIG_HAVE_CXX),y) ifeq ($(CONFIG_HAVE_CXX),y)
@ -153,9 +153,9 @@ endif
# CLEANDIRS are the directories that will clean in. These are # CLEANDIRS are the directories that will clean in. These are
# all directories that we know about. # all directories that we know about.
# KERNDEPDIRS are the directories in which we will build target dependencies. # KERNDEPDIRS are the directories in which we will build target dependencies.
# If NuttX and applications are built separately (CONFIG_NUTTX_KERNEL), # If NuttX and applications are built separately (CONFIG_BUILD_PROTECTED),
# then this holds only the directories containing kernel files. # then this holds only the directories containing kernel files.
# USERDEPDIRS. If NuttX and applications are built separately (CONFIG_NUTTX_KERNEL), # USERDEPDIRS. If NuttX and applications are built separately (CONFIG_BUILD_PROTECTED),
# then this holds only the directories containing user files. # then this holds only the directories containing user files.
CLEANDIRS = $(NONFSDIRS) $(FSDIRS) $(USERDIRS) $(OTHERDIRS) CLEANDIRS = $(NONFSDIRS) $(FSDIRS) $(USERDIRS) $(OTHERDIRS)
@ -212,7 +212,7 @@ USERLIBS =
# both the kernel- and user-space builds. For now, the memory manager (mm) # both the kernel- and user-space builds. For now, the memory manager (mm)
# is placed in user space (only). # is placed in user space (only).
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
NUTTXLIBS += lib\libstubs$(LIBEXT) lib\libkc$(LIBEXT) lib\libkmm$(LIBEXT) NUTTXLIBS += lib\libstubs$(LIBEXT) lib\libkc$(LIBEXT) lib\libkmm$(LIBEXT)
NUTTXLIBS += lib\libkarch$(LIBEXT) NUTTXLIBS += lib\libkarch$(LIBEXT)
USERLIBS += lib\libproxies$(LIBEXT) lib\libuc$(LIBEXT) lib\libumm$(LIBEXT) USERLIBS += lib\libproxies$(LIBEXT) lib\libuc$(LIBEXT) lib\libumm$(LIBEXT)
@ -229,7 +229,7 @@ endif
# be defined in Make.defs for this to work! # be defined in Make.defs for this to work!
ifeq ($(CONFIG_HAVE_CXX),y) ifeq ($(CONFIG_HAVE_CXX),y)
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
USERLIBS += lib\libcxx$(LIBEXT) USERLIBS += lib\libcxx$(LIBEXT)
else else
NUTTXLIBS += lib\libcxx$(LIBEXT) NUTTXLIBS += lib\libcxx$(LIBEXT)
@ -239,7 +239,7 @@ endif
# Add library for application support. # Add library for application support.
ifneq ($(APPDIR),) ifneq ($(APPDIR),)
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
USERLIBS += lib\libapps$(LIBEXT) USERLIBS += lib\libapps$(LIBEXT)
else else
NUTTXLIBS += lib\libapps$(LIBEXT) NUTTXLIBS += lib\libapps$(LIBEXT)
@ -275,7 +275,7 @@ endif
ifeq ($(CONFIG_NX),y) ifeq ($(CONFIG_NX),y)
NUTTXLIBS += lib\libgraphics$(LIBEXT) NUTTXLIBS += lib\libgraphics$(LIBEXT)
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
NUTTXLIBS += lib\libknx$(LIBEXT) NUTTXLIBS += lib\libknx$(LIBEXT)
USERLIBS += lib\libunx$(LIBEXT) USERLIBS += lib\libunx$(LIBEXT)
else else

View File

@ -154,6 +154,10 @@ config ARCH_HAVE_MMU
bool bool
default n default n
config ARCH_HAVE_MPU
bool
default n
config ARCH_NAND_HWECC config ARCH_NAND_HWECC
bool bool
default n default n
@ -162,6 +166,26 @@ config ARCH_HAVE_EXTCLK
bool bool
default n default n
config ARCH_USE_MMU
bool "Enable MMU"
default n
depends on ARCH_HAVE_MMU
---help---
The architecture supports supports an MMU. Enable this option in
order to enable use of the MMU. For most architectures, this is
not really an option: It is required to use the MMU. In those
cases, this selection will always be forced.
config ARCH_USE_MPU
bool "Enable MPU"
default n
depends on ARCH_HAVE_MPU
---help---
The architecture supports supports an MPU. Enable this option in
order to enable use of the MPU. For most architectures, this option
is enabled by other, platform-specific logic. In those cases, this
selection will always be forced.
menuconfig ARCH_ADDRENV menuconfig ARCH_ADDRENV
bool "Address environments" bool "Address environments"
default n default n
@ -224,12 +248,12 @@ config ARCH_STACK_NPAGES
This, along with knowledge of the page size, determines the size of This, along with knowledge of the page size, determines the size of
the stack virtual address space. Default is 1. the stack virtual address space. Default is 1.
endif # ARCH_ADDRENV && ARCH_HAVE_MMU endif # ARCH_ADDRENV && ARCH_NEED_ADDRENV_MAPPING
menuconfig PAGING menuconfig PAGING
bool "On-demand paging" bool "On-demand paging"
default n default n
depends on ARCH_HAVE_MMU && !ARCH_ROMPGTABLE depends on ARCH_USE_MMU && !ARCH_ROMPGTABLE
---help--- ---help---
If set =y in your configation file, this setting will enable the on-demand If set =y in your configation file, this setting will enable the on-demand
paging feature as described in http://www.nuttx.org/NuttXDemandPaging.html. paging feature as described in http://www.nuttx.org/NuttXDemandPaging.html.
@ -537,7 +561,7 @@ config ARCH_HIPRI_INTERRUPT
int up_prioritize_irq(int irq, int priority) int up_prioritize_irq(int irq, int priority)
NOTE: ARCH_INTERRUPTSTACK must be set in kernel mode (NUTTX_KERNEL). NOTE: ARCH_INTERRUPTSTACK must be set in kernel mode (BUILD_KERNEL).
In kernel mode without an interrupt stack, the interrupt handler In kernel mode without an interrupt stack, the interrupt handler
will set the MSP to the stack pointer of the interrupted thread. If will set the MSP to the stack pointer of the interrupted thread. If
the interrupted thread was a privileged thread, that will be the MSP the interrupted thread was a privileged thread, that will be the MSP
@ -641,7 +665,7 @@ config RAM_START
config RAM_VSTART config RAM_VSTART
hex "Primary RAM start address (virtual)" hex "Primary RAM start address (virtual)"
default 0x0 default 0x0
depends on ARCH_HAVE_MMU depends on ARCH_USE_MMU
help help
The virtual start address of installed primary RAM. "Primary" RAM The virtual start address of installed primary RAM. "Primary" RAM
refers to the RAM that you link program code into. If program code refers to the RAM that you link program code into. If program code
@ -657,7 +681,7 @@ config RAM_SIZE
does not execute out of RAM but from FLASH, then you may designate does not execute out of RAM but from FLASH, then you may designate
any block of RAM as "primary." any block of RAM as "primary."
if BOOT_RUNFROMFLASH && ARCH_HAVE_MMU if BOOT_RUNFROMFLASH && ARCH_USE_MMU
config FLASH_START config FLASH_START
hex "Boot FLASH start address (physical)" hex "Boot FLASH start address (physical)"
@ -680,7 +704,7 @@ config FLASH_SIZE
The size in bytes of the installed boot FLASH. "Boot" FLASH The size in bytes of the installed boot FLASH. "Boot" FLASH
refers to the FLASH that you link program code into. refers to the FLASH that you link program code into.
endif # BOOT_RUNFROMFLASH && ARCH_HAVE_MMU endif # BOOT_RUNFROMFLASH && ARCH_USE_MMU
config ARCH_HAVE_SDRAM config ARCH_HAVE_SDRAM
bool bool

View File

@ -15,11 +15,12 @@ config ARCH_CHIP_A1X
select ARCH_CORTEXA8 select ARCH_CORTEXA8
select ARCH_HAVE_FPU select ARCH_HAVE_FPU
select ARCH_HAVE_MMU select ARCH_HAVE_MMU
select ARCH_USE_MMU
select ARCH_HAVE_LOWVECTORS select ARCH_HAVE_LOWVECTORS
select ARCH_HAVE_SDRAM select ARCH_HAVE_SDRAM
select BOOT_RUNFROMSDRAM select BOOT_RUNFROMSDRAM
select ARCH_HAVE_ADDRENV if EXPERIMENTAL select ARCH_HAVE_ADDRENV
select ARCH_NEED_ADDRENV_MAPPING if EXPERIMENTAL select ARCH_NEED_ADDRENV_MAPPING
---help--- ---help---
Allwinner A1X family: A10, A10S (A12), A13 (ARM Cortex-A8) Allwinner A1X family: A10, A10S (A12), A13 (ARM Cortex-A8)
@ -137,8 +138,8 @@ config ARCH_CHIP_SAMA5
select ARCH_HAVE_LOWVECTORS select ARCH_HAVE_LOWVECTORS
select ARCH_HAVE_I2CRESET select ARCH_HAVE_I2CRESET
select ARCH_HAVE_TICKLESS select ARCH_HAVE_TICKLESS
select ARCH_HAVE_ADDRENV if EXPERIMENTAL select ARCH_HAVE_ADDRENV
select ARCH_NEED_ADDRENV_MAPPING if EXPERIMENTAL select ARCH_NEED_ADDRENV_MAPPING
---help--- ---help---
Atmel SAMA5 (ARM Cortex-A5) Atmel SAMA5 (ARM Cortex-A5)
@ -182,11 +183,13 @@ config ARCH_ARM926EJS
bool bool
default n default n
select ARCH_HAVE_MMU select ARCH_HAVE_MMU
select ARCH_USE_MMU
config ARCH_ARM920T config ARCH_ARM920T
bool bool
default n default n
select ARCH_HAVE_MMU select ARCH_HAVE_MMU
select ARCH_USE_MMU
config ARCH_CORTEXM0 config ARCH_CORTEXM0
bool bool
@ -212,6 +215,7 @@ config ARCH_CORTEXA5
default n default n
select ARCH_HAVE_IRQPRIO select ARCH_HAVE_IRQPRIO
select ARCH_HAVE_MMU select ARCH_HAVE_MMU
select ARCH_USE_MMU
select ARCH_HAVE_COHERENT_DCACHE if ELF select ARCH_HAVE_COHERENT_DCACHE if ELF
config ARCH_CORTEXA8 config ARCH_CORTEXA8
@ -219,6 +223,7 @@ config ARCH_CORTEXA8
default n default n
select ARCH_HAVE_IRQPRIO select ARCH_HAVE_IRQPRIO
select ARCH_HAVE_MMU select ARCH_HAVE_MMU
select ARCH_USE_MMU
select ARCH_HAVE_COHERENT_DCACHE if ELF select ARCH_HAVE_COHERENT_DCACHE if ELF
config ARCH_FAMILY config ARCH_FAMILY
@ -288,14 +293,12 @@ config ARCH_FPU
Build in support for the ARM Cortex-M4 Floating Point Unit (FPU). Build in support for the ARM Cortex-M4 Floating Point Unit (FPU).
Check your chip specifications first; not all Cortex-M4 chips support the FPU. Check your chip specifications first; not all Cortex-M4 chips support the FPU.
config ARCH_HAVE_MPU
bool
default n
config ARMV7M_MPU config ARMV7M_MPU
bool "MPU support" bool "MPU support"
default n default n if !ARCH_USE_MPU
default y if ARCH_USE_MPU
depends on ARCH_HAVE_MPU depends on ARCH_HAVE_MPU
select ARCH_USE_MPU
---help--- ---help---
Build in support for the ARM Cortex-M3/4 Memory Protection Unit (MPU). Build in support for the ARM Cortex-M3/4 Memory Protection Unit (MPU).
Check your chip specifications first; not all Cortex-M3/4 chips support the MPU. Check your chip specifications first; not all Cortex-M3/4 chips support the MPU.
@ -305,7 +308,7 @@ config ARMV7M_MPU_NREGIONS
default 8 default 8
depends on ARMV7M_MPU depends on ARMV7M_MPU
---help--- ---help---
This is the number of protection regions supported by the MPU. This is the number of protection regions supported by the MPU.
config ARCH_HAVE_LOWVECTORS config ARCH_HAVE_LOWVECTORS
bool bool
@ -320,7 +323,7 @@ config ARCH_LOWVECTORS
config ARCH_ROMPGTABLE config ARCH_ROMPGTABLE
bool "ROM page table" bool "ROM page table"
default n default n
depends on ARCH_HAVE_MMU depends on ARCH_USE_MMU
---help--- ---help---
Support a fixed memory mapping use a (read-only) page table in ROM/FLASH. Support a fixed memory mapping use a (read-only) page table in ROM/FLASH.

View File

@ -85,7 +85,7 @@
* modes. * modes.
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
# define REG_EXC_RETURN (10) /* EXC_RETURN */ # define REG_EXC_RETURN (10) /* EXC_RETURN */
# define SW_XCPT_REGS (11) # define SW_XCPT_REGS (11)
#else #else
@ -178,11 +178,11 @@ struct xcptcontext
uint32_t saved_pc; uint32_t saved_pc;
uint32_t saved_primask; uint32_t saved_primask;
uint32_t saved_xpsr; uint32_t saved_xpsr;
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
uint32_t saved_lr; uint32_t saved_lr;
#endif #endif
# ifdef CONFIG_NUTTX_KERNEL # ifdef CONFIG_BUILD_PROTECTED
/* This is the saved address to use when returning from a user-space /* This is the saved address to use when returning from a user-space
* signal handler. * signal handler.
*/ */

View File

@ -200,7 +200,7 @@
#ifdef CONFIG_LIB_SYSCALL #ifdef CONFIG_LIB_SYSCALL
struct xcpt_syscall_s struct xcpt_syscall_s
{ {
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_KERNEL
uint32_t cpsr; /* The CPSR value */ uint32_t cpsr; /* The CPSR value */
#endif #endif
uint32_t sysreturn; /* The return PC */ uint32_t sysreturn; /* The return PC */

View File

@ -140,11 +140,11 @@ struct xcptcontext
uint32_t saved_primask; uint32_t saved_primask;
#endif #endif
uint32_t saved_xpsr; uint32_t saved_xpsr;
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
uint32_t saved_lr; uint32_t saved_lr;
#endif #endif
# ifdef CONFIG_NUTTX_KERNEL # ifdef CONFIG_BUILD_PROTECTED
/* This is the saved address to use when returning from a user-space /* This is the saved address to use when returning from a user-space
* signal handler. * signal handler.
*/ */

View File

@ -65,7 +65,7 @@
#define REG_R10 (8) /* R10 */ #define REG_R10 (8) /* R10 */
#define REG_R11 (9) /* R11 */ #define REG_R11 (9) /* R11 */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
# define REG_EXC_RETURN (10) /* EXC_RETURN */ # define REG_EXC_RETURN (10) /* EXC_RETURN */
# define SW_INT_REGS (11) # define SW_INT_REGS (11)
#else #else

View File

@ -356,16 +356,6 @@ void up_boot(void)
up_earlyserialinit(); up_earlyserialinit();
#endif #endif
#ifdef CONFIG_NUTTX_KERNEL
/* For the case of the separate user-/kernel-space build, perform whatever
* platform specific initialization of the user memory is required.
* Normally this just means initializing the user space .data and .bss
* segments.
*/
a1x_userspace();
#endif
/* Perform board-specific initialization, This must include: /* Perform board-specific initialization, This must include:
* *
* - Initialization of board-specific memory resources (e.g., SDRAM) * - Initialization of board-specific memory resources (e.g., SDRAM)

View File

@ -114,7 +114,7 @@ void up_initial_state(struct tcb_s *tcb)
* what kind of thread is being started. Disable FIQs in any event * what kind of thread is being started. Disable FIQs in any event
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_KERNEL
if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL) if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
{ {
/* It is a kernel thread.. set supervisor mode */ /* It is a kernel thread.. set supervisor mode */

View File

@ -53,11 +53,11 @@
/* Configuration ********************************************************************/ /* Configuration ********************************************************************/
/* This logic uses three system calls {0,1,2} for context switching and one for the /* This logic uses three system calls {0,1,2} for context switching and one for the
* syscall return. So a minimum of four syscall values must be reserved. If * syscall return. So a minimum of four syscall values must be reserved. If
* CONFIG_NUTTX_KERNEL is defined, then four more syscall values must be reserved. * CONFIG_BUILD_PROTECTED is defined, then four more syscall values must be reserved.
*/ */
#ifdef CONFIG_LIB_SYSCALL #ifdef CONFIG_LIB_SYSCALL
# ifdef CONFIG_NUTTX_KERNEL # ifdef CONFIG_BUILD_PROTECTED
# ifndef CONFIG_SYS_RESERVED # ifndef CONFIG_SYS_RESERVED
# error "CONFIG_SYS_RESERVED must be defined to have the value 8" # error "CONFIG_SYS_RESERVED must be defined to have the value 8"
# elif CONFIG_SYS_RESERVED != 8 # elif CONFIG_SYS_RESERVED != 8
@ -103,7 +103,7 @@
#define SYS_syscall_return (3) #define SYS_syscall_return (3)
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/* SYS call 4: /* SYS call 4:
* *
* void up_task_start(main_t taskentry, int argc, FAR char *argv[]) * void up_task_start(main_t taskentry, int argc, FAR char *argv[])
@ -135,7 +135,7 @@
#define SYS_signal_handler_return (7) #define SYS_signal_handler_return (7)
#endif /* CONFIG_NUTTX_KERNEL */ #endif /* CONFIG_BUILD_PROTECTED */
#endif /* CONFIG_LIB_SYSCALL */ #endif /* CONFIG_LIB_SYSCALL */
/************************************************************************************ /************************************************************************************

View File

@ -160,7 +160,7 @@ static inline void up_registerdump(void)
current_regs[REG_R10], current_regs[REG_R11], current_regs[REG_R10], current_regs[REG_R11],
current_regs[REG_R12], current_regs[REG_R13], current_regs[REG_R12], current_regs[REG_R13],
current_regs[REG_R14], current_regs[REG_R15]); current_regs[REG_R14], current_regs[REG_R15]);
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
lldbg("xPSR: %08x PRIMASK: %08x EXEC_RETURN: %08x\n", lldbg("xPSR: %08x PRIMASK: %08x EXEC_RETURN: %08x\n",
current_regs[REG_XPSR], current_regs[REG_PRIMASK], current_regs[REG_XPSR], current_regs[REG_PRIMASK],
current_regs[REG_EXC_RETURN]); current_regs[REG_EXC_RETURN]);

View File

@ -92,7 +92,7 @@ exception_common:
* the context is on the MSP or PSP. * the context is on the MSP or PSP.
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
mov r0, r14 /* Copy high register to low register */ mov r0, r14 /* Copy high register to low register */
lsl r0, #(31 - EXC_RETURN_PROCESS_BITNO) /* Move to bit 31 */ lsl r0, #(31 - EXC_RETURN_PROCESS_BITNO) /* Move to bit 31 */
bmi 1f /* Test bit 31 */ bmi 1f /* Test bit 31 */
@ -129,7 +129,7 @@ exception_common:
mov r3, r9 mov r3, r9
mov r4, r10 mov r4, r10
mov r5, r11 mov r5, r11
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
mov r6, r14 mov r6, r14
stmia r0!, {r2-r6} /* Save the high registers r8-r11 and r14 */ stmia r0!, {r2-r6} /* Save the high registers r8-r11 and r14 */
#else #else
@ -200,7 +200,7 @@ exception_common:
mov r2, #(4*REG_R8) /* R2=Offset to R8 storage */ mov r2, #(4*REG_R8) /* R2=Offset to R8 storage */
add r0, r1, r2 /* R0=Address of R8 storage */ add r0, r1, r2 /* R0=Address of R8 storage */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
ldmia r0!, {r2-r6} /* Recover R8-R11 and R14 (5 registers)*/ ldmia r0!, {r2-r6} /* Recover R8-R11 and R14 (5 registers)*/
mov r8, r2 /* Move to position in high registers */ mov r8, r2 /* Move to position in high registers */
mov r9, r3 mov r9, r3
@ -227,7 +227,7 @@ exception_common:
* context is on the MSP or PSP. * context is on the MSP or PSP.
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
mov r0, r14 /* Copy high register to low register */ mov r0, r14 /* Copy high register to low register */
lsl r0, #(31 - EXC_RETURN_PROCESS_BITNO) /* Move to bit 31 */ lsl r0, #(31 - EXC_RETURN_PROCESS_BITNO) /* Move to bit 31 */
bmi 5f /* Test bit 31 */ bmi 5f /* Test bit 31 */

View File

@ -99,7 +99,7 @@ int up_hardfault(int irq, FAR void *context)
* REVISIT: What if the PC lies in "unknown" external memory? * REVISIT: What if the PC lies in "unknown" external memory?
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/* In the kernel build, SVCalls are expected in either the base, kernel /* In the kernel build, SVCalls are expected in either the base, kernel
* FLASH region or in the user FLASH region. * FLASH region or in the user FLASH region.
*/ */

View File

@ -126,9 +126,9 @@ void up_initial_state(struct tcb_s *tcb)
#endif #endif
#endif /* CONFIG_PIC */ #endif /* CONFIG_PIC */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/* All tasks start via a stub function in kernel space. So all /* All tasks start via a stub function in kernel space. So all
* tasks must start in privileged thread mode. If CONFIG_NUTTX_KERNEL * tasks must start in privileged thread mode. If CONFIG_BUILD_PROTECTED
* is defined, then that stub function will switch to unprivileged * is defined, then that stub function will switch to unprivileged
* mode before transferring control to the user task. * mode before transferring control to the user task.
*/ */

View File

@ -152,7 +152,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.saved_pc = current_regs[REG_PC]; tcb->xcp.saved_pc = current_regs[REG_PC];
tcb->xcp.saved_primask = current_regs[REG_PRIMASK]; tcb->xcp.saved_primask = current_regs[REG_PRIMASK];
tcb->xcp.saved_xpsr = current_regs[REG_XPSR]; tcb->xcp.saved_xpsr = current_regs[REG_XPSR];
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
tcb->xcp.saved_lr = current_regs[REG_LR]; tcb->xcp.saved_lr = current_regs[REG_LR];
#endif #endif
/* Then set up to vector to the trampoline with interrupts /* Then set up to vector to the trampoline with interrupts
@ -163,7 +163,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
current_regs[REG_PC] = (uint32_t)up_sigdeliver; current_regs[REG_PC] = (uint32_t)up_sigdeliver;
current_regs[REG_PRIMASK] = 1; current_regs[REG_PRIMASK] = 1;
current_regs[REG_XPSR] = ARMV6M_XPSR_T; current_regs[REG_XPSR] = ARMV6M_XPSR_T;
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
current_regs[REG_LR] = EXC_RETURN_PRIVTHR; current_regs[REG_LR] = EXC_RETURN_PRIVTHR;
#endif #endif
/* And make sure that the saved context in the TCB is the same /* And make sure that the saved context in the TCB is the same
@ -190,7 +190,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.saved_pc = tcb->xcp.regs[REG_PC]; tcb->xcp.saved_pc = tcb->xcp.regs[REG_PC];
tcb->xcp.saved_primask = tcb->xcp.regs[REG_PRIMASK]; tcb->xcp.saved_primask = tcb->xcp.regs[REG_PRIMASK];
tcb->xcp.saved_xpsr = tcb->xcp.regs[REG_XPSR]; tcb->xcp.saved_xpsr = tcb->xcp.regs[REG_XPSR];
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
tcb->xcp.saved_lr = tcb->xcp.regs[REG_LR]; tcb->xcp.saved_lr = tcb->xcp.regs[REG_LR];
#endif #endif
@ -202,7 +202,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_PC] = (uint32_t)up_sigdeliver; tcb->xcp.regs[REG_PC] = (uint32_t)up_sigdeliver;
tcb->xcp.regs[REG_PRIMASK] = 1; tcb->xcp.regs[REG_PRIMASK] = 1;
tcb->xcp.regs[REG_XPSR] = ARMV6M_XPSR_T; tcb->xcp.regs[REG_XPSR] = ARMV6M_XPSR_T;
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
tcb->xcp.regs[REG_LR] = EXC_RETURN_PRIVTHR; tcb->xcp.regs[REG_LR] = EXC_RETURN_PRIVTHR;
#endif #endif
} }

View File

@ -109,7 +109,7 @@ void up_sigdeliver(void)
regs[REG_PC] = rtcb->xcp.saved_pc; regs[REG_PC] = rtcb->xcp.saved_pc;
regs[REG_PRIMASK] = rtcb->xcp.saved_primask; regs[REG_PRIMASK] = rtcb->xcp.saved_primask;
regs[REG_XPSR] = rtcb->xcp.saved_xpsr; regs[REG_XPSR] = rtcb->xcp.saved_xpsr;
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
regs[REG_LR] = rtcb->xcp.saved_lr; regs[REG_LR] = rtcb->xcp.saved_lr;
#endif #endif

View File

@ -41,7 +41,7 @@
#include <arch/syscall.h> #include <arch/syscall.h>
#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) #if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__)
/**************************************************************************** /****************************************************************************
* File info * File info
@ -112,4 +112,4 @@ up_signal_handler:
.size up_signal_handler, .-up_signal_handler .size up_signal_handler, .-up_signal_handler
.end .end
#endif /* CONFIG_NUTTX_KERNEL && !__KERNEL__ */ #endif /* CONFIG_BUILD_PROTECTED && !__KERNEL__ */

View File

@ -181,7 +181,7 @@ int up_svcall(int irq, FAR void *context)
svcdbg(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", svcdbg(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n",
regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11], regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11],
regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]);
# ifdef CONFIG_NUTTX_KERNEL # ifdef CONFIG_BUILD_PROTECTED
svcdbg(" PSR: %08x PRIMASK: %08x EXC_RETURN: %08x\n", svcdbg(" PSR: %08x PRIMASK: %08x EXC_RETURN: %08x\n",
regs[REG_XPSR], regs[REG_PRIMASK], regs[REG_EXC_RETURN]); regs[REG_XPSR], regs[REG_PRIMASK], regs[REG_EXC_RETURN]);
# else # else
@ -312,7 +312,7 @@ int up_svcall(int irq, FAR void *context)
* R3 = argv * R3 = argv
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
case SYS_task_start: case SYS_task_start:
{ {
/* Set up to return to the user-space task start-up function in /* Set up to return to the user-space task start-up function in
@ -344,7 +344,7 @@ int up_svcall(int irq, FAR void *context)
* R2 = arg * R2 = arg
*/ */
#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_PTHREAD) #if defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_DISABLE_PTHREAD)
case SYS_pthread_start: case SYS_pthread_start:
{ {
/* Set up to return to the user-space pthread start-up function in /* Set up to return to the user-space pthread start-up function in
@ -378,7 +378,7 @@ int up_svcall(int irq, FAR void *context)
* ucontext (on the stack) * ucontext (on the stack)
*/ */
#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) #if defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_DISABLE_SIGNALS)
case SYS_signal_handler: case SYS_signal_handler:
{ {
struct tcb_s *rtcb = sched_self(); struct tcb_s *rtcb = sched_self();
@ -421,7 +421,7 @@ int up_svcall(int irq, FAR void *context)
* R0 = SYS_signal_handler_return * R0 = SYS_signal_handler_return
*/ */
#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) #if defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_DISABLE_SIGNALS)
case SYS_signal_handler_return: case SYS_signal_handler_return:
{ {
struct tcb_s *rtcb = sched_self(); struct tcb_s *rtcb = sched_self();
@ -497,7 +497,7 @@ int up_svcall(int irq, FAR void *context)
current_regs[REG_R10], current_regs[REG_R11], current_regs[REG_R10], current_regs[REG_R11],
current_regs[REG_R12], current_regs[REG_R13], current_regs[REG_R12], current_regs[REG_R13],
current_regs[REG_R14], current_regs[REG_R15]); current_regs[REG_R14], current_regs[REG_R15]);
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
svcdbg(" PSR: %08x PRIMASK: %08x EXC_RETURN: %08x\n", svcdbg(" PSR: %08x PRIMASK: %08x EXC_RETURN: %08x\n",
current_regs[REG_XPSR], current_regs[REG_PRIMASK], current_regs[REG_XPSR], current_regs[REG_PRIMASK],
current_regs[REG_EXC_RETURN]); current_regs[REG_EXC_RETURN]);

View File

@ -114,7 +114,7 @@ void up_initial_state(struct tcb_s *tcb)
* what kind of thread is being started. Disable FIQs in any event * what kind of thread is being started. Disable FIQs in any event
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_KERNEL
if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL) if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)
{ {
/* It is a kernel thread.. set supervisor mode */ /* It is a kernel thread.. set supervisor mode */

View File

@ -157,7 +157,7 @@ static void dispatch_syscall(void)
uint32_t *arm_syscall(uint32_t *regs) uint32_t *arm_syscall(uint32_t *regs)
{ {
uint32_t cmd; uint32_t cmd;
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_KERNEL
uint32_t cpsr; uint32_t cpsr;
#endif #endif
@ -214,7 +214,7 @@ uint32_t *arm_syscall(uint32_t *regs)
*/ */
regs[REG_PC] = rtcb->xcp.syscall[index].sysreturn; regs[REG_PC] = rtcb->xcp.syscall[index].sysreturn;
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_KERNEL
regs[REG_CPSR] = rtcb->xcp.syscall[index].cpsr; regs[REG_CPSR] = rtcb->xcp.syscall[index].cpsr;
#endif #endif
rtcb->xcp.nsyscalls = index; rtcb->xcp.nsyscalls = index;
@ -239,7 +239,7 @@ uint32_t *arm_syscall(uint32_t *regs)
* R3 = argv * R3 = argv
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_KERNEL
case SYS_task_start: case SYS_task_start:
{ {
/* Set up to return to the user-space task start-up function in /* Set up to return to the user-space task start-up function in
@ -272,7 +272,7 @@ uint32_t *arm_syscall(uint32_t *regs)
* R2 = arg * R2 = arg
*/ */
#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_PTHREAD) #if defined(CONFIG_BUILD_KERNEL) && !defined(CONFIG_DISABLE_PTHREAD)
case SYS_pthread_start: case SYS_pthread_start:
{ {
/* Set up to return to the user-space pthread start-up function in /* Set up to return to the user-space pthread start-up function in
@ -307,7 +307,7 @@ uint32_t *arm_syscall(uint32_t *regs)
* ucontext (on the stack) * ucontext (on the stack)
*/ */
#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) #if defined(CONFIG_BUILD_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS)
case SYS_signal_handler: case SYS_signal_handler:
{ {
struct tcb_s *rtcb = sched_self(); struct tcb_s *rtcb = sched_self();
@ -351,7 +351,7 @@ uint32_t *arm_syscall(uint32_t *regs)
* R0 = SYS_signal_handler_return * R0 = SYS_signal_handler_return
*/ */
#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) #if defined(CONFIG_BUILD_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS)
case SYS_signal_handler_return: case SYS_signal_handler_return:
{ {
struct tcb_s *rtcb = sched_self(); struct tcb_s *rtcb = sched_self();
@ -392,13 +392,13 @@ uint32_t *arm_syscall(uint32_t *regs)
/* Setup to return to dispatch_syscall in privileged mode. */ /* Setup to return to dispatch_syscall in privileged mode. */
rtcb->xcp.syscall[index].sysreturn = regs[REG_PC]; rtcb->xcp.syscall[index].sysreturn = regs[REG_PC];
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_KERNEL
rtcb->xcp.syscall[index].cpsr = regs[REG_CPSR]; rtcb->xcp.syscall[index].cpsr = regs[REG_CPSR];
#endif #endif
rtcb->xcp.nsyscalls = index + 1; rtcb->xcp.nsyscalls = index + 1;
regs[REG_PC] = (uint32_t)dispatch_syscall; regs[REG_PC] = (uint32_t)dispatch_syscall;
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_KERNEL
regval = regs[REG_CPSR] & ~PSR_MODE_MASK; regval = regs[REG_CPSR] & ~PSR_MODE_MASK;
regs[REG_CPSR] = regval | PSR_MODE_SVC; regs[REG_CPSR] = regval | PSR_MODE_SVC;
#endif #endif

View File

@ -54,11 +54,11 @@
/* Configuration ********************************************************************/ /* Configuration ********************************************************************/
/* This logic uses one system call for the syscall return. So a minimum of one /* This logic uses one system call for the syscall return. So a minimum of one
* syscall values must be reserved. If CONFIG_NUTTX_KERNEL is defined, then four * syscall values must be reserved. If CONFIG_BUILD_KERNEL is defined, then four
* more syscall values must be reserved. * more syscall values must be reserved.
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_KERNEL
# ifndef CONFIG_SYS_RESERVED # ifndef CONFIG_SYS_RESERVED
# error "CONFIG_SYS_RESERVED must be defined to have the value 5" # error "CONFIG_SYS_RESERVED must be defined to have the value 5"
# elif CONFIG_SYS_RESERVED != 5 # elif CONFIG_SYS_RESERVED != 5
@ -81,7 +81,7 @@
#define SYS_syscall_return (0) #define SYS_syscall_return (0)
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_KERNEL
/* SYS call 1: /* SYS call 1:
* *
* void up_task_start(main_t taskentry, int argc, FAR char *argv[]) * void up_task_start(main_t taskentry, int argc, FAR char *argv[])
@ -113,7 +113,7 @@
#define SYS_signal_handler_return (4) #define SYS_signal_handler_return (4)
#endif /* CONFIG_NUTTX_KERNEL */ #endif /* CONFIG_BUILD_KERNEL */
/************************************************************************************ /************************************************************************************
* Inline Functions * Inline Functions

View File

@ -53,11 +53,11 @@
/* Configuration ********************************************************************/ /* Configuration ********************************************************************/
/* This logic uses three system calls {0,1,2} for context switching and one for the /* This logic uses three system calls {0,1,2} for context switching and one for the
* syscall return. So a minimum of four syscall values must be reserved. If * syscall return. So a minimum of four syscall values must be reserved. If
* CONFIG_NUTTX_KERNEL is defined, then four more syscall values must be reserved. * CONFIG_BUILD_PROTECTED is defined, then four more syscall values must be reserved.
*/ */
#ifdef CONFIG_LIB_SYSCALL #ifdef CONFIG_LIB_SYSCALL
# ifdef CONFIG_NUTTX_KERNEL # ifdef CONFIG_BUILD_PROTECTED
# ifndef CONFIG_SYS_RESERVED # ifndef CONFIG_SYS_RESERVED
# error "CONFIG_SYS_RESERVED must be defined to have the value 8" # error "CONFIG_SYS_RESERVED must be defined to have the value 8"
# elif CONFIG_SYS_RESERVED != 8 # elif CONFIG_SYS_RESERVED != 8
@ -103,7 +103,7 @@
#define SYS_syscall_return (3) #define SYS_syscall_return (3)
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/* SYS call 4: /* SYS call 4:
* *
* void up_task_start(main_t taskentry, int argc, FAR char *argv[]) * void up_task_start(main_t taskentry, int argc, FAR char *argv[])
@ -135,7 +135,7 @@
#define SYS_signal_handler_return (7) #define SYS_signal_handler_return (7)
#endif /* CONFIG_NUTTX_KERNEL */ #endif /* CONFIG_BUILD_PROTECTED */
#endif /* CONFIG_LIB_SYSCALL */ #endif /* CONFIG_LIB_SYSCALL */
/************************************************************************************ /************************************************************************************

View File

@ -66,7 +66,7 @@
* no privileged task has run. * no privileged task has run.
*/ */
# if defined(CONFIG_NUTTX_KERNEL) && CONFIG_ARCH_INTERRUPTSTACK < 4 # if defined(CONFIG_BUILD_PROTECTED) && CONFIG_ARCH_INTERRUPTSTACK < 4
# error Interrupt stack must be used with high priority interrupts in kernel mode # error Interrupt stack must be used with high priority interrupts in kernel mode
# endif # endif
@ -259,7 +259,7 @@ exception_common:
/* The EXC_RETURN value tells us whether we are returning on the MSP or PSP /* The EXC_RETURN value tells us whether we are returning on the MSP or PSP
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1
* (handler mode) if the stack is on the MSP. It can only be on the PSP if * (handler mode) if the stack is on the MSP. It can only be on the PSP if
* EXC_RETURN is 0xfffffffd (unprivileged thread) * EXC_RETURN is 0xfffffffd (unprivileged thread)

View File

@ -108,7 +108,7 @@ int up_hardfault(int irq, FAR void *context)
* use the BASEPRI register if you have external memory. * use the BASEPRI register if you have external memory.
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/* In the kernel build, SVCalls are expected in either the base, kernel /* In the kernel build, SVCalls are expected in either the base, kernel
* FLASH region or in the user FLASH region. * FLASH region or in the user FLASH region.
*/ */

View File

@ -126,16 +126,16 @@ void up_initial_state(struct tcb_s *tcb)
#endif #endif
#endif /* CONFIG_PIC */ #endif /* CONFIG_PIC */
#if defined(CONFIG_ARMV7M_CMNVECTOR) || defined(CONFIG_NUTTX_KERNEL) #if defined(CONFIG_ARMV7M_CMNVECTOR) || defined(CONFIG_BUILD_PROTECTED)
/* All tasks start via a stub function in kernel space. So all /* All tasks start via a stub function in kernel space. So all
* tasks must start in privileged thread mode. If CONFIG_NUTTX_KERNEL * tasks must start in privileged thread mode. If CONFIG_BUILD_PROTECTED
* is defined, then that stub function will switch to unprivileged * is defined, then that stub function will switch to unprivileged
* mode before transferring control to the user task. * mode before transferring control to the user task.
*/ */
xcp->regs[REG_EXC_RETURN] = EXC_RETURN_PRIVTHR; xcp->regs[REG_EXC_RETURN] = EXC_RETURN_PRIVTHR;
#endif /* CONFIG_ARMV7M_CMNVECTOR || CONFIG_NUTTX_KERNEL */ #endif /* CONFIG_ARMV7M_CMNVECTOR || CONFIG_BUILD_PROTECTED */
#if defined(CONFIG_ARMV7M_CMNVECTOR) && defined(CONFIG_ARCH_FPU) #if defined(CONFIG_ARMV7M_CMNVECTOR) && defined(CONFIG_ARCH_FPU)

View File

@ -157,7 +157,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.saved_primask = current_regs[REG_PRIMASK]; tcb->xcp.saved_primask = current_regs[REG_PRIMASK];
#endif #endif
tcb->xcp.saved_xpsr = current_regs[REG_XPSR]; tcb->xcp.saved_xpsr = current_regs[REG_XPSR];
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
tcb->xcp.saved_lr = current_regs[REG_LR]; tcb->xcp.saved_lr = current_regs[REG_LR];
#endif #endif
/* Then set up to vector to the trampoline with interrupts /* Then set up to vector to the trampoline with interrupts
@ -172,7 +172,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
current_regs[REG_PRIMASK] = 1; current_regs[REG_PRIMASK] = 1;
#endif #endif
current_regs[REG_XPSR] = ARMV7M_XPSR_T; current_regs[REG_XPSR] = ARMV7M_XPSR_T;
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
current_regs[REG_LR] = EXC_RETURN_PRIVTHR; current_regs[REG_LR] = EXC_RETURN_PRIVTHR;
#endif #endif
/* And make sure that the saved context in the TCB is the same /* And make sure that the saved context in the TCB is the same
@ -203,7 +203,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.saved_primask = tcb->xcp.regs[REG_PRIMASK]; tcb->xcp.saved_primask = tcb->xcp.regs[REG_PRIMASK];
#endif #endif
tcb->xcp.saved_xpsr = tcb->xcp.regs[REG_XPSR]; tcb->xcp.saved_xpsr = tcb->xcp.regs[REG_XPSR];
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
tcb->xcp.saved_lr = tcb->xcp.regs[REG_LR]; tcb->xcp.saved_lr = tcb->xcp.regs[REG_LR];
#endif #endif
/* Then set up to vector to the trampoline with interrupts /* Then set up to vector to the trampoline with interrupts
@ -218,7 +218,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver)
tcb->xcp.regs[REG_PRIMASK] = 1; tcb->xcp.regs[REG_PRIMASK] = 1;
#endif #endif
tcb->xcp.regs[REG_XPSR] = ARMV7M_XPSR_T; tcb->xcp.regs[REG_XPSR] = ARMV7M_XPSR_T;
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
tcb->xcp.regs[REG_LR] = EXC_RETURN_PRIVTHR; tcb->xcp.regs[REG_LR] = EXC_RETURN_PRIVTHR;
#endif #endif
} }

View File

@ -108,7 +108,7 @@ void up_sigdeliver(void)
regs[REG_PRIMASK] = rtcb->xcp.saved_primask; regs[REG_PRIMASK] = rtcb->xcp.saved_primask;
#endif #endif
regs[REG_XPSR] = rtcb->xcp.saved_xpsr; regs[REG_XPSR] = rtcb->xcp.saved_xpsr;
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
regs[REG_LR] = rtcb->xcp.saved_lr; regs[REG_LR] = rtcb->xcp.saved_lr;
#endif #endif

View File

@ -41,7 +41,7 @@
#include <arch/syscall.h> #include <arch/syscall.h>
#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) #if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__)
/**************************************************************************** /****************************************************************************
* File info * File info
@ -115,4 +115,4 @@ up_signal_handler:
.size up_signal_handler, .-up_signal_handler .size up_signal_handler, .-up_signal_handler
.end .end
#endif /* CONFIG_NUTTX_KERNEL && !__KERNEL__ */ #endif /* CONFIG_BUILD_PROTECTED && !__KERNEL__ */

View File

@ -311,7 +311,7 @@ int up_svcall(int irq, FAR void *context)
* R3 = argv * R3 = argv
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
case SYS_task_start: case SYS_task_start:
{ {
/* Set up to return to the user-space task start-up function in /* Set up to return to the user-space task start-up function in
@ -343,7 +343,7 @@ int up_svcall(int irq, FAR void *context)
* R2 = arg * R2 = arg
*/ */
#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_PTHREAD) #if defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_DISABLE_PTHREAD)
case SYS_pthread_start: case SYS_pthread_start:
{ {
/* Set up to return to the user-space pthread start-up function in /* Set up to return to the user-space pthread start-up function in
@ -377,7 +377,7 @@ int up_svcall(int irq, FAR void *context)
* ucontext (on the stack) * ucontext (on the stack)
*/ */
#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) #if defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_DISABLE_SIGNALS)
case SYS_signal_handler: case SYS_signal_handler:
{ {
struct tcb_s *rtcb = sched_self(); struct tcb_s *rtcb = sched_self();
@ -420,7 +420,7 @@ int up_svcall(int irq, FAR void *context)
* R0 = SYS_signal_handler_return * R0 = SYS_signal_handler_return
*/ */
#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) #if defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_DISABLE_SIGNALS)
case SYS_signal_handler_return: case SYS_signal_handler_return:
{ {
struct tcb_s *rtcb = sched_self(); struct tcb_s *rtcb = sched_self();

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/common/up_allocateheap.c * arch/arm/src/common/up_allocateheap.c
* *
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Copyright (C) 2007, 2008, 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -55,6 +55,13 @@
/**************************************************************************** /****************************************************************************
* Private Definitions * Private Definitions
****************************************************************************/ ****************************************************************************/
/* Configuration */
#undef HAVE_KERNEL_HEAP
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \
defined(CONFIG_MM_KERNEL_HEAP)
# define HAVE_KERNEL_HEAP 1
#endif
/**************************************************************************** /****************************************************************************
* Private Data * Private Data
@ -74,9 +81,9 @@
* Description: * Description:
* This function will be called to dynamically set aside the heap region. * This function will be called to dynamically set aside the heap region.
* *
* For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and * For the kernel build (CONFIG_BUILD_KERNEL/PROTECTED=y) with both kernel-
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * and user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides
* size of the unprotected, user-space heap. * the size of the unprotected, user-space heap.
* *
* If a protected kernel-space heap is provided, the kernel heap must be * If a protected kernel-space heap is provided, the kernel heap must be
* allocated by an analogous up_allocate_kheap(). A custom version of this * allocated by an analogous up_allocate_kheap(). A custom version of this
@ -104,7 +111,7 @@
void up_allocate_heap(FAR void **heap_start, size_t *heap_size) void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
{ {
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef HAVE_KERNEL_HEAP
/* Get the unaligned size and position of the user-space heap. /* Get the unaligned size and position of the user-space heap.
* This heap begins after the user-space .bss section at an offset * This heap begins after the user-space .bss section at an offset
* of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment). * of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment).
@ -134,14 +141,14 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
* Name: up_allocate_kheap * Name: up_allocate_kheap
* *
* Description: * Description:
* For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and * For the kernel build (CONFIG_BUILD_PROTECTED/KERNEL=y) with both kernel-
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates * and user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates
* the kernel-space heap. A custom version of this function is need if * the kernel-space heap. A custom version of this function is need if
* memory protection of the kernel heap is required. * memory protection of the kernel heap is required.
* *
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef HAVE_KERNEL_HEAP
void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
{ {
/* Get the unaligned size and position of the user-space heap. /* Get the unaligned size and position of the user-space heap.

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/common/up_createstack.c * arch/arm/src/common/up_createstack.c
* *
* Copyright (C) 2007-2013 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -54,6 +54,13 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Macros * Pre-processor Macros
****************************************************************************/ ****************************************************************************/
/* Configuration */
#undef HAVE_KERNEL_HEAP
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \
defined(CONFIG_MM_KERNEL_HEAP)
# define HAVE_KERNEL_HEAP 1
#endif
/* ARM requires at least a 4-byte stack alignment. For use with EABI and /* ARM requires at least a 4-byte stack alignment. For use with EABI and
* floating point, the stack must be aligned to 8-byte addresses. * floating point, the stack must be aligned to 8-byte addresses.
@ -120,10 +127,11 @@
* however, there are certain contexts where the TCB may not be fully * however, there are certain contexts where the TCB may not be fully
* initialized when up_create_stack is called. * initialized when up_create_stack is called.
* *
* If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect * If either CONFIG_BUILD_PROTECTED or CONFIG_BUILD_KERNEL are defined,
* how the stack is allocated. For example, kernel thread stacks should * then this thread type may affect how the stack is allocated. For
* be allocated from protected kernel memory. Stacks for user tasks and * example, kernel thread stacks should be allocated from protected
* threads must come from memory that is accessible to user code. * kernel memory. Stacks for user tasks and threads must come from
* memory that is accessible to user code.
* *
****************************************************************************/ ****************************************************************************/
@ -149,7 +157,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype)
* then create a zeroed stack to make stack dumps easier to trace. * then create a zeroed stack to make stack dumps easier to trace.
*/ */
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef HAVE_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/common/up_pthread_start.c * arch/arm/src/common/up_pthread_start.c
* *
* Copyright (C) 2013 Gregory Nutt. All rights reserved. * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -44,7 +44,9 @@
#include "svcall.h" #include "svcall.h"
#include "up_internal.h" #include "up_internal.h"
#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) && !defined(CONFIG_DISABLE_PTHREAD) #if ((defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__) || \
defined(defined(CONFIG_BUILD_KERNEL)) && \
!defined(CONFIG_DISABLE_PTHREAD)
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@ -93,4 +95,4 @@ void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg)
sys_call2(SYS_pthread_start, (uintptr_t)entrypt, (uintptr_t)arg); sys_call2(SYS_pthread_start, (uintptr_t)entrypt, (uintptr_t)arg);
} }
#endif /* CONFIG_NUTTX_KERNEL &&& __KERNEL__ && !CONFIG_DISABLE_PTHREAD */ #endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */

View File

@ -47,6 +47,17 @@
#include "up_internal.h" #include "up_internal.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration */
#undef HAVE_KERNEL_HEAP
#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \
defined(CONFIG_MM_KERNEL_HEAP)
# define HAVE_KERNEL_HEAP 1
#endif
/**************************************************************************** /****************************************************************************
* Private Types * Private Types
****************************************************************************/ ****************************************************************************/
@ -79,11 +90,11 @@
* however, there are certain error recovery contexts where the TCB may * however, there are certain error recovery contexts where the TCB may
* not be fully initialized when up_release_stack is called. * not be fully initialized when up_release_stack is called.
* *
* If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect * If either CONFIG_BUILD_PROTECTED or CONFIG_BUILD_KERNEL are defined,
* how the stack is freed. For example, kernel thread stacks may have * then this thread type may affect how the stack is freed. For example,
* been allocated from protected kernel memory. Stacks for user tasks * kernel thread stacks may have been allocated from protected kernel
* and threads must have come from memory that is accessible to user * memory. Stacks for user tasks and threads must have come from memory
* code. * that is accessible to user code.
* *
* Returned Value: * Returned Value:
* None * None
@ -96,7 +107,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype)
if (dtcb->stack_alloc_ptr) if (dtcb->stack_alloc_ptr)
{ {
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #ifdef HAVE_KERNEL_HEAP
/* Use the kernel allocator if this is a kernel thread */ /* Use the kernel allocator if this is a kernel thread */
if (ttype == TCB_FLAG_TTYPE_KERNEL) if (ttype == TCB_FLAG_TTYPE_KERNEL)

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/common/up_signal_dispatch.c * arch/arm/src/common/up_signal_dispatch.c
* *
* Copyright (C) 2013 Gregory Nutt. All rights reserved. * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -43,7 +43,9 @@
#include "svcall.h" #include "svcall.h"
#include "up_internal.h" #include "up_internal.h"
#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) && !defined(CONFIG_DISABLE_SIGNALS) #if ((defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__) || \
defined(defined(CONFIG_BUILD_KERNEL)) && \
!defined(CONFIG_DISABLE_SIGNALS)
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@ -99,4 +101,4 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo,
(uintptr_t)info, (uintptr_t)ucontext); (uintptr_t)info, (uintptr_t)ucontext);
} }
#endif /* CONFIG_NUTTX_KERNEL && __KERNEL__ && !CONFIG_DISABLE_SIGNALS */ #endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* arch/arm/src/common/up_task_start.c * arch/arm/src/common/up_task_start.c
* *
* Copyright (C) 2013 Gregory Nutt. All rights reserved. * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -43,7 +43,7 @@
#include "svcall.h" #include "svcall.h"
#include "up_internal.h" #include "up_internal.h"
#ifdef CONFIG_NUTTX_KERNEL #if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@ -94,4 +94,4 @@ void up_task_start(main_t taskentry, int argc, FAR char *argv[])
(uintptr_t)argv); (uintptr_t)argv);
} }
#endif /* CONFIG_NUTTX_KERNEL */ #endif /* CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL */

View File

@ -71,7 +71,7 @@
* This function will be called to dynamically set aside * This function will be called to dynamically set aside
* the heap region. * the heap region.
* *
* For the kernel build (CONFIG_NUTTX_KERNEL=y) with both * For the kernel build (CONFIG_BUILD_KERNEL=y) with both
* kernel- and user-space heaps (CONFIG_MM_KERNEL_HEAP=y), * kernel- and user-space heaps (CONFIG_MM_KERNEL_HEAP=y),
* this function provides the size of the unprotected, * this function provides the size of the unprotected,
* user-space heap. * user-space heap.

View File

@ -74,7 +74,7 @@
* Description: * Description:
* This function will be called to dynamically set aside the heap region. * This function will be called to dynamically set aside the heap region.
* *
* For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and * For the kernel build (CONFIG_BUILD_KERNEL=y) with both kernel- and
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the
* size of the unprotected, user-space heap. * size of the unprotected, user-space heap.
* *

View File

@ -58,7 +58,7 @@ ifeq ($(CONFIG_ARCH_MEMCPY),y)
CMN_ASRCS += up_memcpy.S CMN_ASRCS += up_memcpy.S
endif endif
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c up_stackframe.c CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c up_stackframe.c
ifneq ($(CONFIG_DISABLE_SIGNALS),y) ifneq ($(CONFIG_DISABLE_SIGNALS),y)
CMN_CSRCS += up_signal_dispatch.c CMN_CSRCS += up_signal_dispatch.c
@ -91,7 +91,7 @@ ifneq ($(CONFIG_SCHED_TICKLESS),y)
CHIP_CSRCS += kinetis_timerisr.c CHIP_CSRCS += kinetis_timerisr.c
endif endif
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
CHIP_CSRCS += kinetis_userspace.c kinetis_mpuinit.c CHIP_CSRCS += kinetis_userspace.c kinetis_mpuinit.c
endif endif

View File

@ -76,7 +76,7 @@
* Description: * Description:
* This function will be called to dynamically set aside the heap region. * This function will be called to dynamically set aside the heap region.
* *
* For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the
* size of the unprotected, user-space heap. * size of the unprotected, user-space heap.
* *
@ -105,7 +105,7 @@
void up_allocate_heap(FAR void **heap_start, size_t *heap_size) void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
{ {
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
/* Get the unaligned size and position of the user-space heap. /* Get the unaligned size and position of the user-space heap.
* This heap begins after the user-space .bss section at an offset * This heap begins after the user-space .bss section at an offset
* of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment). * of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment).
@ -151,13 +151,13 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
* Name: up_allocate_kheap * Name: up_allocate_kheap
* *
* Description: * Description:
* For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates
* (and protects) the kernel-space heap. * (and protects) the kernel-space heap.
* *
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
{ {
/* Get the unaligned size and position of the user-space heap. /* Get the unaligned size and position of the user-space heap.

View File

@ -46,7 +46,7 @@
#include "mpu.h" #include "mpu.h"
#include "kinetis_mpuinit.h" #include "kinetis_mpuinit.h"
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_ARMV7M_MPU) #if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_ARMV7M_MPU)
/**************************************************************************** /****************************************************************************
* Private Definitions * Private Definitions
@ -120,5 +120,5 @@ void kinetis_mpu_uheap(uintptr_t start, size_t size)
mpu_userintsram(start, size); mpu_userintsram(start, size);
} }
#endif /* CONFIG_NUTTX_KERNEL && CONFIG_ARMV7M_MPU */ #endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARMV7M_MPU */

View File

@ -67,7 +67,7 @@
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void kinetis_mpuinitialize(void); void kinetis_mpuinitialize(void);
#else #else
# define kinetis_mpuinitialize() # define kinetis_mpuinitialize()
@ -81,7 +81,7 @@ void kinetis_mpuinitialize(void);
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void kinetis_mpu_uheap(uintptr_t start, size_t size); void kinetis_mpu_uheap(uintptr_t start, size_t size);
#else #else
# define kinetis_mpu_uheap(start,size) # define kinetis_mpu_uheap(start,size)

View File

@ -146,7 +146,7 @@ void __start(void)
* segments. * segments.
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
kinetis_userspace(); kinetis_userspace();
#endif #endif

View File

@ -47,7 +47,7 @@
#include "kinetis_mpuinit.h" #include "kinetis_mpuinit.h"
#include "kinetis_userspace.h" #include "kinetis_userspace.h"
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@ -115,5 +115,5 @@ void kinetis_userspace(void)
kinetis_mpuinitialize(); kinetis_mpuinitialize();
} }
#endif /* CONFIG_NUTTX_KERNEL */ #endif /* CONFIG_BUILD_PROTECTED */

View File

@ -69,7 +69,7 @@
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void kinetis_userspace(void); void kinetis_userspace(void);
#endif #endif

View File

@ -63,7 +63,7 @@
* nested interrupt, the interrupt stack if no privileged task has run. * nested interrupt, the interrupt stack if no privileged task has run.
*/ */
# if defined(CONFIG_NUTTX_KERNEL) && CONFIG_ARCH_INTERRUPTSTACK < 4 # if defined(CONFIG_BUILD_PROTECTED) && CONFIG_ARCH_INTERRUPTSTACK < 4
# error Interrupt stack must be used with high priority interrupts in kernel mode # error Interrupt stack must be used with high priority interrupts in kernel mode
# endif # endif
@ -621,7 +621,7 @@ exception_common:
/* Complete the context save */ /* Complete the context save */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1
* (handler mode) if the stack is on the MSP. It can only be on the PSP if * (handler mode) if the stack is on the MSP. It can only be on the PSP if
* EXC_RETURN is 0xfffffffd (unprivileged thread) * EXC_RETURN is 0xfffffffd (unprivileged thread)
@ -663,7 +663,7 @@ exception_common:
* r14=register values. * r14=register values.
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP value */
#else #else
stmdb sp!, {r2-r11} /* Save the remaining registers plus the SP value */ stmdb sp!, {r2-r11} /* Save the remaining registers plus the SP value */
@ -751,7 +751,7 @@ exception_common:
ldmia r1, {r4-r11} /* Fetch eight registers in HW save area */ ldmia r1, {r4-r11} /* Fetch eight registers in HW save area */
ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */ ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */
stmdb r1!, {r4-r11} /* Store eight registers in HW save area */ stmdb r1!, {r4-r11} /* Store eight registers in HW save area */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
ldmia r0, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ ldmia r0, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */
#else #else
ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */ ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */
@ -766,7 +766,7 @@ exception_common:
*/ */
2: 2:
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */
#else #else
ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */ ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */
@ -791,7 +791,7 @@ exception_common:
3: 3:
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1
* (handler mode) if the stack is on the MSP. It can only be on the PSP if * (handler mode) if the stack is on the MSP. It can only be on the PSP if
* EXC_RETURN is 0xfffffffd (unprivileged thread) * EXC_RETURN is 0xfffffffd (unprivileged thread)

View File

@ -47,7 +47,7 @@ CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c up_systemreset.c
CMN_CSRCS += up_unblocktask.c up_usestack.c up_doirq.c up_hardfault.c CMN_CSRCS += up_unblocktask.c up_usestack.c up_doirq.c up_hardfault.c
CMN_CSRCS += up_svcall.c up_vectors.c up_vfork.c CMN_CSRCS += up_svcall.c up_vectors.c up_vfork.c
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
CMN_CSRCS += up_task_start.c up_pthread_start.c up_stackframe.c CMN_CSRCS += up_task_start.c up_pthread_start.c up_stackframe.c
ifneq ($(CONFIG_DISABLE_SIGNALS),y) ifneq ($(CONFIG_DISABLE_SIGNALS),y)
CMN_CSRCS += up_signal_dispatch.c CMN_CSRCS += up_signal_dispatch.c
@ -75,7 +75,7 @@ ifneq ($(CONFIG_SCHED_TICKLESS),y)
CHIP_CSRCS += kl_timerisr.c CHIP_CSRCS += kl_timerisr.c
endif endif
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
CHIP_CSRCS += kl_userspace.c CHIP_CSRCS += kl_userspace.c
endif endif

View File

@ -162,7 +162,7 @@ void __start(void)
* segments. * segments.
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
kl_userspace(); kl_userspace();
showprogress('E'); showprogress('E');
#endif #endif

View File

@ -46,7 +46,7 @@
#include "kl_userspace.h" #include "kl_userspace.h"
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@ -110,5 +110,5 @@ void kl_userspace(void)
} }
} }
#endif /* CONFIG_NUTTX_KERNEL */ #endif /* CONFIG_BUILD_PROTECTED */

View File

@ -69,7 +69,7 @@
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void kl_userspace(void); void kl_userspace(void);
#endif #endif

View File

@ -70,7 +70,7 @@ ifeq ($(CONFIG_ARCH_MEMCPY),y)
CMN_ASRCS += up_memcpy.S CMN_ASRCS += up_memcpy.S
endif endif
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c up_stackframe.c CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c up_stackframe.c
ifneq ($(CONFIG_DISABLE_SIGNALS),y) ifneq ($(CONFIG_DISABLE_SIGNALS),y)
CMN_CSRCS += up_signal_dispatch.c CMN_CSRCS += up_signal_dispatch.c
@ -113,7 +113,7 @@ ifeq ($(CONFIG_ARMV7M_CMNVECTOR),y)
CHIP_ASRCS += lpc17_vectors.S CHIP_ASRCS += lpc17_vectors.S
endif endif
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
CHIP_CSRCS += lpc17_userspace.c lpc17_mpuinit.c CHIP_CSRCS += lpc17_userspace.c lpc17_mpuinit.c
endif endif

View File

@ -186,7 +186,7 @@
* Description: * Description:
* This function will be called to dynamically set aside the heap region. * This function will be called to dynamically set aside the heap region.
* *
* For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the
* size of the unprotected, user-space heap. * size of the unprotected, user-space heap.
* *
@ -215,7 +215,7 @@
void up_allocate_heap(FAR void **heap_start, size_t *heap_size) void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
{ {
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
/* Get the unaligned size and position of the user-space heap. /* Get the unaligned size and position of the user-space heap.
* This heap begins after the user-space .bss section at an offset * This heap begins after the user-space .bss section at an offset
* of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment). * of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment).
@ -261,13 +261,13 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
* Name: up_allocate_kheap * Name: up_allocate_kheap
* *
* Description: * Description:
* For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates
* (and protects) the kernel-space heap. * (and protects) the kernel-space heap.
* *
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
{ {
/* Get the unaligned size and position of the user-space heap. /* Get the unaligned size and position of the user-space heap.
@ -326,7 +326,7 @@ void up_addregion(void)
*/ */
#ifdef LPC17_AHB_HEAPBASE #ifdef LPC17_AHB_HEAPBASE
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
/* Yes.. allow user-mode access to the AHB SRAM user heap memory */ /* Yes.. allow user-mode access to the AHB SRAM user heap memory */

View File

@ -46,7 +46,7 @@
#include "mpu.h" #include "mpu.h"
#include "lpc17_mpuinit.h" #include "lpc17_mpuinit.h"
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_ARMV7M_MPU) #if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_ARMV7M_MPU)
/**************************************************************************** /****************************************************************************
* Private Definitions * Private Definitions
@ -120,5 +120,5 @@ void lpc17_mpu_uheap(uintptr_t start, size_t size)
mpu_userintsram(start, size); mpu_userintsram(start, size);
} }
#endif /* CONFIG_NUTTX_KERNEL && CONFIG_ARMV7M_MPU */ #endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARMV7M_MPU */

View File

@ -67,7 +67,7 @@
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void lpc17_mpuinitialize(void); void lpc17_mpuinitialize(void);
#else #else
# define lpc17_mpuinitialize() # define lpc17_mpuinitialize()
@ -81,7 +81,7 @@ void lpc17_mpuinitialize(void);
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void lpc17_mpu_uheap(uintptr_t start, size_t size); void lpc17_mpu_uheap(uintptr_t start, size_t size);
#else #else
# define lpc17_mpu_uheap(start,size) # define lpc17_mpu_uheap(start,size)

View File

@ -239,7 +239,7 @@ void __start(void)
* segments. * segments.
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
lpc17_userspace(); lpc17_userspace();
showprogress('E'); showprogress('E');
#endif #endif

View File

@ -47,7 +47,7 @@
#include "lpc17_mpuinit.h" #include "lpc17_mpuinit.h"
#include "lpc17_userspace.h" #include "lpc17_userspace.h"
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@ -115,5 +115,5 @@ void lpc17_userspace(void)
lpc17_mpuinitialize(); lpc17_mpuinitialize();
} }
#endif /* CONFIG_NUTTX_KERNEL */ #endif /* CONFIG_BUILD_PROTECTED */

View File

@ -69,7 +69,7 @@
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void lpc17_userspace(void); void lpc17_userspace(void);
#endif #endif

View File

@ -64,7 +64,7 @@
* nested interrupt, the interrupt stack if no privileged task has run. * nested interrupt, the interrupt stack if no privileged task has run.
*/ */
# if defined(CONFIG_NUTTX_KERNEL) && CONFIG_ARCH_INTERRUPTSTACK < 4 # if defined(CONFIG_BUILD_PROTECTED) && CONFIG_ARCH_INTERRUPTSTACK < 4
# error Interrupt stack must be used with high priority interrupts in kernel mode # error Interrupt stack must be used with high priority interrupts in kernel mode
# endif # endif
@ -233,7 +233,7 @@ exception_common:
/* Complete the context save */ /* Complete the context save */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1
* (handler mode) if the stack is on the MSP. It can only be on the PSP if * (handler mode) if the stack is on the MSP. It can only be on the PSP if
* EXC_RETURN is 0xfffffffd (unprivileged thread) * EXC_RETURN is 0xfffffffd (unprivileged thread)
@ -275,7 +275,7 @@ exception_common:
* r14=register values. * r14=register values.
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP value */
#else #else
stmdb sp!, {r2-r11} /* Save the remaining registers plus the SP value */ stmdb sp!, {r2-r11} /* Save the remaining registers plus the SP value */
@ -363,7 +363,7 @@ exception_common:
ldmia r1, {r4-r11} /* Fetch eight registers in HW save area */ ldmia r1, {r4-r11} /* Fetch eight registers in HW save area */
ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */ ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */
stmdb r1!, {r4-r11} /* Store eight registers in HW save area */ stmdb r1!, {r4-r11} /* Store eight registers in HW save area */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
ldmia r0, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ ldmia r0, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */
#else #else
ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */ ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */
@ -378,7 +378,7 @@ exception_common:
*/ */
2: 2:
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */
#else #else
ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */ ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */
@ -403,7 +403,7 @@ exception_common:
3: 3:
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1
* (handler mode) if the stack is on the MSP. It can only be on the PSP if * (handler mode) if the stack is on the MSP. It can only be on the PSP if
* EXC_RETURN is 0xfffffffd (unprivileged thread) * EXC_RETURN is 0xfffffffd (unprivileged thread)

View File

@ -159,7 +159,7 @@
* Description: * Description:
* This function will be called to dynamically set aside the heap region. * This function will be called to dynamically set aside the heap region.
* *
* For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and * For the kernel build (CONFIG_BUILD_KERNEL=y) with both kernel- and
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the
* size of the unprotected, user-space heap. * size of the unprotected, user-space heap.
* *

View File

@ -59,7 +59,7 @@ ifeq ($(CONFIG_ARCH_MEMCPY),y)
CMN_ASRCS += up_memcpy.S CMN_ASRCS += up_memcpy.S
endif endif
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c up_stackframe.c CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c up_stackframe.c
ifneq ($(CONFIG_DISABLE_SIGNALS),y) ifneq ($(CONFIG_DISABLE_SIGNALS),y)
CMN_CSRCS += up_signal_dispatch.c CMN_CSRCS += up_signal_dispatch.c
@ -91,7 +91,7 @@ ifneq ($(CONFIG_SCHED_TICKLESS),y)
CHIP_CSRCS += lpc43_timerisr.c CHIP_CSRCS += lpc43_timerisr.c
endif endif
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
CHIP_CSRCS += lpc43_userspace.c lpc43_mpuinit.c CHIP_CSRCS += lpc43_userspace.c lpc43_mpuinit.c
endif endif

View File

@ -234,7 +234,7 @@ const uint32_t g_idle_topstack = (uint32_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE;
* Description: * Description:
* This function will be called to dynamically set aside the heap region. * This function will be called to dynamically set aside the heap region.
* *
* For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the
* size of the unprotected, user-space heap. * size of the unprotected, user-space heap.
* *

View File

@ -46,7 +46,7 @@
#include "mpu.h" #include "mpu.h"
#include "lpc43_mpuinit.h" #include "lpc43_mpuinit.h"
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_ARMV7M_MPU) #if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_ARMV7M_MPU)
/**************************************************************************** /****************************************************************************
* Private Definitions * Private Definitions
@ -120,5 +120,5 @@ void lpc43_mpu_uheap(uintptr_t start, size_t size)
mpu_userintsram(start, size); mpu_userintsram(start, size);
} }
#endif /* CONFIG_NUTTX_KERNEL && CONFIG_ARMV7M_MPU */ #endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARMV7M_MPU */

View File

@ -67,7 +67,7 @@
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void lpc43_mpuinitialize(void); void lpc43_mpuinitialize(void);
#else #else
# define lpc43_mpuinitialize() # define lpc43_mpuinitialize()
@ -81,7 +81,7 @@ void lpc43_mpuinitialize(void);
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void lpc43_mpu_uheap(uintptr_t start, size_t size); void lpc43_mpu_uheap(uintptr_t start, size_t size);
#else #else
# define lpc43_mpu_uheap(start,size) # define lpc43_mpu_uheap(start,size)

View File

@ -339,7 +339,7 @@ void __start(void)
* segments. * segments.
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
lpc43_userspace(); lpc43_userspace();
showprogress('F'); showprogress('F');
#endif #endif

View File

@ -47,7 +47,7 @@
#include "lpc43_mpuinit.h" #include "lpc43_mpuinit.h"
#include "lpc43_userspace.h" #include "lpc43_userspace.h"
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@ -115,5 +115,5 @@ void lpc43_userspace(void)
lpc43_mpuinitialize(); lpc43_mpuinitialize();
} }
#endif /* CONFIG_NUTTX_KERNEL */ #endif /* CONFIG_BUILD_PROTECTED */

View File

@ -69,7 +69,7 @@
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void lpc43_userspace(void); void lpc43_userspace(void);
#endif #endif

View File

@ -47,7 +47,7 @@ CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c up_systemreset.c
CMN_CSRCS += up_unblocktask.c up_usestack.c up_doirq.c up_hardfault.c CMN_CSRCS += up_unblocktask.c up_usestack.c up_doirq.c up_hardfault.c
CMN_CSRCS += up_svcall.c up_vectors.c up_vfork.c CMN_CSRCS += up_svcall.c up_vectors.c up_vfork.c
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
CMN_CSRCS += up_task_start.c up_pthread_start.c up_stackframe.c CMN_CSRCS += up_task_start.c up_pthread_start.c up_stackframe.c
ifneq ($(CONFIG_DISABLE_SIGNALS),y) ifneq ($(CONFIG_DISABLE_SIGNALS),y)
CMN_CSRCS += up_signal_dispatch.c CMN_CSRCS += up_signal_dispatch.c
@ -75,7 +75,7 @@ ifneq ($(CONFIG_SCHED_TICKLESS),y)
CHIP_CSRCS += nuc_timerisr.c CHIP_CSRCS += nuc_timerisr.c
endif endif
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
CHIP_CSRCS += nuc_userspace.c CHIP_CSRCS += nuc_userspace.c
endif endif

View File

@ -156,7 +156,7 @@ void __start(void)
* segments. * segments.
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
nuc_userspace(); nuc_userspace();
showprogress('E'); showprogress('E');
#endif #endif

View File

@ -46,7 +46,7 @@
#include "nuc_userspace.h" #include "nuc_userspace.h"
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@ -110,5 +110,5 @@ void nuc_userspace(void)
} }
} }
#endif /* CONFIG_NUTTX_KERNEL */ #endif /* CONFIG_BUILD_PROTECTED */

View File

@ -69,7 +69,7 @@
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void nuc_userspace(void); void nuc_userspace(void);
#endif #endif

View File

@ -62,7 +62,7 @@ ifeq ($(CONFIG_ARCH_MEMCPY),y)
CMN_ASRCS += up_memcpy.S CMN_ASRCS += up_memcpy.S
endif endif
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c up_stackframe.c CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c up_stackframe.c
ifneq ($(CONFIG_DISABLE_SIGNALS),y) ifneq ($(CONFIG_DISABLE_SIGNALS),y)
CMN_CSRCS += up_signal_dispatch.c CMN_CSRCS += up_signal_dispatch.c
@ -104,7 +104,7 @@ else
CHIP_CSRCS += sam_clockconfig.c sam_gpio.c CHIP_CSRCS += sam_clockconfig.c sam_gpio.c
endif endif
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
CHIP_CSRCS += sam_userspace.c sam_mpuinit.c CHIP_CSRCS += sam_userspace.c sam_mpuinit.c
endif endif

View File

@ -175,7 +175,7 @@
* Description: * Description:
* This function will be called to dynamically set aside the heap region. * This function will be called to dynamically set aside the heap region.
* *
* For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the
* size of the unprotected, user-space heap. * size of the unprotected, user-space heap.
* *
@ -204,7 +204,7 @@
void up_allocate_heap(FAR void **heap_start, size_t *heap_size) void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
{ {
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
/* Get the unaligned size and position of the user-space heap. /* Get the unaligned size and position of the user-space heap.
* This heap begins after the user-space .bss section at an offset * This heap begins after the user-space .bss section at an offset
* of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment). * of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment).
@ -250,13 +250,13 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
* Name: up_allocate_kheap * Name: up_allocate_kheap
* *
* Description: * Description:
* For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates
* (and protects) the kernel-space heap. * (and protects) the kernel-space heap.
* *
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
{ {
/* Get the unaligned size and position of the user-space heap. /* Get the unaligned size and position of the user-space heap.

View File

@ -46,7 +46,7 @@
#include "mpu.h" #include "mpu.h"
#include "sam_mpuinit.h" #include "sam_mpuinit.h"
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_ARMV7M_MPU) #if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_ARMV7M_MPU)
/**************************************************************************** /****************************************************************************
* Private Definitions * Private Definitions
@ -120,5 +120,5 @@ void sam_mpu_uheap(uintptr_t start, size_t size)
mpu_userintsram(start, size); mpu_userintsram(start, size);
} }
#endif /* CONFIG_NUTTX_KERNEL && CONFIG_ARMV7M_MPU */ #endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARMV7M_MPU */

View File

@ -85,7 +85,7 @@ extern "C"
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void sam_mpuinitialize(void); void sam_mpuinitialize(void);
#else #else
# define sam_mpuinitialize() # define sam_mpuinitialize()
@ -99,7 +99,7 @@ void sam_mpuinitialize(void);
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void sam_mpu_uheap(uintptr_t start, size_t size); void sam_mpu_uheap(uintptr_t start, size_t size);
#else #else
# define sam_mpu_uheap(start,size) # define sam_mpu_uheap(start,size)

View File

@ -154,7 +154,7 @@ void __start(void)
* segements. * segements.
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
sam_userspace(); sam_userspace();
showprogress('C'); showprogress('C');
#endif #endif

View File

@ -47,7 +47,7 @@
#include "sam_mpuinit.h" #include "sam_mpuinit.h"
#include "sam_userspace.h" #include "sam_userspace.h"
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/**************************************************************************** /****************************************************************************
* Private Definitions * Private Definitions
@ -115,5 +115,5 @@ void sam_userspace(void)
sam_mpuinitialize(); sam_mpuinitialize();
} }
#endif /* CONFIG_NUTTX_KERNEL */ #endif /* CONFIG_BUILD_PROTECTED */

View File

@ -92,7 +92,7 @@ extern "C"
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void sam_userspace(void); void sam_userspace(void);
#endif #endif

View File

@ -62,7 +62,7 @@
* nested interrupt, the interrupt stack if no privileged task has run. * nested interrupt, the interrupt stack if no privileged task has run.
*/ */
# if defined(CONFIG_NUTTX_KERNEL) && CONFIG_ARCH_INTERRUPTSTACK < 4 # if defined(CONFIG_BUILD_PROTECTED) && CONFIG_ARCH_INTERRUPTSTACK < 4
# error Interrupt stack must be used with high priority interrupts in kernel mode # error Interrupt stack must be used with high priority interrupts in kernel mode
# endif # endif
@ -246,7 +246,7 @@ exception_common:
/* Complete the context save */ /* Complete the context save */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1
* (handler mode) if the stack is on the MSP. It can only be on the PSP if * (handler mode) if the stack is on the MSP. It can only be on the PSP if
* EXC_RETURN is 0xfffffffd (unprivileged thread) * EXC_RETURN is 0xfffffffd (unprivileged thread)
@ -288,7 +288,7 @@ exception_common:
* r14=register values. * r14=register values.
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP value */
#else #else
stmdb sp!, {r2-r11} /* Save the remaining registers plus the SP value */ stmdb sp!, {r2-r11} /* Save the remaining registers plus the SP value */
@ -376,7 +376,7 @@ exception_common:
ldmia r1, {r4-r11} /* Fetch eight registers in HW save area */ ldmia r1, {r4-r11} /* Fetch eight registers in HW save area */
ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */ ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */
stmdb r1!, {r4-r11} /* Store eight registers in HW save area */ stmdb r1!, {r4-r11} /* Store eight registers in HW save area */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
ldmia r0, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ ldmia r0, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */
#else #else
ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */ ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */
@ -391,7 +391,7 @@ exception_common:
*/ */
2: 2:
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */
#else #else
ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */ ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */
@ -416,7 +416,7 @@ exception_common:
3: 3:
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1
* (handler mode) if the stack is on the MSP. It can only be on the PSP if * (handler mode) if the stack is on the MSP. It can only be on the PSP if
* EXC_RETURN is 0xfffffffd (unprivileged thread) * EXC_RETURN is 0xfffffffd (unprivileged thread)

View File

@ -46,7 +46,6 @@
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/kmalloc.h> #include <nuttx/kmalloc.h>
#include <nuttx/userspace.h>
#include <arch/board/board.h> #include <arch/board/board.h>
@ -219,7 +218,7 @@
* Description: * Description:
* This function will be called to dynamically set aside the heap region. * This function will be called to dynamically set aside the heap region.
* *
* For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and * For the kernel build (CONFIG_BUILD_KERNEL=y) with both kernel- and
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the
* size of the unprotected, user-space heap. * size of the unprotected, user-space heap.
* *
@ -249,7 +248,7 @@
void up_allocate_heap(FAR void **heap_start, size_t *heap_size) void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
{ {
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP)
/* Get the unaligned size and position of the user-space heap. /* Get the unaligned size and position of the user-space heap.
* This heap begins after the user-space .bss section at an offset * This heap begins after the user-space .bss section at an offset
* of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment). * of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment).
@ -291,14 +290,14 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
* Name: up_allocate_kheap * Name: up_allocate_kheap
* *
* Description: * Description:
* For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and * For the kernel build (CONFIG_BUILD_KERNEL=y) with both kernel- and
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates
* the kernel-space heap. A custom version of this function is need if * the kernel-space heap. A custom version of this function is need if
* memory protection of the kernel heap is required. * memory protection of the kernel heap is required.
* *
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP)
void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
{ {
/* Get the unaligned size and position of the user-space heap. /* Get the unaligned size and position of the user-space heap.
@ -341,7 +340,7 @@ void up_addregion(void)
vaddr = (uintptr_t)SAM_ISRAM0_VADDR vaddr = (uintptr_t)SAM_ISRAM0_VADDR
size = SAM_ISRAM0_SIZE + SAM_ISRAM1_SIZE; size = SAM_ISRAM0_SIZE + SAM_ISRAM1_SIZE;
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP)
/* Allow user-mode access to the ISRAM heap */ /* Allow user-mode access to the ISRAM heap */
sam_uheap(vaddr, size); sam_uheap(vaddr, size);
@ -360,7 +359,7 @@ void up_addregion(void)
vaddr = (uintptr_t)SAM_DDRCS_VSECTION + SAMA5_DDRCS_HEAP_OFFSET; vaddr = (uintptr_t)SAM_DDRCS_VSECTION + SAMA5_DDRCS_HEAP_OFFSET;
size = SAMA5_DDRCS_HEAP_SIZE; size = SAMA5_DDRCS_HEAP_SIZE;
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP)
/* Allow user-mode access to the DDR-SDRAM heap */ /* Allow user-mode access to the DDR-SDRAM heap */
sam_uheap(vaddr, size); sam_uheap(vaddr, size);
@ -385,7 +384,7 @@ void up_addregion(void)
vaddr = (uintptr_t)SAM_EBICS0_VSECTION + SAMA5_EBICS0_HEAP_OFFSET; vaddr = (uintptr_t)SAM_EBICS0_VSECTION + SAMA5_EBICS0_HEAP_OFFSET;
size = SAMA5_EBICS0_HEAP_SIZE; size = SAMA5_EBICS0_HEAP_SIZE;
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP)
/* Allow user-mode access to the EBICS0 heap */ /* Allow user-mode access to the EBICS0 heap */
sam_uheap(vaddr, size); sam_uheap(vaddr, size);
@ -410,7 +409,7 @@ void up_addregion(void)
vaddr = (uintptr_t)SAM_EBICS1_VSECTION + SAMA5_EBICS1_HEAP_OFFSET; vaddr = (uintptr_t)SAM_EBICS1_VSECTION + SAMA5_EBICS1_HEAP_OFFSET;
size = SAMA5_EBICS1_HEAP_SIZE; size = SAMA5_EBICS1_HEAP_SIZE;
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP)
/* Allow user-mode access to the EBICS1 heap */ /* Allow user-mode access to the EBICS1 heap */
sam_uheap(vaddr, size); sam_uheap(vaddr, size);
@ -435,7 +434,7 @@ void up_addregion(void)
vaddr = (uintptr_t)SAM_EBICS2_VSECTION + SAMA5_EBICS2_HEAP_OFFSET; vaddr = (uintptr_t)SAM_EBICS2_VSECTION + SAMA5_EBICS2_HEAP_OFFSET;
size = SAMA5_EBICS2_HEAP_SIZE; size = SAMA5_EBICS2_HEAP_SIZE;
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP)
/* Allow user-mode access to the EBICS2 heap */ /* Allow user-mode access to the EBICS2 heap */
sam_uheap(vaddr, size); sam_uheap(vaddr, size);
@ -460,7 +459,7 @@ void up_addregion(void)
vaddr = (uintptr_t)SAM_EBICS3_VSECTION + SAMA5_EBICS3_HEAP_OFFSET; vaddr = (uintptr_t)SAM_EBICS3_VSECTION + SAMA5_EBICS3_HEAP_OFFSET;
size = SAMA5_EBICS3_HEAP_SIZE; size = SAMA5_EBICS3_HEAP_SIZE;
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP)
/* Allow user-mode access to the EBICS3 heap */ /* Allow user-mode access to the EBICS3 heap */
sam_uheap(vaddr, size); sam_uheap(vaddr, size);

View File

@ -782,14 +782,4 @@ void up_boot(void)
sam_earlyserialinit(); sam_earlyserialinit();
#endif #endif
#ifdef CONFIG_NUTTX_KERNEL
/* For the case of the separate user-/kernel-space build, perform whatever
* platform specific initialization of the user memory is required.
* Normally this just means initializing the user space .data and .bss
* segments.
*/
sam_userspace();
#endif
} }

View File

@ -47,7 +47,7 @@ CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c up_systemreset.c
CMN_CSRCS += up_unblocktask.c up_usestack.c up_doirq.c up_hardfault.c CMN_CSRCS += up_unblocktask.c up_usestack.c up_doirq.c up_hardfault.c
CMN_CSRCS += up_svcall.c up_vectors.c up_vfork.c CMN_CSRCS += up_svcall.c up_vectors.c up_vfork.c
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
CMN_CSRCS += up_task_start.c up_pthread_start.c up_stackframe.c CMN_CSRCS += up_task_start.c up_pthread_start.c up_stackframe.c
ifneq ($(CONFIG_DISABLE_SIGNALS),y) ifneq ($(CONFIG_DISABLE_SIGNALS),y)
CMN_CSRCS += up_signal_dispatch.c CMN_CSRCS += up_signal_dispatch.c
@ -76,7 +76,7 @@ ifneq ($(CONFIG_SCHED_TICKLESS),y)
CHIP_CSRCS += sam_timerisr.c CHIP_CSRCS += sam_timerisr.c
endif endif
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
CHIP_CSRCS += sam_userspace.c CHIP_CSRCS += sam_userspace.c
endif endif

View File

@ -157,7 +157,7 @@ void __start(void)
* segments. * segments.
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
sam_userspace(); sam_userspace();
showprogress('E'); showprogress('E');
#endif #endif

View File

@ -46,7 +46,7 @@
#include "sam_userspace.h" #include "sam_userspace.h"
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@ -110,4 +110,4 @@ void sam_userspace(void)
} }
} }
#endif /* CONFIG_NUTTX_KERNEL */ #endif /* CONFIG_BUILD_PROTECTED */

View File

@ -69,7 +69,7 @@
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void sam_userspace(void); void sam_userspace(void);
#endif #endif

View File

@ -67,7 +67,7 @@ ifeq ($(CONFIG_ARCH_MEMCPY),y)
CMN_ASRCS += up_memcpy.S CMN_ASRCS += up_memcpy.S
endif endif
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c up_stackframe.c CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c up_stackframe.c
ifneq ($(CONFIG_DISABLE_SIGNALS),y) ifneq ($(CONFIG_DISABLE_SIGNALS),y)
CMN_CSRCS += up_signal_dispatch.c CMN_CSRCS += up_signal_dispatch.c
@ -105,7 +105,7 @@ ifeq ($(CONFIG_ARMV7M_CMNVECTOR),y)
CHIP_ASRCS += stm32_vectors.S CHIP_ASRCS += stm32_vectors.S
endif endif
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
CHIP_CSRCS += stm32_userspace.c stm32_mpuinit.c CHIP_CSRCS += stm32_userspace.c stm32_mpuinit.c
endif endif

View File

@ -426,7 +426,7 @@ static inline void up_heap_color(FAR void *start, size_t size)
* Description: * Description:
* This function will be called to dynamically set aside the heap region. * This function will be called to dynamically set aside the heap region.
* *
* For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the
* size of the unprotected, user-space heap. * size of the unprotected, user-space heap.
* *
@ -455,7 +455,7 @@ static inline void up_heap_color(FAR void *start, size_t size)
void up_allocate_heap(FAR void **heap_start, size_t *heap_size) void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
{ {
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
/* Get the unaligned size and position of the user-space heap. /* Get the unaligned size and position of the user-space heap.
* This heap begins after the user-space .bss section at an offset * This heap begins after the user-space .bss section at an offset
* of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment). * of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment).
@ -509,13 +509,13 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
* Name: up_allocate_kheap * Name: up_allocate_kheap
* *
* Description: * Description:
* For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates
* (and protects) the kernel-space heap. * (and protects) the kernel-space heap.
* *
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
{ {
/* Get the unaligned size and position of the user-space heap. /* Get the unaligned size and position of the user-space heap.
@ -562,7 +562,7 @@ void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
void up_addregion(void) void up_addregion(void)
{ {
#ifndef CONFIG_STM32_CCMEXCLUDE #ifndef CONFIG_STM32_CCMEXCLUDE
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
/* Allow user-mode access to the STM32F20xxx/STM32F40xxx CCM SRAM heap */ /* Allow user-mode access to the STM32F20xxx/STM32F40xxx CCM SRAM heap */
@ -580,7 +580,7 @@ void up_addregion(void)
#endif #endif
#ifdef CONFIG_STM32_FSMC_SRAM #ifdef CONFIG_STM32_FSMC_SRAM
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
/* Allow user-mode access to the FSMC SRAM user heap memory */ /* Allow user-mode access to the FSMC SRAM user heap memory */

View File

@ -46,7 +46,7 @@
#include "mpu.h" #include "mpu.h"
#include "stm32_mpuinit.h" #include "stm32_mpuinit.h"
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_ARMV7M_MPU) #if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_ARMV7M_MPU)
/**************************************************************************** /****************************************************************************
* Private Definitions * Private Definitions
@ -120,5 +120,5 @@ void stm32_mpu_uheap(uintptr_t start, size_t size)
mpu_userintsram(start, size); mpu_userintsram(start, size);
} }
#endif /* CONFIG_NUTTX_KERNEL && CONFIG_ARMV7M_MPU */ #endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARMV7M_MPU */

View File

@ -67,7 +67,7 @@
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void stm32_mpuinitialize(void); void stm32_mpuinitialize(void);
#else #else
# define stm32_mpuinitialize() # define stm32_mpuinitialize()
@ -81,7 +81,7 @@ void stm32_mpuinitialize(void);
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void stm32_mpu_uheap(uintptr_t start, size_t size); void stm32_mpu_uheap(uintptr_t start, size_t size);
#else #else
# define stm32_mpu_uheap(start,size) # define stm32_mpu_uheap(start,size)

View File

@ -280,7 +280,7 @@ void __start(void)
* segments. * segments.
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
stm32_userspace(); stm32_userspace();
showprogress('E'); showprogress('E');
#endif #endif

View File

@ -47,7 +47,7 @@
#include "stm32_mpuinit.h" #include "stm32_mpuinit.h"
#include "stm32_userspace.h" #include "stm32_userspace.h"
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@ -115,5 +115,5 @@ void stm32_userspace(void)
stm32_mpuinitialize(); stm32_mpuinitialize();
} }
#endif /* CONFIG_NUTTX_KERNEL */ #endif /* CONFIG_BUILD_PROTECTED */

View File

@ -69,7 +69,7 @@
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void stm32_userspace(void); void stm32_userspace(void);
#endif #endif

View File

@ -70,7 +70,7 @@
* no privileged task has run. * no privileged task has run.
*/ */
# if defined(CONFIG_NUTTX_KERNEL) && CONFIG_ARCH_INTERRUPTSTACK < 4 # if defined(CONFIG_BUILD_PROTECTED) && CONFIG_ARCH_INTERRUPTSTACK < 4
# error Interrupt stack must be used with high priority interrupts in kernel mode # error Interrupt stack must be used with high priority interrupts in kernel mode
# endif # endif
@ -248,7 +248,7 @@ exception_common:
/* Complete the context save */ /* Complete the context save */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1
* (handler mode) if the stack is on the MSP. It can only be on the PSP if * (handler mode) if the stack is on the MSP. It can only be on the PSP if
* EXC_RETURN is 0xfffffffd (unprivileged thread) * EXC_RETURN is 0xfffffffd (unprivileged thread)
@ -290,7 +290,7 @@ exception_common:
* r14=register values. * r14=register values.
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP value */
#else #else
stmdb sp!, {r2-r11} /* Save the remaining registers plus the SP value */ stmdb sp!, {r2-r11} /* Save the remaining registers plus the SP value */
@ -378,7 +378,7 @@ exception_common:
ldmia r1, {r4-r11} /* Fetch eight registers in HW save area */ ldmia r1, {r4-r11} /* Fetch eight registers in HW save area */
ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */ ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */
stmdb r1!, {r4-r11} /* Store eight registers in HW save area */ stmdb r1!, {r4-r11} /* Store eight registers in HW save area */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
ldmia r0, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ ldmia r0, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */
#else #else
ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */ ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */
@ -393,7 +393,7 @@ exception_common:
*/ */
2: 2:
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */
#else #else
ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */ ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */
@ -418,7 +418,7 @@ exception_common:
3: 3:
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1
* (handler mode) if the stack is on the MSP. It can only be on the PSP if * (handler mode) if the stack is on the MSP. It can only be on the PSP if
* EXC_RETURN is 0xfffffffd (unprivileged thread) * EXC_RETURN is 0xfffffffd (unprivileged thread)

View File

@ -58,7 +58,7 @@ ifeq ($(CONFIG_DEBUG_STACK),y)
CMN_CSRCS += up_checkstack.c CMN_CSRCS += up_checkstack.c
endif endif
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c up_stackframe.c CMN_CSRCS += up_mpu.c up_task_start.c up_pthread_start.c up_stackframe.c
ifneq ($(CONFIG_DISABLE_SIGNALS),y) ifneq ($(CONFIG_DISABLE_SIGNALS),y)
CMN_CSRCS += up_signal_dispatch.c CMN_CSRCS += up_signal_dispatch.c
@ -81,7 +81,7 @@ ifneq ($(CONFIG_SCHED_TICKLESS),y)
CHIP_CSRCS += tiva_timerisr.c CHIP_CSRCS += tiva_timerisr.c
endif endif
ifeq ($(CONFIG_NUTTX_KERNEL),y) ifeq ($(CONFIG_BUILD_PROTECTED),y)
CHIP_CSRCS += tiva_userspace.c tiva_mpuinit.c CHIP_CSRCS += tiva_userspace.c tiva_mpuinit.c
endif endif

View File

@ -76,7 +76,7 @@
* Description: * Description:
* This function will be called to dynamically set aside the heap region. * This function will be called to dynamically set aside the heap region.
* *
* For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the
* size of the unprotected, user-space heap. * size of the unprotected, user-space heap.
* *
@ -105,7 +105,7 @@
void up_allocate_heap(FAR void **heap_start, size_t *heap_size) void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
{ {
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
/* Get the unaligned size and position of the user-space heap. /* Get the unaligned size and position of the user-space heap.
* This heap begins after the user-space .bss section at an offset * This heap begins after the user-space .bss section at an offset
* of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment). * of CONFIG_MM_KERNEL_HEAPSIZE (subject to alignment).
@ -151,13 +151,13 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size)
* Name: up_allocate_kheap * Name: up_allocate_kheap
* *
* Description: * Description:
* For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and * For the kernel build (CONFIG_BUILD_PROTECTED=y) with both kernel- and
* user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates
* (and protects) the kernel-space heap. * (and protects) the kernel-space heap.
* *
****************************************************************************/ ****************************************************************************/
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) #if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP)
void up_allocate_kheap(FAR void **heap_start, size_t *heap_size) void up_allocate_kheap(FAR void **heap_start, size_t *heap_size)
{ {
/* Get the unaligned size and position of the user-space heap. /* Get the unaligned size and position of the user-space heap.

View File

@ -46,7 +46,7 @@
#include "mpu.h" #include "mpu.h"
#include "tiva_mpuinit.h" #include "tiva_mpuinit.h"
#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_ARMV7M_MPU) #if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_ARMV7M_MPU)
/**************************************************************************** /****************************************************************************
* Private Definitions * Private Definitions
@ -120,5 +120,5 @@ void tiva_mpu_uheap(uintptr_t start, size_t size)
mpu_userintsram(start, size); mpu_userintsram(start, size);
} }
#endif /* CONFIG_NUTTX_KERNEL && CONFIG_ARMV7M_MPU */ #endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARMV7M_MPU */

View File

@ -67,7 +67,7 @@
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void tiva_mpuinitialize(void); void tiva_mpuinitialize(void);
#else #else
# define tiva_mpuinitialize() # define tiva_mpuinitialize()
@ -81,7 +81,7 @@ void tiva_mpuinitialize(void);
* *
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
void tiva_mpu_uheap(uintptr_t start, size_t size); void tiva_mpu_uheap(uintptr_t start, size_t size);
#else #else
# define tiva_mpu_uheap(start,size) # define tiva_mpu_uheap(start,size)

View File

@ -150,7 +150,7 @@ void __start(void)
* segments. * segments.
*/ */
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
tiva_userspace(); tiva_userspace();
showprogress('E'); showprogress('E');
#endif #endif

View File

@ -47,7 +47,7 @@
#include "tiva_mpuinit.h" #include "tiva_mpuinit.h"
#include "tiva_userspace.h" #include "tiva_userspace.h"
#ifdef CONFIG_NUTTX_KERNEL #ifdef CONFIG_BUILD_PROTECTED
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
@ -115,4 +115,4 @@ void tiva_userspace(void)
tiva_mpuinitialize(); tiva_mpuinitialize();
} }
#endif /* CONFIG_NUTTX_KERNEL */ #endif /* CONFIG_BUILD_PROTECTED */

Some files were not shown because too many files have changed in this diff Show More