diff options
-rw-r--r-- | nuttx/arch/arm/src/armv7-m/up_svcall.c | 1 | ||||
-rw-r--r-- | nuttx/arch/arm/src/common/up_pthread_start.c | 5 | ||||
-rw-r--r-- | nuttx/arch/arm/src/common/up_signal_dispatch.c | 5 | ||||
-rw-r--r-- | nuttx/arch/arm/src/stm32/stm32_serial.c | 9 | ||||
-rw-r--r-- | nuttx/configs/stm32f4discovery/kernel/up_userspace.c | 7 | ||||
-rw-r--r-- | nuttx/configs/stm32f4discovery/kostest/defconfig | 211 | ||||
-rw-r--r-- | nuttx/include/errno.h | 44 | ||||
-rw-r--r-- | nuttx/include/nuttx/arch.h | 4 | ||||
-rw-r--r-- | nuttx/syscall/syscall_funclookup.c | 17 |
9 files changed, 215 insertions, 88 deletions
diff --git a/nuttx/arch/arm/src/armv7-m/up_svcall.c b/nuttx/arch/arm/src/armv7-m/up_svcall.c index 80d07b4e5..ada12e61a 100644 --- a/nuttx/arch/arm/src/armv7-m/up_svcall.c +++ b/nuttx/arch/arm/src/armv7-m/up_svcall.c @@ -46,6 +46,7 @@ #include <arch/irq.h> #include <nuttx/sched.h> +#include <nuttx/userspace.h> #ifdef CONFIG_LIB_SYSCALL # include <syscall.h> diff --git a/nuttx/arch/arm/src/common/up_pthread_start.c b/nuttx/arch/arm/src/common/up_pthread_start.c index 31ccb80c1..59fd7073b 100644 --- a/nuttx/arch/arm/src/common/up_pthread_start.c +++ b/nuttx/arch/arm/src/common/up_pthread_start.c @@ -44,9 +44,8 @@ #include "svcall.h" #include "up_internal.h" -#if ((defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__) || \ - defined(defined(CONFIG_BUILD_KERNEL)) && \ - !defined(CONFIG_DISABLE_PTHREAD) +#if ((defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ + defined(CONFIG_BUILD_KERNEL)) && !defined(CONFIG_DISABLE_PTHREAD) /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/arch/arm/src/common/up_signal_dispatch.c b/nuttx/arch/arm/src/common/up_signal_dispatch.c index 75725237f..f0cf91a49 100644 --- a/nuttx/arch/arm/src/common/up_signal_dispatch.c +++ b/nuttx/arch/arm/src/common/up_signal_dispatch.c @@ -43,9 +43,8 @@ #include "svcall.h" #include "up_internal.h" -#if ((defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__) || \ - defined(defined(CONFIG_BUILD_KERNEL)) && \ - !defined(CONFIG_DISABLE_SIGNALS) +#if ((defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ + defined(CONFIG_BUILD_KERNEL)) && !defined(CONFIG_DISABLE_SIGNALS) /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/arch/arm/src/stm32/stm32_serial.c b/nuttx/arch/arm/src/stm32/stm32_serial.c index 647b66bc9..42973bce1 100644 --- a/nuttx/arch/arm/src/stm32/stm32_serial.c +++ b/nuttx/arch/arm/src/stm32/stm32_serial.c @@ -177,7 +177,7 @@ /* The DMA buffer size when using RX DMA to emulate a FIFO. * * When streaming data, the generic serial layer will be called - * everytime the FIFO receives half this number of bytes. + * every time the FIFO receives half this number of bytes. */ # define RXDMA_BUFFER_SIZE 32 @@ -2426,8 +2426,6 @@ static void up_dma_rxcallback(DMA_HANDLE handle, uint8_t status, void *arg) } #endif -#endif /* HAVE UART */ - /**************************************************************************** * Name: up_pm_notify * @@ -2532,11 +2530,14 @@ static int up_pm_prepare(struct pm_callback_s *cb, enum pm_state_e pmstate) return OK; } #endif +#endif /* USE_SERIALDRIVER */ /**************************************************************************** * Public Functions ****************************************************************************/ +#ifdef USE_SERIALDRIVER + /**************************************************************************** * Name: up_earlyserialinit * @@ -2734,8 +2735,6 @@ void stm32_serial_dma_poll(void) * ****************************************************************************/ -#ifdef USE_SERIALDRIVER - int up_putc(int ch) { #if CONSOLE_UART > 0 diff --git a/nuttx/configs/stm32f4discovery/kernel/up_userspace.c b/nuttx/configs/stm32f4discovery/kernel/up_userspace.c index 047fd7647..19fda356d 100644 --- a/nuttx/configs/stm32f4discovery/kernel/up_userspace.c +++ b/nuttx/configs/stm32f4discovery/kernel/up_userspace.c @@ -41,9 +41,10 @@ #include <stdlib.h> -#include <nuttx/userspace.h> -#include <nuttx/wqueue.h> +#include <nuttx/arch.h> #include <nuttx/mm.h> +#include <nuttx/wqueue.h> +#include <nuttx/userspace.h> #if defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__) @@ -69,7 +70,7 @@ * following way: * * - The linker script defines, for example, the symbol_sdata. - * - The declareion extern uint32_t _sdata; makes C happy. C will believe + * - The declaration extern uint32_t _sdata; makes C happy. C will believe * that the value _sdata is the address of a uint32_t variable _data (it is * not!). * - We can recoved the linker value then by simply taking the address of diff --git a/nuttx/configs/stm32f4discovery/kostest/defconfig b/nuttx/configs/stm32f4discovery/kostest/defconfig index 743585918..59f682fd3 100644 --- a/nuttx/configs/stm32f4discovery/kostest/defconfig +++ b/nuttx/configs/stm32f4discovery/kostest/defconfig @@ -21,11 +21,12 @@ CONFIG_WINDOWS_CYGWIN=y # Build Configuration # # CONFIG_APPS_DIR="../apps" +# CONFIG_BUILD_FLAT is not set +CONFIG_BUILD_PROTECTED=y CONFIG_BUILD_2PASS=y CONFIG_PASS1_TARGET="all" CONFIG_PASS1_BUILDIR="configs/stm32f4discovery/kernel" CONFIG_PASS1_OBJECT="" -CONFIG_BUILD_PROTECTED=y CONFIG_NUTTX_USERSPACE=0x08020000 # @@ -35,6 +36,7 @@ CONFIG_NUTTX_USERSPACE=0x08020000 CONFIG_INTELHEX_BINARY=y # CONFIG_MOTOROLA_SREC is not set CONFIG_RAW_BINARY=y +# CONFIG_UBOOT_UIMAGE is not set # # Customize Header Files @@ -84,6 +86,7 @@ CONFIG_ARCH="arm" # CONFIG_ARCH_CHIP_KINETIS is not set # CONFIG_ARCH_CHIP_KL is not set # CONFIG_ARCH_CHIP_LM is not set +# CONFIG_ARCH_CHIP_TIVA is not set # CONFIG_ARCH_CHIP_LPC17XX is not set # CONFIG_ARCH_CHIP_LPC214X is not set # CONFIG_ARCH_CHIP_LPC2378 is not set @@ -110,8 +113,6 @@ CONFIG_ARCH_HAVE_CMNVECTOR=y # CONFIG_ARMV7M_CMNVECTOR is not set 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 @@ -149,6 +150,7 @@ CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y # CONFIG_ARCH_CHIP_STM32L152V6 is not set # CONFIG_ARCH_CHIP_STM32L152V8 is not set # CONFIG_ARCH_CHIP_STM32L152VB is not set +# CONFIG_ARCH_CHIP_STM32L162ZD is not set # CONFIG_ARCH_CHIP_STM32F100C8 is not set # CONFIG_ARCH_CHIP_STM32F100CB is not set # CONFIG_ARCH_CHIP_STM32F100R8 is not set @@ -161,16 +163,18 @@ CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y # CONFIG_ARCH_CHIP_STM32F100VC is not set # CONFIG_ARCH_CHIP_STM32F100VD is not set # CONFIG_ARCH_CHIP_STM32F100VE is not set -# CONFIG_ARCH_CHIP_STM32F103C4 is not set -# CONFIG_ARCH_CHIP_STM32F103C8 is not set # CONFIG_ARCH_CHIP_STM32F103T8 is not set # CONFIG_ARCH_CHIP_STM32F103TB is not set +# CONFIG_ARCH_CHIP_STM32F103C4 is not set +# CONFIG_ARCH_CHIP_STM32F103C8 is not set # CONFIG_ARCH_CHIP_STM32F103CB is not set # CONFIG_ARCH_CHIP_STM32F103R8 is not set # CONFIG_ARCH_CHIP_STM32F103RB is not set +# CONFIG_ARCH_CHIP_STM32F103RC is not set +# CONFIG_ARCH_CHIP_STM32F103RD is not set +# CONFIG_ARCH_CHIP_STM32F103RE is not set # CONFIG_ARCH_CHIP_STM32F103V8 is not set # CONFIG_ARCH_CHIP_STM32F103VB is not set -# CONFIG_ARCH_CHIP_STM32F103RE is not set # CONFIG_ARCH_CHIP_STM32F103VC is not set # CONFIG_ARCH_CHIP_STM32F103VE is not set # CONFIG_ARCH_CHIP_STM32F103ZE is not set @@ -190,6 +194,7 @@ CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y # CONFIG_ARCH_CHIP_STM32F303RC is not set # CONFIG_ARCH_CHIP_STM32F303VB is not set # CONFIG_ARCH_CHIP_STM32F303VC is not set +# CONFIG_ARCH_CHIP_STM32F401RE is not set # CONFIG_ARCH_CHIP_STM32F405RG is not set # CONFIG_ARCH_CHIP_STM32F405VG is not set # CONFIG_ARCH_CHIP_STM32F405ZG is not set @@ -217,15 +222,50 @@ CONFIG_ARCH_CHIP_STM32F407VG=y # CONFIG_STM32_MEDIUMDENSITY is not set # CONFIG_STM32_LOWDENSITY is not set # CONFIG_STM32_STM32F20XX is not set +# CONFIG_STM32_STM32F207 is not set # CONFIG_STM32_STM32F30XX is not set CONFIG_STM32_STM32F40XX=y +# CONFIG_STM32_STM32F401 is not set +# CONFIG_STM32_STM32F405 is not set +CONFIG_STM32_STM32F407=y +# CONFIG_STM32_STM32F427 is not set +# CONFIG_STM32_STM32F429 is not set # CONFIG_STM32_DFU is not set # # STM32 Peripheral Support # +CONFIG_STM32_HAVE_CCM=y # CONFIG_STM32_HAVE_USBDEV is not set CONFIG_STM32_HAVE_OTGFS=y +CONFIG_STM32_HAVE_FSMC=y +CONFIG_STM32_HAVE_USART3=y +CONFIG_STM32_HAVE_USART4=y +CONFIG_STM32_HAVE_USART5=y +CONFIG_STM32_HAVE_USART6=y +# CONFIG_STM32_HAVE_USART7 is not set +# CONFIG_STM32_HAVE_USART8 is not set +CONFIG_STM32_HAVE_TIM1=y +CONFIG_STM32_HAVE_TIM5=y +CONFIG_STM32_HAVE_TIM6=y +CONFIG_STM32_HAVE_TIM7=y +CONFIG_STM32_HAVE_TIM8=y +CONFIG_STM32_HAVE_TIM9=y +CONFIG_STM32_HAVE_TIM10=y +CONFIG_STM32_HAVE_TIM11=y +CONFIG_STM32_HAVE_TIM12=y +CONFIG_STM32_HAVE_TIM13=y +CONFIG_STM32_HAVE_TIM14=y +# CONFIG_STM32_HAVE_TIM15 is not set +# CONFIG_STM32_HAVE_TIM16 is not set +# CONFIG_STM32_HAVE_TIM17 is not set +CONFIG_STM32_HAVE_ADC2=y +CONFIG_STM32_HAVE_ADC3=y +# CONFIG_STM32_HAVE_ADC4 is not set +CONFIG_STM32_HAVE_CAN1=y +CONFIG_STM32_HAVE_CAN2=y +CONFIG_STM32_HAVE_RNG=y +CONFIG_STM32_HAVE_ETHMAC=y # CONFIG_STM32_ADC1 is not set # CONFIG_STM32_ADC2 is not set # CONFIG_STM32_ADC3 is not set @@ -314,11 +354,17 @@ CONFIG_STM32_USART=y # CONFIG_ARCH_VECNOTIRQ is not set # CONFIG_ARCH_DMA is not set CONFIG_ARCH_HAVE_IRQPRIO=y +# CONFIG_ARCH_L2CACHE is not set +# CONFIG_ARCH_HAVE_COHERENT_DCACHE is not set # CONFIG_CUSTOM_STACK is not set -# CONFIG_ARCH_ADDRENV is not set +# CONFIG_ARCH_HAVE_ADDRENV is not set +# CONFIG_ARCH_NEED_ADDRENV_MAPPING is not set CONFIG_ARCH_HAVE_VFORK=y # CONFIG_ARCH_HAVE_MMU is not set +CONFIG_ARCH_HAVE_MPU=y # CONFIG_ARCH_NAND_HWECC is not set +# CONFIG_ARCH_HAVE_EXTCLK is not set +CONFIG_ARCH_USE_MPU=y # CONFIG_ARCH_IRQPRIO is not set CONFIG_ARCH_STACKDUMP=y # CONFIG_ENDIAN_BIG is not set @@ -381,35 +427,70 @@ CONFIG_ARCH_HAVE_IRQBUTTONS=y # # RTOS Features # -CONFIG_BOARD_INITIALIZE=y +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_POSIX_TIMERS is not set +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set +CONFIG_DISABLE_ENVIRON=y + +# +# Clocks and Timers +# CONFIG_USEC_PER_TICK=10000 # CONFIG_SYSTEM_TIME64 is not set -CONFIG_RR_INTERVAL=200 -# CONFIG_SCHED_CPULOAD is not set -# CONFIG_SCHED_INSTRUMENTATION is not set -CONFIG_TASK_NAME_SIZE=0 -# CONFIG_SCHED_HAVE_PARENT is not set +# CONFIG_CLOCK_MONOTONIC is not set # CONFIG_JULIAN_TIME is not set CONFIG_START_YEAR=2013 CONFIG_START_MONTH=3 CONFIG_START_DAY=22 -CONFIG_DEV_CONSOLE=y +CONFIG_MAX_WDOGPARMS=2 +CONFIG_PREALLOC_WDOGS=8 +CONFIG_WDOG_INTRESERVE=2 +CONFIG_PREALLOC_TIMERS=4 + +# +# Tasks and Scheduling +# +CONFIG_USER_ENTRYPOINT="ostest_main" +CONFIG_RR_INTERVAL=200 +CONFIG_TASK_NAME_SIZE=0 +CONFIG_MAX_TASK_ARGS=4 +CONFIG_MAX_TASKS=16 +# CONFIG_SCHED_HAVE_PARENT is not set +# CONFIG_SCHED_WAITPID is not set + +# +# Pthread Options +# # CONFIG_MUTEX_TYPES is not set -# CONFIG_PRIORITY_INHERITANCE is not set +CONFIG_NPTHREAD_KEYS=4 + +# +# Performance Monitoring +# +# CONFIG_SCHED_CPULOAD is not set +# CONFIG_SCHED_INSTRUMENTATION is not set + +# +# Files and I/O +# +CONFIG_DEV_CONSOLE=y # CONFIG_FDCLONE_DISABLE is not set # CONFIG_FDCLONE_STDIO is not set CONFIG_SDCLONE_DISABLE=y -# CONFIG_SCHED_WAITPID is not set +CONFIG_NFILE_DESCRIPTORS=8 +CONFIG_NFILE_STREAMS=8 +CONFIG_NAME_MAX=32 +# CONFIG_PRIORITY_INHERITANCE is not set + +# +# RTOS hooks +# +CONFIG_BOARD_INITIALIZE=y # CONFIG_SCHED_STARTHOOK is not set # CONFIG_SCHED_ATEXIT is not set # CONFIG_SCHED_ONEXIT is not set -CONFIG_USER_ENTRYPOINT="ostest_main" -CONFIG_DISABLE_OS_API=y -# CONFIG_DISABLE_POSIX_TIMERS is not set -# CONFIG_DISABLE_PTHREAD is not set -# CONFIG_DISABLE_SIGNALS is not set -# CONFIG_DISABLE_MQUEUE is not set -CONFIG_DISABLE_ENVIRON=y # # Signal Numbers @@ -420,19 +501,10 @@ CONFIG_SIG_SIGALARM=3 CONFIG_SIG_SIGCONDTIMEDOUT=16 # -# Sizes of configurable things (0 disables) +# POSIX Message Queue Options # -CONFIG_MAX_TASKS=16 -CONFIG_MAX_TASK_ARGS=4 -CONFIG_NPTHREAD_KEYS=4 -CONFIG_NFILE_DESCRIPTORS=8 -CONFIG_NFILE_STREAMS=8 -CONFIG_NAME_MAX=32 CONFIG_PREALLOC_MQ_MSGS=4 CONFIG_MQ_MAXMSGSIZE=32 -CONFIG_MAX_WDOGPARMS=2 -CONFIG_PREALLOC_WDOGS=4 -CONFIG_PREALLOC_TIMERS=4 # # Stack and heap information @@ -441,10 +513,7 @@ CONFIG_IDLETHREAD_STACKSIZE=1024 CONFIG_USERMAIN_STACKSIZE=2048 CONFIG_PTHREAD_STACK_MIN=256 CONFIG_PTHREAD_STACK_DEFAULT=2048 - -# -# System call configuration -# +CONFIG_LIB_SYSCALL=y CONFIG_SYS_RESERVED=8 CONFIG_SYS_NNEST=2 @@ -455,6 +524,12 @@ CONFIG_DISABLE_POLL=y CONFIG_DEV_NULL=y # CONFIG_DEV_ZERO is not set # CONFIG_LOOP is not set + +# +# Buffering +# +# CONFIG_DRVR_WRITEBUFFER is not set +# CONFIG_DRVR_READAHEAD is not set # CONFIG_RAMDISK is not set # CONFIG_CAN is not set # CONFIG_ARCH_HAVE_PWM_PULSECOUNT is not set @@ -465,6 +540,7 @@ CONFIG_ARCH_HAVE_I2CRESET=y # CONFIG_I2S is not set # CONFIG_RTC is not set # CONFIG_WATCHDOG is not set +# CONFIG_TIMER is not set # CONFIG_ANALOG is not set # CONFIG_AUDIO_DEVICES is not set # CONFIG_VIDEO_DEVICES is not set @@ -545,6 +621,11 @@ CONFIG_USART2_2STOP=0 # CONFIG_NET is not set # +# Crypto API +# +# CONFIG_CRYPTO is not set + +# # File Systems # @@ -591,7 +672,6 @@ CONFIG_MM_REGIONS=2 # CONFIG_BINFMT_DISABLE is not set # CONFIG_NXFLAT is not set # CONFIG_ELF is not set -# CONFIG_BUILTIN is not set # CONFIG_PIC is not set CONFIG_SYMTAB_ORDEREDBYNAME=y @@ -650,6 +730,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # CONFIG_EXAMPLES_BUTTONS is not set # CONFIG_EXAMPLES_CAN is not set # CONFIG_EXAMPLES_CONFIGDATA is not set +# CONFIG_EXAMPLES_CPUHOG is not set # CONFIG_EXAMPLES_DHCPD is not set # CONFIG_EXAMPLES_ELF is not set # CONFIG_EXAMPLES_FTPC is not set @@ -660,7 +741,6 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # CONFIG_EXAMPLES_HIDKBD is not set # CONFIG_EXAMPLES_KEYPADTEST is not set # CONFIG_EXAMPLES_IGMP is not set -# CONFIG_EXAMPLES_LCDRW is not set # CONFIG_EXAMPLES_MM is not set # CONFIG_EXAMPLES_MODBUS is not set # CONFIG_EXAMPLES_MOUNT is not set @@ -681,7 +761,6 @@ CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048 CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 CONFIG_EXAMPLES_OSTEST_RR_RANGE=10000 CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 -# CONFIG_EXAMPLES_PASHELLO is not set # CONFIG_EXAMPLES_PIPE is not set # CONFIG_EXAMPLES_POLL is not set # CONFIG_EXAMPLES_POSIXSPAWN is not set @@ -689,6 +768,8 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 # CONFIG_EXAMPLES_RGMP is not set # CONFIG_EXAMPLES_ROMFS is not set # CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERIALBLASTER is not set +# CONFIG_EXAMPLES_SERIALRX is not set # CONFIG_EXAMPLES_SERLOOP is not set # CONFIG_EXAMPLES_SLCD is not set # CONFIG_EXAMPLES_SMART is not set @@ -756,35 +837,37 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 # # -# USB CDC/ACM Device Commands +# Custom Free Memory Command # +# CONFIG_SYSTEM_FREE is not set # -# USB Composite Device Commands +# EMACS-like Command Line Editor # +# CONFIG_SYSTEM_CLE is not set # -# Custom Free Memory Command +# FLASH Program Installation # -# CONFIG_SYSTEM_FREE is not set +# CONFIG_SYSTEM_INSTALL is not set # -# I2C tool +# FLASH Erase-all Command # # -# INI File Parser +# Intel HEX to binary conversion # -# CONFIG_SYSTEM_INIFILE is not set +# CONFIG_SYSTEM_HEX2BIN is not set # -# FLASH Program Installation +# I2C tool # -# CONFIG_SYSTEM_INSTALL is not set # -# FLASH Erase-all Command +# INI File Parser # +# CONFIG_SYSTEM_INIFILE is not set # # NxPlayer media player library / command Line @@ -802,6 +885,14 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 # CONFIG_SYSTEM_READLINE is not set # +# P-Code Support +# + +# +# PHY Tool +# + +# # Power Off # # CONFIG_SYSTEM_POWEROFF is not set @@ -817,26 +908,30 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 # CONFIG_SYSTEM_SDCARD is not set # +# Sudoku +# +# CONFIG_SYSTEM_SUDOKU is not set + +# # Sysinfo # # CONFIG_SYSTEM_SYSINFO is not set # -# USB Monitor +# VI Work-Alike Editor # +# CONFIG_SYSTEM_VI is not set # -# EMACS-like Command Line Editor +# Stack Monitor # -# CONFIG_SYSTEM_CLE is not set # -# VI Work-Alike Editor +# USB CDC/ACM Device Commands # -# CONFIG_SYSTEM_VI is not set # -# Stack Monitor +# USB Composite Device Commands # # @@ -844,6 +939,10 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 # # +# USB Monitor +# + +# # Zmodem Commands # # CONFIG_SYSTEM_ZMODEM is not set diff --git a/nuttx/include/errno.h b/nuttx/include/errno.h index dc90b4d05..e61a752aa 100644 --- a/nuttx/include/errno.h +++ b/nuttx/include/errno.h @@ -43,8 +43,31 @@ #include <nuttx/compiler.h> /************************************************************************ - * Definitions + * Pre-processor Definitions ************************************************************************/ +/* How can we access the errno variable? */ + +#undef __DIRECT_ERRNO_ACCESS +#if !defined(CONFIG_LIB_SYSCALL) + /* No system calls? Then there can only be direct access */ + +# define __DIRECT_ERRNO_ACCESS 1 + +#elif !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL) + /* Flat build... complete access */ + +# define __DIRECT_ERRNO_ACCESS 1 + +#elif defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__) + /* Kernel portion of protected build. The Kernel has access */ + +# define __DIRECT_ERRNO_ACCESS 1 + +#elif defined(CONFIG_BUILD_KERNEL) + /* Kernel only build. The kernel has access */ + +# define __DIRECT_ERRNO_ACCESS 1 +#endif /* Convenience/compatibility definition. * @@ -52,7 +75,7 @@ * from all code using a simple pointer. */ -#ifndef CONFIG_LIB_SYSCALL +#ifdef __DIRECT_ERRNO_ACCESS # define errno *get_errno_ptr() # define set_errno(e) do { errno = (int)(e); } while (0) @@ -64,16 +87,8 @@ * a little differently. In kernel-mode, the TCB errno value can still be * read and written using a pointer from code executing within the * 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 -#else - -/* But in user-mode, the errno can only be read using the name 'errno'. + * + * But in user-mode, the errno can only be read using the name 'errno'. * The non-standard API set_errno() must explicitly be used from user- * mode code in order to set the errno value. * @@ -84,8 +99,7 @@ # define errno get_errno() -#endif /* __KERNEL__ */ -#endif /* CONFIG_LIB_SYSCALL */ +#endif /* __DIRECT_ERRNO_ACCESS */ /* Definitions of error numbers and the string that would be * returned by strerror(). @@ -365,7 +379,7 @@ extern "C" FAR int *get_errno_ptr(void); -#ifdef CONFIG_LIB_SYSCALL +#ifndef __DIRECT_ERRNO_ACCESS void set_errno(int errcode); int get_errno(void); #endif diff --git a/nuttx/include/nuttx/arch.h b/nuttx/include/nuttx/arch.h index 3070f0291..a9290d8a3 100644 --- a/nuttx/include/nuttx/arch.h +++ b/nuttx/include/nuttx/arch.h @@ -617,8 +617,8 @@ void up_signal_dispatch(_sa_sigaction_t sighand, int signo, * ****************************************************************************/ -#if (defined(CONFIG_BUILD_PROTECTED) && defined(__KERNEL__)) || \ - defined(CONFIG_BUILD_KERNEL) && !defined(CONFIG_DISABLE_SIGNALS) +#if (defined(CONFIG_BUILD_PROTECTED) && !defined(__KERNEL__)) && \ + !defined(CONFIG_DISABLE_SIGNALS) void up_signal_handler(_sa_sigaction_t sighand, int signo, FAR siginfo_t *info, FAR void *ucontext) noreturn_function; diff --git a/nuttx/syscall/syscall_funclookup.c b/nuttx/syscall/syscall_funclookup.c index 6f38634ac..43e411fc3 100644 --- a/nuttx/syscall/syscall_funclookup.c +++ b/nuttx/syscall/syscall_funclookup.c @@ -90,9 +90,24 @@ uint32_t syscall_clock_systimer(void); /**************************************************************************** - * Pre-processor definitions + * Pre-processor Definitions ****************************************************************************/ +/* Errno access is awkward. We need to generate get_errno() and set_errno() + * interfaces to support the system calls, even though we don't use them + * ourself. + * + * The "normal" protoypes for these functions is in errno.h. The following + * must agree exactly. + */ + +#ifdef __DIRECT_ERRNO_ACCESS +# undef set_errno +# undef get_errno +void set_errno(int errcode); +int get_errno(void); +#endif + /**************************************************************************** * Public Data ****************************************************************************/ |