Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1332,11 +1332,11 @@ comment "Board Settings"

config BOARD_LOOPSPERMSEC
int "Delay loops per millisecond"
default 5000
---help---
Simple delay loops are used by some logic, especially during boot-up,
driver initialization. These delay loops must be calibrated for each
board in order to assure accurate timing by the delay loops.
driver initialization. These delay loops must be calibrated for each
board in order to assure accurate timing by the delay loops. You can
do so with `calib_udelay` (EXAMPLES_CALIB_UDELAY).

comment "Interrupt options"

Expand Down
1 change: 1 addition & 0 deletions boards/arm/phy62xx/phy6222/configs/nsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CONFIG_ARCH_CHIP="phy62xx"
CONFIG_ARCH_CHIP_PHY6222=y
CONFIG_ARCH_CHIP_PHY62XX=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=0
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEFAULT_SMALL=y
Expand Down
1 change: 1 addition & 0 deletions boards/arm/phy62xx/phy6222/configs/phy_sbp/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ CONFIG_ARCH_CHIP="phy62xx"
CONFIG_ARCH_CHIP_PHY6222=y
CONFIG_ARCH_CHIP_PHY62XX=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=0
CONFIG_BUILTIN=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
Expand Down
1 change: 1 addition & 0 deletions boards/arm/qemu/qemu-armv7a/configs/full/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ CONFIG_ARM_THUMB=y
CONFIG_AUDIO=y
CONFIG_BATTERY_CHARGER=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=393693
CONFIG_BUILTIN=y
CONFIG_CRYPTO=y
CONFIG_CRYPTO_MBEDTLS=y
Expand Down
1 change: 1 addition & 0 deletions boards/arm/qemu/qemu-armv7a/configs/gdbstub/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ CONFIG_ARCH_CHIP_QEMU_ARM=y
CONFIG_ARCH_CHIP_QEMU_CORTEXA7=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_LOWVECTORS=y
CONFIG_BOARD_LOOPSPERMSEC=393693
CONFIG_BOARD_MEMORY_RANGE="{0x40200000,0x48000000,0x6}"
CONFIG_BUILTIN=y
CONFIG_DEBUG_ASSERTIONS=y
Expand Down
1 change: 1 addition & 0 deletions boards/arm/qemu/qemu-armv7a/configs/knsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ CONFIG_ARM_SEMIHOSTING_HOSTFS=y
CONFIG_ARM_THUMB=y
CONFIG_BINFMT_ELF_EXECUTABLE=y
CONFIG_BOARDCTL_POWEROFF=y
CONFIG_BOARD_LOOPSPERMSEC=393693
CONFIG_BUILD_KERNEL=y
CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_FEATURES=y
Expand Down
1 change: 1 addition & 0 deletions boards/arm/qemu/qemu-armv7a/configs/knsh_smp/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ CONFIG_ARM_SEMIHOSTING_HOSTFS=y
CONFIG_ARM_THUMB=y
CONFIG_BINFMT_ELF_EXECUTABLE=y
CONFIG_BOARDCTL_POWEROFF=y
CONFIG_BOARD_LOOPSPERMSEC=393693
CONFIG_BUILD_KERNEL=y
CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_FEATURES=y
Expand Down
1 change: 1 addition & 0 deletions boards/arm/qemu/qemu-armv7a/configs/nsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ CONFIG_ARCH_LOWVECTORS=y
CONFIG_ARM_PSCI=y
CONFIG_ARM_SEMIHOSTING_HOSTFS=y
CONFIG_BOARDCTL_POWEROFF=y
CONFIG_BOARD_LOOPSPERMSEC=393693
CONFIG_BUILTIN=y
CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_FEATURES=y
Expand Down
1 change: 1 addition & 0 deletions boards/arm/qemu/qemu-armv7a/configs/rpproxy/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ CONFIG_ARM_THUMB=y
CONFIG_BCH=y
CONFIG_BOARDCTL_POWEROFF=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=393693
CONFIG_BUILTIN=y
CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_FEATURES=y
Expand Down
1 change: 1 addition & 0 deletions boards/arm/qemu/qemu-armv7a/configs/rpserver/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ CONFIG_BCH=y
CONFIG_BLK_RPMSG_SERVER=y
CONFIG_BOARDCTL_POWEROFF=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=393693
CONFIG_BUILTIN=y
CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_ASSERTIONS_EXPRESSION=y
Expand Down
1 change: 1 addition & 0 deletions boards/arm/qemu/qemu-armv7a/configs/smp/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CONFIG_ARCH_CHIP_QEMU_CORTEXA7=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_LOWVECTORS=y
CONFIG_ARM_PSCI=y
CONFIG_BOARD_LOOPSPERMSEC=393693
CONFIG_BUILTIN=y
CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_FEATURES=y
Expand Down
1 change: 1 addition & 0 deletions boards/arm/stm32/b-g474e-dpow1/configs/nsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CONFIG_ARCH_RAMVECTORS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARMV7M_LIBM=y
CONFIG_ARMV7M_MEMCPY=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
Expand Down
1 change: 1 addition & 0 deletions boards/arm/stm32/b-g474e-dpow1/configs/ostest/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CONFIG_ARCH_RAMVECTORS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARMV7M_LIBM=y
CONFIG_ARMV7M_MEMCPY=y
CONFIG_BOARD_LOOPSPERMSEC=16717
CONFIG_BUILTIN=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_SYMBOLS=y
Expand Down
1 change: 1 addition & 0 deletions boards/arm/stm32/nucleo-g474re/configs/lpuartnsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CONFIG_ARCH_RAMVECTORS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARMV7M_LIBM=y
CONFIG_ARMV7M_MEMCPY=y
CONFIG_BOARD_LOOPSPERMSEC=0
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
Expand Down
1 change: 1 addition & 0 deletions boards/arm/stm32/nucleo-g474re/configs/nsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CONFIG_ARCH_RAMVECTORS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARMV7M_LIBM=y
CONFIG_ARMV7M_MEMCPY=y
CONFIG_BOARD_LOOPSPERMSEC=0
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ CONFIG_ARCH_RAMVECTORS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARMV7M_LIBM=y
CONFIG_ARMV7M_MEMCPY=y
CONFIG_BOARD_LOOPSPERMSEC=0
CONFIG_CDCACM=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_HARDFAULT_INFO=y
Expand Down
1 change: 1 addition & 0 deletions boards/arm/stm32wl5/nucleo-wl55jc/configs/demo/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ CONFIG_ARCH_CHIP="stm32wl5"
CONFIG_ARCH_CHIP_STM32WL55JC_CPU1=y
CONFIG_ARCH_CHIP_STM32WL5=y
CONFIG_ARCH_IRQBUTTONS=y
CONFIG_BOARD_LOOPSPERMSEC=0
CONFIG_BUILTIN=y
CONFIG_EXAMPLES_BUTTONS=y
CONFIG_EXAMPLES_LEDS=y
Expand Down
1 change: 1 addition & 0 deletions boards/arm/stm32wl5/nucleo-wl55jc/configs/fb/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CONFIG_ARCH_CHIP="stm32wl5"
CONFIG_ARCH_CHIP_STM32WL55JC_CPU1=y
CONFIG_ARCH_CHIP_STM32WL5=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think it's better to make CONFIG_BOARD_LOOPSPERMSEC default to zero and warning or error in the source code, instead explicitly set it to zero in defconfig.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because then it allows users to forget to add a proper value when they add a new config/board. The few places where I added zero to the defconfig is only a workaround for boards where no one owns them up come up with a real value. Otherwise this would break CI

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can warning/error in source code anyway. both are equal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if I add an error in the source code it's more work; an undefined symbol automatically causes an error

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you already add the check in code:
https://github.com/apache/nuttx/pull/17011/changes#diff-ebeffbbfc04cab0f5a0fd2ccbb776f2f541fcb836231537f55a27c503de761baR59
why do you duplicate the same thing in many places?

CONFIG_BUILTIN=y
CONFIG_DRIVERS_VIDEO=y
CONFIG_EXAMPLES_FB=y
Expand Down
1 change: 1 addition & 0 deletions boards/arm/stm32wl5/nucleo-wl55jc/configs/nsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ CONFIG_ARCH_BUTTONS=y
CONFIG_ARCH_CHIP="stm32wl5"
CONFIG_ARCH_CHIP_STM32WL55JC_CPU1=y
CONFIG_ARCH_CHIP_STM32WL5=y
CONFIG_BOARD_LOOPSPERMSEC=0
CONFIG_INIT_ENTRYNAME="main"
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_LPUART1_SERIAL_CONSOLE=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ CONFIG_ARCH_IRQBUTTONS=y
CONFIG_ARCH_LOWVECTORS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARM_TOOLCHAIN_BUILDROOT=y
CONFIG_BOARD_LOOPSPERMSEC=0
CONFIG_BUILTIN=y
CONFIG_FAT_LCNAMES=y
CONFIG_FAT_LFN=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_IRQBUTTONS=y
CONFIG_ARCH_LOWVECTORS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=0
CONFIG_BUILTIN=y
CONFIG_ELF=y
CONFIG_FAT_LCNAMES=y
Expand Down
1 change: 1 addition & 0 deletions boards/arm64/a527/avaota-a1/configs/nsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ CONFIG_ARCH_USE_MMU=y
CONFIG_ARM64_STRING_FUNCTION=y
CONFIG_BOARDCTL_ROMDISK=y
CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=201847
CONFIG_BUILD_KERNEL=y
CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_ASSERTIONS_EXPRESSION=y
Expand Down
4 changes: 3 additions & 1 deletion cmake/nuttx_kconfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ function(nuttx_export_kconfig kconfigfile)
string(REPLACE "${Name}=" "" Value ${NameAndValue})

# remove extra quotes
string(REPLACE "\"" "" Value ${Value})
if(Value)
string(REPLACE "\"" "" Value ${Value})
endif()
decode_semicolon(Value)
# Set the variable
set(${Name}
Expand Down
5 changes: 5 additions & 0 deletions drivers/timers/arch_alarm.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
* Pre-processor Definitions
****************************************************************************/

/* If no value is given, we proceed with 0 since a one-shot timer is used for
* accurate delays. A runtime DEBUGASSERT catches the case where the one-shot
* timer lower-half isn't registered in time.
*/

#ifndef CONFIG_BOARD_LOOPSPERMSEC
# define CONFIG_BOARD_LOOPSPERMSEC 0
#endif
Expand Down
5 changes: 5 additions & 0 deletions drivers/timers/arch_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
* Pre-processor Definitions
****************************************************************************/

/* If no value is given, we proceed with 0 since a timer is used for accurate
* delays. A runtime DEBUGASSERT catches the case where the timer lower-half
* isn't registered in time.
*/

#ifndef CONFIG_BOARD_LOOPSPERMSEC
# define CONFIG_BOARD_LOOPSPERMSEC 0
#endif
Expand Down
2 changes: 1 addition & 1 deletion sched/clock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ set(SRCS
# don't want the weak references to conflict.

if(NOT CONFIG_TIMER_ARCH AND NOT CONFIG_ALARM_ARCH)
list(APPEND SRCS delay.c)
list(APPEND SRCS clock_delay.c)
endif()

if(CONFIG_CLOCK_TIMEKEEPING)
Expand Down
2 changes: 1 addition & 1 deletion sched/clock/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ CSRCS += clock_perf.c clock_realtime2absticks.c clock_getres.c

ifneq ($(CONFIG_TIMER_ARCH),y)
ifneq ($(CONFIG_ALARM_ARCH),y)
CSRCS += delay.c
CSRCS += clock_delay.c
endif
endif

Expand Down
13 changes: 12 additions & 1 deletion sched/clock/delay.c → sched/clock/clock_delay.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/****************************************************************************
* sched/clock/delay.c
* sched/clock/clock_delay.c
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -56,6 +56,17 @@
* Pre-processor Definitions
****************************************************************************/

#if defined(CONFIG_BOARD_LOOPSPERMSEC) && CONFIG_BOARD_LOOPSPERMSEC == 0
#warning \
"CONFIG_BOARD_LOOPSPERMSEC is set to 0 even though this architecture does" \
"not rely on timer or alarm drivers for correct timings. up_udelay() and " \
"similar delay functions will not work correctly. Please determine an " \
"appropriate value for CONFIG_BOARD_LOOPSPERMSEC using the calib_udelay " \
"application in nuttx-apps. If this configuration is a NuttX provided " \
"configuration, it would be appreciated if you submit a patch with the " \
"new value to apache/nuttx."
#endif

#define CONFIG_BOARD_LOOPSPER100USEC ((CONFIG_BOARD_LOOPSPERMSEC+5)/10)
#define CONFIG_BOARD_LOOPSPER10USEC ((CONFIG_BOARD_LOOPSPERMSEC+50)/100)
#define CONFIG_BOARD_LOOPSPERUSEC ((CONFIG_BOARD_LOOPSPERMSEC+500)/1000)
Expand Down
Loading