diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-08-29 14:47:22 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-08-29 14:47:22 -0600 |
commit | 64892e44f2ce2612c77b1b20497fb007adafafb8 (patch) | |
tree | 2c917f29727a017b85193ac85959663d504b26e5 | |
parent | c48af0eb9c61462f59a7ba63ca7a73e8df146f49 (diff) | |
download | px4-nuttx-64892e44f2ce2612c77b1b20497fb007adafafb8.tar.gz px4-nuttx-64892e44f2ce2612c77b1b20497fb007adafafb8.tar.bz2 px4-nuttx-64892e44f2ce2612c77b1b20497fb007adafafb8.zip |
Rename CONFIG_NUTTX_KERNEL to CONFIG_BUILD_PROTECTED; Partially integrate new CONFIG_BUILD_KERNEL
234 files changed, 738 insertions, 693 deletions
diff --git a/NxWidgets/Kconfig b/NxWidgets/Kconfig index 9e4c4ec9a..4f6b84b73 100644 --- a/NxWidgets/Kconfig +++ b/NxWidgets/Kconfig @@ -52,7 +52,7 @@ if NX_MULTIUSER config NXWIDGET_SERVERINIT bool "Start server" default y - depends on !NUTTX_KERNEL + depends on !BUILD_PROTECTED && !BUILD_KERNEL ---help--- If this option is selected, then the NxWidgets::CNxServer class will bring up the NX server when it is initialized. If this option is @@ -779,7 +779,7 @@ comment "Touchscreen Device Settings" config NXWM_TOUCHSCREEN_DEVINIT bool "Touchscreen Device Initialization" default y - depends on !NUTTX_KERNEL + depends on !BUILD_PROTECTED && !BUILD_KERNEL ---help--- It this option is selected, then the NxWM:CTouchscreen listener thread will call a function arch_tcinitialize(NXWM_TOUCHSCREEN_DEVNO) diff --git a/apps/NxWidgets/Kconfig b/apps/NxWidgets/Kconfig index 9e4c4ec9a..4f6b84b73 100644 --- a/apps/NxWidgets/Kconfig +++ b/apps/NxWidgets/Kconfig @@ -52,7 +52,7 @@ if NX_MULTIUSER config NXWIDGET_SERVERINIT bool "Start server" default y - depends on !NUTTX_KERNEL + depends on !BUILD_PROTECTED && !BUILD_KERNEL ---help--- If this option is selected, then the NxWidgets::CNxServer class will bring up the NX server when it is initialized. If this option is @@ -779,7 +779,7 @@ comment "Touchscreen Device Settings" config NXWM_TOUCHSCREEN_DEVINIT bool "Touchscreen Device Initialization" default y - depends on !NUTTX_KERNEL + depends on !BUILD_PROTECTED && !BUILD_KERNEL ---help--- It this option is selected, then the NxWM:CTouchscreen listener thread will call a function arch_tcinitialize(NXWM_TOUCHSCREEN_DEVNO) diff --git a/apps/examples/README.txt b/apps/examples/README.txt index e6bf986c2..29219daaf 100644 --- a/apps/examples/README.txt +++ b/apps/examples/README.txt @@ -75,7 +75,8 @@ examples/buttons NOTE: This test exercises internal button driver interfaces. As such, it relies on internal OS interfaces that are not normally available to a user-space program. As a result, this example cannot be used if a - NuttX is built as a protected, supervisor kernel (CONFIG_NUTTX_KERNEL). + NuttX is built as a protected, supervisor kernel (CONFIG_BUILD_PROTECTED + or CONFIG_BUILD_KERNEL). examples/can ^^^^^^^^^^^^ @@ -291,8 +292,9 @@ examples/flash_test * CONFIG_MTD_SMART=y - SMART block driver support * CONFIG_NSH_BUILTIN_APPS=y - This example can only be built as an NSH command - * CONFIG_NUTTX_KERNEL=n - This test uses internal OS interfaces and so - is not available in the NUTTX kernel build + * CONFIG_BUILD_PROTECTED=n and CONFIG_BUILD_KERNEL=n- This test uses + internal OS interfaces and so is not available in the NUTTX kernel + builds examples/ftpc ^^^^^^^^^^^^^ @@ -582,7 +584,8 @@ examples/lcdrw NOTE: This test exercises internal lcd driver interfaces. As such, it relies on internal OS interfaces that are not normally available to a user-space program. As a result, this example cannot be used if a - NuttX is built as a protected, supervisor kernel (CONFIG_NUTTX_KERNEL). + NuttX is built as a protected, supervisor kernel (CONFIG_BUILD_PROTECTED + or CONFIG_BUILD_KERNEL). examples/mm ^^^^^^^^^^^ @@ -1387,7 +1390,8 @@ examples/relays NOTE: This test exercises internal relay driver interfaces. As such, it relies on internal OS interfaces that are not normally available to a user-space program. As a result, this example cannot be used if a - NuttX is built as a protected, supervisor kernel (CONFIG_NUTTX_KERNEL). + NuttX is built as a protected, supervisor kernel (CONFIG_BUILD_PROTECTED + or CONFIG_BUILD_KERNEL). examples/rgmp ^^^^^^^^^^^^^ diff --git a/apps/examples/buttons/buttons_main.c b/apps/examples/buttons/buttons_main.c index 34b6c8055..987ab8559 100644 --- a/apps/examples/buttons/buttons_main.c +++ b/apps/examples/buttons/buttons_main.c @@ -37,7 +37,8 @@ * NOTE: This test exercises internal button driver interfaces. As such, it * it relies on internal OS interfaces that are not normally available to a * user-space program. As a result, this example cannot be used if a - * NuttX is built as a protected, supervisor kernel (CONFIG_NUTTX_KERNEL). + * NuttX is built as a protected, supervisor kernel (CONFIG_BUILD_PROTECTED or + * CONFIG_BUILD_KERNEL). ****************************************************************************/ /**************************************************************************** diff --git a/apps/examples/elf/tests/errno/Makefile b/apps/examples/elf/tests/errno/Makefile index 44e50744b..d0f6f8256 100644 --- a/apps/examples/elf/tests/errno/Makefile +++ b/apps/examples/elf/tests/errno/Makefile @@ -54,7 +54,7 @@ endif LIBS = ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y) -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) LIBS += -luc else LIBS += -lc diff --git a/apps/examples/elf/tests/hello/Makefile b/apps/examples/elf/tests/hello/Makefile index a5fc71e31..bcb227979 100644 --- a/apps/examples/elf/tests/hello/Makefile +++ b/apps/examples/elf/tests/hello/Makefile @@ -54,7 +54,7 @@ endif LIBS = ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y) -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) LIBS += -luc else LIBS += -lc diff --git a/apps/examples/elf/tests/helloxx/Makefile b/apps/examples/elf/tests/helloxx/Makefile index f0b204ca5..8882e21a5 100644 --- a/apps/examples/elf/tests/helloxx/Makefile +++ b/apps/examples/elf/tests/helloxx/Makefile @@ -54,7 +54,7 @@ endif LIBS = ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y) -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) LIBS += -luc else LIBS += -lc diff --git a/apps/examples/elf/tests/longjmp/Makefile b/apps/examples/elf/tests/longjmp/Makefile index f85f95434..802d84df1 100644 --- a/apps/examples/elf/tests/longjmp/Makefile +++ b/apps/examples/elf/tests/longjmp/Makefile @@ -54,7 +54,7 @@ endif LIBS = ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y) -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) LIBS += -luc else LIBS += -lc diff --git a/apps/examples/elf/tests/mutex/Makefile b/apps/examples/elf/tests/mutex/Makefile index 70848c0f8..197bb41a9 100644 --- a/apps/examples/elf/tests/mutex/Makefile +++ b/apps/examples/elf/tests/mutex/Makefile @@ -54,7 +54,7 @@ endif LIBS = ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y) -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) LIBS += -luc else LIBS += -lc diff --git a/apps/examples/elf/tests/pthread/Makefile b/apps/examples/elf/tests/pthread/Makefile index 1b02b017c..0aa524506 100644 --- a/apps/examples/elf/tests/pthread/Makefile +++ b/apps/examples/elf/tests/pthread/Makefile @@ -54,7 +54,7 @@ endif LIBS = ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y) -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) LIBS += -luc else LIBS += -lc diff --git a/apps/examples/elf/tests/signal/Makefile b/apps/examples/elf/tests/signal/Makefile index abb596f6c..80b843e32 100644 --- a/apps/examples/elf/tests/signal/Makefile +++ b/apps/examples/elf/tests/signal/Makefile @@ -54,7 +54,7 @@ endif LIBS = ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y) -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) LIBS += -luc else LIBS += -lc diff --git a/apps/examples/elf/tests/struct/Makefile b/apps/examples/elf/tests/struct/Makefile index b0fa3e474..27595dfaa 100644 --- a/apps/examples/elf/tests/struct/Makefile +++ b/apps/examples/elf/tests/struct/Makefile @@ -56,7 +56,7 @@ endif LIBS = ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y) -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) LIBS += -luc else LIBS += -lc diff --git a/apps/examples/elf/tests/task/Makefile b/apps/examples/elf/tests/task/Makefile index dcf758dfd..6a93da9e3 100644 --- a/apps/examples/elf/tests/task/Makefile +++ b/apps/examples/elf/tests/task/Makefile @@ -54,7 +54,7 @@ endif LIBS = ifeq ($(CONFIG_EXAMPLES_ELF_LIBC),y) -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) LIBS += -luc else LIBS += -lc diff --git a/apps/examples/flash_test/Kconfig b/apps/examples/flash_test/Kconfig index 49b56dccc..e681226a9 100644 --- a/apps/examples/flash_test/Kconfig +++ b/apps/examples/flash_test/Kconfig @@ -6,7 +6,7 @@ config EXAMPLES_FLASH_TEST bool "SMART FLASH block device test" default n - depends on !NUTTX_KERNEL && MTD_SMART && NSH_BUILTIN_APPS + depends on (!BUILD_PROTECTED && !BUILD_KERNEL) && MTD_SMART && NSH_BUILTIN_APPS ---help--- This logic performs a SMART flash block device test. This test performs a sector allocate, read, write, free and garbage collection diff --git a/apps/examples/i2schar/Kconfig b/apps/examples/i2schar/Kconfig index 953318cfe..0deb0ebce 100644 --- a/apps/examples/i2schar/Kconfig +++ b/apps/examples/i2schar/Kconfig @@ -78,7 +78,7 @@ config EXAMPLES_I2SCHAR_BUFSIZE config EXAMPLES_I2SCHAR_DEVINIT bool "Architecture-specific device initialization" default 256 - depends on !NUTTX_KERNEL + depends on !BUILD_PROTECTED && !BUILD_KERNEL ---help--- Define if architecture-specific I2S device initialize is available. If defined, the the platform specific code must provide a function diff --git a/apps/examples/mtdpart/Kconfig b/apps/examples/mtdpart/Kconfig index 6f8e6e490..cd8533e68 100644 --- a/apps/examples/mtdpart/Kconfig +++ b/apps/examples/mtdpart/Kconfig @@ -6,7 +6,7 @@ config EXAMPLES_MTDPART bool "MTD partition test" default n - depends on MTD_PARTITION && !NUTTX_KERNEL + depends on MTD_PARTITION && !BUILD_PROTECTED && !BUILD_KERNEL ---help--- Enable the MTD partition test example. diff --git a/apps/nshlib/Kconfig b/apps/nshlib/Kconfig index b51b2931e..0add860d6 100644 --- a/apps/nshlib/Kconfig +++ b/apps/nshlib/Kconfig @@ -301,7 +301,7 @@ config NSH_DISABLE_NSFMOUNT config NSH_DISABLE_PS bool "Disable ps" default n - depends on !NUTTX_KERNEL + depends on !BUILD_PROTECTED && !BUILD_KERNEL config NSH_DISABLE_PING bool "Disable ping" diff --git a/apps/nshlib/nsh.h b/apps/nshlib/nsh.h index 23b030072..a17b0a901 100644 --- a/apps/nshlib/nsh.h +++ b/apps/nshlib/nsh.h @@ -546,11 +546,11 @@ # define IOBUFFERSIZE (PATH_MAX + 1) #endif -/* Certain commands are not availalbe in a kernel build because they depend +/* Certain commands are not available in a kernel builds because they depend * on interfaces that are not exported by the kernel. */ -#ifdef CONFIG_NUTTX_KERNEL +#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL) # undef CONFIG_NSH_DISABLE_DF # define CONFIG_NSH_DISABLE_DF 1 #endif diff --git a/apps/nshlib/nsh_command.c b/apps/nshlib/nsh_command.c index ef141b80a..3950b3379 100644 --- a/apps/nshlib/nsh_command.c +++ b/apps/nshlib/nsh_command.c @@ -292,7 +292,7 @@ static const struct cmdmap_s g_cmdmap[] = #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE) # ifndef CONFIG_NSH_DISABLE_MOUNT -# ifdef CONFIG_NUTTX_KERNEL +#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL) { "mount", cmd_mount, 5, 5, "-t <fstype> [<block-device>] <mount-point>" }, # else { "mount", cmd_mount, 1, 5, "[-t <fstype> [<block-device>] <mount-point>]" }, diff --git a/apps/nshlib/nsh_mntcmds.c b/apps/nshlib/nsh_mntcmds.c index 584c1258a..55d9df9b6 100644 --- a/apps/nshlib/nsh_mntcmds.c +++ b/apps/nshlib/nsh_mntcmds.c @@ -88,7 +88,7 @@ #if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \ defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_MOUNT) -#ifndef CONFIG_NUTTX_KERNEL +#if !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL) static const char* get_fstype(FAR struct statfs *statbuf) { FAR const char *fstype; @@ -227,7 +227,7 @@ static int df_man_readable_handler(FAR const char *mountpoint, usedlabel = labels[which]; -#ifndef CONFIG_NUTTX_KERNEL +#if !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL) nsh_output(vtbl, "%-10s %6ld%c %8ld%c %8ld%c %s\n", get_fstype(statbuf), size, sizelabel, used, usedlabel, free, freelabel, mountpoint); @@ -249,7 +249,7 @@ static int df_man_readable_handler(FAR const char *mountpoint, #if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \ defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_MOUNT) -#ifndef CONFIG_NUTTX_KERNEL +#if !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL) static int mount_handler(FAR const char *mountpoint, FAR struct statfs *statbuf, FAR void *arg) { @@ -274,7 +274,7 @@ static int mount_handler(FAR const char *mountpoint, #if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) && \ defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_MOUNT) -#ifndef CONFIG_NUTTX_KERNEL +#if !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL) static inline int mount_show(FAR struct nsh_vtbl_s *vtbl, FAR const char *progname) { return foreach_mountpoint(mount_handler, (FAR void *)vtbl); @@ -297,7 +297,7 @@ int cmd_df(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) #ifdef CONFIG_NSH_CMDOPT_DF_H if (argc > 1 && strcmp(argv[1], "-h") == 0) { -#ifndef CONFIG_NUTTX_KERNEL +#if !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL) nsh_output(vtbl, "Filesystem Size Used Available Mounted on\n"); #else nsh_output(vtbl, "Size Used Available Mounted on\n"); @@ -333,7 +333,7 @@ int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) /* The mount command behaves differently if no parameters are provided */ -#ifndef CONFIG_NUTTX_KERNEL +#if !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL) if (argc < 2) { return mount_show(vtbl, argv[0]); diff --git a/apps/nshlib/nsh_routecmds.c b/apps/nshlib/nsh_routecmds.c index b8a6c4784..30489332a 100644 --- a/apps/nshlib/nsh_routecmds.c +++ b/apps/nshlib/nsh_routecmds.c @@ -321,11 +321,14 @@ errout: * ****************************************************************************/ -#if !defined(CONFIG_NSH_DISABLE_DELROUTE) && !defined(CONFIG_NUTTX_KERNEL) +#if !defined(CONFIG_NSH_DISABLE_DELROUTE) && \ + !defined(CONFIG_BUILD_PROTECTED) && \ + !defined(CONFIG_BUILD_KERNEL) + /* Perhaps... someday. This would current depend on using the internal - * OS interface net_foreachroute and internal OS data structrues defined + * OS interface net_foreachroute and internal OS data structures defined * in nuttx/net/net_route.h */ -#endif /* !CONFIG_NSH_DISABLE_DELROUTE && !CONFIG_NUTTX_KERNEL */ +#endif /* !CONFIG_NSH_DISABLE_DELROUTE && !CONFIG_BUILD_PROTECTED && !CONFIG_BUILD_KERNEL */ #endif /* CONFIG_NET && CONFIG_NET_ROUTE */ diff --git a/apps/system/flash_eraseall/Kconfig b/apps/system/flash_eraseall/Kconfig index 032df07bd..5ecc6eb26 100644 --- a/apps/system/flash_eraseall/Kconfig +++ b/apps/system/flash_eraseall/Kconfig @@ -6,7 +6,7 @@ config SYSTEM_FLASH_ERASEALL bool "FLASH eraseall tool" default n - depends on MTD && NSH_BUILTIN_APPS && !NUTTX_KERNEL + depends on MTD && NSH_BUILTIN_APPS && !BUILD_PROTECTED && !BUILD_KERNEL ---help--- Enable support for the FLASH eraseall tool. diff --git a/apps/system/i2c/README.txt b/apps/system/i2c/README.txt index bb4abc831..a47b7eb0e 100644 --- a/apps/system/i2c/README.txt +++ b/apps/system/i2c/README.txt @@ -361,7 +361,8 @@ The I2C tools requires the following in your NuttX configuration: NOTE 2: This I2C tool uses direct I2C device interfaces. As such, it relies on internal OS interfaces that are not normally available to a user-space program. As a result, the I2C tool cannot be used if a - NuttX is built as a protected, supervisor kernel (CONFIG_NUTTX_KERNEL). + NuttX is built as a protected, supervisor kernel (CONFIG_BUILD_PROTECTED + or CONFIG_BUILD_KERNEL). 3. I2C driver configuration diff --git a/apps/system/usbmsc/README.txt b/apps/system/usbmsc/README.txt index 6734a4ed8..9207dfb6b 100755 --- a/apps/system/usbmsc/README.txt +++ b/apps/system/usbmsc/README.txt @@ -73,4 +73,5 @@ system/usbmsc NOTE 2: This add-on used internal USB device driver interfaces. As such,
it relies on internal OS interfaces that are not normally available to a
user-space program. As a result, this add-on cannot be used if a
- NuttX is built as a protected, supervisor kernel (CONFIG_NUTTX_KERNEL).
+ NuttX is built as a protected, supervisor kernel (CONFIG_BUILD_PROTECTED
+ or CONFIG_BUILD_KERNEL).
diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html index 88155b8ca..7bbadfaed 100644 --- a/nuttx/Documentation/NuttxPortingGuide.html +++ b/nuttx/Documentation/NuttxPortingGuide.html @@ -12,7 +12,7 @@ <h1><big><font color="#3c34ec"> <i>NuttX RTOS Porting Guide</i> </font></big></h1> - <p>Last Updated: August 24, 2014</p> + <p>Last Updated: August 29, 2014</p> </td> </tr> </table> @@ -486,7 +486,7 @@ kernel-mode NuttX functions. This directory must always be provided to prevent compilation errors. 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> <li> <code>uintptr_t sys_call0(unsigned int nbr)</code>: @@ -1329,7 +1329,7 @@ include/ </p> <p> 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 <kernel> space (<code>libkc.a</code>). </p> <p> @@ -1393,7 +1393,7 @@ libc/ <h2>2.14 <a name="DirStructSyscall">nuttx/syscall</a></h2> <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. This directory holds a syscall interface that can be used for communication 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> This function may also need to set up processor registers so that the new thread executes with the correct privileges. - If <code>CONFIG_NUTTX_KERNEL</code> has 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: + 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: Kernel threads will require kernel-mode privileges; User tasks and pthreads should have only user-mode privileges. - If <code>CONFIG_NUTTX_KERNEL</code> has <i>not</i> been selected, - then all threads should have kernel-mode privileges. + If neither <code>CONFIG_BUILD_PROTECTED</code> nor <code>CONFIG_BUILD_KERNEL</code> have been selected, then all threads should have kernel-mode privileges. </p> <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. </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> </li> </ul> @@ -1909,7 +1906,7 @@ The system can be re-made subsequently by just typing <code>make</code>. </li> </ul> <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><b>Input Parameters:</b></p> <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. </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. Stacks for user tasks and threads must have come from memory that is accessible to user </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. </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>. </p> diff --git a/nuttx/Kconfig b/nuttx/Kconfig index eb1a43e9a..d8960a951 100644 --- a/nuttx/Kconfig +++ b/nuttx/Kconfig @@ -111,37 +111,79 @@ config APPS_DIR `-application | `- Makefile - + Then you would set APPS_DIR=../application. The application direction must contain Makefile and this make file must support the following targets: - + 1)libapps$(LIBEXT) (usually libapps.a). libapps.a is a static library ( an archive) that contains all of application object files. - + 2)clean. Do whatever is appropriate to clean the application directories for a fresh build. - + 3)distclean. Clean everything -- auto-generated files, symbolic links etc. -- so that the directory contents are the same as the contents in your configuration management system. This is only done when you change the NuttX configuration. - + 4)depend. Make or update the application build dependencies. - + When this application is invoked it will receive the setting TOPDIR like: - + $(MAKE) -C $(CONFIG_APPS_DIR) TOPDIR="$(TOPDIR)" <target> - + 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) 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 bool "Two pass build" default n + depends on !BUILD_KERNEL ---help--- Enables the two pass build options. @@ -183,17 +225,10 @@ config PASS1_OBJECT from the PASS1_TARGET. It may be available at link time 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 hex "Beginning of user-space blob" default 0x0 - depends on NUTTX_KERNEL + depends on BUILD_PROTECTED ---help--- In the kernel build, the NuttX kernel and the user-space blob are built separately linked objects. NUTTX_USERSPACE provides the diff --git a/nuttx/Makefile.unix b/nuttx/Makefile.unix index 318e7f715..a5b3aa47e 100644 --- a/nuttx/Makefile.unix +++ b/nuttx/Makefile.unix @@ -91,7 +91,7 @@ APPDIR := ${shell if [ -r $(CONFIG_APPS_DIR)/Makefile ]; then echo "$(CONFIG_APP NUTTX_ADDONS := USER_ADDONS := -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) USER_ADDONS += $(APPDIR) else NUTTX_ADDONS += $(APPDIR) @@ -117,7 +117,7 @@ CONTEXTDIRS = $(APPDIR) USERDIRS = OTHERDIRS = lib -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) USERDIRS += libc mm $(USER_ADDONS) ifeq ($(CONFIG_HAVE_CXX),y) @@ -160,9 +160,9 @@ endif # CLEANDIRS are the directories that will clean in. These are # all directories that we know about. # 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. -# 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. CLEANDIRS = $(NONFSDIRS) $(FSDIRS) $(USERDIRS) $(OTHERDIRS) @@ -219,7 +219,7 @@ USERLIBS = # both the kernel- and user-space builds. For now, the memory manager (mm) # 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/libkarch$(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! ifeq ($(CONFIG_HAVE_CXX),y) -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) USERLIBS += lib/libcxx$(LIBEXT) else NUTTXLIBS += lib/libcxx$(LIBEXT) @@ -246,7 +246,7 @@ endif # Add library for application support. ifneq ($(APPDIR),) -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) USERLIBS += lib/libapps$(LIBEXT) else NUTTXLIBS += lib/libapps$(LIBEXT) @@ -282,7 +282,7 @@ endif ifeq ($(CONFIG_NX),y) NUTTXLIBS += lib/libgraphics$(LIBEXT) -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) NUTTXLIBS += lib/libknx$(LIBEXT) USERLIBS += lib/libunx$(LIBEXT) else diff --git a/nuttx/Makefile.win b/nuttx/Makefile.win index d1367230b..c77ce9c4b 100644 --- a/nuttx/Makefile.win +++ b/nuttx/Makefile.win @@ -84,7 +84,7 @@ APPDIR := ${shell if exist "$(CONFIG_APPS_DIR)\Makefile" echo $(CONFIG_APPS_DIR) NUTTX_ADDONS := USER_ADDONS := -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) USER_ADDONS += $(APPDIR) else NUTTX_ADDONS += $(APPDIR) @@ -110,7 +110,7 @@ CONTEXTDIRS = $(APPDIR) USERDIRS = OTHERDIRS = lib -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) USERDIRS += libc mm $(USER_ADDONS) ifeq ($(CONFIG_HAVE_CXX),y) @@ -153,9 +153,9 @@ endif # CLEANDIRS are the directories that will clean in. These are # all directories that we know about. # 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. -# 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. CLEANDIRS = $(NONFSDIRS) $(FSDIRS) $(USERDIRS) $(OTHERDIRS) @@ -212,7 +212,7 @@ USERLIBS = # both the kernel- and user-space builds. For now, the memory manager (mm) # 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\libkarch$(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! ifeq ($(CONFIG_HAVE_CXX),y) -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) USERLIBS += lib\libcxx$(LIBEXT) else NUTTXLIBS += lib\libcxx$(LIBEXT) @@ -239,7 +239,7 @@ endif # Add library for application support. ifneq ($(APPDIR),) -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) USERLIBS += lib\libapps$(LIBEXT) else NUTTXLIBS += lib\libapps$(LIBEXT) @@ -275,7 +275,7 @@ endif ifeq ($(CONFIG_NX),y) NUTTXLIBS += lib\libgraphics$(LIBEXT) -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) NUTTXLIBS += lib\libknx$(LIBEXT) USERLIBS += lib\libunx$(LIBEXT) else diff --git a/nuttx/arch/Kconfig b/nuttx/arch/Kconfig index 0cb83efcf..41b28fab5 100644 --- a/nuttx/arch/Kconfig +++ b/nuttx/arch/Kconfig @@ -154,6 +154,10 @@ config ARCH_HAVE_MMU bool default n +config ARCH_HAVE_MPU + bool + default n + config ARCH_NAND_HWECC bool default n @@ -162,6 +166,26 @@ config ARCH_HAVE_EXTCLK bool 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 bool "Address environments" default n @@ -224,12 +248,12 @@ config ARCH_STACK_NPAGES This, along with knowledge of the page size, determines the size of the stack virtual address space. Default is 1. -endif # ARCH_ADDRENV && ARCH_HAVE_MMU +endif # ARCH_ADDRENV && ARCH_NEED_ADDRENV_MAPPING menuconfig PAGING bool "On-demand paging" default n - depends on ARCH_HAVE_MMU && !ARCH_ROMPGTABLE + depends on ARCH_USE_MMU && !ARCH_ROMPGTABLE ---help--- 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. @@ -537,7 +561,7 @@ config ARCH_HIPRI_INTERRUPT 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 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 @@ -641,7 +665,7 @@ config RAM_START config RAM_VSTART hex "Primary RAM start address (virtual)" default 0x0 - depends on ARCH_HAVE_MMU + depends on ARCH_USE_MMU help The virtual start address of installed primary RAM. "Primary" RAM 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 any block of RAM as "primary." -if BOOT_RUNFROMFLASH && ARCH_HAVE_MMU +if BOOT_RUNFROMFLASH && ARCH_USE_MMU config FLASH_START hex "Boot FLASH start address (physical)" @@ -680,7 +704,7 @@ config FLASH_SIZE The size in bytes of the installed boot FLASH. "Boot" FLASH 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 bool diff --git a/nuttx/arch/arm/Kconfig b/nuttx/arch/arm/Kconfig index 31007c7d3..fd815b85a 100644 --- a/nuttx/arch/arm/Kconfig +++ b/nuttx/arch/arm/Kconfig @@ -15,11 +15,12 @@ config ARCH_CHIP_A1X select ARCH_CORTEXA8 select ARCH_HAVE_FPU select ARCH_HAVE_MMU + select ARCH_USE_MMU select ARCH_HAVE_LOWVECTORS select ARCH_HAVE_SDRAM select BOOT_RUNFROMSDRAM - select ARCH_HAVE_ADDRENV if EXPERIMENTAL - select ARCH_NEED_ADDRENV_MAPPING if EXPERIMENTAL + select ARCH_HAVE_ADDRENV + select ARCH_NEED_ADDRENV_MAPPING ---help--- 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_I2CRESET select ARCH_HAVE_TICKLESS - select ARCH_HAVE_ADDRENV if EXPERIMENTAL - select ARCH_NEED_ADDRENV_MAPPING if EXPERIMENTAL + select ARCH_HAVE_ADDRENV + select ARCH_NEED_ADDRENV_MAPPING ---help--- Atmel SAMA5 (ARM Cortex-A5) @@ -182,11 +183,13 @@ config ARCH_ARM926EJS bool default n select ARCH_HAVE_MMU + select ARCH_USE_MMU config ARCH_ARM920T bool default n select ARCH_HAVE_MMU + select ARCH_USE_MMU config ARCH_CORTEXM0 bool @@ -212,6 +215,7 @@ config ARCH_CORTEXA5 default n select ARCH_HAVE_IRQPRIO select ARCH_HAVE_MMU + select ARCH_USE_MMU select ARCH_HAVE_COHERENT_DCACHE if ELF config ARCH_CORTEXA8 @@ -219,6 +223,7 @@ config ARCH_CORTEXA8 default n select ARCH_HAVE_IRQPRIO select ARCH_HAVE_MMU + select ARCH_USE_MMU select ARCH_HAVE_COHERENT_DCACHE if ELF config ARCH_FAMILY @@ -288,14 +293,12 @@ config ARCH_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. -config ARCH_HAVE_MPU - bool - default n - config ARMV7M_MPU bool "MPU support" - default n + default n if !ARCH_USE_MPU + default y if ARCH_USE_MPU depends on ARCH_HAVE_MPU + select ARCH_USE_MPU ---help--- 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. @@ -305,7 +308,7 @@ config ARMV7M_MPU_NREGIONS default 8 depends on ARMV7M_MPU ---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 bool @@ -320,7 +323,7 @@ config ARCH_LOWVECTORS config ARCH_ROMPGTABLE bool "ROM page table" default n - depends on ARCH_HAVE_MMU + depends on ARCH_USE_MMU ---help--- Support a fixed memory mapping use a (read-only) page table in ROM/FLASH. diff --git a/nuttx/arch/arm/include/armv6-m/irq.h b/nuttx/arch/arm/include/armv6-m/irq.h index be851aa93..05bff9df6 100644 --- a/nuttx/arch/arm/include/armv6-m/irq.h +++ b/nuttx/arch/arm/include/armv6-m/irq.h @@ -85,7 +85,7 @@ * modes. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED # define REG_EXC_RETURN (10) /* EXC_RETURN */ # define SW_XCPT_REGS (11) #else @@ -178,11 +178,11 @@ struct xcptcontext uint32_t saved_pc; uint32_t saved_primask; uint32_t saved_xpsr; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED uint32_t saved_lr; #endif -# ifdef CONFIG_NUTTX_KERNEL +# ifdef CONFIG_BUILD_PROTECTED /* This is the saved address to use when returning from a user-space * signal handler. */ diff --git a/nuttx/arch/arm/include/armv7-a/irq.h b/nuttx/arch/arm/include/armv7-a/irq.h index f21aba734..3373819df 100755 --- a/nuttx/arch/arm/include/armv7-a/irq.h +++ b/nuttx/arch/arm/include/armv7-a/irq.h @@ -200,7 +200,7 @@ #ifdef CONFIG_LIB_SYSCALL struct xcpt_syscall_s { -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL uint32_t cpsr; /* The CPSR value */ #endif uint32_t sysreturn; /* The return PC */ diff --git a/nuttx/arch/arm/include/armv7-m/irq.h b/nuttx/arch/arm/include/armv7-m/irq.h index 818af6560..c170ff99d 100644 --- a/nuttx/arch/arm/include/armv7-m/irq.h +++ b/nuttx/arch/arm/include/armv7-m/irq.h @@ -140,11 +140,11 @@ struct xcptcontext uint32_t saved_primask; #endif uint32_t saved_xpsr; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED uint32_t saved_lr; #endif -# ifdef CONFIG_NUTTX_KERNEL +# ifdef CONFIG_BUILD_PROTECTED /* This is the saved address to use when returning from a user-space * signal handler. */ diff --git a/nuttx/arch/arm/include/armv7-m/irq_lazyfpu.h b/nuttx/arch/arm/include/armv7-m/irq_lazyfpu.h index f2380cbb6..e211cfbe5 100644 --- a/nuttx/arch/arm/include/armv7-m/irq_lazyfpu.h +++ b/nuttx/arch/arm/include/armv7-m/irq_lazyfpu.h @@ -65,7 +65,7 @@ #define REG_R10 (8) /* R10 */ #define REG_R11 (9) /* R11 */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED # define REG_EXC_RETURN (10) /* EXC_RETURN */ # define SW_INT_REGS (11) #else diff --git a/nuttx/arch/arm/src/a1x/a1x_boot.c b/nuttx/arch/arm/src/a1x/a1x_boot.c index 392b4744d..9750bf90d 100644 --- a/nuttx/arch/arm/src/a1x/a1x_boot.c +++ b/nuttx/arch/arm/src/a1x/a1x_boot.c @@ -356,16 +356,6 @@ void up_boot(void) up_earlyserialinit(); #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: * * - Initialization of board-specific memory resources (e.g., SDRAM) diff --git a/nuttx/arch/arm/src/arm/up_initialstate.c b/nuttx/arch/arm/src/arm/up_initialstate.c index 7d8ef65b1..2ff8cedbf 100644 --- a/nuttx/arch/arm/src/arm/up_initialstate.c +++ b/nuttx/arch/arm/src/arm/up_initialstate.c @@ -114,7 +114,7 @@ void up_initial_state(struct tcb_s *tcb) * 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) { /* It is a kernel thread.. set supervisor mode */ diff --git a/nuttx/arch/arm/src/armv6-m/svcall.h b/nuttx/arch/arm/src/armv6-m/svcall.h index 0aaf9b701..c3e849394 100644 --- a/nuttx/arch/arm/src/armv6-m/svcall.h +++ b/nuttx/arch/arm/src/armv6-m/svcall.h @@ -53,11 +53,11 @@ /* Configuration ********************************************************************/ /* 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 - * 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_NUTTX_KERNEL +# ifdef CONFIG_BUILD_PROTECTED # ifndef CONFIG_SYS_RESERVED # error "CONFIG_SYS_RESERVED must be defined to have the value 8" # elif CONFIG_SYS_RESERVED != 8 @@ -103,7 +103,7 @@ #define SYS_syscall_return (3) -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* SYS call 4: * * void up_task_start(main_t taskentry, int argc, FAR char *argv[]) @@ -135,7 +135,7 @@ #define SYS_signal_handler_return (7) -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ #endif /* CONFIG_LIB_SYSCALL */ /************************************************************************************ diff --git a/nuttx/arch/arm/src/armv6-m/up_assert.c b/nuttx/arch/arm/src/armv6-m/up_assert.c index 5bd9790d0..492ee730e 100644 --- a/nuttx/arch/arm/src/armv6-m/up_assert.c +++ b/nuttx/arch/arm/src/armv6-m/up_assert.c @@ -160,7 +160,7 @@ static inline void up_registerdump(void) current_regs[REG_R10], current_regs[REG_R11], current_regs[REG_R12], current_regs[REG_R13], 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", current_regs[REG_XPSR], current_regs[REG_PRIMASK], current_regs[REG_EXC_RETURN]); diff --git a/nuttx/arch/arm/src/armv6-m/up_exception.S b/nuttx/arch/arm/src/armv6-m/up_exception.S index 1a04cfe27..62cb7a2d6 100644 --- a/nuttx/arch/arm/src/armv6-m/up_exception.S +++ b/nuttx/arch/arm/src/armv6-m/up_exception.S @@ -92,7 +92,7 @@ exception_common: * 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 */ lsl r0, #(31 - EXC_RETURN_PROCESS_BITNO) /* Move to bit 31 */ bmi 1f /* Test bit 31 */ @@ -129,7 +129,7 @@ exception_common: mov r3, r9 mov r4, r10 mov r5, r11 -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED mov r6, r14 stmia r0!, {r2-r6} /* Save the high registers r8-r11 and r14 */ #else @@ -200,7 +200,7 @@ exception_common: mov r2, #(4*REG_R8) /* R2=Offset to 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)*/ mov r8, r2 /* Move to position in high registers */ mov r9, r3 @@ -227,7 +227,7 @@ exception_common: * context is on the MSP or PSP. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED mov r0, r14 /* Copy high register to low register */ lsl r0, #(31 - EXC_RETURN_PROCESS_BITNO) /* Move to bit 31 */ bmi 5f /* Test bit 31 */ diff --git a/nuttx/arch/arm/src/armv6-m/up_hardfault.c b/nuttx/arch/arm/src/armv6-m/up_hardfault.c index 988a4f13b..b7bbe8814 100644 --- a/nuttx/arch/arm/src/armv6-m/up_hardfault.c +++ b/nuttx/arch/arm/src/armv6-m/up_hardfault.c @@ -99,7 +99,7 @@ int up_hardfault(int irq, FAR void *context) * 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 * FLASH region or in the user FLASH region. */ diff --git a/nuttx/arch/arm/src/armv6-m/up_initialstate.c b/nuttx/arch/arm/src/armv6-m/up_initialstate.c index 6dc000d12..1ee313095 100644 --- a/nuttx/arch/arm/src/armv6-m/up_initialstate.c +++ b/nuttx/arch/arm/src/armv6-m/up_initialstate.c @@ -126,9 +126,9 @@ void up_initial_state(struct tcb_s *tcb) #endif #endif /* CONFIG_PIC */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* 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 * mode before transferring control to the user task. */ diff --git a/nuttx/arch/arm/src/armv6-m/up_schedulesigaction.c b/nuttx/arch/arm/src/armv6-m/up_schedulesigaction.c index e6e4314fd..e538674b4 100644 --- a/nuttx/arch/arm/src/armv6-m/up_schedulesigaction.c +++ b/nuttx/arch/arm/src/armv6-m/up_schedulesigaction.c @@ -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_primask = current_regs[REG_PRIMASK]; tcb->xcp.saved_xpsr = current_regs[REG_XPSR]; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED tcb->xcp.saved_lr = current_regs[REG_LR]; #endif /* 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_PRIMASK] = 1; current_regs[REG_XPSR] = ARMV6M_XPSR_T; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED current_regs[REG_LR] = EXC_RETURN_PRIVTHR; #endif /* 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_primask = tcb->xcp.regs[REG_PRIMASK]; 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]; #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_PRIMASK] = 1; tcb->xcp.regs[REG_XPSR] = ARMV6M_XPSR_T; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED tcb->xcp.regs[REG_LR] = EXC_RETURN_PRIVTHR; #endif } diff --git a/nuttx/arch/arm/src/armv6-m/up_sigdeliver.c b/nuttx/arch/arm/src/armv6-m/up_sigdeliver.c index e1e8589ea..def3de0ac 100644 --- a/nuttx/arch/arm/src/armv6-m/up_sigdeliver.c +++ b/nuttx/arch/arm/src/armv6-m/up_sigdeliver.c @@ -109,7 +109,7 @@ void up_sigdeliver(void) regs[REG_PC] = rtcb->xcp.saved_pc; regs[REG_PRIMASK] = rtcb->xcp.saved_primask; regs[REG_XPSR] = rtcb->xcp.saved_xpsr; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED regs[REG_LR] = rtcb->xcp.saved_lr; #endif diff --git a/nuttx/arch/arm/src/armv6-m/up_signal_handler.S b/nuttx/arch/arm/src/armv6-m/up_signal_handler.S index 559b8c6d7..f294db9fc 100644 --- a/nuttx/arch/arm/src/armv6-m/up_signal_handler.S +++ b/nuttx/arch/arm/src/armv6-m/up_signal_handler.S @@ -41,7 +41,7 @@ #include <arch/syscall.h> -#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__) /**************************************************************************** * File info @@ -112,4 +112,4 @@ up_signal_handler: .size up_signal_handler, .-up_signal_handler .end -#endif /* CONFIG_NUTTX_KERNEL && !__KERNEL__ */ +#endif /* CONFIG_BUILD_PROTECTED && !__KERNEL__ */ diff --git a/nuttx/arch/arm/src/armv6-m/up_svcall.c b/nuttx/arch/arm/src/armv6-m/up_svcall.c index b88260281..ac5e89d7b 100644 --- a/nuttx/arch/arm/src/armv6-m/up_svcall.c +++ b/nuttx/arch/arm/src/armv6-m/up_svcall.c @@ -181,7 +181,7 @@ int up_svcall(int irq, FAR void *context) 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_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", regs[REG_XPSR], regs[REG_PRIMASK], regs[REG_EXC_RETURN]); # else @@ -312,7 +312,7 @@ int up_svcall(int irq, FAR void *context) * R3 = argv */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED case SYS_task_start: { /* 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 */ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_PTHREAD) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_DISABLE_PTHREAD) case SYS_pthread_start: { /* 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) */ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_DISABLE_SIGNALS) case SYS_signal_handler: { struct tcb_s *rtcb = sched_self(); @@ -421,7 +421,7 @@ int up_svcall(int irq, FAR void *context) * 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: { 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_R12], current_regs[REG_R13], 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", current_regs[REG_XPSR], current_regs[REG_PRIMASK], current_regs[REG_EXC_RETURN]); diff --git a/nuttx/arch/arm/src/armv7-a/arm_initialstate.c b/nuttx/arch/arm/src/armv7-a/arm_initialstate.c index d42062941..74205394c 100644 --- a/nuttx/arch/arm/src/armv7-a/arm_initialstate.c +++ b/nuttx/arch/arm/src/armv7-a/arm_initialstate.c @@ -114,7 +114,7 @@ void up_initial_state(struct tcb_s *tcb) * 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) { /* It is a kernel thread.. set supervisor mode */ diff --git a/nuttx/arch/arm/src/armv7-a/arm_syscall.c b/nuttx/arch/arm/src/armv7-a/arm_syscall.c index 542f9c7d0..32b122e42 100644 --- a/nuttx/arch/arm/src/armv7-a/arm_syscall.c +++ b/nuttx/arch/arm/src/armv7-a/arm_syscall.c @@ -157,7 +157,7 @@ static void dispatch_syscall(void) uint32_t *arm_syscall(uint32_t *regs) { uint32_t cmd; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL uint32_t cpsr; #endif @@ -214,7 +214,7 @@ uint32_t *arm_syscall(uint32_t *regs) */ regs[REG_PC] = rtcb->xcp.syscall[index].sysreturn; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL regs[REG_CPSR] = rtcb->xcp.syscall[index].cpsr; #endif rtcb->xcp.nsyscalls = index; @@ -239,7 +239,7 @@ uint32_t *arm_syscall(uint32_t *regs) * R3 = argv */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL case SYS_task_start: { /* 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 */ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_PTHREAD) +#if defined(CONFIG_BUILD_KERNEL) && !defined(CONFIG_DISABLE_PTHREAD) case SYS_pthread_start: { /* 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) */ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) +#if defined(CONFIG_BUILD_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) case SYS_signal_handler: { struct tcb_s *rtcb = sched_self(); @@ -351,7 +351,7 @@ uint32_t *arm_syscall(uint32_t *regs) * 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: { 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. */ rtcb->xcp.syscall[index].sysreturn = regs[REG_PC]; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL rtcb->xcp.syscall[index].cpsr = regs[REG_CPSR]; #endif rtcb->xcp.nsyscalls = index + 1; regs[REG_PC] = (uint32_t)dispatch_syscall; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL regval = regs[REG_CPSR] & ~PSR_MODE_MASK; regs[REG_CPSR] = regval | PSR_MODE_SVC; #endif diff --git a/nuttx/arch/arm/src/armv7-a/svcall.h b/nuttx/arch/arm/src/armv7-a/svcall.h index 90a25fb2c..5253e27b9 100644 --- a/nuttx/arch/arm/src/armv7-a/svcall.h +++ b/nuttx/arch/arm/src/armv7-a/svcall.h @@ -54,11 +54,11 @@ /* Configuration ********************************************************************/ /* 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. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL # ifndef CONFIG_SYS_RESERVED # error "CONFIG_SYS_RESERVED must be defined to have the value 5" # elif CONFIG_SYS_RESERVED != 5 @@ -81,7 +81,7 @@ #define SYS_syscall_return (0) -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL /* SYS call 1: * * void up_task_start(main_t taskentry, int argc, FAR char *argv[]) @@ -113,7 +113,7 @@ #define SYS_signal_handler_return (4) -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_KERNEL */ /************************************************************************************ * Inline Functions diff --git a/nuttx/arch/arm/src/armv7-m/svcall.h b/nuttx/arch/arm/src/armv7-m/svcall.h index dd4ef8d6c..f90579946 100644 --- a/nuttx/arch/arm/src/armv7-m/svcall.h +++ b/nuttx/arch/arm/src/armv7-m/svcall.h @@ -53,11 +53,11 @@ /* Configuration ********************************************************************/ /* 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 - * 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_NUTTX_KERNEL +# ifdef CONFIG_BUILD_PROTECTED # ifndef CONFIG_SYS_RESERVED # error "CONFIG_SYS_RESERVED must be defined to have the value 8" # elif CONFIG_SYS_RESERVED != 8 @@ -103,7 +103,7 @@ #define SYS_syscall_return (3) -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* SYS call 4: * * void up_task_start(main_t taskentry, int argc, FAR char *argv[]) @@ -135,7 +135,7 @@ #define SYS_signal_handler_return (7) -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ #endif /* CONFIG_LIB_SYSCALL */ /************************************************************************************ diff --git a/nuttx/arch/arm/src/armv7-m/up_exception.S b/nuttx/arch/arm/src/armv7-m/up_exception.S index 517525415..88f5fe2d6 100644 --- a/nuttx/arch/arm/src/armv7-m/up_exception.S +++ b/nuttx/arch/arm/src/armv7-m/up_exception.S @@ -66,7 +66,7 @@ * 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 # endif @@ -259,7 +259,7 @@ exception_common: /* 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 * (handler mode) if the stack is on the MSP. It can only be on the PSP if * EXC_RETURN is 0xfffffffd (unprivileged thread) diff --git a/nuttx/arch/arm/src/armv7-m/up_hardfault.c b/nuttx/arch/arm/src/armv7-m/up_hardfault.c index 732c2ca0e..7af0fe551 100644 --- a/nuttx/arch/arm/src/armv7-m/up_hardfault.c +++ b/nuttx/arch/arm/src/armv7-m/up_hardfault.c @@ -108,7 +108,7 @@ int up_hardfault(int irq, FAR void *context) * 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 * FLASH region or in the user FLASH region. */ diff --git a/nuttx/arch/arm/src/armv7-m/up_initialstate.c b/nuttx/arch/arm/src/armv7-m/up_initialstate.c index e7f7ef7fd..d4c625b86 100644 --- a/nuttx/arch/arm/src/armv7-m/up_initialstate.c +++ b/nuttx/arch/arm/src/armv7-m/up_initialstate.c @@ -126,16 +126,16 @@ void up_initial_state(struct tcb_s *tcb) #endif #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 - * 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 * mode before transferring control to the user task. */ 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) diff --git a/nuttx/arch/arm/src/armv7-m/up_schedulesigaction.c b/nuttx/arch/arm/src/armv7-m/up_schedulesigaction.c index 8110ef2da..d61420a73 100644 --- a/nuttx/arch/arm/src/armv7-m/up_schedulesigaction.c +++ b/nuttx/arch/arm/src/armv7-m/up_schedulesigaction.c @@ -157,7 +157,7 @@ void up_schedule_sigaction(struct tcb_s *tcb, sig_deliver_t sigdeliver) tcb->xcp.saved_primask = current_regs[REG_PRIMASK]; #endif tcb->xcp.saved_xpsr = current_regs[REG_XPSR]; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED tcb->xcp.saved_lr = current_regs[REG_LR]; #endif /* 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; #endif current_regs[REG_XPSR] = ARMV7M_XPSR_T; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED current_regs[REG_LR] = EXC_RETURN_PRIVTHR; #endif /* 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]; #endif 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]; #endif /* 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; #endif tcb->xcp.regs[REG_XPSR] = ARMV7M_XPSR_T; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED tcb->xcp.regs[REG_LR] = EXC_RETURN_PRIVTHR; #endif } diff --git a/nuttx/arch/arm/src/armv7-m/up_sigdeliver.c b/nuttx/arch/arm/src/armv7-m/up_sigdeliver.c index 4fbfc02c5..c65f3cf0a 100644 --- a/nuttx/arch/arm/src/armv7-m/up_sigdeliver.c +++ b/nuttx/arch/arm/src/armv7-m/up_sigdeliver.c @@ -108,7 +108,7 @@ void up_sigdeliver(void) regs[REG_PRIMASK] = rtcb->xcp.saved_primask; #endif regs[REG_XPSR] = rtcb->xcp.saved_xpsr; -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED regs[REG_LR] = rtcb->xcp.saved_lr; #endif diff --git a/nuttx/arch/arm/src/armv7-m/up_signal_handler.S b/nuttx/arch/arm/src/armv7-m/up_signal_handler.S index f19dcdaa7..38a0bd35d 100644 --- a/nuttx/arch/arm/src/armv7-m/up_signal_handler.S +++ b/nuttx/arch/arm/src/armv7-m/up_signal_handler.S @@ -41,7 +41,7 @@ #include <arch/syscall.h> -#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__) /**************************************************************************** * File info @@ -115,4 +115,4 @@ up_signal_handler: .size up_signal_handler, .-up_signal_handler .end -#endif /* CONFIG_NUTTX_KERNEL && !__KERNEL__ */ +#endif /* CONFIG_BUILD_PROTECTED && !__KERNEL__ */ diff --git a/nuttx/arch/arm/src/armv7-m/up_svcall.c b/nuttx/arch/arm/src/armv7-m/up_svcall.c index 4a87401c1..80d07b4e5 100644 --- a/nuttx/arch/arm/src/armv7-m/up_svcall.c +++ b/nuttx/arch/arm/src/armv7-m/up_svcall.c @@ -311,7 +311,7 @@ int up_svcall(int irq, FAR void *context) * R3 = argv */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED case SYS_task_start: { /* 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 */ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_PTHREAD) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_DISABLE_PTHREAD) case SYS_pthread_start: { /* 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) */ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_DISABLE_SIGNALS) case SYS_signal_handler: { struct tcb_s *rtcb = sched_self(); @@ -420,7 +420,7 @@ int up_svcall(int irq, FAR void *context) * 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: { struct tcb_s *rtcb = sched_self(); diff --git a/nuttx/arch/arm/src/common/up_allocateheap.c b/nuttx/arch/arm/src/common/up_allocateheap.c index a5c1a068c..f312ae067 100644 --- a/nuttx/arch/arm/src/common/up_allocateheap.c +++ b/nuttx/arch/arm/src/common/up_allocateheap.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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> * * Redistribution and use in source and binary forms, with or without @@ -55,6 +55,13 @@ /**************************************************************************** * 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 @@ -74,9 +81,9 @@ * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and - * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function provides the - * size of the unprotected, user-space heap. + * For the kernel build (CONFIG_BUILD_KERNEL/PROTECTED=y) with both kernel- + * and user-space heaps (CONFIG_MM_KERNEL_HEAP=y), 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 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) { -#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. * This heap begins after the user-space .bss section at an offset * 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 * * Description: - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and - * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), this function allocates + * For the kernel build (CONFIG_BUILD_PROTECTED/KERNEL=y) with both kernel- + * 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 * 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) { /* Get the unaligned size and position of the user-space heap. diff --git a/nuttx/arch/arm/src/common/up_createstack.c b/nuttx/arch/arm/src/common/up_createstack.c index 44d6ce862..38170e228 100644 --- a/nuttx/arch/arm/src/common/up_createstack.c +++ b/nuttx/arch/arm/src/common/up_createstack.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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> * * Redistribution and use in source and binary forms, with or without @@ -54,6 +54,13 @@ /**************************************************************************** * 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 * 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 * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL 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 either CONFIG_BUILD_PROTECTED or CONFIG_BUILD_KERNEL 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. * ****************************************************************************/ @@ -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. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#ifdef HAVE_KERNEL_HEAP /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/nuttx/arch/arm/src/common/up_pthread_start.c b/nuttx/arch/arm/src/common/up_pthread_start.c index 2f9de8995..31ccb80c1 100644 --- a/nuttx/arch/arm/src/common/up_pthread_start.c +++ b/nuttx/arch/arm/src/common/up_pthread_start.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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> * * Redistribution and use in source and binary forms, with or without @@ -44,7 +44,9 @@ #include "svcall.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 @@ -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); } -#endif /* CONFIG_NUTTX_KERNEL &&& __KERNEL__ && !CONFIG_DISABLE_PTHREAD */ +#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */ diff --git a/nuttx/arch/arm/src/common/up_releasestack.c b/nuttx/arch/arm/src/common/up_releasestack.c index 9668ec245..d7abec71a 100644 --- a/nuttx/arch/arm/src/common/up_releasestack.c +++ b/nuttx/arch/arm/src/common/up_releasestack.c @@ -48,6 +48,17 @@ #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 ****************************************************************************/ @@ -79,11 +90,11 @@ * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is 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. Stacks for user tasks - * and threads must have come from memory that is accessible to user - * code. + * If either CONFIG_BUILD_PROTECTED or CONFIG_BUILD_KERNEL 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. Stacks for user tasks and threads must have come from memory + * that is accessible to user code. * * Returned Value: * None @@ -96,7 +107,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) 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 */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/nuttx/arch/arm/src/common/up_signal_dispatch.c b/nuttx/arch/arm/src/common/up_signal_dispatch.c index d46b77928..75725237f 100644 --- a/nuttx/arch/arm/src/common/up_signal_dispatch.c +++ b/nuttx/arch/arm/src/common/up_signal_dispatch.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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> * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,9 @@ #include "svcall.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 @@ -99,4 +101,4 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo, (uintptr_t)info, (uintptr_t)ucontext); } -#endif /* CONFIG_NUTTX_KERNEL && __KERNEL__ && !CONFIG_DISABLE_SIGNALS */ +#endif /* (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) && !CONFIG_DISABLE_PTHREAD */ diff --git a/nuttx/arch/arm/src/common/up_task_start.c b/nuttx/arch/arm/src/common/up_task_start.c index 0a3f3c4a4..c840a19dc 100644 --- a/nuttx/arch/arm/src/common/up_task_start.c +++ b/nuttx/arch/arm/src/common/up_task_start.c @@ -1,7 +1,7 @@ /**************************************************************************** * 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> * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,7 @@ #include "svcall.h" #include "up_internal.h" -#ifdef CONFIG_NUTTX_KERNEL +#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL) /**************************************************************************** * Pre-processor Definitions @@ -94,4 +94,4 @@ void up_task_start(main_t taskentry, int argc, FAR char *argv[]) (uintptr_t)argv); } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL */ diff --git a/nuttx/arch/arm/src/dm320/dm320_allocateheap.c b/nuttx/arch/arm/src/dm320/dm320_allocateheap.c index 1ccffe3bb..509d08fed 100644 --- a/nuttx/arch/arm/src/dm320/dm320_allocateheap.c +++ b/nuttx/arch/arm/src/dm320/dm320_allocateheap.c @@ -71,7 +71,7 @@ * This function will be called to dynamically set aside * 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), * this function provides the size of the unprotected, * user-space heap. diff --git a/nuttx/arch/arm/src/imx/imx_allocateheap.c b/nuttx/arch/arm/src/imx/imx_allocateheap.c index 266e743f8..93c0f48c0 100644 --- a/nuttx/arch/arm/src/imx/imx_allocateheap.c +++ b/nuttx/arch/arm/src/imx/imx_allocateheap.c @@ -74,7 +74,7 @@ * Description: * 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 * size of the unprotected, user-space heap. * diff --git a/nuttx/arch/arm/src/kinetis/Make.defs b/nuttx/arch/arm/src/kinetis/Make.defs index 6f0de0594..4e5689d27 100644 --- a/nuttx/arch/arm/src/kinetis/Make.defs +++ b/nuttx/arch/arm/src/kinetis/Make.defs @@ -58,7 +58,7 @@ ifeq ($(CONFIG_ARCH_MEMCPY),y) CMN_ASRCS += up_memcpy.S 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 ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_signal_dispatch.c @@ -91,7 +91,7 @@ ifneq ($(CONFIG_SCHED_TICKLESS),y) CHIP_CSRCS += kinetis_timerisr.c endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CHIP_CSRCS += kinetis_userspace.c kinetis_mpuinit.c endif diff --git a/nuttx/arch/arm/src/kinetis/kinetis_allocateheap.c b/nuttx/arch/arm/src/kinetis/kinetis_allocateheap.c index fab0b3cb5..a03b13222 100644 --- a/nuttx/arch/arm/src/kinetis/kinetis_allocateheap.c +++ b/nuttx/arch/arm/src/kinetis/kinetis_allocateheap.c @@ -76,7 +76,7 @@ * Description: * 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 * size of the unprotected, user-space heap. * @@ -105,7 +105,7 @@ 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. * This heap begins after the user-space .bss section at an offset * 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 * * 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 * (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) { /* Get the unaligned size and position of the user-space heap. diff --git a/nuttx/arch/arm/src/kinetis/kinetis_mpuinit.c b/nuttx/arch/arm/src/kinetis/kinetis_mpuinit.c index bd81374ff..07ea72229 100644 --- a/nuttx/arch/arm/src/kinetis/kinetis_mpuinit.c +++ b/nuttx/arch/arm/src/kinetis/kinetis_mpuinit.c @@ -46,7 +46,7 @@ #include "mpu.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 @@ -120,5 +120,5 @@ void kinetis_mpu_uheap(uintptr_t start, size_t size) mpu_userintsram(start, size); } -#endif /* CONFIG_NUTTX_KERNEL && CONFIG_ARMV7M_MPU */ +#endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARMV7M_MPU */ diff --git a/nuttx/arch/arm/src/kinetis/kinetis_mpuinit.h b/nuttx/arch/arm/src/kinetis/kinetis_mpuinit.h index 1e88b67a2..f3cf95370 100644 --- a/nuttx/arch/arm/src/kinetis/kinetis_mpuinit.h +++ b/nuttx/arch/arm/src/kinetis/kinetis_mpuinit.h @@ -67,7 +67,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void kinetis_mpuinitialize(void); #else # 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); #else # define kinetis_mpu_uheap(start,size) diff --git a/nuttx/arch/arm/src/kinetis/kinetis_start.c b/nuttx/arch/arm/src/kinetis/kinetis_start.c index b611709a6..1d463ec2e 100644 --- a/nuttx/arch/arm/src/kinetis/kinetis_start.c +++ b/nuttx/arch/arm/src/kinetis/kinetis_start.c @@ -146,7 +146,7 @@ void __start(void) * segments. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED kinetis_userspace(); #endif diff --git a/nuttx/arch/arm/src/kinetis/kinetis_userspace.c b/nuttx/arch/arm/src/kinetis/kinetis_userspace.c index d0d57145d..4fc37a090 100644 --- a/nuttx/arch/arm/src/kinetis/kinetis_userspace.c +++ b/nuttx/arch/arm/src/kinetis/kinetis_userspace.c @@ -47,7 +47,7 @@ #include "kinetis_mpuinit.h" #include "kinetis_userspace.h" -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /**************************************************************************** * Pre-processor Definitions @@ -115,5 +115,5 @@ void kinetis_userspace(void) kinetis_mpuinitialize(); } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ diff --git a/nuttx/arch/arm/src/kinetis/kinetis_userspace.h b/nuttx/arch/arm/src/kinetis/kinetis_userspace.h index ecad3b609..39b4b6ef5 100644 --- a/nuttx/arch/arm/src/kinetis/kinetis_userspace.h +++ b/nuttx/arch/arm/src/kinetis/kinetis_userspace.h @@ -69,7 +69,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void kinetis_userspace(void); #endif diff --git a/nuttx/arch/arm/src/kinetis/kinetis_vectors.S b/nuttx/arch/arm/src/kinetis/kinetis_vectors.S index 8ba6db658..ed0ba52a1 100644 --- a/nuttx/arch/arm/src/kinetis/kinetis_vectors.S +++ b/nuttx/arch/arm/src/kinetis/kinetis_vectors.S @@ -63,7 +63,7 @@ * 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 # endif @@ -621,7 +621,7 @@ exception_common: /* Complete the context save */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* 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 * EXC_RETURN is 0xfffffffd (unprivileged thread) @@ -663,7 +663,7 @@ exception_common: * r14=register values. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ #else 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 */ ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */ 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 */ #else ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -766,7 +766,7 @@ exception_common: */ 2: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ #else ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -791,7 +791,7 @@ exception_common: 3: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* 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 * EXC_RETURN is 0xfffffffd (unprivileged thread) diff --git a/nuttx/arch/arm/src/kl/Make.defs b/nuttx/arch/arm/src/kl/Make.defs index 9fc5bcd08..12162fde0 100644 --- a/nuttx/arch/arm/src/kl/Make.defs +++ b/nuttx/arch/arm/src/kl/Make.defs @@ -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_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 ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_signal_dispatch.c @@ -75,7 +75,7 @@ ifneq ($(CONFIG_SCHED_TICKLESS),y) CHIP_CSRCS += kl_timerisr.c endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CHIP_CSRCS += kl_userspace.c endif diff --git a/nuttx/arch/arm/src/kl/kl_start.c b/nuttx/arch/arm/src/kl/kl_start.c index 79d1ec160..c87f65b7c 100644 --- a/nuttx/arch/arm/src/kl/kl_start.c +++ b/nuttx/arch/arm/src/kl/kl_start.c @@ -162,7 +162,7 @@ void __start(void) * segments. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED kl_userspace(); showprogress('E'); #endif diff --git a/nuttx/arch/arm/src/kl/kl_userspace.c b/nuttx/arch/arm/src/kl/kl_userspace.c index 8949a90d2..d66bfe2e4 100644 --- a/nuttx/arch/arm/src/kl/kl_userspace.c +++ b/nuttx/arch/arm/src/kl/kl_userspace.c @@ -46,7 +46,7 @@ #include "kl_userspace.h" -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /**************************************************************************** * Pre-processor Definitions @@ -110,5 +110,5 @@ void kl_userspace(void) } } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ diff --git a/nuttx/arch/arm/src/kl/kl_userspace.h b/nuttx/arch/arm/src/kl/kl_userspace.h index c92dfe2b0..a87af46f7 100644 --- a/nuttx/arch/arm/src/kl/kl_userspace.h +++ b/nuttx/arch/arm/src/kl/kl_userspace.h @@ -69,7 +69,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void kl_userspace(void); #endif diff --git a/nuttx/arch/arm/src/lpc17xx/Make.defs b/nuttx/arch/arm/src/lpc17xx/Make.defs index 19114864b..539e5de71 100644 --- a/nuttx/arch/arm/src/lpc17xx/Make.defs +++ b/nuttx/arch/arm/src/lpc17xx/Make.defs @@ -70,7 +70,7 @@ ifeq ($(CONFIG_ARCH_MEMCPY),y) CMN_ASRCS += up_memcpy.S 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 ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_signal_dispatch.c @@ -113,7 +113,7 @@ ifeq ($(CONFIG_ARMV7M_CMNVECTOR),y) CHIP_ASRCS += lpc17_vectors.S endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CHIP_CSRCS += lpc17_userspace.c lpc17_mpuinit.c endif diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_allocateheap.c b/nuttx/arch/arm/src/lpc17xx/lpc17_allocateheap.c index cc84be352..e5116a96a 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_allocateheap.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_allocateheap.c @@ -186,7 +186,7 @@ * Description: * 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 * size of the unprotected, user-space heap. * @@ -215,7 +215,7 @@ 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. * This heap begins after the user-space .bss section at an offset * 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 * * 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 * (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) { /* Get the unaligned size and position of the user-space heap. @@ -326,7 +326,7 @@ void up_addregion(void) */ #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 */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_mpuinit.c b/nuttx/arch/arm/src/lpc17xx/lpc17_mpuinit.c index 046f6e703..c8ccee51f 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_mpuinit.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_mpuinit.c @@ -46,7 +46,7 @@ #include "mpu.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 @@ -120,5 +120,5 @@ void lpc17_mpu_uheap(uintptr_t start, size_t size) mpu_userintsram(start, size); } -#endif /* CONFIG_NUTTX_KERNEL && CONFIG_ARMV7M_MPU */ +#endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARMV7M_MPU */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_mpuinit.h b/nuttx/arch/arm/src/lpc17xx/lpc17_mpuinit.h index 4d0e6944f..145789532 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_mpuinit.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_mpuinit.h @@ -67,7 +67,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void lpc17_mpuinitialize(void); #else # 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); #else # define lpc17_mpu_uheap(start,size) diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_start.c b/nuttx/arch/arm/src/lpc17xx/lpc17_start.c index 80f136f11..2cfb16f39 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_start.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_start.c @@ -239,7 +239,7 @@ void __start(void) * segments. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED lpc17_userspace(); showprogress('E'); #endif diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_userspace.c b/nuttx/arch/arm/src/lpc17xx/lpc17_userspace.c index 8a2d23dde..3e8f4e774 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_userspace.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_userspace.c @@ -47,7 +47,7 @@ #include "lpc17_mpuinit.h" #include "lpc17_userspace.h" -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /**************************************************************************** * Pre-processor Definitions @@ -115,5 +115,5 @@ void lpc17_userspace(void) lpc17_mpuinitialize(); } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_userspace.h b/nuttx/arch/arm/src/lpc17xx/lpc17_userspace.h index 880e52eda..5adb8771c 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_userspace.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_userspace.h @@ -69,7 +69,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void lpc17_userspace(void); #endif diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_vectors.S b/nuttx/arch/arm/src/lpc17xx/lpc17_vectors.S index 9e54b3048..555bf0ddc 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_vectors.S +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_vectors.S @@ -64,7 +64,7 @@ * 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 # endif @@ -233,7 +233,7 @@ exception_common: /* Complete the context save */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* 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 * EXC_RETURN is 0xfffffffd (unprivileged thread) @@ -275,7 +275,7 @@ exception_common: * r14=register values. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ #else 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 */ ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */ 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 */ #else ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -378,7 +378,7 @@ exception_common: */ 2: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ #else ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -403,7 +403,7 @@ exception_common: 3: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* 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 * EXC_RETURN is 0xfffffffd (unprivileged thread) diff --git a/nuttx/arch/arm/src/lpc31xx/lpc31_allocateheap.c b/nuttx/arch/arm/src/lpc31xx/lpc31_allocateheap.c index 6606f5a80..4c2c262b1 100644 --- a/nuttx/arch/arm/src/lpc31xx/lpc31_allocateheap.c +++ b/nuttx/arch/arm/src/lpc31xx/lpc31_allocateheap.c @@ -159,7 +159,7 @@ * Description: * 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 * size of the unprotected, user-space heap. * diff --git a/nuttx/arch/arm/src/lpc43xx/Make.defs b/nuttx/arch/arm/src/lpc43xx/Make.defs index 9b4053b3b..04793d7b1 100644 --- a/nuttx/arch/arm/src/lpc43xx/Make.defs +++ b/nuttx/arch/arm/src/lpc43xx/Make.defs @@ -59,7 +59,7 @@ ifeq ($(CONFIG_ARCH_MEMCPY),y) CMN_ASRCS += up_memcpy.S 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 ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_signal_dispatch.c @@ -91,7 +91,7 @@ ifneq ($(CONFIG_SCHED_TICKLESS),y) CHIP_CSRCS += lpc43_timerisr.c endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CHIP_CSRCS += lpc43_userspace.c lpc43_mpuinit.c endif diff --git a/nuttx/arch/arm/src/lpc43xx/lpc43_allocateheap.c b/nuttx/arch/arm/src/lpc43xx/lpc43_allocateheap.c index 0dd84e1ae..93cbe2acc 100644 --- a/nuttx/arch/arm/src/lpc43xx/lpc43_allocateheap.c +++ b/nuttx/arch/arm/src/lpc43xx/lpc43_allocateheap.c @@ -234,7 +234,7 @@ const uint32_t g_idle_topstack = (uint32_t)&_ebss + CONFIG_IDLETHREAD_STACKSIZE; * Description: * 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 * size of the unprotected, user-space heap. * diff --git a/nuttx/arch/arm/src/lpc43xx/lpc43_mpuinit.c b/nuttx/arch/arm/src/lpc43xx/lpc43_mpuinit.c index 02e8fb04e..c9a20b55a 100644 --- a/nuttx/arch/arm/src/lpc43xx/lpc43_mpuinit.c +++ b/nuttx/arch/arm/src/lpc43xx/lpc43_mpuinit.c @@ -46,7 +46,7 @@ #include "mpu.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 @@ -120,5 +120,5 @@ void lpc43_mpu_uheap(uintptr_t start, size_t size) mpu_userintsram(start, size); } -#endif /* CONFIG_NUTTX_KERNEL && CONFIG_ARMV7M_MPU */ +#endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARMV7M_MPU */ diff --git a/nuttx/arch/arm/src/lpc43xx/lpc43_mpuinit.h b/nuttx/arch/arm/src/lpc43xx/lpc43_mpuinit.h index 1759e0dcd..f4c6c59ca 100644 --- a/nuttx/arch/arm/src/lpc43xx/lpc43_mpuinit.h +++ b/nuttx/arch/arm/src/lpc43xx/lpc43_mpuinit.h @@ -67,7 +67,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void lpc43_mpuinitialize(void); #else # 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); #else # define lpc43_mpu_uheap(start,size) diff --git a/nuttx/arch/arm/src/lpc43xx/lpc43_start.c b/nuttx/arch/arm/src/lpc43xx/lpc43_start.c index 19756c754..f07811eb5 100644 --- a/nuttx/arch/arm/src/lpc43xx/lpc43_start.c +++ b/nuttx/arch/arm/src/lpc43xx/lpc43_start.c @@ -339,7 +339,7 @@ void __start(void) * segments. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED lpc43_userspace(); showprogress('F'); #endif diff --git a/nuttx/arch/arm/src/lpc43xx/lpc43_userspace.c b/nuttx/arch/arm/src/lpc43xx/lpc43_userspace.c index 7bc7f1c25..822381b24 100644 --- a/nuttx/arch/arm/src/lpc43xx/lpc43_userspace.c +++ b/nuttx/arch/arm/src/lpc43xx/lpc43_userspace.c @@ -47,7 +47,7 @@ #include "lpc43_mpuinit.h" #include "lpc43_userspace.h" -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /**************************************************************************** * Pre-processor Definitions @@ -115,5 +115,5 @@ void lpc43_userspace(void) lpc43_mpuinitialize(); } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ diff --git a/nuttx/arch/arm/src/lpc43xx/lpc43_userspace.h b/nuttx/arch/arm/src/lpc43xx/lpc43_userspace.h index f7632388f..77b6d1e60 100644 --- a/nuttx/arch/arm/src/lpc43xx/lpc43_userspace.h +++ b/nuttx/arch/arm/src/lpc43xx/lpc43_userspace.h @@ -69,7 +69,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void lpc43_userspace(void); #endif diff --git a/nuttx/arch/arm/src/nuc1xx/Make.defs b/nuttx/arch/arm/src/nuc1xx/Make.defs index c8cfdf0a3..6161b4928 100644 --- a/nuttx/arch/arm/src/nuc1xx/Make.defs +++ b/nuttx/arch/arm/src/nuc1xx/Make.defs @@ -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_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 ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_signal_dispatch.c @@ -75,7 +75,7 @@ ifneq ($(CONFIG_SCHED_TICKLESS),y) CHIP_CSRCS += nuc_timerisr.c endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CHIP_CSRCS += nuc_userspace.c endif diff --git a/nuttx/arch/arm/src/nuc1xx/nuc_start.c b/nuttx/arch/arm/src/nuc1xx/nuc_start.c index aeb0f4e6e..e7cf1b4b1 100644 --- a/nuttx/arch/arm/src/nuc1xx/nuc_start.c +++ b/nuttx/arch/arm/src/nuc1xx/nuc_start.c @@ -156,7 +156,7 @@ void __start(void) * segments. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED nuc_userspace(); showprogress('E'); #endif diff --git a/nuttx/arch/arm/src/nuc1xx/nuc_userspace.c b/nuttx/arch/arm/src/nuc1xx/nuc_userspace.c index 88a50695c..2ace6184b 100644 --- a/nuttx/arch/arm/src/nuc1xx/nuc_userspace.c +++ b/nuttx/arch/arm/src/nuc1xx/nuc_userspace.c @@ -46,7 +46,7 @@ #include "nuc_userspace.h" -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /**************************************************************************** * Pre-processor Definitions @@ -110,5 +110,5 @@ void nuc_userspace(void) } } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ diff --git a/nuttx/arch/arm/src/nuc1xx/nuc_userspace.h b/nuttx/arch/arm/src/nuc1xx/nuc_userspace.h index 9123ce8e1..e648c04e7 100644 --- a/nuttx/arch/arm/src/nuc1xx/nuc_userspace.h +++ b/nuttx/arch/arm/src/nuc1xx/nuc_userspace.h @@ -69,7 +69,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void nuc_userspace(void); #endif diff --git a/nuttx/arch/arm/src/sam34/Make.defs b/nuttx/arch/arm/src/sam34/Make.defs index 607b08fd6..ec7d10b3a 100644 --- a/nuttx/arch/arm/src/sam34/Make.defs +++ b/nuttx/arch/arm/src/sam34/Make.defs @@ -62,7 +62,7 @@ ifeq ($(CONFIG_ARCH_MEMCPY),y) CMN_ASRCS += up_memcpy.S 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 ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_signal_dispatch.c @@ -104,7 +104,7 @@ else CHIP_CSRCS += sam_clockconfig.c sam_gpio.c endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CHIP_CSRCS += sam_userspace.c sam_mpuinit.c endif diff --git a/nuttx/arch/arm/src/sam34/sam_allocateheap.c b/nuttx/arch/arm/src/sam34/sam_allocateheap.c index a868b419d..dc468ed0d 100644 --- a/nuttx/arch/arm/src/sam34/sam_allocateheap.c +++ b/nuttx/arch/arm/src/sam34/sam_allocateheap.c @@ -175,7 +175,7 @@ * Description: * 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 * size of the unprotected, user-space heap. * @@ -204,7 +204,7 @@ 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. * This heap begins after the user-space .bss section at an offset * 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 * * 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 * (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) { /* Get the unaligned size and position of the user-space heap. diff --git a/nuttx/arch/arm/src/sam34/sam_mpuinit.c b/nuttx/arch/arm/src/sam34/sam_mpuinit.c index 3b49f9d97..ec2366a8e 100644 --- a/nuttx/arch/arm/src/sam34/sam_mpuinit.c +++ b/nuttx/arch/arm/src/sam34/sam_mpuinit.c @@ -46,7 +46,7 @@ #include "mpu.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 @@ -120,5 +120,5 @@ void sam_mpu_uheap(uintptr_t start, size_t size) mpu_userintsram(start, size); } -#endif /* CONFIG_NUTTX_KERNEL && CONFIG_ARMV7M_MPU */ +#endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARMV7M_MPU */ diff --git a/nuttx/arch/arm/src/sam34/sam_mpuinit.h b/nuttx/arch/arm/src/sam34/sam_mpuinit.h index d047447ac..cedc3c8ef 100644 --- a/nuttx/arch/arm/src/sam34/sam_mpuinit.h +++ b/nuttx/arch/arm/src/sam34/sam_mpuinit.h @@ -85,7 +85,7 @@ extern "C" * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void sam_mpuinitialize(void); #else # 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); #else # define sam_mpu_uheap(start,size) diff --git a/nuttx/arch/arm/src/sam34/sam_start.c b/nuttx/arch/arm/src/sam34/sam_start.c index 24857d9ce..0a51927a5 100644 --- a/nuttx/arch/arm/src/sam34/sam_start.c +++ b/nuttx/arch/arm/src/sam34/sam_start.c @@ -154,7 +154,7 @@ void __start(void) * segements. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED sam_userspace(); showprogress('C'); #endif diff --git a/nuttx/arch/arm/src/sam34/sam_userspace.c b/nuttx/arch/arm/src/sam34/sam_userspace.c index fc266fe8f..d61e07d0f 100644 --- a/nuttx/arch/arm/src/sam34/sam_userspace.c +++ b/nuttx/arch/arm/src/sam34/sam_userspace.c @@ -47,7 +47,7 @@ #include "sam_mpuinit.h" #include "sam_userspace.h" -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /**************************************************************************** * Private Definitions @@ -115,5 +115,5 @@ void sam_userspace(void) sam_mpuinitialize(); } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ diff --git a/nuttx/arch/arm/src/sam34/sam_userspace.h b/nuttx/arch/arm/src/sam34/sam_userspace.h index b24577589..57ce401d3 100644 --- a/nuttx/arch/arm/src/sam34/sam_userspace.h +++ b/nuttx/arch/arm/src/sam34/sam_userspace.h @@ -92,7 +92,7 @@ extern "C" * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void sam_userspace(void); #endif diff --git a/nuttx/arch/arm/src/sam34/sam_vectors.S b/nuttx/arch/arm/src/sam34/sam_vectors.S index 10cbd82f3..51524be86 100644 --- a/nuttx/arch/arm/src/sam34/sam_vectors.S +++ b/nuttx/arch/arm/src/sam34/sam_vectors.S @@ -62,7 +62,7 @@ * 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 # endif @@ -246,7 +246,7 @@ exception_common: /* Complete the context save */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* 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 * EXC_RETURN is 0xfffffffd (unprivileged thread) @@ -288,7 +288,7 @@ exception_common: * r14=register values. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ #else 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 */ ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */ 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 */ #else ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -391,7 +391,7 @@ exception_common: */ 2: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ #else ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -416,7 +416,7 @@ exception_common: 3: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* 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 * EXC_RETURN is 0xfffffffd (unprivileged thread) diff --git a/nuttx/arch/arm/src/sama5/sam_allocateheap.c b/nuttx/arch/arm/src/sama5/sam_allocateheap.c index 3a4113fde..44c32fcd4 100644 --- a/nuttx/arch/arm/src/sama5/sam_allocateheap.c +++ b/nuttx/arch/arm/src/sama5/sam_allocateheap.c @@ -46,7 +46,6 @@ #include <nuttx/arch.h> #include <nuttx/kmalloc.h> -#include <nuttx/userspace.h> #include <arch/board/board.h> @@ -219,7 +218,7 @@ * Description: * 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 * size of the unprotected, user-space heap. * @@ -249,7 +248,7 @@ 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. * This heap begins after the user-space .bss section at an offset * 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 * * 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 * the kernel-space heap. A custom version of this function is need if * 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) { /* 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 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 */ sam_uheap(vaddr, size); @@ -360,7 +359,7 @@ void up_addregion(void) vaddr = (uintptr_t)SAM_DDRCS_VSECTION + SAMA5_DDRCS_HEAP_OFFSET; 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 */ sam_uheap(vaddr, size); @@ -385,7 +384,7 @@ void up_addregion(void) vaddr = (uintptr_t)SAM_EBICS0_VSECTION + SAMA5_EBICS0_HEAP_OFFSET; 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 */ sam_uheap(vaddr, size); @@ -410,7 +409,7 @@ void up_addregion(void) vaddr = (uintptr_t)SAM_EBICS1_VSECTION + SAMA5_EBICS1_HEAP_OFFSET; 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 */ sam_uheap(vaddr, size); @@ -435,7 +434,7 @@ void up_addregion(void) vaddr = (uintptr_t)SAM_EBICS2_VSECTION + SAMA5_EBICS2_HEAP_OFFSET; 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 */ sam_uheap(vaddr, size); @@ -460,7 +459,7 @@ void up_addregion(void) vaddr = (uintptr_t)SAM_EBICS3_VSECTION + SAMA5_EBICS3_HEAP_OFFSET; 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 */ sam_uheap(vaddr, size); diff --git a/nuttx/arch/arm/src/sama5/sam_boot.c b/nuttx/arch/arm/src/sama5/sam_boot.c index 37f3c4ba5..32d51a9e8 100644 --- a/nuttx/arch/arm/src/sama5/sam_boot.c +++ b/nuttx/arch/arm/src/sama5/sam_boot.c @@ -782,14 +782,4 @@ void up_boot(void) sam_earlyserialinit(); #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 } diff --git a/nuttx/arch/arm/src/samd/Make.defs b/nuttx/arch/arm/src/samd/Make.defs index 308757881..1cc4b2f4d 100644 --- a/nuttx/arch/arm/src/samd/Make.defs +++ b/nuttx/arch/arm/src/samd/Make.defs @@ -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_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 ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_signal_dispatch.c @@ -76,7 +76,7 @@ ifneq ($(CONFIG_SCHED_TICKLESS),y) CHIP_CSRCS += sam_timerisr.c endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CHIP_CSRCS += sam_userspace.c endif diff --git a/nuttx/arch/arm/src/samd/sam_start.c b/nuttx/arch/arm/src/samd/sam_start.c index 81aacbe47..58062bfc1 100644 --- a/nuttx/arch/arm/src/samd/sam_start.c +++ b/nuttx/arch/arm/src/samd/sam_start.c @@ -157,7 +157,7 @@ void __start(void) * segments. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED sam_userspace(); showprogress('E'); #endif diff --git a/nuttx/arch/arm/src/samd/sam_userspace.c b/nuttx/arch/arm/src/samd/sam_userspace.c index 0f40d617e..60275e56d 100644 --- a/nuttx/arch/arm/src/samd/sam_userspace.c +++ b/nuttx/arch/arm/src/samd/sam_userspace.c @@ -46,7 +46,7 @@ #include "sam_userspace.h" -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /**************************************************************************** * Pre-processor Definitions @@ -110,4 +110,4 @@ void sam_userspace(void) } } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ diff --git a/nuttx/arch/arm/src/samd/sam_userspace.h b/nuttx/arch/arm/src/samd/sam_userspace.h index 922aed1db..e460afad3 100644 --- a/nuttx/arch/arm/src/samd/sam_userspace.h +++ b/nuttx/arch/arm/src/samd/sam_userspace.h @@ -69,7 +69,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void sam_userspace(void); #endif diff --git a/nuttx/arch/arm/src/stm32/Make.defs b/nuttx/arch/arm/src/stm32/Make.defs index c8b7df07d..2a3675da1 100644 --- a/nuttx/arch/arm/src/stm32/Make.defs +++ b/nuttx/arch/arm/src/stm32/Make.defs @@ -67,7 +67,7 @@ ifeq ($(CONFIG_ARCH_MEMCPY),y) CMN_ASRCS += up_memcpy.S 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 ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_signal_dispatch.c @@ -105,7 +105,7 @@ ifeq ($(CONFIG_ARMV7M_CMNVECTOR),y) CHIP_ASRCS += stm32_vectors.S endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CHIP_CSRCS += stm32_userspace.c stm32_mpuinit.c endif diff --git a/nuttx/arch/arm/src/stm32/stm32_allocateheap.c b/nuttx/arch/arm/src/stm32/stm32_allocateheap.c index a89f38c90..7d662938d 100644 --- a/nuttx/arch/arm/src/stm32/stm32_allocateheap.c +++ b/nuttx/arch/arm/src/stm32/stm32_allocateheap.c @@ -426,7 +426,7 @@ static inline void up_heap_color(FAR void *start, size_t size) * Description: * 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 * 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) { -#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. * This heap begins after the user-space .bss section at an offset * 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 * * 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 * (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) { /* 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) { #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 */ @@ -580,7 +580,7 @@ void up_addregion(void) #endif #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 */ diff --git a/nuttx/arch/arm/src/stm32/stm32_mpuinit.c b/nuttx/arch/arm/src/stm32/stm32_mpuinit.c index 0b44a32cc..e2eeaaa99 100644 --- a/nuttx/arch/arm/src/stm32/stm32_mpuinit.c +++ b/nuttx/arch/arm/src/stm32/stm32_mpuinit.c @@ -46,7 +46,7 @@ #include "mpu.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 @@ -120,5 +120,5 @@ void stm32_mpu_uheap(uintptr_t start, size_t size) mpu_userintsram(start, size); } -#endif /* CONFIG_NUTTX_KERNEL && CONFIG_ARMV7M_MPU */ +#endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARMV7M_MPU */ diff --git a/nuttx/arch/arm/src/stm32/stm32_mpuinit.h b/nuttx/arch/arm/src/stm32/stm32_mpuinit.h index 009306947..6d76db47e 100644 --- a/nuttx/arch/arm/src/stm32/stm32_mpuinit.h +++ b/nuttx/arch/arm/src/stm32/stm32_mpuinit.h @@ -67,7 +67,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void stm32_mpuinitialize(void); #else # 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); #else # define stm32_mpu_uheap(start,size) diff --git a/nuttx/arch/arm/src/stm32/stm32_start.c b/nuttx/arch/arm/src/stm32/stm32_start.c index 20fb2054c..e115a63cc 100644 --- a/nuttx/arch/arm/src/stm32/stm32_start.c +++ b/nuttx/arch/arm/src/stm32/stm32_start.c @@ -280,7 +280,7 @@ void __start(void) * segments. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED stm32_userspace(); showprogress('E'); #endif diff --git a/nuttx/arch/arm/src/stm32/stm32_userspace.c b/nuttx/arch/arm/src/stm32/stm32_userspace.c index b68705dce..55dcc1122 100644 --- a/nuttx/arch/arm/src/stm32/stm32_userspace.c +++ b/nuttx/arch/arm/src/stm32/stm32_userspace.c @@ -47,7 +47,7 @@ #include "stm32_mpuinit.h" #include "stm32_userspace.h" -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /**************************************************************************** * Pre-processor Definitions @@ -115,5 +115,5 @@ void stm32_userspace(void) stm32_mpuinitialize(); } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ diff --git a/nuttx/arch/arm/src/stm32/stm32_userspace.h b/nuttx/arch/arm/src/stm32/stm32_userspace.h index 297ceeaa0..70614552d 100644 --- a/nuttx/arch/arm/src/stm32/stm32_userspace.h +++ b/nuttx/arch/arm/src/stm32/stm32_userspace.h @@ -69,7 +69,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void stm32_userspace(void); #endif diff --git a/nuttx/arch/arm/src/stm32/stm32_vectors.S b/nuttx/arch/arm/src/stm32/stm32_vectors.S index 645f0f1c8..8f015b7e2 100644 --- a/nuttx/arch/arm/src/stm32/stm32_vectors.S +++ b/nuttx/arch/arm/src/stm32/stm32_vectors.S @@ -70,7 +70,7 @@ * 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 # endif @@ -248,7 +248,7 @@ exception_common: /* Complete the context save */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* 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 * EXC_RETURN is 0xfffffffd (unprivileged thread) @@ -290,7 +290,7 @@ exception_common: * r14=register values. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ #else 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 */ ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */ 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 */ #else ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -393,7 +393,7 @@ exception_common: */ 2: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ #else ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -418,7 +418,7 @@ exception_common: 3: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* 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 * EXC_RETURN is 0xfffffffd (unprivileged thread) diff --git a/nuttx/arch/arm/src/tiva/Make.defs b/nuttx/arch/arm/src/tiva/Make.defs index e97d5f50f..e13771bfa 100644 --- a/nuttx/arch/arm/src/tiva/Make.defs +++ b/nuttx/arch/arm/src/tiva/Make.defs @@ -58,7 +58,7 @@ ifeq ($(CONFIG_DEBUG_STACK),y) CMN_CSRCS += up_checkstack.c 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 ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_signal_dispatch.c @@ -81,7 +81,7 @@ ifneq ($(CONFIG_SCHED_TICKLESS),y) CHIP_CSRCS += tiva_timerisr.c endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CHIP_CSRCS += tiva_userspace.c tiva_mpuinit.c endif diff --git a/nuttx/arch/arm/src/tiva/tiva_allocateheap.c b/nuttx/arch/arm/src/tiva/tiva_allocateheap.c index b38457e98..a76fb5bc8 100644 --- a/nuttx/arch/arm/src/tiva/tiva_allocateheap.c +++ b/nuttx/arch/arm/src/tiva/tiva_allocateheap.c @@ -76,7 +76,7 @@ * Description: * 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 * size of the unprotected, user-space heap. * @@ -105,7 +105,7 @@ 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. * This heap begins after the user-space .bss section at an offset * 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 * * 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 * (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) { /* Get the unaligned size and position of the user-space heap. diff --git a/nuttx/arch/arm/src/tiva/tiva_mpuinit.c b/nuttx/arch/arm/src/tiva/tiva_mpuinit.c index 8ec8da5df..803cfe9bf 100644 --- a/nuttx/arch/arm/src/tiva/tiva_mpuinit.c +++ b/nuttx/arch/arm/src/tiva/tiva_mpuinit.c @@ -46,7 +46,7 @@ #include "mpu.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 @@ -120,5 +120,5 @@ void tiva_mpu_uheap(uintptr_t start, size_t size) mpu_userintsram(start, size); } -#endif /* CONFIG_NUTTX_KERNEL && CONFIG_ARMV7M_MPU */ +#endif /* CONFIG_BUILD_PROTECTED && CONFIG_ARMV7M_MPU */ diff --git a/nuttx/arch/arm/src/tiva/tiva_mpuinit.h b/nuttx/arch/arm/src/tiva/tiva_mpuinit.h index faba85425..82dde88d7 100644 --- a/nuttx/arch/arm/src/tiva/tiva_mpuinit.h +++ b/nuttx/arch/arm/src/tiva/tiva_mpuinit.h @@ -67,7 +67,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void tiva_mpuinitialize(void); #else # 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); #else # define tiva_mpu_uheap(start,size) diff --git a/nuttx/arch/arm/src/tiva/tiva_start.c b/nuttx/arch/arm/src/tiva/tiva_start.c index f0c66f6d2..1e1326678 100644 --- a/nuttx/arch/arm/src/tiva/tiva_start.c +++ b/nuttx/arch/arm/src/tiva/tiva_start.c @@ -150,7 +150,7 @@ void __start(void) * segments. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED tiva_userspace(); showprogress('E'); #endif diff --git a/nuttx/arch/arm/src/tiva/tiva_userspace.c b/nuttx/arch/arm/src/tiva/tiva_userspace.c index e2b278024..9f2c6b59a 100644 --- a/nuttx/arch/arm/src/tiva/tiva_userspace.c +++ b/nuttx/arch/arm/src/tiva/tiva_userspace.c @@ -47,7 +47,7 @@ #include "tiva_mpuinit.h" #include "tiva_userspace.h" -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /**************************************************************************** * Pre-processor Definitions @@ -115,4 +115,4 @@ void tiva_userspace(void) tiva_mpuinitialize(); } -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ diff --git a/nuttx/arch/arm/src/tiva/tiva_userspace.h b/nuttx/arch/arm/src/tiva/tiva_userspace.h index b6cb3541c..cdfced142 100644 --- a/nuttx/arch/arm/src/tiva/tiva_userspace.h +++ b/nuttx/arch/arm/src/tiva/tiva_userspace.h @@ -69,7 +69,7 @@ * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED void tiva_userspace(void); #endif diff --git a/nuttx/arch/arm/src/tiva/tiva_vectors.S b/nuttx/arch/arm/src/tiva/tiva_vectors.S index 8dc52e881..0680f0baa 100644 --- a/nuttx/arch/arm/src/tiva/tiva_vectors.S +++ b/nuttx/arch/arm/src/tiva/tiva_vectors.S @@ -69,7 +69,7 @@ * 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 # endif @@ -223,7 +223,7 @@ exception_common: /* Complete the context save */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* 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 * EXC_RETURN is 0xfffffffd (unprivileged thread) @@ -265,7 +265,7 @@ exception_common: * r14=register values. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED stmdb sp!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ #else stmdb sp!, {r2-r11} /* Save the remaining registers plus the SP value */ @@ -353,7 +353,7 @@ exception_common: ldmia r1, {r4-r11} /* Fetch eight registers in HW save area */ ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */ 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 */ #else ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -368,7 +368,7 @@ exception_common: */ 2: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ #else ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */ @@ -393,7 +393,7 @@ exception_common: 3: -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* 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 * EXC_RETURN is 0xfffffffd (unprivileged thread) diff --git a/nuttx/arch/avr/src/avr/up_createstack.c b/nuttx/arch/avr/src/avr/up_createstack.c index 1dd7e5006..d14ec63fd 100644 --- a/nuttx/arch/avr/src/avr/up_createstack.c +++ b/nuttx/arch/avr/src/avr/up_createstack.c @@ -96,11 +96,6 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL 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. - * ****************************************************************************/ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) @@ -125,28 +120,11 @@ 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. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) - /* Use the kernel allocator if this is a kernel thread */ - - if (ttype == TCB_FLAG_TTYPE_KERNEL) - { #if defined(CONFIG_DEBUG) && !defined(CONFIG_DEBUG_STACK) - tcb->stack_alloc_ptr = (uint32_t *)kzalloc(stack_size); + tcb->stack_alloc_ptr = (uint32_t *)kuzalloc(stack_size); #else - tcb->stack_alloc_ptr = (uint32_t *)kmalloc(stack_size); + tcb->stack_alloc_ptr = (uint32_t *)kumalloc(stack_size); #endif - } - else -#endif - { - /* Use the user-space allocator if this is a task or pthread */ - -#if defined(CONFIG_DEBUG) && !defined(CONFIG_DEBUG_STACK) - tcb->stack_alloc_ptr = (uint32_t *)kuzalloc(stack_size); -#else - tcb->stack_alloc_ptr = (uint32_t *)kumalloc(stack_size); -#endif - } #ifdef CONFIG_DEBUG /* Was the allocation successful? */ diff --git a/nuttx/arch/avr/src/avr32/up_createstack.c b/nuttx/arch/avr/src/avr32/up_createstack.c index fd1af6782..9082d796f 100644 --- a/nuttx/arch/avr/src/avr32/up_createstack.c +++ b/nuttx/arch/avr/src/avr32/up_createstack.c @@ -95,7 +95,7 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL 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. @@ -124,7 +124,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. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/nuttx/arch/avr/src/avr32/up_initialstate.c b/nuttx/arch/avr/src/avr32/up_initialstate.c index 86138b616..821637423 100644 --- a/nuttx/arch/avr/src/avr32/up_initialstate.c +++ b/nuttx/arch/avr/src/avr32/up_initialstate.c @@ -115,8 +115,8 @@ void up_initial_state(struct tcb_s *tcb) * supervisor-mode. */ -#ifdef CONFIG_NUTTX_KERNEL -# error "Missing logic for the CONFIG_NUTTX_KERNEL build" +#ifdef CONFIG_BUILD_KERNEL +# error "Missing logic for the CONFIG_BUILD_KERNEL build" #endif /* Enable or disable interrupts, based on user configuration */ diff --git a/nuttx/arch/avr/src/common/up_allocateheap.c b/nuttx/arch/avr/src/common/up_allocateheap.c index b5a080d43..4076d97d1 100644 --- a/nuttx/arch/avr/src/common/up_allocateheap.c +++ b/nuttx/arch/avr/src/common/up_allocateheap.c @@ -70,7 +70,7 @@ * Description: * 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 * size of the unprotected, user-space heap. * diff --git a/nuttx/arch/avr/src/common/up_releasestack.c b/nuttx/arch/avr/src/common/up_releasestack.c index 11b5181c4..7595f1e0a 100644 --- a/nuttx/arch/avr/src/common/up_releasestack.c +++ b/nuttx/arch/avr/src/common/up_releasestack.c @@ -79,7 +79,7 @@ * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL is 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. Stacks for user tasks * and threads must have come from memory that is accessible to user @@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/nuttx/arch/hc/src/common/up_allocateheap.c b/nuttx/arch/hc/src/common/up_allocateheap.c index 505edd112..b16016acd 100644 --- a/nuttx/arch/hc/src/common/up_allocateheap.c +++ b/nuttx/arch/hc/src/common/up_allocateheap.c @@ -69,7 +69,7 @@ * Description: * 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 * size of the unprotected, user-space heap. * diff --git a/nuttx/arch/hc/src/common/up_createstack.c b/nuttx/arch/hc/src/common/up_createstack.c index aad1557fc..ea542d985 100644 --- a/nuttx/arch/hc/src/common/up_createstack.c +++ b/nuttx/arch/hc/src/common/up_createstack.c @@ -92,7 +92,7 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL 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. @@ -121,7 +121,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. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/nuttx/arch/hc/src/common/up_releasestack.c b/nuttx/arch/hc/src/common/up_releasestack.c index 096108f86..86819d389 100644 --- a/nuttx/arch/hc/src/common/up_releasestack.c +++ b/nuttx/arch/hc/src/common/up_releasestack.c @@ -79,7 +79,7 @@ * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL is 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. Stacks for user tasks * and threads must have come from memory that is accessible to user @@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/nuttx/arch/mips/include/mips32/irq.h b/nuttx/arch/mips/include/mips32/irq.h index d42dbcfd2..27c200edf 100644 --- a/nuttx/arch/mips/include/mips32/irq.h +++ b/nuttx/arch/mips/include/mips32/irq.h @@ -57,7 +57,7 @@ */ #undef MIPS32_SAVE_GP -#if defined(CONFIG_NUTTX_KERNEL) || defined(CONFIG_NXFLAT) +#if defined(CONFIG_BUILD_KERNEL) || defined(CONFIG_NXFLAT) # define MIPS32_SAVE_GP 1 #endif @@ -316,7 +316,7 @@ /* This structure represents the return state from a system call */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL struct xcpt_syscall_s { uint32_t sysreturn; /* The return PC */ @@ -343,7 +343,7 @@ struct xcptcontext uint32_t saved_epc; /* Trampoline PC */ uint32_t saved_status; /* Status with interrupts disabled. */ -# ifdef CONFIG_NUTTX_KERNEL +# ifdef CONFIG_BUILD_KERNEL /* This is the saved address to use when returning from a user-space * signal handler. */ @@ -353,7 +353,7 @@ struct xcptcontext # endif #endif -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL /* The following array holds information needed to return from each nested * system call. */ diff --git a/nuttx/arch/mips/include/mips32/syscall.h b/nuttx/arch/mips/include/mips32/syscall.h index bf2a7847f..a9ec7f9e0 100644 --- a/nuttx/arch/mips/include/mips32/syscall.h +++ b/nuttx/arch/mips/include/mips32/syscall.h @@ -63,7 +63,7 @@ * reserved (0 is not used). */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL # ifndef CONFIG_SYS_RESERVED # error "CONFIG_SYS_RESERVED must be defined to the value 4" # elif CONFIG_SYS_RESERVED != 4 @@ -170,7 +170,7 @@ #define up_switchcontext(saveregs, restoreregs) \ (void)sys_call2(SYS_switch_context, (uintptr_t)saveregs, (uintptr_t)restoreregs) -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL /* SYS call 3: * * void up_syscall_return(void); diff --git a/nuttx/arch/mips/src/common/up_allocateheap.c b/nuttx/arch/mips/src/common/up_allocateheap.c index c334290dd..507114420 100644 --- a/nuttx/arch/mips/src/common/up_allocateheap.c +++ b/nuttx/arch/mips/src/common/up_allocateheap.c @@ -70,7 +70,7 @@ * Description: * 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 * size of the unprotected, user-space heap. * diff --git a/nuttx/arch/mips/src/common/up_createstack.c b/nuttx/arch/mips/src/common/up_createstack.c index 506ece44d..92b99842a 100644 --- a/nuttx/arch/mips/src/common/up_createstack.c +++ b/nuttx/arch/mips/src/common/up_createstack.c @@ -113,7 +113,7 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL 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. @@ -142,7 +142,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. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/nuttx/arch/mips/src/common/up_releasestack.c b/nuttx/arch/mips/src/common/up_releasestack.c index 6e510ed3d..a023342fa 100644 --- a/nuttx/arch/mips/src/common/up_releasestack.c +++ b/nuttx/arch/mips/src/common/up_releasestack.c @@ -79,7 +79,7 @@ * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL is 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. Stacks for user tasks * and threads must have come from memory that is accessible to user @@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/nuttx/arch/mips/src/mips32/up_initialstate.c b/nuttx/arch/mips/src/mips32/up_initialstate.c index ca981ffaf..7a9b629fb 100644 --- a/nuttx/arch/mips/src/mips32/up_initialstate.c +++ b/nuttx/arch/mips/src/mips32/up_initialstate.c @@ -116,7 +116,7 @@ void up_initial_state(struct tcb_s *tcb) * privileged thread mode. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL # warning "Missing logic" #endif diff --git a/nuttx/arch/mips/src/mips32/up_swint0.c b/nuttx/arch/mips/src/mips32/up_swint0.c index 5b1c2067c..4cfc74b5b 100644 --- a/nuttx/arch/mips/src/mips32/up_swint0.c +++ b/nuttx/arch/mips/src/mips32/up_swint0.c @@ -122,7 +122,7 @@ static void up_registerdump(const uint32_t *regs) * ****************************************************************************/ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL static void dispatch_syscall(void) naked_function; static void dispatch_syscall(void) { @@ -234,7 +234,7 @@ int up_swint0(int irq, FAR void *context) * unprivileged thread mode. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL case SYS_syscall_return: { struct tcb_s *rtcb = sched_self(); @@ -262,7 +262,7 @@ int up_swint0(int irq, FAR void *context) default: { -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL FAR struct tcb_s *rtcb = sched_self(); int index = rtcb->xcp.nsyscalls; diff --git a/nuttx/arch/mips/src/pic32mx/pic32mx-config.h b/nuttx/arch/mips/src/pic32mx/pic32mx-config.h index 058b02f68..a80e2bba5 100644 --- a/nuttx/arch/mips/src/pic32mx/pic32mx-config.h +++ b/nuttx/arch/mips/src/pic32mx/pic32mx-config.h @@ -491,7 +491,7 @@ * reserved (0 is not used). */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL # if !defined(CONFIG_SYS_RESERVED) || CONFIG_SYS_RESERVED < 4 # error "CONFIG_SYS_RESERVED must be defined to be 4 for a kernel build" # elif CONFIG_SYS_RESERVED > 4 diff --git a/nuttx/arch/rgmp/src/nuttx.c b/nuttx/arch/rgmp/src/nuttx.c index 4cc2a1a05..338940be3 100644 --- a/nuttx/arch/rgmp/src/nuttx.c +++ b/nuttx/arch/rgmp/src/nuttx.c @@ -126,7 +126,7 @@ int up_create_stack(struct tcb_s *tcb, size_t stack_size, uint8_t ttype) /* Allocate the memory for the stack */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) { @@ -170,7 +170,7 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size) return OK; } -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_KERNEL FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size) { uintptr_t topaddr; @@ -206,7 +206,7 @@ void up_release_stack(struct tcb_s *dtcb, uint8_t ttype) /* Is there a stack allocated? */ if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) { diff --git a/nuttx/arch/sh/src/common/up_allocateheap.c b/nuttx/arch/sh/src/common/up_allocateheap.c index ee7e90e05..cbfea5684 100644 --- a/nuttx/arch/sh/src/common/up_allocateheap.c +++ b/nuttx/arch/sh/src/common/up_allocateheap.c @@ -69,7 +69,7 @@ * Description: * 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 * size of the unprotected, user-space heap. * diff --git a/nuttx/arch/sh/src/common/up_createstack.c b/nuttx/arch/sh/src/common/up_createstack.c index 4c2d36ae9..03808f765 100644 --- a/nuttx/arch/sh/src/common/up_createstack.c +++ b/nuttx/arch/sh/src/common/up_createstack.c @@ -92,7 +92,7 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL 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. @@ -121,7 +121,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. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/nuttx/arch/sh/src/common/up_releasestack.c b/nuttx/arch/sh/src/common/up_releasestack.c index 422f12f49..c6f04be76 100644 --- a/nuttx/arch/sh/src/common/up_releasestack.c +++ b/nuttx/arch/sh/src/common/up_releasestack.c @@ -79,7 +79,7 @@ * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL is 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. Stacks for user tasks * and threads must have come from memory that is accessible to user @@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/nuttx/arch/sh/src/sh1/sh1_initialstate.c b/nuttx/arch/sh/src/sh1/sh1_initialstate.c index fe703f5a9..0f63c0afb 100644 --- a/nuttx/arch/sh/src/sh1/sh1_initialstate.c +++ b/nuttx/arch/sh/src/sh1/sh1_initialstate.c @@ -115,8 +115,8 @@ void up_initial_state(struct tcb_s *tcb) * supervisor-mode. */ -#ifdef CONFIG_NUTTX_KERNEL -# error "Missing logic for the CONFIG_NUTTX_KERNEL build" +#ifdef CONFIG_BUILD_KERNEL +# error "Missing logic for the CONFIG_BUILD_KERNEL build" #endif /* Enable or disable interrupts, based on user configuration */ diff --git a/nuttx/arch/sim/src/up_allocateheap.c b/nuttx/arch/sim/src/up_allocateheap.c index 9f5dfd205..da6511c65 100644 --- a/nuttx/arch/sim/src/up_allocateheap.c +++ b/nuttx/arch/sim/src/up_allocateheap.c @@ -72,10 +72,6 @@ static uint8_t sim_heap[SIM_HEAP_SIZE]; * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and - * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), 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 up_allocate_kheap(). * diff --git a/nuttx/arch/sim/src/up_createstack.c b/nuttx/arch/sim/src/up_createstack.c index 4115dd4ed..07a8efc15 100644 --- a/nuttx/arch/sim/src/up_createstack.c +++ b/nuttx/arch/sim/src/up_createstack.c @@ -93,11 +93,6 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL 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. - * ****************************************************************************/ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) @@ -112,18 +107,7 @@ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) /* Allocate the memory for the stack */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) - /* Use the kernel allocator if this is a kernel thread */ - - if (ttype == TCB_FLAG_TTYPE_KERNEL) - { - stack_alloc_ptr = (uint32_t *)kmalloc(stack_size); - } - else -#endif - { - stack_alloc_ptr = (uint32_t*)kumalloc(adj_stack_size); - } + stack_alloc_ptr = (uint32_t*)kumalloc(adj_stack_size); /* Was the allocation successful? */ diff --git a/nuttx/arch/sim/src/up_releasestack.c b/nuttx/arch/sim/src/up_releasestack.c index 49a68eb8d..f8f47c44d 100644 --- a/nuttx/arch/sim/src/up_releasestack.c +++ b/nuttx/arch/sim/src/up_releasestack.c @@ -82,12 +82,6 @@ * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is 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. Stacks for user tasks - * and threads must have come from memory that is accessible to user - * code. - * * Returned Value: * None * @@ -99,20 +93,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) - /* Use the kernel allocator if this is a kernel thread */ - - if (ttype == TCB_FLAG_TTYPE_KERNEL) - { - sched_kfree(dtcb->stack_alloc_ptr); - } - else -#endif - { - /* Use the user-space allocator if this is a task or pthread */ - - sched_ufree(dtcb->stack_alloc_ptr); - } + sched_ufree(dtcb->stack_alloc_ptr); } /* Mark the stack freed */ diff --git a/nuttx/arch/x86/src/common/up_allocateheap.c b/nuttx/arch/x86/src/common/up_allocateheap.c index c51e3d855..79779ffba 100644 --- a/nuttx/arch/x86/src/common/up_allocateheap.c +++ b/nuttx/arch/x86/src/common/up_allocateheap.c @@ -70,7 +70,7 @@ * Description: * 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 * size of the unprotected, user-space heap. * diff --git a/nuttx/arch/x86/src/i486/up_createstack.c b/nuttx/arch/x86/src/i486/up_createstack.c index cdd7fec7c..6b02e4464 100644 --- a/nuttx/arch/x86/src/i486/up_createstack.c +++ b/nuttx/arch/x86/src/i486/up_createstack.c @@ -94,7 +94,7 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL 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. @@ -123,7 +123,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. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/nuttx/arch/x86/src/i486/up_initialstate.c b/nuttx/arch/x86/src/i486/up_initialstate.c index 8efd0e92a..242545330 100644 --- a/nuttx/arch/x86/src/i486/up_initialstate.c +++ b/nuttx/arch/x86/src/i486/up_initialstate.c @@ -111,8 +111,8 @@ void up_initial_state(struct tcb_s *tcb) * supervisor-mode. */ -#ifdef CONFIG_NUTTX_KERNEL -# error "Missing logic for the CONFIG_NUTTX_KERNEL build" +#ifdef CONFIG_BUILD_KERNEL +# error "Missing logic for the CONFIG_BUILD_KERNEL build" #endif /* Enable or disable interrupts, based on user configuration. If the IF diff --git a/nuttx/arch/x86/src/i486/up_releasestack.c b/nuttx/arch/x86/src/i486/up_releasestack.c index 89bf974c7..797934f9f 100644 --- a/nuttx/arch/x86/src/i486/up_releasestack.c +++ b/nuttx/arch/x86/src/i486/up_releasestack.c @@ -79,7 +79,7 @@ * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL is 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. Stacks for user tasks * and threads must have come from memory that is accessible to user @@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/nuttx/arch/z16/src/common/up_allocateheap.c b/nuttx/arch/z16/src/common/up_allocateheap.c index af3b06713..8f6f3ac41 100644 --- a/nuttx/arch/z16/src/common/up_allocateheap.c +++ b/nuttx/arch/z16/src/common/up_allocateheap.c @@ -85,13 +85,6 @@ * Description: * This function will be called to dynamically set aside the heap region. * - * For the kernel build (CONFIG_NUTTX_KERNEL=y) with both kernel- and - * user-space heaps (CONFIG_MM_KERNEL_HEAP=y), 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 up_allocate_kheap(). - * ****************************************************************************/ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) diff --git a/nuttx/arch/z16/src/common/up_createstack.c b/nuttx/arch/z16/src/common/up_createstack.c index 0a7fecd3b..5daf8cc76 100644 --- a/nuttx/arch/z16/src/common/up_createstack.c +++ b/nuttx/arch/z16/src/common/up_createstack.c @@ -93,11 +93,6 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL 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. - * ****************************************************************************/ int up_create_stack(FAR struct tcb_s *tcb, size_t stack_size, uint8_t ttype) @@ -122,28 +117,11 @@ 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. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) - /* Use the kernel allocator if this is a kernel thread */ - - if (ttype == TCB_FLAG_TTYPE_KERNEL) - { #if defined(CONFIG_DEBUG) && !defined(CONFIG_DEBUG_STACK) - tcb->stack_alloc_ptr = (uint32_t *)kzalloc(stack_size); + tcb->stack_alloc_ptr = (uint32_t *)kuzalloc(stack_size); #else - tcb->stack_alloc_ptr = (uint32_t *)kmalloc(stack_size); + tcb->stack_alloc_ptr = (uint32_t *)kumalloc(stack_size); #endif - } - else -#endif - { - /* Use the user-space allocator if this is a task or pthread */ - -#if defined(CONFIG_DEBUG) && !defined(CONFIG_DEBUG_STACK) - tcb->stack_alloc_ptr = (uint32_t *)kuzalloc(stack_size); -#else - tcb->stack_alloc_ptr = (uint32_t *)kumalloc(stack_size); -#endif - } #ifdef CONFIG_DEBUG /* Was the allocation successful? */ diff --git a/nuttx/arch/z16/src/common/up_releasestack.c b/nuttx/arch/z16/src/common/up_releasestack.c index d57f2c11a..c64a5f408 100644 --- a/nuttx/arch/z16/src/common/up_releasestack.c +++ b/nuttx/arch/z16/src/common/up_releasestack.c @@ -79,12 +79,6 @@ * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is 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. Stacks for user tasks - * and threads must have come from memory that is accessible to user - * code. - * * Returned Value: * None * @@ -96,20 +90,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) - /* Use the kernel allocator if this is a kernel thread */ - - if (ttype == TCB_FLAG_TTYPE_KERNEL) - { - sched_kfree(dtcb->stack_alloc_ptr); - } - else -#endif - { - /* Use the user-space allocator if this is a task or pthread */ - - sched_ufree(dtcb->stack_alloc_ptr); - } + sched_ufree(dtcb->stack_alloc_ptr); /* Mark the stack freed */ diff --git a/nuttx/arch/z80/src/common/up_allocateheap.c b/nuttx/arch/z80/src/common/up_allocateheap.c index 8a6095d51..c3c5a0349 100644 --- a/nuttx/arch/z80/src/common/up_allocateheap.c +++ b/nuttx/arch/z80/src/common/up_allocateheap.c @@ -87,7 +87,7 @@ * Description: * 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 * size of the unprotected, user-space heap. * diff --git a/nuttx/arch/z80/src/common/up_createstack.c b/nuttx/arch/z80/src/common/up_createstack.c index 1a058ec50..1b7506673 100644 --- a/nuttx/arch/z80/src/common/up_createstack.c +++ b/nuttx/arch/z80/src/common/up_createstack.c @@ -92,7 +92,7 @@ * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL 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. @@ -121,7 +121,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. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/nuttx/arch/z80/src/common/up_releasestack.c b/nuttx/arch/z80/src/common/up_releasestack.c index 9ea249a63..be978aadd 100644 --- a/nuttx/arch/z80/src/common/up_releasestack.c +++ b/nuttx/arch/z80/src/common/up_releasestack.c @@ -79,7 +79,7 @@ * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is defined, then this thread type may affect + * If CONFIG_BUILD_KERNEL is 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. Stacks for user tasks * and threads must have come from memory that is accessible to user @@ -96,7 +96,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype) if (dtcb->stack_alloc_ptr) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) /* Use the kernel allocator if this is a kernel thread */ if (ttype == TCB_FLAG_TTYPE_KERNEL) diff --git a/nuttx/binfmt/Kconfig b/nuttx/binfmt/Kconfig index 0575cd369..14bd4364f 100644 --- a/nuttx/binfmt/Kconfig +++ b/nuttx/binfmt/Kconfig @@ -52,7 +52,7 @@ endif config BUILTIN bool "Support Builtin Applications" default n - depends on !NUTTX_KERNEL || EXPERIMENTAL + depends on (!BUILD_PROTECTED && !BUILD_KERNEL) || EXPERIMENTAL ---help--- Enable support for builtin applications. This features assigns a string name to an application and in addition if FS_BINFS is defined, retaining @@ -60,10 +60,10 @@ config BUILTIN is also the underlying requirement to support built-in applications in the NuttShell (NSH). - ISSUES: This feature is highly coupled with logic in the apps/subdirectory - and, as a consequence, cannot be used in environments that do not - include the standard NuttX apps/ nor in build configurations using - NUTTX_KERNEL. + ISSUES: This feature is highly coupled with logic in the apps/ + sub-directory and, as a consequence, cannot be used in environments + that do not include the standard NuttX apps/ nor in build + configurations using BUILD_PROTECTED or BUILD_KERNEL. if BUILTIN source binfmt/libbuiltin/Kconfig @@ -72,7 +72,7 @@ endif config PCODE bool "Support P-Code Applications" default n - depends on INTERPRETERS_PCODE && SYSTEM_PRUN && (!NUTTX_KERNEL || EXPERIMENTAL) + depends on INTERPRETERS_PCODE && SYSTEM_PRUN && ((!BUILD_PROTECTED && !BUILD_KERNEL) || EXPERIMENTAL) ---help--- Enable support for interpreted P-Code binaries. P-Code binaries are generated by the NuttX Pascal compiler. @@ -87,7 +87,7 @@ config PCODE ISSUES: This feature is highly coupled with logic in the apps/subdirectory and, as a consequence, cannot be used in environments that do not include the standard NuttX apps/ nor in build configurations using - NUTTX_KERNEL. + UILD_PROTECTED or BUILD_KERNEL.. if PCODE source binfmt/libpcode/Kconfig diff --git a/nuttx/binfmt/pcode.c b/nuttx/binfmt/pcode.c index ce244a269..b2a243cb0 100644 --- a/nuttx/binfmt/pcode.c +++ b/nuttx/binfmt/pcode.c @@ -218,7 +218,7 @@ static int pcode_mount_testfs(void) * ****************************************************************************/ -#ifndef CONFIG_NUTTX_KERNEL +#if !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL) static void pcode_onexit(int exitcode, FAR void *arg) { FAR struct binary_s *binp = (FAR struct binary_s *)arg; @@ -236,12 +236,13 @@ static void pcode_onexit(int exitcode, FAR void *arg) * Description: * This is the proxy program that runs and starts the P-Code interpreter. * - * REVISIT: There are issues here when CONFIG_NUTTX_KERNEL is selected. Also - * This implementation is too highly couple to logic in the apps/ directory. + * REVISIT: There are issues here when CONFIG_BUILD_PROTECTED or + * CONFIG_BUILD_KERNEL are selected. Also this implementation is too highly + * couple to logic in the apps/ directory. * ****************************************************************************/ -#ifndef CONFIG_NUTTX_KERNEL +#if !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL) static int pcode_proxy(int argc, char **argv) { FAR struct binary_s *binp; @@ -289,7 +290,7 @@ static int pcode_proxy(int argc, char **argv) return EXIT_SUCCESS; } #else -# error Missing logic for the case of CONFIG_NUTTX_KERNEL +# error Missing logic for the case of CONFIG_BUILD_PROTECTED/KERNEL #endif /**************************************************************************** @@ -371,7 +372,8 @@ static int pcode_load(struct binary_s *binp) } /* Return the load information. - * REVISIT: There are issues here when CONFIG_NUTTX_KERNEL is selected. + * REVISIT: There are issues here when CONFIG_BUILD_PROTECTED or + * CONFIG_BUILD_KERNEL are selected. */ binp->entrypt = pcode_proxy; diff --git a/nuttx/configs/ea3131/pgnsh/defconfig b/nuttx/configs/ea3131/pgnsh/defconfig index fddd3d2b4..fbae9b06c 100644 --- a/nuttx/configs/ea3131/pgnsh/defconfig +++ b/nuttx/configs/ea3131/pgnsh/defconfig @@ -25,7 +25,7 @@ CONFIG_BUILD_2PASS=y CONFIG_PASS1_TARGET="all" CONFIG_PASS1_BUILDIR="configs/ea3131/locked" CONFIG_PASS1_OBJECT="locked.r" -# CONFIG_NUTTX_KERNEL is not set +# CONFIG_BUILD_PROTECTED is not set # # Binary Output Formats diff --git a/nuttx/configs/mikroe-stm32f4/kernel/up_userspace.c b/nuttx/configs/mikroe-stm32f4/kernel/up_userspace.c index 77092457c..614ae3b89 100644 --- a/nuttx/configs/mikroe-stm32f4/kernel/up_userspace.c +++ b/nuttx/configs/mikroe-stm32f4/kernel/up_userspace.c @@ -45,7 +45,7 @@ #include <nuttx/wqueue.h> #include <nuttx/mm.h> -#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__) /**************************************************************************** * Pre-processor Definitions @@ -139,4 +139,4 @@ const struct userspace_s userspace __attribute__ ((section (".userspace"))) = * Public Functions ****************************************************************************/ -#endif /* CONFIG_NUTTX_KERNEL && !__KERNEL__ */ +#endif /* CONFIG_BUILD_PROTECTED && !__KERNEL__ */ diff --git a/nuttx/configs/mikroe-stm32f4/kostest/defconfig b/nuttx/configs/mikroe-stm32f4/kostest/defconfig index 1f2e7c592..75123cc7d 100644 --- a/nuttx/configs/mikroe-stm32f4/kostest/defconfig +++ b/nuttx/configs/mikroe-stm32f4/kostest/defconfig @@ -21,7 +21,7 @@ CONFIG_BUILD_2PASS=y CONFIG_PASS1_TARGET="all" CONFIG_PASS1_BUILDIR="configs/mikroe-stm32f4/kernel" CONFIG_PASS1_OBJECT="" -CONFIG_NUTTX_KERNEL=y +CONFIG_BUILD_PROTECTED=y CONFIG_NUTTX_USERSPACE=0x08020000 # @@ -107,6 +107,7 @@ CONFIG_ARCH_HAVE_CMNVECTOR=y CONFIG_ARCH_HAVE_FPU=y # CONFIG_ARCH_FPU is not set CONFIG_ARCH_HAVE_MPU=y +CONFIG_ARCH_USE_MPU=y CONFIG_ARMV7M_MPU=y CONFIG_ARMV7M_MPU_NREGIONS=8 diff --git a/nuttx/configs/open1788/kernel/up_userspace.c b/nuttx/configs/open1788/kernel/up_userspace.c index 59e218492..ffcd8db48 100644 --- a/nuttx/configs/open1788/kernel/up_userspace.c +++ b/nuttx/configs/open1788/kernel/up_userspace.c @@ -45,7 +45,7 @@ #include <nuttx/wqueue.h> #include <nuttx/mm.h> -#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__) /**************************************************************************** * Pre-processor Definitions @@ -139,4 +139,4 @@ const struct userspace_s userspace __attribute__ ((section (".userspace"))) = * Public Functions ****************************************************************************/ -#endif /* CONFIG_NUTTX_KERNEL && !__KERNEL__ */ +#endif /* CONFIG_BUILD_PROTECTED && !__KERNEL__ */ diff --git a/nuttx/configs/open1788/knsh/defconfig b/nuttx/configs/open1788/knsh/defconfig index b83c1a387..dc4203c75 100644 --- a/nuttx/configs/open1788/knsh/defconfig +++ b/nuttx/configs/open1788/knsh/defconfig @@ -20,7 +20,7 @@ CONFIG_BUILD_2PASS=y CONFIG_PASS1_TARGET="all" CONFIG_PASS1_BUILDIR="configs/open1788/kernel" CONFIG_PASS1_OBJECT="" -CONFIG_NUTTX_KERNEL=y +CONFIG_BUILD_PROTECTED=y CONFIG_NUTTX_USERSPACE=0x00010000 # @@ -86,6 +86,7 @@ CONFIG_ARCH_CHIP="lpc17xx" CONFIG_ARCH_HAVE_CMNVECTOR=y # CONFIG_ARMV7M_CMNVECTOR is not set CONFIG_ARCH_HAVE_MPU=y +CONFIG_ARCH_USE_MPU=y CONFIG_ARMV7M_MPU=y CONFIG_ARMV7M_MPU_NREGIONS=8 diff --git a/nuttx/configs/pcduino-a10/nsh/pcduino-140107.patch b/nuttx/configs/pcduino-a10/nsh/pcduino-140107.patch index b5df28eb8..e6a1b9c18 100644 --- a/nuttx/configs/pcduino-a10/nsh/pcduino-140107.patch +++ b/nuttx/configs/pcduino-a10/nsh/pcduino-140107.patch @@ -48,7 +48,7 @@ index 3cc6323..ad42790 100644 @@ -353,6 +359,7 @@ void up_boot(void) */ - #ifdef CONFIG_NUTTX_KERNEL + #ifdef CONFIG_BUILD_PROTECTED +lowsyslog("Calling a1x_userspace\n"); // REMOVE ME a1x_userspace(); #endif diff --git a/nuttx/configs/sam3u-ek/kernel/up_userspace.c b/nuttx/configs/sam3u-ek/kernel/up_userspace.c index 50a45838f..51ed83b6f 100644 --- a/nuttx/configs/sam3u-ek/kernel/up_userspace.c +++ b/nuttx/configs/sam3u-ek/kernel/up_userspace.c @@ -45,7 +45,7 @@ #include <nuttx/wqueue.h> #include <nuttx/mm.h> -#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__) /**************************************************************************** * Pre-processor Definitions @@ -139,4 +139,4 @@ const struct userspace_s userspace __attribute__ ((section (".userspace"))) = * Public Functions ****************************************************************************/ -#endif /* CONFIG_NUTTX_KERNEL && !__KERNEL__ */ +#endif /* CONFIG_BUILD_PROTECTED && !__KERNEL__ */ diff --git a/nuttx/configs/sam3u-ek/knsh/defconfig b/nuttx/configs/sam3u-ek/knsh/defconfig index 6183909de..41a6a65de 100644 --- a/nuttx/configs/sam3u-ek/knsh/defconfig +++ b/nuttx/configs/sam3u-ek/knsh/defconfig @@ -21,7 +21,7 @@ CONFIG_BUILD_2PASS=y CONFIG_PASS1_TARGET="all" CONFIG_PASS1_BUILDIR="configs/sam3u-ek/kernel" CONFIG_PASS1_OBJECT="" -CONFIG_NUTTX_KERNEL=y +CONFIG_BUILD_PROTECTED=y CONFIG_NUTTX_USERSPACE=0x00090000 # @@ -104,6 +104,7 @@ CONFIG_ARCH_CHIP="sam34" # CONFIG_ARMV7M_USEBASEPRI is not set # CONFIG_ARCH_HAVE_FPU is not set CONFIG_ARCH_HAVE_MPU=y +CONFIG_ARCH_USE_MPU=y CONFIG_ARMV7M_MPU=y CONFIG_ARMV7M_MPU_NREGIONS=8 diff --git a/nuttx/configs/sam4s-xplained-pro/nsh/defconfig b/nuttx/configs/sam4s-xplained-pro/nsh/defconfig index 30888281f..f01103652 100644 --- a/nuttx/configs/sam4s-xplained-pro/nsh/defconfig +++ b/nuttx/configs/sam4s-xplained-pro/nsh/defconfig @@ -101,6 +101,7 @@ CONFIG_ARCH_CHIP="sam34" CONFIG_ARMV7M_USEBASEPRI=y # CONFIG_ARCH_HAVE_FPU is not set CONFIG_ARCH_HAVE_MPU=y +CONFIG_ARCH_USE_MPU=y CONFIG_ARMV7M_MPU=y CONFIG_ARMV7M_MPU_NREGIONS=8 diff --git a/nuttx/configs/stm3240g-eval/kernel/up_userspace.c b/nuttx/configs/stm3240g-eval/kernel/up_userspace.c index 0f57b3438..c5aecd02e 100644 --- a/nuttx/configs/stm3240g-eval/kernel/up_userspace.c +++ b/nuttx/configs/stm3240g-eval/kernel/up_userspace.c @@ -45,7 +45,7 @@ #include <nuttx/wqueue.h> #include <nuttx/mm.h> -#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__) /**************************************************************************** * Pre-processor Definitions @@ -139,4 +139,4 @@ const struct userspace_s userspace __attribute__ ((section (".userspace"))) = * Public Functions ****************************************************************************/ -#endif /* CONFIG_NUTTX_KERNEL && !__KERNEL__ */ +#endif /* CONFIG_BUILD_PROTECTED && !__KERNEL__ */ diff --git a/nuttx/configs/stm3240g-eval/knxwm/defconfig b/nuttx/configs/stm3240g-eval/knxwm/defconfig index 2844b7b6c..7de3b478c 100644 --- a/nuttx/configs/stm3240g-eval/knxwm/defconfig +++ b/nuttx/configs/stm3240g-eval/knxwm/defconfig @@ -25,7 +25,7 @@ CONFIG_BUILD_2PASS=y CONFIG_PASS1_TARGET="all" CONFIG_PASS1_BUILDIR="configs/stm3240g-eval/kernel" CONFIG_PASS1_OBJECT="" -CONFIG_NUTTX_KERNEL=y +CONFIG_BUILD_PROTECTED=y CONFIG_NUTTX_USERSPACE=0x08040000 # @@ -111,6 +111,7 @@ CONFIG_ARCH_HAVE_CMNVECTOR=y CONFIG_ARCH_HAVE_FPU=y # CONFIG_ARCH_FPU is not set CONFIG_ARCH_HAVE_MPU=y +CONFIG_ARCH_USE_MPU=y CONFIG_ARMV7M_MPU=y CONFIG_ARMV7M_MPU_NREGIONS=8 diff --git a/nuttx/configs/stm3240g-eval/src/up_boot.c b/nuttx/configs/stm3240g-eval/src/up_boot.c index 35989f90f..eff7a36d3 100644 --- a/nuttx/configs/stm3240g-eval/src/up_boot.c +++ b/nuttx/configs/stm3240g-eval/src/up_boot.c @@ -51,7 +51,7 @@ * if nx_start() is available (CONFIG_NX_NXSTART=y) and if the NxWidget::CNxServer * class expects the RTOS to do the NX initialization (CONFIG_NXWIDGET_SERVERINIT=n). * This combination of settings is normally only used in the kernel build mode - * (CONFIG_NUTTX_KERNEL) when NxWidgets is unable to initialize NX from user-space. + * (CONFIG_BUILD_PROTECTED) when NxWidgets is unable to initialize NX from user-space. */ #undef HAVE_NXSTART @@ -67,7 +67,7 @@ # include <nuttx/nx/nx.h> # endif # else -# if !defined(CONFIG_NXWIDGET_SERVERINIT) && defined(CONFIG_NUTTX_KERNEL) +# if !defined(CONFIG_NXWIDGET_SERVERINIT) && defined(CONFIG_BUILD_PROTECTED) # error CONFIG_NX_NXSTART=y is needed # endif # endif @@ -78,7 +78,7 @@ * touchscreen (CONFIG_NXWM_TOUCHSCREEN=y), and if we were asked to * initialize the touchscreen for NxWM (NXWM_TOUCHSCREEN_DEVINIT=n). This * combination of settings is normally only used in the kernel build mode - * (CONFIG_NUTTX_KERNEL) when NxWidgets is unable to initialize NX from + * (CONFIG_BUILD_PROTECTED) when NxWidgets is unable to initialize NX from * user-space. */ @@ -93,7 +93,7 @@ # include <nuttx/input/touchscreen.h> # endif # else -# if !defined(CONFIG_NXWM_TOUCHSCREEN_DEVINIT) && defined(CONFIG_NUTTX_KERNEL) +# if !defined(CONFIG_NXWM_TOUCHSCREEN_DEVINIT) && defined(CONFIG_BUILD_PROTECTED) # error CONFIG_INPUT_STMPE811=y is needed # endif # endif diff --git a/nuttx/configs/stm32f4discovery/kernel/up_userspace.c b/nuttx/configs/stm32f4discovery/kernel/up_userspace.c index 6dd84cbe3..047fd7647 100644 --- a/nuttx/configs/stm32f4discovery/kernel/up_userspace.c +++ b/nuttx/configs/stm32f4discovery/kernel/up_userspace.c @@ -45,7 +45,7 @@ #include <nuttx/wqueue.h> #include <nuttx/mm.h> -#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__) /**************************************************************************** * Pre-processor Definitions @@ -139,4 +139,4 @@ const struct userspace_s userspace __attribute__ ((section (".userspace"))) = * Public Functions ****************************************************************************/ -#endif /* CONFIG_NUTTX_KERNEL && !__KERNEL__ */ +#endif /* CONFIG_BUILD_PROTECTED && !__KERNEL__ */ diff --git a/nuttx/configs/stm32f4discovery/kostest/defconfig b/nuttx/configs/stm32f4discovery/kostest/defconfig index 3e210d62f..743585918 100644 --- a/nuttx/configs/stm32f4discovery/kostest/defconfig +++ b/nuttx/configs/stm32f4discovery/kostest/defconfig @@ -25,7 +25,7 @@ CONFIG_BUILD_2PASS=y CONFIG_PASS1_TARGET="all" CONFIG_PASS1_BUILDIR="configs/stm32f4discovery/kernel" CONFIG_PASS1_OBJECT="" -CONFIG_NUTTX_KERNEL=y +CONFIG_BUILD_PROTECTED=y CONFIG_NUTTX_USERSPACE=0x08020000 # @@ -111,6 +111,7 @@ CONFIG_ARCH_HAVE_CMNVECTOR=y CONFIG_ARCH_HAVE_FPU=y # CONFIG_ARCH_FPU is not set CONFIG_ARCH_HAVE_MPU=y +CONFIG_ARCH_USE_MPU=y CONFIG_ARMV7M_MPU=y CONFIG_ARMV7M_MPU_NREGIONS=8 diff --git a/nuttx/drivers/timer.c b/nuttx/drivers/timer.c index 0fb4c5f8e..d8dd6b01f 100644 --- a/nuttx/drivers/timer.c +++ b/nuttx/drivers/timer.c @@ -380,7 +380,7 @@ static int timer_ioctl(FAR struct file *filep, int cmd, unsigned long arg) * case direct callbacks from kernel space into user space is forbidden. */ -#ifndef CONFIG_NUTTX_KERNEL +#if !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL) case TCIOC_SETHANDLER: { FAR struct timer_sethandler_s *sethandler; diff --git a/nuttx/fs/fs_fdopen.c b/nuttx/fs/fs_fdopen.c index 0b1b4338a..5356ae03d 100644 --- a/nuttx/fs/fs_fdopen.c +++ b/nuttx/fs/fs_fdopen.c @@ -193,7 +193,8 @@ FAR struct file_struct *fs_fdopen(int fd, int oflags, FAR struct tcb_s *tcb) /* Get the stream list from the TCB */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ + defined(CONFIG_MM_KERNEL_HEAP) slist = tcb->group->tg_streamlist; #else slist = &tcb->group->tg_streamlist; diff --git a/nuttx/include/errno.h b/nuttx/include/errno.h index 8c2ea46a8..dc90b4d05 100644 --- a/nuttx/include/errno.h +++ b/nuttx/include/errno.h @@ -66,7 +66,8 @@ * kernel. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) +#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ + defined(CONFIG_BUILD_KERNEL) # define errno *get_errno_ptr() # define set_errno(e) do { errno = (int)(e); } while (0) # define get_errno(e) errno diff --git a/nuttx/include/nuttx/arch.h b/nuttx/include/nuttx/arch.h index d4b076821..3070f0291 100644 --- a/nuttx/include/nuttx/arch.h +++ b/nuttx/include/nuttx/arch.h @@ -231,10 +231,11 @@ void up_initial_state(FAR struct tcb_s *tcb); * however, there are certain contexts where the TCB may not be fully * initialized when up_create_stack is called. * - * If CONFIG_NUTTX_KERNEL 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 CONFIG_BUILD_PROTECTED or CONFIG_BUILD_KERNEL are 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. * ****************************************************************************/ @@ -307,7 +308,8 @@ int up_use_stack(FAR struct tcb_s *tcb, FAR void *stack, size_t stack_size); * ****************************************************************************/ -#if !defined(CONFIG_CUSTOM_STACK) && defined(CONFIG_NUTTX_KERNEL) +#if !defined(CONFIG_CUSTOM_STACK) && (defined(CONFIG_BUILD_PROTECTED) || \ + defined(CONFIG_BUILD_KERNEL)) FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size); #endif @@ -331,11 +333,11 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size); * however, there are certain error recovery contexts where the TCB may * not be fully initialized when up_release_stack is called. * - * If CONFIG_NUTTX_KERNEL is 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. Stacks for user tasks - * and threads must have come from memory that is accessible to user - * code. + * If CONFIG_BUILD_PROTECTED or CONFIG_BUILD_KERNEL 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. Stacks for user tasks and threads must have come from memory + * that is accessible to user code. * * Returned Value: * None @@ -526,7 +528,8 @@ void up_schedule_sigaction(FAR struct tcb_s *tcb, sig_deliver_t sigdeliver); * ****************************************************************************/ -#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) +#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ + defined(CONFIG_BUILD_KERNEL) void up_task_start(main_t taskentry, int argc, FAR char *argv[]) noreturn_function; #endif @@ -555,7 +558,8 @@ void up_task_start(main_t taskentry, int argc, FAR char *argv[]) * ****************************************************************************/ -#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) && !defined(CONFIG_DISABLE_PTHREAD) +#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ + defined(CONFIG_BUILD_KERNEL) && !defined(CONFIG_DISABLE_PTHREAD) void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg) noreturn_function; #endif @@ -588,7 +592,8 @@ void up_pthread_start(pthread_startroutine_t entrypt, pthread_addr_t arg) * ****************************************************************************/ -#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) && !defined(CONFIG_DISABLE_SIGNALS) +#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ + defined(CONFIG_BUILD_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) void up_signal_dispatch(_sa_sigaction_t sighand, int signo, FAR siginfo_t *info, FAR void *ucontext); #endif @@ -612,7 +617,8 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo, * ****************************************************************************/ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) && !defined(CONFIG_DISABLE_SIGNALS) +#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ + defined(CONFIG_BUILD_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) void up_signal_handler(_sa_sigaction_t sighand, int signo, FAR siginfo_t *info, FAR void *ucontext) noreturn_function; @@ -624,7 +630,7 @@ void up_signal_handler(_sa_sigaction_t sighand, int signo, * Description: * 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 * size of the unprotected, user-space heap. * @@ -639,13 +645,13 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size); * Name: up_allocate_kheap * * 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 * (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); #endif diff --git a/nuttx/include/nuttx/clock.h b/nuttx/include/nuttx/clock.h index 8ea787d16..18c67fe16 100644 --- a/nuttx/include/nuttx/clock.h +++ b/nuttx/include/nuttx/clock.h @@ -71,7 +71,7 @@ # define __HAVE_KERNEL_GLOBALS 0 -#elif defined(CONFIG_NUTTX_KERNEL) +#elif defined(CONFIG_BUILD_PROTECTED) # if defined(__KERNEL__) /* Case 3: Kernel mode of protected kernel build */ @@ -82,6 +82,11 @@ # define __HAVE_KERNEL_GLOBALS 0 # endif +#elif defined(CONFIG_BUILD_KERNEL) + /* Case 3: Kernel only build */ + +# define __HAVE_KERNEL_GLOBALS 1 + #elif defined(CONFIG_LIB_SYSCALL) /* Case 4: Building with SYSCALLs enabled, but not part of a kernel build */ diff --git a/nuttx/include/nuttx/kmalloc.h b/nuttx/include/nuttx/kmalloc.h index e47ff7119..bea2d03ba 100644 --- a/nuttx/include/nuttx/kmalloc.h +++ b/nuttx/include/nuttx/kmalloc.h @@ -49,7 +49,7 @@ #include <nuttx/mm.h> #include <nuttx/userspace.h> -#if !defined(CONFIG_NUTTX_KERNEL) || defined(__KERNEL__) +#if !defined(CONFIG_BUILD_PROTECTED) || defined(__KERNEL__) /**************************************************************************** * Public Types @@ -89,7 +89,7 @@ extern "C" #define kumm_trysemaphore() umm_trysemaphore() #define kumm_givesemaphore() umm_givesemaphore() -#ifndef CONFIG_NUTTX_KERNEL +#ifndef CONFIG_BUILD_PROTECTED /* In the flat build, the following are declared in stdlib.h and are * directly callable. */ @@ -116,7 +116,7 @@ extern "C" /* This family of allocators is used to manage kernel protected memory */ -#if !defined(CONFIG_NUTTX_KERNEL) +#if !defined(CONFIG_BUILD_PROTECTED) /* If this is not a kernel build, then these map to the same interfaces * as were used for the user-mode function. */ @@ -180,7 +180,7 @@ bool kmm_heapmember(FAR void *mem); void sched_ufree(FAR void *address); -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_MM_KERNEL_HEAP) void sched_kfree(FAR void *address); #else # define sched_kfree(a) sched_ufree(a) @@ -201,5 +201,5 @@ void sched_garbagecollection(void); } #endif -#endif /* !CONFIG_NUTTX_KERNEL || __KERNEL__ */ +#endif /* !CONFIG_BUILD_PROTECTED || __KERNEL__ */ #endif /* __INCLUDE_NUTTX_KMALLOC_H */ diff --git a/nuttx/include/nuttx/mm.h b/nuttx/include/nuttx/mm.h index ac831e2ce..7eac6b930 100644 --- a/nuttx/include/nuttx/mm.h +++ b/nuttx/include/nuttx/mm.h @@ -65,6 +65,12 @@ # define CONFIG_MM_SMALL 1 #endif +#undef HAVE_USER_HEAP +#if (!defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__)) && \ + !defined(CONFIG_BUILD_KERNEL) +# define HAVE_USER_HEAP +#endif + /* Chunk Header Definitions *************************************************/ /* These definitions define the characteristics of allocator * @@ -220,7 +226,7 @@ extern "C" #define EXTERN extern #endif -#if !defined(CONFIG_NUTTX_KERNEL) || !defined(__KERNEL__) +#ifdef HAVE_USER_HEAP /* This is the user heap */ EXTERN struct mm_heap_s g_mmheap; @@ -240,13 +246,13 @@ void mm_addregion(FAR struct mm_heap_s *heap, FAR void *heapstart, /* Functions contained in umm_initialize.c **********************************/ -#if !defined(CONFIG_NUTTX_KERNEL) || !defined(__KERNEL__) +#ifdef HAVE_USER_HEAP void umm_initialize(FAR void *heap_start, size_t heap_size); #endif /* Functions contained in umm_addregion.c ***********************************/ -#if !defined(CONFIG_NUTTX_KERNEL) || !defined(__KERNEL__) +#ifdef HAVE_USER_HEAP void umm_addregion(FAR void *heapstart, size_t heapsize); #endif @@ -259,7 +265,7 @@ void mm_givesemaphore(FAR struct mm_heap_s *heap); /* Functions contained in umm_semaphore.c ***********************************/ -#if !defined(CONFIG_NUTTX_KERNEL) || !defined(__KERNEL__) +#ifdef HAVE_USER_HEAP int umm_trysemaphore(void); void umm_givesemaphore(void); #endif diff --git a/nuttx/include/nuttx/pgalloc.h b/nuttx/include/nuttx/pgalloc.h index bc1e78846..dc878790e 100644 --- a/nuttx/include/nuttx/pgalloc.h +++ b/nuttx/include/nuttx/pgalloc.h @@ -59,7 +59,7 @@ * CONFIG_DEBUG_PGALLOC - Just like CONFIG_DEBUG_MM, but only generates * output from the page allocation logic. * - * Dependencies: CONFIG_ARCH_HAVE_MMU and CONFIG_GRAN + * Dependencies: CONFIG_ARCH_USE_MMU and CONFIG_GRAN */ #ifndef CONFIG_MM_PGALLOC_PGSIZE diff --git a/nuttx/include/nuttx/sched.h b/nuttx/include/nuttx/sched.h index ecff5de23..1952bea77 100644 --- a/nuttx/include/nuttx/sched.h +++ b/nuttx/include/nuttx/sched.h @@ -396,7 +396,8 @@ struct task_group_s * allocated using a user-space allocator. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ + defined(CONFIG_MM_KERNEL_HEAP) FAR struct streamlist *tg_streamlist; #else struct streamlist tg_streamlist; /* Holds C buffered I/O info */ @@ -559,7 +560,8 @@ struct task_tcb_s uint8_t init_priority; /* Initial priority of the task */ -#if !defined(CONFIG_CUSTOM_STACK) && defined(CONFIG_NUTTX_KERNEL) +#if !defined(CONFIG_CUSTOM_STACK) && (defined(CONFIG_BUILD_PROTECTED) || \ + defined(CONFIG_BUILD_KERNEL)) /* In the kernel mode build, the arguments are saved on the task's stack */ FAR char **argv; /* Name+start-up parameters */ diff --git a/nuttx/include/nuttx/userspace.h b/nuttx/include/nuttx/userspace.h index 5115aad7d..a8286b797 100644 --- a/nuttx/include/nuttx/userspace.h +++ b/nuttx/include/nuttx/userspace.h @@ -49,13 +49,13 @@ #include <nuttx/arch.h> -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ /* Configuration ************************************************************/ -/* If CONFIG_NUTTX_KERNEL, then CONFIG_NUTTX_USERSPACE must be defined to +/* If CONFIG_BUILD_PROTECTED, then CONFIG_NUTTX_USERSPACE must be defined to * provide the address where the user-space header can be found in memory. */ @@ -83,7 +83,7 @@ * they can be called through the userspace structure. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) +#if defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__) # define umm_initialize(b,s) USERSPACE->mm_initialize(b,s) # define umm_addregion(b,s) USERSPACE->mm_addregion(b,s) # define umm_trysemaphore() USERSPACE->mm_trysemaphore() @@ -186,7 +186,7 @@ extern "C" * ****************************************************************************/ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__) void task_startup(main_t entrypt, int argc, FAR char *argv[]) noreturn_function; #endif @@ -206,7 +206,7 @@ void task_startup(main_t entrypt, int argc, FAR char *argv[]) noreturn_function; * ****************************************************************************/ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) && !defined(CONFIG_DISABLE_PTHREAD) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__) && !defined(CONFIG_DISABLE_PTHREAD) void pthread_startup(pthread_startroutine_t entrypt, pthread_addr_t arg); #endif @@ -215,5 +215,5 @@ void pthread_startup(pthread_startroutine_t entrypt, pthread_addr_t arg); } #endif -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ #endif /* __INCLUDE_NUTTX_USERSPACE_H */ diff --git a/nuttx/include/nuttx/wqueue.h b/nuttx/include/nuttx/wqueue.h index bf9c56834..f3cef91fc 100644 --- a/nuttx/include/nuttx/wqueue.h +++ b/nuttx/include/nuttx/wqueue.h @@ -87,9 +87,9 @@ * priority worker thread. Default: CONFIG_IDLETHREAD_STACKSIZE. */ -/* Is this a kernel build (CONFIG_NUTTX_KERNEL=y) */ +/* Is this a protected build (CONFIG_BUILD_PROTECTED=y) */ -#ifdef CONFIG_NUTTX_KERNEL +#if defined(CONFIG_BUILD_PROTECTED) /* Yes.. kernel worker threads are not built in a kernel build when we are * building the user-space libraries. @@ -111,8 +111,13 @@ # endif +#elif defined(CONFIG_BUILD_KERNEL) + /* The kernel only build is equivalent to the kernel part of the protected + * build. + */ +#else /* User-space worker threads are not built in a flat build - * (CONFIG_NUTTX_KERNEL=n) + * (CONFIG_BUILD_PROTECTED=n && CONFIG_BUILD_KERNEL=n) */ #else @@ -220,14 +225,14 @@ * User Work Queue: Will be available if CONFIG_SCHED_USRWORK is defined */ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__) # ifdef CONFIG_SCHED_USRWORK # define NWORKERS 1 # define USRWORK 0 # endif #else - /* In a flat build (CONFIG_NUTTX_KERNEL=n) or during the kernel phase of + /* In a flat build (CONFIG_BUILD_PROTECTED=n) or during the kernel phase of * the kernel build, there may be 0, 1, or 2 work queues. * * Work queue IDs (indices): @@ -256,11 +261,11 @@ # define NWORKERS 1 # endif -# ifndef CONFIG_NUTTX_KERNEL +# if !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL) # define USRWORK LPWORK # endif -#endif /* CONFIG_NUTTX_KERNEL && !__KERNEL__ */ +#endif /* CONFIG_BUILD_PROTECTED && !__KERNEL__ */ /**************************************************************************** * Public Types @@ -314,7 +319,7 @@ extern "C" * logic. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* Play some games in the kernel mode build to assure that different * naming is used for the global work queue data structures. This may @@ -329,11 +334,11 @@ EXTERN struct wqueue_s g_usrwork[NWORKERS]; # define g_work g_usrwork # endif -#else /* CONFIG_NUTTX_KERNEL */ +#else /* CONFIG_BUILD_PROTECTED */ EXTERN struct wqueue_s g_work[NWORKERS]; -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ /**************************************************************************** * Public Function Prototypes diff --git a/nuttx/include/sys/syscall.h b/nuttx/include/sys/syscall.h index 0dd6216c1..ffa50e4d2 100644 --- a/nuttx/include/sys/syscall.h +++ b/nuttx/include/sys/syscall.h @@ -439,6 +439,6 @@ EXTERN const uint8_t g_funcnparms[SYS_nsyscalls]; #endif #endif /* __ASSEMBLY__ */ -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_LIB_SYSCALL */ #endif /* __INCLUDE_SYS_SYSCALL_H */ diff --git a/nuttx/libc/Kconfig b/nuttx/libc/Kconfig index 6ed38bc6d..79b7cbc0f 100644 --- a/nuttx/libc/Kconfig +++ b/nuttx/libc/Kconfig @@ -460,7 +460,7 @@ config SCHED_LPWORKSTACKSIZE endif # SCHED_LPWORK endif # SCHED_HPWORK -if NUTTX_KERNEL +if BUILD_PROTECTED config SCHED_USRWORK bool "User mode worker thread" @@ -490,7 +490,7 @@ config SCHED_LPWORKSTACKSIZE The stack size allocated for the lower priority worker thread. Default: 2K. endif # SCHED_USRWORK -endif # NUTTX_KERNEL +endif # BUILD_PROTECTED endif # SCHED_WORKQUEUE config LIB_KBDCODEC diff --git a/nuttx/libc/Makefile b/nuttx/libc/Makefile index 4556b66a4..7404b9c5e 100644 --- a/nuttx/libc/Makefile +++ b/nuttx/libc/Makefile @@ -37,12 +37,20 @@ # CFLAGS -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) ifeq ($(CONFIG_WINDOWS_NATIVE),y) KDEFINE = ${shell $(TOPDIR)\tools\define.bat "$(CC)" __KERNEL__} else KDEFINE = ${shell $(TOPDIR)/tools/define.sh "$(CC)" __KERNEL__} endif +else +ifeq ($(CONFIG_BUILD_KERNEL),y) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + KDEFINE = ${shell $(TOPDIR)\tools\define.bat "$(CC)" __KERNEL__} +else + KDEFINE = ${shell $(TOPDIR)/tools/define.sh "$(CC)" __KERNEL__} +endif +endif endif # Sources and paths @@ -122,7 +130,7 @@ endif # Dependencies .depend: Makefile $(SRCS) -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) $(Q) $(MKDEP) --obj-path ubin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_ubin.dep $(Q) $(MKDEP) --obj-path kbin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) $(KDEFINE) -- $(SRCS) >Make_kbin.dep else diff --git a/nuttx/libc/README.txt b/nuttx/libc/README.txt index b165bd74b..8e8fa9f73 100644 --- a/nuttx/libc/README.txt +++ b/nuttx/libc/README.txt @@ -11,13 +11,16 @@ mode. In that model, there is no real architectural distinction between what is a kernel-mode program and what is a user-mode program; the system is more like on multi-threaded program that all runs in kernel-mode. -But if the CONFIG_NUTTX_KERNEL option is selected, NuttX will be built into -distinct user-mode and kernel-mode sections. In that case, most of the +But if the CONFIG_BUILD_PROTECTED option is selected, NuttX will be built +into distinct user-mode and kernel-mode sections. In that case, most of the code in the nuttx/ directory will run in kernel-mode with with exceptions of (1) the user-mode "proxies" found in syscall/proxies, and (2) the standard C library functions found in this directory. In this build model, it is critical to separate the user-mode OS interfaces in this way. +If CONFIG_BUILD_KERNEL is selected, then only a NuttX kernel will be built +with no applications. + Sub-Directories =============== diff --git a/nuttx/libc/lib_internal.h b/nuttx/libc/lib_internal.h index c65cab5b2..6b9404680 100644 --- a/nuttx/libc/lib_internal.h +++ b/nuttx/libc/lib_internal.h @@ -80,7 +80,8 @@ * mode is supported. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) +#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ + defined(CONFIG_BUILD_KERNEL) # include <nuttx/kmalloc.h> /* Domain-specific allocations */ diff --git a/nuttx/libc/misc/lib_init.c b/nuttx/libc/misc/lib_init.c index 586699a4a..f4f4e5b6e 100644 --- a/nuttx/libc/misc/lib_init.c +++ b/nuttx/libc/misc/lib_init.c @@ -49,7 +49,8 @@ #include "lib_internal.h" -#if !defined(CONFIG_NUTTX_KERNEL) || defined(__KERNEL__) +#if !defined(CONFIG_BUILD_PROTECTED) || defined(__KERNEL__) || \ + defined(CONFIG_BUILD_KERNEL) /************************************************************ * Pre-processor Definitions @@ -150,5 +151,5 @@ void lib_releaselist(FAR struct streamlist *list) #endif } -#endif /* !CONFIG_NUTTX_KERNEL || __KERNEL__ */ +#endif /* !CONFIG_BUILD_PROTECTED || __KERNEL__ || CONFIG_BUILD_KERNEL */ #endif /* CONFIG_NFILE_STREAMS */ diff --git a/nuttx/libc/pthread/Make.defs b/nuttx/libc/pthread/Make.defs index c4ccbf635..a443a6996 100644 --- a/nuttx/libc/pthread/Make.defs +++ b/nuttx/libc/pthread/Make.defs @@ -50,7 +50,7 @@ ifeq ($(CONFIG_MUTEX_TYPES),y) CSRCS += pthread_mutexattrsettype.c pthread_mutexattrgettype.c endif -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CSRCS += pthread_startup.c endif diff --git a/nuttx/libc/pthread/pthread_attrinit.c b/nuttx/libc/pthread/pthread_attrinit.c index a2d6bf938..d4a3e0f93 100644 --- a/nuttx/libc/pthread/pthread_attrinit.c +++ b/nuttx/libc/pthread/pthread_attrinit.c @@ -64,7 +64,8 @@ * the user address space. */ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) +#if (defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__)) && \ + !defined(CONFIG_BUILD_KERNEL) pthread_attr_t g_default_pthread_attr = PTHREAD_ATTR_INITIALIZER; #endif diff --git a/nuttx/libc/pthread/pthread_startup.c b/nuttx/libc/pthread/pthread_startup.c index 50aa263e4..6dea37c4e 100644 --- a/nuttx/libc/pthread/pthread_startup.c +++ b/nuttx/libc/pthread/pthread_startup.c @@ -44,7 +44,8 @@ #include <nuttx/userspace.h> -#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) +#if (defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__)) || \ + !defined(CONFIG_BUILD_KERNEL) /**************************************************************************** * Pre-processor Definitions @@ -105,4 +106,4 @@ void pthread_startup(pthread_startroutine_t entrypt, pthread_addr_t arg) pthread_exit(exit_status); } -#endif /* CONFIG_NUTTX_KERNEL && !__KERNEL__ */ +#endif /* (CONFIG_BUILD_PROTECTED && !__KERNEL__) && !CONFIG_BUILD_KERNEL */ diff --git a/nuttx/libc/sched/Make.defs b/nuttx/libc/sched/Make.defs index 310a6259b..f1e69aff8 100644 --- a/nuttx/libc/sched/Make.defs +++ b/nuttx/libc/sched/Make.defs @@ -37,7 +37,7 @@ CSRCS += sched_getprioritymax.c sched_getprioritymin.c -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CSRCS += task_startup.c endif diff --git a/nuttx/libc/sched/task_startup.c b/nuttx/libc/sched/task_startup.c index 72cffbaaa..8c81c0b50 100644 --- a/nuttx/libc/sched/task_startup.c +++ b/nuttx/libc/sched/task_startup.c @@ -44,7 +44,7 @@ #include <nuttx/userspace.h> -#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__) /**************************************************************************** * Pre-processor Definitions @@ -101,4 +101,4 @@ void task_startup(main_t entrypt, int argc, FAR char *argv[]) exit(entrypt(argc, argv)); } -#endif /* CONFIG_NUTTX_KERNEL && !__KERNEL__ */ +#endif /* CONFIG_BUILD_PROTECTED && !__KERNEL__ */ diff --git a/nuttx/libc/stdio/lib_lowsyslog.c b/nuttx/libc/stdio/lib_lowsyslog.c index 364a41831..3ada77bf5 100644 --- a/nuttx/libc/stdio/lib_lowsyslog.c +++ b/nuttx/libc/stdio/lib_lowsyslog.c @@ -46,7 +46,7 @@ /* This interface can only be used from within the kernel */ -#if !defined(CONFIG_NUTTX_KERNEL) || defined(__KERNEL__) +#if !defined(CONFIG_BUILD_PROTECTED) || defined(__KERNEL__) /**************************************************************************** * Definitions diff --git a/nuttx/libc/stdio/lib_syslog.c b/nuttx/libc/stdio/lib_syslog.c index 4e5afcebb..5f0958262 100644 --- a/nuttx/libc/stdio/lib_syslog.c +++ b/nuttx/libc/stdio/lib_syslog.c @@ -50,7 +50,7 @@ /* Some output destinations are only available from within the kernel */ -#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) +#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__) # undef CONFIG_SYSLOG # undef CONFIG_ARCH_LOWPUTC #endif diff --git a/nuttx/libc/wqueue/Make.defs b/nuttx/libc/wqueue/Make.defs index fca63a8a6..3f1303d7a 100644 --- a/nuttx/libc/wqueue/Make.defs +++ b/nuttx/libc/wqueue/Make.defs @@ -39,7 +39,7 @@ ifeq ($(CONFIG_SCHED_WORKQUEUE),y) CSRCS += work_thread.c work_queue.c work_cancel.c work_signal.c -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) CSRCS += work_usrstart.c endif diff --git a/nuttx/libc/wqueue/work_thread.c b/nuttx/libc/wqueue/work_thread.c index ed26ca3ff..657fe9d10 100644 --- a/nuttx/libc/wqueue/work_thread.c +++ b/nuttx/libc/wqueue/work_thread.c @@ -67,7 +67,7 @@ /* The state of each work queue. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED /* Play some games in the kernel mode build to assure that different * naming is used for the global work queue data structures. This may @@ -83,11 +83,11 @@ struct wqueue_s g_kernelwork[NWORKERS]; struct wqueue_s g_usrwork[NWORKERS]; # endif -#else /* CONFIG_NUTTX_KERNEL */ +#else /* CONFIG_BUILD_PROTECTED */ struct wqueue_s g_work[NWORKERS]; -#endif /* CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_BUILD_PROTECTED */ /**************************************************************************** * Private Variables diff --git a/nuttx/libc/wqueue/work_usrstart.c b/nuttx/libc/wqueue/work_usrstart.c index 2b3ee3c67..068c016d1 100644 --- a/nuttx/libc/wqueue/work_usrstart.c +++ b/nuttx/libc/wqueue/work_usrstart.c @@ -46,7 +46,7 @@ #include <nuttx/wqueue.h> -#if defined(CONFIG_NUTTX_KERNEL) && !defined(__KERNEL__) && \ +#if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__) && \ defined(CONFIG_SCHED_WORKQUEUE) && defined(CONFIG_SCHED_USRWORK) /**************************************************************************** @@ -112,4 +112,4 @@ int work_usrstart(void) return g_usrwork[USRWORK].pid; } -#endif /* CONFIG_NUTTX_KERNEL && !__KERNEL__ CONFIG_SCHED_WORKQUEUE && CONFIG_SCHED_USRWORK */ +#endif /* CONFIG_BUILD_PROTECTED && !__KERNEL__ CONFIG_SCHED_WORKQUEUE && CONFIG_SCHED_USRWORK */ diff --git a/nuttx/libnx/Makefile b/nuttx/libnx/Makefile index 37a195996..375bb2691 100644 --- a/nuttx/libnx/Makefile +++ b/nuttx/libnx/Makefile @@ -37,7 +37,7 @@ # CFLAGS -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) ifeq ($(CONFIG_WINDOWS_NATIVE),y) KDEFINE = ${shell $(TOPDIR)\tools\define.bat "$(CC)" __KERNEL__} else @@ -185,7 +185,7 @@ endif # Dependencies .depend: Makefile gensources $(SRCS) -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) $(Q) $(MKDEP) --obj-path ubin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_ubin.dep $(Q) $(MKDEP) --obj-path kbin --obj-suffix $(OBJEXT) $(DEPPATH) "$(CC)" -- $(CFLAGS) $(KDEFINE) -- $(SRCS) >Make_kbin.dep else diff --git a/nuttx/libnx/nxcontext.h b/nuttx/libnx/nxcontext.h index ca5e6dcb1..e8b52ece9 100644 --- a/nuttx/libnx/nxcontext.h +++ b/nuttx/libnx/nxcontext.h @@ -61,7 +61,9 @@ * mode is supported. */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) +#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ + defined(CONFIG_BUILD_KERNEL) + # include <nuttx/kmalloc.h> /* Domain-specific allocations */ diff --git a/nuttx/libxx/libxx_internal.hxx b/nuttx/libxx/libxx_internal.hxx index 74d5526ce..25ad13c76 100644 --- a/nuttx/libxx/libxx_internal.hxx +++ b/nuttx/libxx/libxx_internal.hxx @@ -52,7 +52,8 @@ // built as separated kernel- and user-space modules, then only the first // mode is supported. -#if defined(CONFIG_NUTTX_KERNEL) && defined(__KERNEL__) +#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ + defined(CONFIG_BUILD_KERNEL) # include <nuttx/kmalloc.h> # define lib_malloc(s) kmalloc(s) # define lib_zalloc(s) kzalloc(s) diff --git a/nuttx/mm/Kconfig b/nuttx/mm/Kconfig index 977baeb86..3812971de 100644 --- a/nuttx/mm/Kconfig +++ b/nuttx/mm/Kconfig @@ -18,7 +18,7 @@ config MM_MULTIHEAP config MM_KERNEL_HEAP bool "Support a protected, kernel heap" default y - depends on NUTTX_KERNEL && MM_MULTIHEAP + depends on (BUILD_PROTECTED || BUILD_KERNEL) && MM_MULTIHEAP ---help--- Partition heap memory into two parts: (1) a protected, kernel-mode heap accessible only by the NuttX kernel, and (2) an unprotected @@ -142,7 +142,7 @@ config DEBUG_GRAN config MM_PGALLOC bool "Enable Page Allocator" default n - depends on ARCH_HAVE_MMU + depends on ARCH_USE_MMU select GRAN ---help--- Enable support for a MMU physical page allocator based on the diff --git a/nuttx/mm/Makefile b/nuttx/mm/Makefile index f605fc5d4..349ced9f8 100644 --- a/nuttx/mm/Makefile +++ b/nuttx/mm/Makefile @@ -40,7 +40,7 @@ DELIM := $(strip /) # CFLAGS -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) ifeq ($(CONFIG_WINDOWS_NATIVE),y) KDEFINE = ${shell $(TOPDIR)\tools\define.bat "$(CC)" __KERNEL__} else @@ -58,10 +58,16 @@ CSRCS += mm_memalign.c mm_free.c mm_mallinfo.c # Allocator instances CSRCS += mm_user.c -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) ifeq ($(CONFIG_MM_KERNEL_HEAP),y) CSRCS += mm_kernel.c endif +else +ifeq ($(CONFIG_BUILD_KERNEL),y) +ifeq ($(CONFIG_MM_KERNEL_HEAP),y) +CSRCS += mm_kernel.c +endif +endif endif # An optional granule allocator @@ -122,7 +128,7 @@ endif # Dependencies .depend: Makefile $(SRCS) -ifeq ($(CONFIG_NUTTX_KERNEL),y) +ifeq ($(CONFIG_BUILD_PROTECTED),y) $(Q) $(MKDEP) --obj-path ubin --obj-suffix $(OBJEXT) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make_ubin.dep $(Q) $(MKDEP) --obj-path kbin --obj-suffix $(OBJEXT) "$(CC)" -- $(CFLAGS) $(KDEFINE) -- $(SRCS) >Make_kbin.dep else diff --git a/nuttx/mm/mm_calloc.c b/nuttx/mm/mm_calloc.c index 0a433947d..3dd501aec 100644 --- a/nuttx/mm/mm_calloc.c +++ b/nuttx/mm/mm_calloc.c @@ -81,7 +81,7 @@ FAR void *mm_calloc(FAR struct mm_heap_s *heap, size_t n, size_t elem_size) * ****************************************************************************/ -#if !defined(CONFIG_NUTTX_KERNEL) || !defined(__KERNEL__) +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) FAR void *calloc(size_t n, size_t elem_size) { #ifdef CONFIG_MM_MULTIHEAP diff --git a/nuttx/mm/mm_free.c b/nuttx/mm/mm_free.c index 220b9bca0..9d04619b1 100644 --- a/nuttx/mm/mm_free.c +++ b/nuttx/mm/mm_free.c @@ -167,7 +167,7 @@ void mm_free(FAR struct mm_heap_s *heap, FAR void *mem) * ****************************************************************************/ -#if !defined(CONFIG_NUTTX_KERNEL) || !defined(__KERNEL__) +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) void free(FAR void *mem) { mm_free(&g_mmheap, mem); diff --git a/nuttx/mm/mm_kernel.c b/nuttx/mm/mm_kernel.c index ee156e889..eb3c7fd7d 100644 --- a/nuttx/mm/mm_kernel.c +++ b/nuttx/mm/mm_kernel.c @@ -43,7 +43,8 @@ #include <nuttx/kmalloc.h> -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) && defined(__KERNEL__) +#if ((defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ + defined(CONFIG_BUILD_KERNEL)) && defined(CONFIG_MM_KERNEL_HEAP) /************************************************************************ * Pre-processor definition @@ -304,4 +305,4 @@ bool kmm_heapmember(FAR void *mem) } #endif -#endif /* CONFIG_NUTTX_KERNEL && CONFIG_MM_KERNEL_HEAP && __KERNEL__ */ +#endif /* ((CONFIG_BUILD_PROTECTED && __KERNEL__) || CONFIG_BUILD_KERNEL) && CONFIG_MM_KERNEL_HEAP*/ diff --git a/nuttx/mm/mm_mallinfo.c b/nuttx/mm/mm_mallinfo.c index e37f82266..4b152c354 100644 --- a/nuttx/mm/mm_mallinfo.c +++ b/nuttx/mm/mm_mallinfo.c @@ -151,7 +151,7 @@ int mm_mallinfo(FAR struct mm_heap_s *heap, FAR struct mallinfo *info) * ****************************************************************************/ -#if !defined(CONFIG_NUTTX_KERNEL) || !defined(__KERNEL__) +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) # ifdef CONFIG_CAN_PASS_STRUCTS struct mallinfo mallinfo(void) @@ -170,4 +170,4 @@ int mallinfo(struct mallinfo *info) } #endif -#endif /* !CONFIG_NUTTX_KERNEL || !__KERNEL__ */ +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/mm_malloc.c b/nuttx/mm/mm_malloc.c index eee483511..354a30e02 100644 --- a/nuttx/mm/mm_malloc.c +++ b/nuttx/mm/mm_malloc.c @@ -228,7 +228,7 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size) * ****************************************************************************/ -#if !defined(CONFIG_NUTTX_KERNEL) || !defined(__KERNEL__) +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) FAR void *malloc(size_t size) { return mm_malloc(&g_mmheap, size); diff --git a/nuttx/mm/mm_memalign.c b/nuttx/mm/mm_memalign.c index 9c0a29546..7fe1d0c74 100644 --- a/nuttx/mm/mm_memalign.c +++ b/nuttx/mm/mm_memalign.c @@ -240,7 +240,7 @@ FAR void *mm_memalign(FAR struct mm_heap_s *heap, size_t alignment, * ****************************************************************************/ -#if !defined(CONFIG_NUTTX_KERNEL) || !defined(__KERNEL__) +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) FAR void *memalign(size_t alignment, size_t size) { diff --git a/nuttx/mm/mm_pgalloc.c b/nuttx/mm/mm_pgalloc.c index bd61a4bf6..403e1fd2f 100644 --- a/nuttx/mm/mm_pgalloc.c +++ b/nuttx/mm/mm_pgalloc.c @@ -59,7 +59,7 @@ * CONFIG_DEBUG_PGALLOC - Just like CONFIG_DEBUG_MM, but only generates * output from the page allocation logic. * - * Dependencies: CONFIG_ARCH_HAVE_MMU and CONFIG_GRAN + * Dependencies: CONFIG_ARCH_USE_MMU and CONFIG_GRAN */ /* Debug */ diff --git a/nuttx/mm/mm_realloc.c b/nuttx/mm/mm_realloc.c index 3bf927d9b..0c7346521 100644 --- a/nuttx/mm/mm_realloc.c +++ b/nuttx/mm/mm_realloc.c @@ -399,7 +399,7 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem, * ****************************************************************************/ -#if !defined(CONFIG_NUTTX_KERNEL) || !defined(__KERNEL__) +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) FAR void *realloc(FAR void *oldmem, size_t size) { diff --git a/nuttx/mm/mm_user.c b/nuttx/mm/mm_user.c index d487e4264..bc99ee839 100644 --- a/nuttx/mm/mm_user.c +++ b/nuttx/mm/mm_user.c @@ -41,7 +41,7 @@ #include <assert.h> #include <nuttx/mm.h> -#if !defined(CONFIG_NUTTX_KERNEL) || !defined(__KERNEL__) +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) /************************************************************************ * Pre-processor definition @@ -153,4 +153,4 @@ void umm_givesemaphore(void) mm_givesemaphore(&g_mmheap); } -#endif /* !CONFIG_NUTTX_KERNEL || !__KERNEL__ */ +#endif /* !CONFIG_BUILD_PROTECTED || !__KERNEL__ */ diff --git a/nuttx/mm/mm_zalloc.c b/nuttx/mm/mm_zalloc.c index bf25aed84..2cef9f436 100644 --- a/nuttx/mm/mm_zalloc.c +++ b/nuttx/mm/mm_zalloc.c @@ -81,7 +81,7 @@ FAR void *mm_zalloc(FAR struct mm_heap_s *heap, size_t size) * ****************************************************************************/ -#if !defined(CONFIG_NUTTX_KERNEL) || !defined(__KERNEL__) +#if !defined(CONFIG_BUILD_PROTECTED) || !defined(__KERNEL__) FAR void *zalloc(size_t size) { #ifdef CONFIG_MM_MULTIHEAP diff --git a/nuttx/sched/group/group_create.c b/nuttx/sched/group/group_create.c index d8e4bf942..9d4f92a2a 100644 --- a/nuttx/sched/group/group_create.c +++ b/nuttx/sched/group/group_create.c @@ -190,8 +190,8 @@ int group_allocate(FAR struct task_tcb_s *tcb) return -ENOMEM; } -#if CONFIG_NFILE_STREAMS > 0 && defined(CONFIG_NUTTX_KERNEL) && \ - defined(CONFIG_MM_KERNEL_HEAP) +#if CONFIG_NFILE_STREAMS > 0 && (defined(CONFIG_BUILD_PROTECTED) || \ + defined(CONFIG_BUILD_KERNEL)) && defined(CONFIG_MM_KERNEL_HEAP) /* In a flat, single-heap build. The stream list is allocated with the * group structure. But in a kernel build with a kernel allocator, it @@ -226,8 +226,8 @@ int group_allocate(FAR struct task_tcb_s *tcb) ret = env_dup(group); if (ret < 0) { -#if CONFIG_NFILE_STREAMS > 0 && defined(CONFIG_NUTTX_KERNEL) && \ - defined(CONFIG_MM_KERNEL_HEAP) +#if CONFIG_NFILE_STREAMS > 0 && (defined(CONFIG_BUILD_PROTECTED) || \ + defined(CONFIG_BUILD_KERNEL)) && defined(CONFIG_MM_KERNEL_HEAP) kufree(group->tg_streamlist); #endif kfree(group); diff --git a/nuttx/sched/group/group_leave.c b/nuttx/sched/group/group_leave.c index 403fe4c95..36b84c836 100644 --- a/nuttx/sched/group/group_leave.c +++ b/nuttx/sched/group/group_leave.c @@ -181,7 +181,8 @@ static inline void group_release(FAR struct task_group_s *group) #if CONFIG_NFILE_STREAMS > 0 /* Free resource held by the stream list */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ + defined(CONFIG_MM_KERNEL_HEAP) lib_releaselist(group->tg_streamlist); #else lib_releaselist(&group->tg_streamlist); @@ -234,8 +235,8 @@ static inline void group_release(FAR struct task_group_s *group) } #endif -#if CONFIG_NFILE_STREAMS > 0 && defined(CONFIG_NUTTX_KERNEL) && \ - defined(CONFIG_MM_KERNEL_HEAP) +#if CONFIG_NFILE_STREAMS > 0 && (defined(CONFIG_BUILD_PROTECTED) || \ + defined(CONFIG_BUILD_KERNEL)) && defined(CONFIG_MM_KERNEL_HEAP) /* In a flat, single-heap build. The stream list is part of the * group structure. But in a kernel build with a kernel allocator, it diff --git a/nuttx/sched/group/group_setupstreams.c b/nuttx/sched/group/group_setupstreams.c index 73eea6b1d..24254dcdd 100644 --- a/nuttx/sched/group/group_setupstreams.c +++ b/nuttx/sched/group/group_setupstreams.c @@ -78,7 +78,8 @@ int group_setupstreams(FAR struct task_tcb_s *tcb) /* Initialize file streams for the task group */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ + defined(CONFIG_MM_KERNEL_HEAP) lib_streaminit(tcb->cmn.group->tg_streamlist); #else lib_streaminit(&tcb->cmn.group->tg_streamlist); diff --git a/nuttx/sched/init/os_bringup.c b/nuttx/sched/init/os_bringup.c index bb9889956..175330ad5 100644 --- a/nuttx/sched/init/os_bringup.c +++ b/nuttx/sched/init/os_bringup.c @@ -197,7 +197,7 @@ int os_bringup(void) #endif /* CONFIG_SCHED_LPWORK */ #endif /* CONFIG_SCHED_HPWORK */ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_SCHED_USRWORK) +#if defined(CONFIG_BUILD_PROTECTED) && defined(CONFIG_SCHED_USRWORK) /* Start the user-space work queue */ DEBUGASSERT(USERSPACE->work_usrstart != NULL); @@ -228,7 +228,7 @@ int os_bringup(void) * header at the beginning of the user-space blob. */ -#ifdef CONFIG_NUTTX_KERNEL +#ifdef CONFIG_BUILD_PROTECTED DEBUGASSERT(USERSPACE->us_entrypoint != NULL); taskid = TASK_CREATE("init", SCHED_PRIORITY_DEFAULT, CONFIG_USERMAIN_STACKSIZE, USERSPACE->us_entrypoint, diff --git a/nuttx/sched/init/os_start.c b/nuttx/sched/init/os_start.c index fdd308dfb..7130b8ae8 100644 --- a/nuttx/sched/init/os_start.c +++ b/nuttx/sched/init/os_start.c @@ -151,7 +151,8 @@ volatile dq_queue_t g_inactivetasks; volatile sq_queue_t g_delayed_kufree; -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ + defined(CONFIG_MM_KERNEL_HEAP) volatile sq_queue_t g_delayed_kfree; #endif @@ -264,7 +265,8 @@ void os_start(void) #endif dq_init(&g_inactivetasks); sq_init(&g_delayed_kufree); -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ + defined(CONFIG_MM_KERNEL_HEAP) sq_init(&g_delayed_kfree); #endif @@ -308,13 +310,14 @@ void os_start(void) * and there is no support that yet. */ -#if defined(CONFIG_CUSTOM_STACK) || !defined(CONFIG_NUTTX_KERNEL) +#if defined(CONFIG_CUSTOM_STACK) || (!defined(CONFIG_BUILD_PROTECTED) && \ + !defined(CONFIG_BUILD_KERNEL)) #if CONFIG_TASK_NAME_SIZE > 0 g_idletcb.argv[0] = g_idletcb.cmn.name; #else g_idletcb.argv[0] = (char*)g_idlename; #endif /* CONFIG_TASK_NAME_SIZE */ -#endif /* CONFIG_CUSTOM_STACK || !CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_CUSTOM_STACK || (!CONFIG_BUILD_PROTECTED && !CONFIG_BUILD_KERNEL) */ /* Then add the idle task's TCB to the head of the ready to run list */ @@ -350,7 +353,8 @@ void os_start(void) up_allocate_heap(&heap_start, &heap_size); kumm_initialize(heap_start, heap_size); -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ + defined(CONFIG_MM_KERNEL_HEAP) /* Get the kernel-mode heap from the platform specific code and configure * the kernel-mode memory allocator. */ diff --git a/nuttx/sched/pthread/pthread_create.c b/nuttx/sched/pthread/pthread_create.c index d6f671676..036818a53 100644 --- a/nuttx/sched/pthread/pthread_create.c +++ b/nuttx/sched/pthread/pthread_create.c @@ -190,7 +190,7 @@ static void pthread_start(void) * to switch to user-mode before calling into the pthread. */ -#ifdef CONFIG_NUTTX_KERNEL +#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL) up_pthread_start(ptcb->cmn.entry.pthread, ptcb->arg); exit_status = NULL; #else diff --git a/nuttx/sched/sched/sched.h b/nuttx/sched/sched/sched.h index c6a6fd800..2f5f800af 100644 --- a/nuttx/sched/sched/sched.h +++ b/nuttx/sched/sched/sched.h @@ -179,7 +179,8 @@ extern volatile dq_queue_t g_inactivetasks; extern volatile sq_queue_t g_delayed_kufree; -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ + defined(CONFIG_MM_KERNEL_HEAP) extern volatile sq_queue_t g_delayed_kfree; #endif diff --git a/nuttx/sched/sched/sched_free.c b/nuttx/sched/sched/sched_free.c index 93d7dea1b..97f1429f6 100644 --- a/nuttx/sched/sched/sched_free.c +++ b/nuttx/sched/sched/sched_free.c @@ -98,7 +98,8 @@ void sched_ufree(FAR void *address) */ flags = irqsave(); -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ + defined(CONFIG_MM_KERNEL_HEAP) DEBUGASSERT(!kmm_heapmember(address)); #endif @@ -122,7 +123,8 @@ void sched_ufree(FAR void *address) } } -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ + defined(CONFIG_MM_KERNEL_HEAP) void sched_kfree(FAR void *address) { irqstate_t flags; diff --git a/nuttx/sched/sched/sched_garbage.c b/nuttx/sched/sched/sched_garbage.c index 7a6839cb1..06de3d577 100644 --- a/nuttx/sched/sched/sched_garbage.c +++ b/nuttx/sched/sched/sched_garbage.c @@ -122,7 +122,8 @@ static inline void sched_kucleanup(void) * ****************************************************************************/ -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ + defined(CONFIG_MM_KERNEL_HEAP) static inline void sched_kcleanup(void) { irqstate_t flags; diff --git a/nuttx/sched/sched/sched_getstreams.c b/nuttx/sched/sched/sched_getstreams.c index f11015b57..a87c95306 100644 --- a/nuttx/sched/sched/sched_getstreams.c +++ b/nuttx/sched/sched/sched_getstreams.c @@ -74,7 +74,8 @@ FAR struct streamlist *sched_getstreams(void) DEBUGASSERT(group); -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ + defined(CONFIG_MM_KERNEL_HEAP) return group->tg_streamlist; #else return &group->tg_streamlist; diff --git a/nuttx/sched/sched/sched_releasetcb.c b/nuttx/sched/sched/sched_releasetcb.c index 7cf80f3d6..ecfaf72ce 100644 --- a/nuttx/sched/sched/sched_releasetcb.c +++ b/nuttx/sched/sched/sched_releasetcb.c @@ -111,7 +111,8 @@ static void sched_releasepid(pid_t pid) int sched_releasetcb(FAR struct tcb_s *tcb, uint8_t ttype) { int ret = OK; -#if defined(CONFIG_CUSTOM_STACK) || !defined(CONFIG_NUTTX_KERNEL) +#if defined(CONFIG_CUSTOM_STACK) || (!defined(CONFIG_BUILD_PROTECTED) && \ + !defined(CONFIG_BUILD_KERNEL)) int i; #endif @@ -168,7 +169,8 @@ int sched_releasetcb(FAR struct tcb_s *tcb, uint8_t ttype) } #endif -#if defined(CONFIG_CUSTOM_STACK) || !defined(CONFIG_NUTTX_KERNEL) +#if defined(CONFIG_CUSTOM_STACK) || (!defined(CONFIG_BUILD_PROTECTED) && \ + !defined(CONFIG_BUILD_KERNEL)) /* Release command line arguments that were allocated for task * start/re-start. * @@ -188,7 +190,7 @@ int sched_releasetcb(FAR struct tcb_s *tcb, uint8_t ttype) } } -#endif /* CONFIG_CUSTOM_STACK || !CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_CUSTOM_STACK || (!CONFIG_BUILD_PROTECTED && !CONFIG_BUILD_KERNEL) */ /* Release this thread's reference to the address environment */ diff --git a/nuttx/sched/signal/sig_deliver.c b/nuttx/sched/signal/sig_deliver.c index 1c753defc..eff0d4e59 100644 --- a/nuttx/sched/signal/sig_deliver.c +++ b/nuttx/sched/signal/sig_deliver.c @@ -133,7 +133,7 @@ void sig_deliver(FAR struct tcb_s *stcb) * calling the task. */ -#ifdef CONFIG_NUTTX_KERNEL +#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL) if ((stcb->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL) { /* The sigq_t pointed to by sigq resides in kernel space. So we diff --git a/nuttx/sched/task/task_exithook.c b/nuttx/sched/task/task_exithook.c index 78a44ec50..cf7c8c8cd 100644 --- a/nuttx/sched/task/task_exithook.c +++ b/nuttx/sched/task/task_exithook.c @@ -558,7 +558,8 @@ static inline void task_flushstreams(FAR struct tcb_s *tcb) if (group && group->tg_nmembers == 1) { -#if defined(CONFIG_NUTTX_KERNEL) && defined(CONFIG_MM_KERNEL_HEAP) +#if (defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL)) && \ + defined(CONFIG_MM_KERNEL_HEAP) (void)lib_flushall(tcb->group->tg_streamlist); #else (void)lib_flushall(&tcb->group->tg_streamlist); diff --git a/nuttx/sched/task/task_setup.c b/nuttx/sched/task/task_setup.c index aece0a30e..a0eaa9af6 100644 --- a/nuttx/sched/task/task_setup.c +++ b/nuttx/sched/task/task_setup.c @@ -448,7 +448,8 @@ static void task_namesetup(FAR struct task_tcb_s *tcb, FAR const char *name) * ****************************************************************************/ -#if defined(CONFIG_CUSTOM_STACK) || !defined(CONFIG_NUTTX_KERNEL) +#if defined(CONFIG_CUSTOM_STACK) || (!defined(CONFIG_BUILD_PROTECTED) && \ + !defined(CONFIG_BUILD_KERNEL)) static int task_tcbargsetup(FAR struct task_tcb_s *tcb, FAR char * const argv[]) { @@ -488,7 +489,7 @@ static int task_tcbargsetup(FAR struct task_tcb_s *tcb, return OK; } -#endif /* CONFIG_CUSTOM_STACK || !CONFIG_NUTTX_KERNEL */ +#endif /* CONFIG_CUSTOM_STACK || (!CONFIG_BUILD_PROTECTED && !CONFIG_BUILD_KERNEL) */ /**************************************************************************** * Name: task_stackargsetup @@ -515,7 +516,8 @@ static int task_tcbargsetup(FAR struct task_tcb_s *tcb, * ****************************************************************************/ -#if !defined(CONFIG_CUSTOM_STACK) && defined(CONFIG_NUTTX_KERNEL) +#if !defined(CONFIG_CUSTOM_STACK) && (defined(CONFIG_BUILD_PROTECTED) || \ + defined(CONFIG_BUILD_KERNEL)) static int task_stackargsetup(FAR struct task_tcb_s *tcb, FAR char * const argv[]) { @@ -617,7 +619,7 @@ static int task_stackargsetup(FAR struct task_tcb_s *tcb, return OK; } -#endif /* !CONFIG_CUSTOM_STACK && CONFIG_NUTTX_KERNEL */ +#endif /* !CONFIG_CUSTOM_STACK && (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) */ /**************************************************************************** * Public Functions @@ -742,7 +744,8 @@ int task_argsetup(FAR struct task_tcb_s *tcb, FAR const char *name, task_namesetup(tcb, name); -#if !defined(CONFIG_CUSTOM_STACK) && defined(CONFIG_NUTTX_KERNEL) +#if !defined(CONFIG_CUSTOM_STACK) && (defined(CONFIG_BUILD_PROTECTED) || \ + defined(CONFIG_BUILD_KERNEL)) /* In the kernel build case, the argv[] array and all strings are copied * to the task's stack. This is done because the TCB (and kernel allocated * strings) are only accessible in kernel-mode. Data on the stack, on the @@ -759,7 +762,7 @@ int task_argsetup(FAR struct task_tcb_s *tcb, FAR const char *name, ret = task_tcbargsetup(tcb, argv); -#endif /* !CONFIG_CUSTOM_STACK && CONFIG_NUTTX_KERNEL */ +#endif /* !CONFIG_CUSTOM_STACK && (CONFIG_BUILD_PROTECTED || CONFIG_BUILD_KERNEL) */ return ret; } diff --git a/nuttx/sched/task/task_start.c b/nuttx/sched/task/task_start.c index 8cc7973f1..1317d9a4e 100644 --- a/nuttx/sched/task/task_start.c +++ b/nuttx/sched/task/task_start.c @@ -127,7 +127,7 @@ void task_start(void) * we have to switch to user-mode before calling the task. */ -#ifdef CONFIG_NUTTX_KERNEL +#if defined(CONFIG_BUILD_PROTECTED) || defined(CONFIG_BUILD_KERNEL) if ((tcb->cmn.flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL) { up_task_start(tcb->cmn.entry.main, argc, tcb->argv); diff --git a/nuttx/syscall/Kconfig b/nuttx/syscall/Kconfig index 6c5f57a8c..3606426c9 100644 --- a/nuttx/syscall/Kconfig +++ b/nuttx/syscall/Kconfig @@ -10,8 +10,8 @@ menuconfig LIB_SYSCALL Build in support for "system calls". System calls are used to implement a call gate mechanism that can be be used to call from user code into the kernel. This is only useful for user code that - lies outside of the kernel such as when the NUTTX_KERNEL build is - selected. + lies outside of the kernel such as when the BUILD_PROTECTED or + BUILD_KERNEL builds are selected. This permits calls from user-mode code into kernel mode; the call gate will change the mode of operation from user to supervisor mode, |