Compare commits

...

6 commits

Author SHA1 Message Date
Xiang Xiao
65dfae5950
Merge 432fa6513d into a2d4d74af7 2025-01-12 16:52:24 +08:00
hujun5
a2d4d74af7 clock_timekeeping: remove enter_critical_section in sched/clock/clock_timekeeping.c
reason:
We would like to replace the critical section with a small lock.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-12 16:51:40 +08:00
wangmingrong1
2149d89336 macro/align: Use ALIGN_UP and ALIGN_DOWN uniformly
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-01-12 16:48:35 +08:00
Yanfeng Liu
71a4e86718 risc-v/Toolchain.defs: guard -r in LDELFFLAGS
This guards use of `-r` in LDELFFLAGS in risc-v common/Toolchain.defs so
that it is only used when BINFMT_ELF_RELOCATABLE is selected.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2025-01-12 16:47:54 +08:00
Xiang Xiao
432fa6513d libc: Add LIBC_ prefix to MEMCPY_VIK and MEMSET_OPTSPEED
align with other option naming convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2025-01-12 16:17:21 +08:00
Xiang Xiao
bfc0391e04 libc: Rename LIBC_STRING_OPTIMIZE to LIBC_NEWLIB_OPTSPEED
and correct the dependence

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2025-01-12 02:15:11 +08:00
66 changed files with 188 additions and 209 deletions

View file

@ -1103,7 +1103,7 @@ static void imx9_lpi2c_setclock(struct imx9_lpi2c_priv_s *priv,
&src_freq);
/* LPI2C output frequency = (Source Clock (Hz)/ 2^prescale) /
* (CLKLO + 1 + CLKHI + 1 + ROUNDDOWN((2 + FILTSCL) / 2^prescale)
* (CLKLO + 1 + CLKHI + 1 + ALIGN_DOWN((2 + FILTSCL)/2^prescale)
*
* Assume CLKLO = 2 * CLKHI, SETHOLD = CLKHI, DATAVD = CLKHI / 2
*/

View file

@ -1161,7 +1161,7 @@ static void imxrt_lpi2c_setclock(struct imxrt_lpi2c_priv_s *priv,
#endif
/* LPI2C output frequency = (Source Clock (Hz)/ 2^prescale) /
* (CLKLO + 1 + CLKHI + 1 + ROUNDDOWN((2 + FILTSCL) / 2^prescale)
* (CLKLO + 1 + CLKHI + 1 + ALIGN_DOWN((2 + FILTSCL)/2^prescale)
*
* Assume CLKLO = 2 * CLKHI, SETHOLD = CLKHI, DATAVD = CLKHI / 2
*/

View file

@ -1010,7 +1010,7 @@ static void s32k1xx_lpi2c_setclock(struct s32k1xx_lpi2c_priv_s *priv,
DEBUGASSERT(src_freq != 0);
/* LPI2C output frequency = (Source Clock (Hz)/ 2^prescale) /
* (CLKLO + 1 + CLKHI + 1 + ROUNDDOWN((2 + FILTSCL) / 2^prescale)
* (CLKLO + 1 + CLKHI + 1 + ALIGN_DOWN((2 + FILTSCL)/2^prescale)
*
* Assume CLKLO = 2 * CLKHI, SETHOLD = CLKHI, DATAVD = CLKHI / 2
*/

View file

@ -990,7 +990,7 @@ static void s32k3xx_lpi2c_setclock(struct s32k3xx_lpi2c_priv_s *priv,
DEBUGASSERT(src_freq != 0);
/* LPI2C output frequency = (Source Clock (Hz)/ 2^prescale) /
* (CLKLO + 1 + CLKHI + 1 + ROUNDDOWN((2 + FILTSCL) / 2^prescale)
* (CLKLO + 1 + CLKHI + 1 + ALIGN_DOWN((2 + FILTSCL)/2^prescale)
*
* Assume CLKLO = 2 * CLKHI, SETHOLD = CLKHI, DATAVD = CLKHI / 2
*/

View file

@ -1122,7 +1122,7 @@ static void imx9_lpi2c_setclock(struct imx9_lpi2c_priv_s *priv,
imx9_get_rootclock(priv->config->clk_root, &src_freq);
/* LPI2C output frequency = (Source Clock (Hz)/ 2^prescale) /
* (CLKLO + 1 + CLKHI + 1 + ROUNDDOWN((2 + FILTSCL) / 2^prescale)
* (CLKLO + 1 + CLKHI + 1 + ALIGN_DOWN((2 + FILTSCL)/2^prescale)
*
* Assume CLKLO = 2 * CLKHI, SETHOLD = CLKHI, DATAVD = CLKHI / 2
*/

View file

@ -433,7 +433,12 @@ LDMODULEFLAGS = -r -T $(call CONVERT_PATH,$(TOPDIR)/libs/libc/modlib/gnu-elf.ld)
CELFFLAGS = $(CFLAGS) -fvisibility=hidden
CXXELFFLAGS = $(CXXFLAGS) -fvisibility=hidden
LDELFFLAGS = -r -e main
LDELFFLAGS = -e main
ifeq ($(CONFIG_BINFMT_ELF_RELOCATABLE),y)
LDELFFLAGS += -r
endif
ifeq ($(CONFIG_ARCH_RV32),y)
LDELFFLAGS += --oformat elf32-littleriscv
else

View file

@ -31,18 +31,13 @@
#include <errno.h>
#include <nuttx/kmalloc.h>
#include <nuttx/nuttx.h>
#include <nuttx/binfmt/binfmt.h>
#include "binfmt.h"
#if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL) && !defined(CONFIG_BINFMT_DISABLE)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define ROUNDUP(x, y) (((x) + (y) - 1) / (y) * (y))
/****************************************************************************
* Public Functions
****************************************************************************/
@ -98,8 +93,8 @@ int binfmt_copyactions(FAR const posix_spawn_file_actions_t **copy,
case SPAWN_FILE_ACTION_OPEN:
open = (FAR struct spawn_open_file_action_s *)entry;
size += ROUNDUP(SIZEOF_OPEN_FILE_ACTION_S(strlen(open->path)),
sizeof(FAR void *));
size += ALIGN_UP(SIZEOF_OPEN_FILE_ACTION_S(strlen(open->path)),
sizeof(FAR void *));
break;
default:
@ -155,8 +150,8 @@ int binfmt_copyactions(FAR const posix_spawn_file_actions_t **copy,
strcpy(open->path, tmp->path);
buffer = (FAR char *)buffer +
ROUNDUP(SIZEOF_OPEN_FILE_ACTION_S(strlen(tmp->path)),
sizeof(FAR void *));
ALIGN_UP(SIZEOF_OPEN_FILE_ACTION_S(strlen(tmp->path)),
sizeof(FAR void *));
break;
default:

View file

@ -66,9 +66,6 @@ CONFIG_IOB_NBUFFERS=128
CONFIG_IOB_THROTTLE=24
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_MEMCPY_VIK=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_MTD_BYTE_WRITE=y
CONFIG_MTD_PARTITION=y

View file

@ -68,9 +68,6 @@ CONFIG_IOB_NBUFFERS=128
CONFIG_IOB_THROTTLE=24
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_MEMCPY_VIK=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_MTD_BYTE_WRITE=y
CONFIG_MTD_PARTITION=y

View file

@ -66,9 +66,6 @@ CONFIG_IOB_NBUFFERS=128
CONFIG_IOB_THROTTLE=24
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_MEMCPY_VIK=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_MTD_BYTE_WRITE=y
CONFIG_MTD_PARTITION=y

View file

@ -80,9 +80,6 @@ CONFIG_LCD_ILI9340=y
CONFIG_LCD_ILI9340_IFACE0=y
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_MEMCPY_VIK=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_IOB=y
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_MTD_BYTE_WRITE=y

View file

@ -83,9 +83,6 @@ CONFIG_LCD_ILI9340=y
CONFIG_LCD_ILI9340_IFACE0=y
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_MEMCPY_VIK=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_IOB=y
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_MTD_BYTE_WRITE=y

View file

@ -64,8 +64,8 @@ CONFIG_LCD=y
CONFIG_LCD_ST7565=y
CONFIG_LIBC_KBDCODEC=y
CONFIG_LIBC_MAX_EXITFUNS=32
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBM=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_MTD=y
CONFIG_NAME_MAX=255

View file

@ -67,9 +67,9 @@ CONFIG_LCD=y
CONFIG_LCD_ST7565=y
CONFIG_LIBC_KBDCODEC=y
CONFIG_LIBC_MAX_EXITFUNS=32
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBM=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_MTD=y
CONFIG_NAME_MAX=255

View file

@ -35,8 +35,8 @@ CONFIG_LC823450_UART0=y
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_KBDCODEC=y
CONFIG_LIBC_MAX_EXITFUNS=32
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBM=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_NAME_MAX=255
CONFIG_NETUTILS_CODECS=y
CONFIG_PATH_INITIAL="/mnt/romfs"

View file

@ -34,8 +34,8 @@ CONFIG_LC823450_SDIF_SDC=y
CONFIG_LC823450_UART0=y
CONFIG_LC823450_UART1=y
CONFIG_LIBC_MAX_EXITFUNS=32
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBM=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MTD=y
CONFIG_NAME_MAX=255
CONFIG_NETUTILS_CODECS=y

View file

@ -47,8 +47,8 @@ CONFIG_LCD=y
CONFIG_LCD_ST7565=y
CONFIG_LIBC_KBDCODEC=y
CONFIG_LIBC_MAX_EXITFUNS=32
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBM=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_NAME_MAX=255
CONFIG_NETUTILS_CODECS=y

View file

@ -77,8 +77,8 @@ CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_KBDCODEC=y
CONFIG_LIBC_MAX_EXITFUNS=32
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBM=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_MTD=y
CONFIG_NAME_MAX=255

View file

@ -52,8 +52,8 @@ CONFIG_LCD=y
CONFIG_LCD_ST7565=y
CONFIG_LIBC_KBDCODEC=y
CONFIG_LIBC_MAX_EXITFUNS=32
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBM=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_NAME_MAX=255
CONFIG_NETUTILS_CODECS=y

View file

@ -34,8 +34,8 @@ CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_KBDCODEC=y
CONFIG_LIBC_MAX_EXITFUNS=32
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBM=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_NAME_MAX=255
CONFIG_NETUTILS_CODECS=y
CONFIG_PATH_INITIAL="/mnt/romfs"

View file

@ -75,7 +75,6 @@ CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_KBDCODEC=y
CONFIG_LIBC_MAX_EXITFUNS=32
CONFIG_LIBM=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_MTD=y
CONFIG_NAME_MAX=255

View file

@ -59,8 +59,8 @@ CONFIG_LCD=y
CONFIG_LCD_ST7565=y
CONFIG_LIBC_KBDCODEC=y
CONFIG_LIBC_MAX_EXITFUNS=32
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBM=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MODLIB_BUFFERSIZE=512
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_MTD=y

View file

@ -70,11 +70,11 @@ CONFIG_IOB_NCHAINS=32
CONFIG_IOB_THROTTLE=10
CONFIG_LIBC_LOCALTIME=y
CONFIG_LIBC_MAX_EXITFUNS=1
CONFIG_LIBC_MEMCPY_VIK=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_LIBM=y
CONFIG_MEMCPY_VIK=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_REGIONS=2
CONFIG_MQ_MAXMSGSIZE=224
CONFIG_MTD=y

View file

@ -71,10 +71,10 @@ CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_PGALLOC=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y

View file

@ -57,10 +57,10 @@ CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_PGALLOC=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y

View file

@ -58,10 +58,10 @@ CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_PGALLOC=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y

View file

@ -61,10 +61,10 @@ CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_PGALLOC=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y

View file

@ -61,10 +61,10 @@ CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_PGALLOC=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y

View file

@ -58,11 +58,11 @@ CONFIG_INIT_MOUNT_TARGET="/system/bin"
CONFIG_INIT_STACKSIZE=3072
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_LIBM=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_PGALLOC=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y

View file

@ -65,11 +65,11 @@ CONFIG_K230_RPTUN_MASTER=y
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_HOSTNAME="master"
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_LIBM=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_PGALLOC=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y

View file

@ -59,11 +59,11 @@ CONFIG_INIT_MOUNT_TARGET="/system/bin"
CONFIG_INIT_STACKSIZE=3072
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_LIBM=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_PGALLOC=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y

View file

@ -53,11 +53,11 @@ CONFIG_INIT_STACKSIZE=3072
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_HOSTNAME="remote"
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_LIBM=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_PGALLOC=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y

View file

@ -35,10 +35,10 @@ CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MMCSD=y
CONFIG_MMCSD_SDIO=y
CONFIG_MPFS_COREPWM0=y

View file

@ -63,11 +63,11 @@ CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_HOSTNAME="icicle"
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_MAX_EXITFUNS=16
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_LIBM=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_KMAP=y
CONFIG_MM_PGALLOC=y
CONFIG_MM_SHM=y

View file

@ -36,10 +36,10 @@ CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_HOSTNAME="icicle"
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MPFS_ENABLE_DPFPU=y
CONFIG_MPFS_ETHMAC_1=y
CONFIG_MPFS_PHYADDR=9

View file

@ -32,10 +32,10 @@ CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_HOSTNAME="icicle"
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MPFS_ENABLE_DPFPU=y
CONFIG_MPFS_UART1=y
CONFIG_NSH_ARCHINIT=y

View file

@ -35,8 +35,6 @@ CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_HOSTNAME="icicle"
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MMCSD=y
CONFIG_MMCSD_SDIO=y
CONFIG_MPFS_BOOTLOADER=y

View file

@ -36,10 +36,10 @@ CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_HOSTNAME="icicle"
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MPFS_ENABLE_DPFPU=y
CONFIG_MPFS_UART1=y
CONFIG_NSH_ARCHINIT=y

View file

@ -41,10 +41,10 @@ CONFIG_INTELHEX_BINARY=y
CONFIG_IOB_NBUFFERS=24
CONFIG_IOB_NCHAINS=24
CONFIG_LIBC_HOSTNAME="icicle"
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_IOB=y
CONFIG_MPFS_IHC_CLIENT=y
CONFIG_MPFS_IHC_LINUX_ON_HART4=0

View file

@ -41,10 +41,10 @@ CONFIG_INTELHEX_BINARY=y
CONFIG_IOB_NBUFFERS=24
CONFIG_IOB_NCHAINS=24
CONFIG_LIBC_HOSTNAME="icicle"
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_IOB=y
CONFIG_MPFS_IHC_CLIENT=y
CONFIG_MPFS_IHC_LINUX_ON_HART3=0

View file

@ -39,8 +39,6 @@ CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_HOSTNAME="icicle"
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MMCSD=y
CONFIG_MMCSD_SDIO=y
CONFIG_MPFS_BOOTLOADER=y

View file

@ -52,10 +52,10 @@ CONFIG_INTELHEX_BINARY=y
CONFIG_IOB_NBUFFERS=24
CONFIG_IOB_NCHAINS=24
CONFIG_LIBC_HOSTNAME="icicle"
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MMCSD=y
CONFIG_MMCSD_SDIO=y
CONFIG_MM_IOB=y

View file

@ -31,10 +31,10 @@ CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_HOSTNAME="icicle"
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MPFS_ENABLE_DPFPU=y
CONFIG_MPFS_UART1=y
CONFIG_NSH_ARCHINIT=y

View file

@ -75,11 +75,11 @@ CONFIG_INIT_MOUNT_TARGET="/system"
CONFIG_INIT_STACKSIZE=3072
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_LIBM=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_PGALLOC=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y

View file

@ -79,11 +79,11 @@ CONFIG_IOB_BUFSIZE=1534
CONFIG_IOB_THROTTLE=2
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_LIBM=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_PGALLOC=y
CONFIG_NET=y
CONFIG_NETDB_DNSCLIENT=y

View file

@ -80,13 +80,13 @@ CONFIG_IOB_NBUFFERS=64
CONFIG_IOB_THROTTLE=8
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_MEMCPY_64BIT=y
CONFIG_LIBC_MEMCPY_VIK=y
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_LIBM=y
CONFIG_MEMCPY_64BIT=y
CONFIG_MEMCPY_VIK=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_PGALLOC=y
CONFIG_NET=y
CONFIG_NETDB_DNSCLIENT=y

View file

@ -64,11 +64,11 @@ CONFIG_INIT_MOUNT_TARGET="/system"
CONFIG_INIT_STACKSIZE=3072
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_LIBM=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_PGALLOC=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y

View file

@ -64,11 +64,11 @@ CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_LIBM=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_PGALLOC=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y

View file

@ -59,11 +59,11 @@ CONFIG_IOB_NBUFFERS=64
CONFIG_IOB_THROTTLE=8
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_MEMCPY_VIK=y
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MEMCPY_VIK=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_NET=y
CONFIG_NETDB_DNSCLIENT=y
CONFIG_NETDB_DNSCLIENT_ENTRIES=4

View file

@ -59,11 +59,11 @@ CONFIG_IOB_NBUFFERS=64
CONFIG_IOB_THROTTLE=8
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_MEMCPY_VIK=y
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MEMCPY_VIK=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_NET=y
CONFIG_NETDB_DNSCLIENT=y
CONFIG_NETDB_DNSCLIENT_ENTRIES=4

View file

@ -61,10 +61,10 @@ CONFIG_INIT_STACKSIZE=3072
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBC_PERROR_STDOUT=y
CONFIG_LIBC_STRERROR=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MM_PGALLOC=y
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK=6
CONFIG_NSH_ARCHINIT=y

View file

@ -36,7 +36,7 @@ CONFIG_INIT_MOUNT_TARGET="/system"
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_MAX_EXITFUNS=1
CONFIG_MEMSET_OPTSPEED=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILE_APPS=y

View file

@ -49,9 +49,9 @@ CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=8192
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBM=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MODLIB_ALIGN_LOG2=3
CONFIG_MODLIB_BUFFERSIZE=64
CONFIG_NSH_ARCHINIT=y

View file

@ -39,9 +39,9 @@ CONFIG_IDLETHREAD_STACKSIZE=4096
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=16384
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBM=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MODLIB_ALIGN_LOG2=3
CONFIG_MODLIB_BUFFERSIZE=64
CONFIG_NSH_ARCHINIT=y

View file

@ -40,9 +40,9 @@ CONFIG_IDLETHREAD_STACKSIZE=4096
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INIT_STACKSIZE=16384
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_MEMSET_64BIT=y
CONFIG_LIBC_MEMSET_OPTSPEED=y
CONFIG_LIBM=y
CONFIG_MEMSET_64BIT=y
CONFIG_MEMSET_OPTSPEED=y
CONFIG_MODLIB_ALIGN_LOG2=3
CONFIG_MODLIB_BUFFERSIZE=64
CONFIG_NSH_ARCHINIT=y

View file

@ -35,6 +35,7 @@
#include <nuttx/init.h>
#include <nuttx/kmalloc.h>
#include <nuttx/fs/fs.h>
#include <nuttx/nuttx.h>
#include <nuttx/spinlock.h>
/****************************************************************************
@ -112,11 +113,6 @@
#define MAXARCS (1 << 20)
/* General rounding functions. */
#define ROUNDDOWN(x, y) (((x) / (y)) * (y))
#define ROUNDUP(x, y) ((((x) + (y) - 1) / (y)) * (y))
/* See profil(2) where this is described (incorrectly) */
#define SCALE_1_TO_1 0x10000
@ -288,13 +284,13 @@ void moncontrol(int mode)
if (mode)
{
uintptr_t lowpc = ROUNDDOWN((uintptr_t)&_stext,
uintptr_t lowpc = ALIGN_DOWN((uintptr_t)&_stext,
HISTFRACTION * sizeof(HISTCOUNTER));
uintptr_t highpc = ROUNDUP((uintptr_t)&_etext,
HISTFRACTION * sizeof(HISTCOUNTER));
uintptr_t highpc = ALIGN_UP((uintptr_t)&_etext,
HISTFRACTION * sizeof(HISTCOUNTER));
size_t textsize = highpc - lowpc;
size_t kcountsize = ROUNDUP(textsize / HISTFRACTION,
sizeof(*p->kcount));
size_t kcountsize = ALIGN_UP(textsize / HISTFRACTION,
sizeof(*p->kcount));
int scale = kcountsize >= textsize ? SCALE_1_TO_1 :
(float)kcountsize / textsize * SCALE_1_TO_1;
FAR unsigned short *kcount = kmm_zalloc(kcountsize);
@ -370,10 +366,10 @@ void monstartup(unsigned long lowpc, unsigned long highpc)
* so the rest of the scaling (here and in gprof) stays in ints.
*/
lowpc = ROUNDDOWN(lowpc, HISTFRACTION * sizeof(HISTCOUNTER));
highpc = ROUNDUP(highpc, HISTFRACTION * sizeof(HISTCOUNTER));
lowpc = ALIGN_DOWN(lowpc, HISTFRACTION * sizeof(HISTCOUNTER));
highpc = ALIGN_UP(highpc, HISTFRACTION * sizeof(HISTCOUNTER));
textsize = highpc - lowpc;
fromssize = ROUNDUP(textsize / HASHFRACTION, sizeof(*p->froms));
fromssize = ALIGN_UP(textsize / HASHFRACTION, sizeof(*p->froms));
tolimit = textsize * ARCDENSITY / 100;
if (tolimit < MINARCS)

View file

@ -64,9 +64,9 @@ set(SRCS
lib_strlcpy.c
lib_strnlen.c)
if(CONFIG_MEMCPY_VIK)
if(CONFIG_LIBC_MEMCPY_VIK)
list(APPEND SRCS lib_vikmemcpy.c)
elseif(CONFIG_LIBC_STRING_OPTIMIZE)
elseif(CONFIG_LIBC_NEWLIB_OPTSPEED)
list(APPEND SRCS lib_bsdmemcpy.c)
else()
list(APPEND SRCS lib_memcpy.c)
@ -76,7 +76,7 @@ if(CONFIG_LIBC_LOCALE)
list(APPEND SRCS lib_strcoll.c lib_strxfrm.c)
endif()
if(CONFIG_LIBC_STRING_OPTIMIZE)
if(CONFIG_LIBC_NEWLIB_OPTSPEED)
list(
APPEND
SRCS

View file

@ -36,13 +36,6 @@ config LIBC_STRERROR_ERRNUM
for unknown errors like "Unknown error 101". Default enabled when
LIBC_STRERROR is not selected.
config LIBC_STRING_OPTIMIZE
bool "optimized string function"
depends on ALLOW_BSD_COMPONENTS
default y
---help---
Use optimized string function implementation based on newlib.
config LIBC_PERROR_STDOUT
bool "perror() to stdout"
default n
@ -55,51 +48,58 @@ endmenu # errno Decode Support
menu "memcpy/memset Options"
config MEMCPY_VIK
config LIBC_NEWLIB_OPTSPEED
bool "newlib optimized function"
depends on ALLOW_BSD_COMPONENTS
default !DEFAULT_SMALL
---help---
Use optimized string function implementation based on newlib.
config LIBC_MEMCPY_VIK
bool "Vik memcpy()"
default n
depends on !LIBC_ARCH_MEMCPY
depends on !LIBC_NEWLIB_OPTSPEED && !LIBC_ARCH_MEMCPY
---help---
Select this option to use the optimized memcpy() function by Daniel Vik.
Select this option for improved performance at the expense of increased
size. See licensing information in the top-level LICENSE file.
if MEMCPY_VIK
if LIBC_MEMCPY_VIK
config MEMCPY_PRE_INC_PTRS
config LIBC_MEMCPY_PRE_INC_PTRS
bool "Pre-increment pointers"
default n
---help---
Use pre-increment of pointers. Default is post increment of pointers.
config MEMCPY_INDEXED_COPY
config LIBC_MEMCPY_INDEXED_COPY
bool "Array indexing"
default y
---help---
Copying data using array indexing. Using this option, disables the
MEMCPY_PRE_INC_PTRS option.
LIBC_MEMCPY_PRE_INC_PTRS option.
config MEMCPY_64BIT
config LIBC_MEMCPY_64BIT
bool "64-bit memcpy()"
default n
---help---
Compiles memcpy() for architectures that support 64-bit operations
efficiently.
endif # MEMCPY_VIK
endif # LIBC_MEMCPY_VIK
config MEMSET_OPTSPEED
config LIBC_MEMSET_OPTSPEED
bool "Optimize memset() for speed"
default n
depends on !LIBC_ARCH_MEMSET
depends on !LIBC_NEWLIB_OPTSPEED && !LIBC_ARCH_MEMSET
---help---
Select this option to use a version of memcpy() optimized for speed.
Default: memcpy() is optimized for size.
config MEMSET_64BIT
config LIBC_MEMSET_64BIT
bool "64-bit memset()"
default n
depends on MEMSET_OPTSPEED
depends on LIBC_MEMSET_OPTSPEED
---help---
Compiles memset() for architectures that support 64-bit operations
efficiently.

View file

@ -38,9 +38,9 @@ CSRCS += lib_memmove.c lib_memset.c
CSRCS += lib_strlcat.c
CSRCS += lib_strlcpy.c lib_strnlen.c
ifeq ($(CONFIG_MEMCPY_VIK),y)
ifeq ($(CONFIG_LIBC_MEMCPY_VIK),y)
CSRCS += lib_vikmemcpy.c
else ifeq ($(CONFIG_LIBC_STRING_OPTIMIZE),y)
else ifeq ($(CONFIG_LIBC_NEWLIB_OPTSPEED),y)
CSRCS += lib_bsdmemcpy.c
else
CSRCS += lib_memcpy.c
@ -50,7 +50,7 @@ ifeq ($(CONFIG_LIBC_LOCALE),y)
CSRCS += lib_strcoll.c lib_strxfrm.c
endif
ifeq ($(CONFIG_LIBC_STRING_OPTIMIZE),y)
ifeq ($(CONFIG_LIBC_NEWLIB_OPTSPEED),y)
CSRCS += lib_bsdmemccpy.c lib_bsdmemcmp.c lib_bsdmemrchr.c lib_bsdstpncpy.c
CSRCS += lib_bsdstrchr.c lib_bsdstrcmp.c lib_bsdstrlen.c lib_bsdstrncpy.c
CSRCS += lib_bsdmemchr.c lib_bsdstpcpy.c lib_bsdstrcat.c lib_bsdstrchrnul.c

View file

@ -38,12 +38,12 @@
* Pre-processor Definitions
****************************************************************************/
/* Can't support CONFIG_MEMSET_64BIT if the platform does not have 64-bit
* integer types.
/* Can't support CONFIG_LIBC_MEMSET_64BIT if the platform does not
* have 64-bit integer types.
*/
#ifndef CONFIG_HAVE_LONG_LONG
# undef CONFIG_MEMSET_64BIT
# undef CONFIG_LIBC_MEMSET_64BIT
#endif
/****************************************************************************
@ -55,7 +55,7 @@
no_builtin("memset")
FAR void *memset(FAR void *s, int c, size_t n)
{
#ifdef CONFIG_MEMSET_OPTSPEED
#ifdef CONFIG_LIBC_MEMSET_OPTSPEED
/* This version is optimized for speed (you could do better
* still by exploiting processor caching or memory burst
* knowledge.)
@ -64,7 +64,7 @@ FAR void *memset(FAR void *s, int c, size_t n)
uintptr_t addr = (uintptr_t)s;
uint16_t val16 = ((uint16_t)c << 8) | (uint16_t)c;
uint32_t val32 = ((uint32_t)val16 << 16) | (uint32_t)val16;
#ifdef CONFIG_MEMSET_64BIT
#ifdef CONFIG_LIBC_MEMSET_64BIT
uint64_t val64 = ((uint64_t)val32 << 32) | (uint64_t)val32;
#endif
@ -96,7 +96,7 @@ FAR void *memset(FAR void *s, int c, size_t n)
n -= 2;
}
#ifndef CONFIG_MEMSET_64BIT
#ifndef CONFIG_LIBC_MEMSET_64BIT
/* Loop while there are at least 16-bytes left to be written */
while (n >= 16)
@ -161,7 +161,7 @@ FAR void *memset(FAR void *s, int c, size_t n)
#endif
}
#ifdef CONFIG_MEMSET_64BIT
#ifdef CONFIG_LIBC_MEMSET_64BIT
/* We may get here with n in the range 0..7. If n >= 4, then we should
* have 64-bit alignment.
*/

View file

@ -45,25 +45,25 @@
* Pre-processor Definitions
****************************************************************************/
/* Can't support CONFIG_MEMCPY_64BIT if the platform does not have 64-bit
* integer types.
/* Can't support CONFIG_LIBC_MEMCPY_64BIT if the platform does not have
* 64-bit integer types.
*/
#ifndef CONFIG_HAVE_LONG_LONG
# undef CONFIG_MEMCPY_64BIT
# undef CONFIG_LIBC_MEMCPY_64BIT
#endif
/* Remove definitions when CONFIG_MEMCPY_INDEXED_COPY is defined */
/* Remove definitions when CONFIG_LIBC_MEMCPY_INDEXED_COPY is defined */
#if defined (CONFIG_MEMCPY_INDEXED_COPY)
# if defined (CONFIG_MEMCPY_PRE_INC_PTRS)
# undef CONFIG_MEMCPY_PRE_INC_PTRS
# endif /* CONFIG_MEMCPY_PRE_INC_PTRS */
#endif /* CONFIG_MEMCPY_INDEXED_COPY */
#ifdef CONFIG_LIBC_MEMCPY_INDEXED_COPY
# ifdef CONFIG_LIBC_MEMCPY_PRE_INC_PTRS
# undef CONFIG_LIBC_MEMCPY_PRE_INC_PTRS
# endif /* CONFIG_LIBC_MEMCPY_PRE_INC_PTRS */
#endif /* CONFIG_LIBC_MEMCPY_INDEXED_COPY */
/* Definitions for pre and post increment of pointers */
#if defined (CONFIG_MEMCPY_PRE_INC_PTRS)
#ifdef CONFIG_LIBC_MEMCPY_PRE_INC_PTRS
# define START_VAL(x) (x)--
# define INC_VAL(x) *++(x)
@ -72,7 +72,7 @@
# define PRE_LOOP_ADJUST - (TYPE_WIDTH - 1)
# define PRE_SWITCH_ADJUST + 1
#else /* CONFIG_MEMCPY_PRE_INC_PTRS */
#else /* CONFIG_LIBC_MEMCPY_PRE_INC_PTRS */
# define START_VAL(x)
# define INC_VAL(x) *(x)++
@ -81,7 +81,7 @@
# define PRE_LOOP_ADJUST
# define PRE_SWITCH_ADJUST
#endif /* CONFIG_MEMCPY_PRE_INC_PTRS */
#endif /* CONFIG_LIBC_MEMCPY_PRE_INC_PTRS */
/* Definitions for endian-ness */
@ -139,21 +139,21 @@
* configuration.
****************************************************************************/
#if defined (CONFIG_MEMCPY_INDEXED_COPY)
#ifdef CONFIG_LIBC_MEMCPY_INDEXED_COPY
# define CP(idx) CP_INDEX(idx)
# define CP_SH(idx, shl, shr) CP_INDEX_SH(idx, shl, shr)
# define INC_INDEX(p, o) ((p) += (o))
#else /* CONFIG_MEMCPY_INDEXED_COPY */
#else /* CONFIG_LIBC_MEMCPY_INDEXED_COPY */
# define CP(idx) CP_INCR()
# define CP_SH(idx, shl, shr) CP_INCR_SH(shl, shr)
# define INC_INDEX(p, o)
#endif /* CONFIG_MEMCPY_INDEXED_COPY */
#endif /* CONFIG_LIBC_MEMCPY_INDEXED_COPY */
#define COPY_REMAINING(count) \
{ \
@ -256,7 +256,7 @@
* Type Definitions
****************************************************************************/
#ifdef CONFIG_MEMCPY_64BIT
#ifdef CONFIG_LIBC_MEMCPY_64BIT
typedef uint64_t uintn;
# define TYPE_WIDTH 8L
#else

View file

@ -41,8 +41,6 @@
* Pre-processor Definitions
****************************************************************************/
#define ROUNDUP(x, y) (((x) + (y) - 1) / (y) * (y))
#if defined(CONFIG_DEBUG_FEATURES) && defined(CONFIG_IOB_DEBUG)
# define ioberr _err
# define iobwarn _warn

View file

@ -35,6 +35,7 @@
#ifdef CONFIG_IOB_ALLOC
# include <nuttx/kmalloc.h>
#endif
#include <nuttx/nuttx.h>
#include <nuttx/mm/iob.h>
#include "iob.h"
@ -333,7 +334,7 @@ FAR struct iob_s *iob_alloc_dynamic(uint16_t size)
FAR struct iob_s *iob;
size_t alignsize;
alignsize = ROUNDUP(sizeof(struct iob_s), CONFIG_IOB_ALIGNMENT) + size;
alignsize = ALIGN_UP(sizeof(struct iob_s), CONFIG_IOB_ALIGNMENT) + size;
iob = kmm_memalign(CONFIG_IOB_ALIGNMENT, alignsize);
if (iob)
@ -344,8 +345,8 @@ FAR struct iob_s *iob_alloc_dynamic(uint16_t size)
iob->io_bufsize = size; /* Total length of the iob buffer */
iob->io_pktlen = 0; /* Total length of the packet */
iob->io_free = iob_free_dynamic; /* Customer free callback */
iob->io_data = (FAR uint8_t *)ROUNDUP((uintptr_t)(iob + 1),
CONFIG_IOB_ALIGNMENT);
iob->io_data = (FAR uint8_t *)ALIGN_UP((uintptr_t)(iob + 1),
CONFIG_IOB_ALIGNMENT);
}
return iob;

View file

@ -28,6 +28,7 @@
#include <stdbool.h>
#include <nuttx/nuttx.h>
#include <nuttx/mm/iob.h>
#include "iob.h"
@ -39,10 +40,10 @@
/* Fix the I/O Buffer size with specified alignment size */
#ifdef CONFIG_IOB_ALLOC
# define IOB_ALIGN_SIZE ROUNDUP(sizeof(struct iob_s) + CONFIG_IOB_BUFSIZE, \
CONFIG_IOB_ALIGNMENT)
# define IOB_ALIGN_SIZE ALIGN_UP(sizeof(struct iob_s) + CONFIG_IOB_BUFSIZE, \
CONFIG_IOB_ALIGNMENT)
#else
# define IOB_ALIGN_SIZE ROUNDUP(sizeof(struct iob_s), CONFIG_IOB_ALIGNMENT)
# define IOB_ALIGN_SIZE ALIGN_UP(sizeof(struct iob_s), CONFIG_IOB_ALIGNMENT)
#endif
#define IOB_BUFFER_SIZE (IOB_ALIGN_SIZE * CONFIG_IOB_NBUFFERS + \
@ -137,8 +138,8 @@ void iob_initialize(void)
* aligned to the CONFIG_IOB_ALIGNMENT memory boundary
*/
buf = ROUNDUP((uintptr_t)g_iob_buffer + offsetof(struct iob_s, io_data),
CONFIG_IOB_ALIGNMENT) - offsetof(struct iob_s, io_data);
buf = ALIGN_UP((uintptr_t)g_iob_buffer + offsetof(struct iob_s, io_data),
CONFIG_IOB_ALIGNMENT) - offsetof(struct iob_s, io_data);
/* Get I/O buffer instance from the start address and add each I/O buffer
* to the free list

View file

@ -53,6 +53,7 @@ static struct timespec g_clock_wall_time;
static uint64_t g_clock_last_counter;
static uint64_t g_clock_mask;
static long g_clock_adjust;
static spinlock_t g_clock_lock = SP_UNLOCKED;
/****************************************************************************
* Private Functions
@ -72,7 +73,7 @@ static int clock_get_current_time(FAR struct timespec *ts,
time_t sec;
int ret;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_clock_lock);
ret = up_timer_gettick(&counter);
if (ret < 0)
@ -96,7 +97,7 @@ static int clock_get_current_time(FAR struct timespec *ts,
ts->tv_sec = base->tv_sec + sec;
errout_in_critical_section:
leave_critical_section(flags);
spin_unlock_irqrestore(&g_clock_lock, flags);
return ret;
}
@ -123,7 +124,7 @@ int clock_timekeeping_set_wall_time(FAR const struct timespec *ts)
uint64_t counter;
int ret;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_clock_lock);
ret = up_timer_gettick(&counter);
if (ret < 0)
@ -137,7 +138,7 @@ int clock_timekeeping_set_wall_time(FAR const struct timespec *ts)
g_clock_last_counter = counter;
errout_in_critical_section:
leave_critical_section(flags);
spin_unlock_irqrestore(&g_clock_lock, flags);
return ret;
}
@ -188,7 +189,7 @@ int adjtime(FAR const struct timeval *delta, FAR struct timeval *olddelta)
return -1;
}
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_clock_lock);
adjust_usec = delta->tv_sec * USEC_PER_SEC + delta->tv_usec;
@ -199,7 +200,7 @@ int adjtime(FAR const struct timeval *delta, FAR struct timeval *olddelta)
g_clock_adjust = adjust_usec;
leave_critical_section(flags);
spin_unlock_irqrestore(&g_clock_lock, flags);
return OK;
}
@ -217,7 +218,7 @@ void clock_update_wall_time(void)
time_t sec;
int ret;
flags = enter_critical_section();
flags = spin_lock_irqsave(&g_clock_lock);
ret = up_timer_gettick(&counter);
if (ret < 0)
@ -271,7 +272,7 @@ void clock_update_wall_time(void)
g_clock_last_counter = counter;
errout_in_critical_section:
leave_critical_section(flags);
spin_unlock_irqrestore(&g_clock_lock, flags);
}
/****************************************************************************
@ -280,6 +281,9 @@ errout_in_critical_section:
void clock_inittimekeeping(FAR const struct timespec *tp)
{
irqstate_t flags;
flags = spin_lock_irqsave(&g_clock_lock);
up_timer_getmask(&g_clock_mask);
if (tp)
@ -292,6 +296,7 @@ void clock_inittimekeeping(FAR const struct timespec *tp)
}
up_timer_gettick(&g_clock_last_counter);
spin_unlock_irqrestore(&g_clock_lock, flags);
}
#endif /* CONFIG_CLOCK_TIMEKEEPING */

View file

@ -32,6 +32,7 @@
#include <nuttx/coredump.h>
#include <nuttx/elf.h>
#include <nuttx/nuttx.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
@ -54,9 +55,6 @@
#define PROGRAM_ALIGNMENT 64
#define ROUNDUP(x, y) ((x + (y - 1)) / (y)) * (y)
#define ROUNDDOWN(x ,y) (((x) / (y)) * (y))
/****************************************************************************
* Private Types
****************************************************************************/
@ -166,8 +164,8 @@ static int elf_emit(FAR struct elf_dumpinfo_s *cinfo,
static int elf_emit_align(FAR struct elf_dumpinfo_s *cinfo)
{
off_t align = ROUNDUP(cinfo->stream->nput,
ELF_PAGESIZE) - cinfo->stream->nput;
off_t align = ALIGN_UP(cinfo->stream->nput,
ELF_PAGESIZE) - cinfo->stream->nput;
unsigned char null[256];
off_t total = align;
off_t ret = 0;
@ -258,10 +256,10 @@ static int elf_get_note_size(int stksegs)
{
int total;
total = stksegs * (sizeof(Elf_Nhdr) + ROUNDUP(CONFIG_TASK_NAME_SIZE, 8) +
sizeof(elf_prstatus_t));
total += stksegs * (sizeof(Elf_Nhdr) + ROUNDUP(CONFIG_TASK_NAME_SIZE, 8) +
sizeof(elf_prpsinfo_t));
total = stksegs * (sizeof(Elf_Nhdr) + ALIGN_UP(CONFIG_TASK_NAME_SIZE, 8) +
sizeof(elf_prstatus_t));
total += stksegs * (sizeof(Elf_Nhdr) + ALIGN_UP(CONFIG_TASK_NAME_SIZE, 8) +
sizeof(elf_prpsinfo_t));
return total;
}
@ -276,7 +274,7 @@ static int elf_get_note_size(int stksegs)
static void elf_emit_tcb_note(FAR struct elf_dumpinfo_s *cinfo,
FAR struct tcb_s *tcb)
{
char name[ROUNDUP(CONFIG_TASK_NAME_SIZE, 8)];
char name[ALIGN_UP(CONFIG_TASK_NAME_SIZE, 8)];
elf_prstatus_t status;
elf_prpsinfo_t info;
FAR uintptr_t *regs;
@ -414,8 +412,8 @@ static void elf_emit_tcb_stack(FAR struct elf_dumpinfo_s *cinfo,
(tcb->stack_base_ptr - tcb->stack_alloc_ptr);
}
sp = ROUNDDOWN(buf, PROGRAM_ALIGNMENT);
len = ROUNDUP(len + (buf - sp), PROGRAM_ALIGNMENT);
sp = ALIGN_DOWN(buf, PROGRAM_ALIGNMENT);
len = ALIGN_UP(len + (buf - sp), PROGRAM_ALIGNMENT);
buf = sp;
elf_emit(cinfo, (FAR void *)buf, len);
@ -546,17 +544,17 @@ static void elf_emit_tcb_phdr(FAR struct elf_dumpinfo_s *cinfo,
(tcb->stack_base_ptr - tcb->stack_alloc_ptr);
}
sp = ROUNDDOWN(phdr->p_vaddr, PROGRAM_ALIGNMENT);
phdr->p_filesz = ROUNDUP(phdr->p_filesz +
(phdr->p_vaddr - sp), PROGRAM_ALIGNMENT);
sp = ALIGN_DOWN(phdr->p_vaddr, PROGRAM_ALIGNMENT);
phdr->p_filesz = ALIGN_UP(phdr->p_filesz +
(phdr->p_vaddr - sp), PROGRAM_ALIGNMENT);
phdr->p_vaddr = sp;
phdr->p_type = PT_LOAD;
phdr->p_offset = ROUNDUP(*offset, ELF_PAGESIZE);
phdr->p_offset = ALIGN_UP(*offset, ELF_PAGESIZE);
phdr->p_paddr = phdr->p_vaddr;
phdr->p_memsz = phdr->p_filesz;
phdr->p_flags = PF_X | PF_W | PF_R;
*offset += ROUNDUP(phdr->p_memsz, ELF_PAGESIZE);
*offset += ALIGN_UP(phdr->p_memsz, ELF_PAGESIZE);
elf_emit(cinfo, phdr, sizeof(*phdr));
}
@ -608,13 +606,13 @@ static void elf_emit_phdr(FAR struct elf_dumpinfo_s *cinfo,
for (i = 0; i < memsegs; i++)
{
phdr.p_type = PT_LOAD;
phdr.p_offset = ROUNDUP(offset, ELF_PAGESIZE);
phdr.p_offset = ALIGN_UP(offset, ELF_PAGESIZE);
phdr.p_vaddr = cinfo->regions[i].start;
phdr.p_paddr = phdr.p_vaddr;
phdr.p_filesz = cinfo->regions[i].end - cinfo->regions[i].start;
phdr.p_memsz = phdr.p_filesz;
phdr.p_flags = cinfo->regions[i].flags;
offset += ROUNDUP(phdr.p_memsz, ELF_PAGESIZE);
offset += ALIGN_UP(phdr.p_memsz, ELF_PAGESIZE);
elf_emit(cinfo, &phdr, sizeof(phdr));
}
}