zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.83k stars 6.6k forks source link

logger: Filesystem backend doesn't work except for first time boot #36667

Closed ExtremeGTX closed 3 years ago

ExtremeGTX commented 3 years ago

Describe the bug After activating LOG_BACKEND_FS, CONFIG_FILE_SYSTEM_LITTLEFS and their dependencies, it worked as expected on the very first time boot (clean storage partition).

The problem is after rebooting the board, nothing new got saved to the log file created from the first time boot nor a new file created. as if logging to filesystem is completely stopped.

What have you tried to diagnose or workaround this issue?

I tried to do some debugging, and I found that adding fs_seek(&file, 0, FS_SEEK_END); just before https://github.com/zephyrproject-rtos/zephyr/blob/882600834e80d2d3d5db4e61d72f63a8bd997fcc/subsys/logging/log_backend_fs.c#L177 make things work. but I think this is not the right way to do it.

After adding the workaround above, makes the logging backend create a new file on each reboot, instead of appending to the old one till it reaches the CONFIG_LOG_BACKEND_FS_FILE_SIZE. that also breaks the limit CONFIG_LOG_BACKEND_FS_FILES_LIMIT, I end up getting 3 files after 3 or more reboots

log.0000
log.000x
log.000(x+1)

To Reproduce Steps to reproduce the behavior:

  1. replace the content of zephyr\samples\hello_world\src\main.c with the following sample code:

    #include <zephyr.h>
    #include <sys/printk.h>
    
    #include <logging/log.h>
    LOG_MODULE_REGISTER(main, LOG_LEVEL_DBG);
    
      void main(void)
      {
          int x = 0;
          while (x < 20)
          {
              k_sleep(K_MSEC(200));
              LOG_INF("Hello World! %s %d", CONFIG_BOARD, x++);
          }
      }
  2. west build -b stm32f769i_disco ./samples/hello_world
  3. west build -b stm32f769i_disco -t menuconfig and use the attached .config below
  4. flash

Expected behavior A clear and concise description of what you expected to happen.

Impact showstopper

Environment (please complete the following information):

Additional context

My .config ``` CONFIG_GPIO=y # CONFIG_SPI is not set # CONFIG_I2C is not set # CONFIG_KSCAN is not set # CONFIG_WIFI is not set # CONFIG_MODEM is not set CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_BOARD="stm32f769i_disco" CONFIG_SOC="stm32f769xx" CONFIG_SOC_SERIES="stm32f7" CONFIG_NUM_IRQS=110 CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=216000000 CONFIG_HEAP_MEM_POOL_SIZE=256 CONFIG_ROM_START_OFFSET=0 # CONFIG_WATCHDOG is not set # CONFIG_UART_NS16550 is not set # CONFIG_PM is not set # CONFIG_PM_DEVICE is not set CONFIG_CORTEX_M_SYSTICK=y CONFIG_CLOCK_CONTROL=y CONFIG_SYS_CLOCK_TICKS_PER_SEC=10000 CONFIG_BUILD_OUTPUT_HEX=y # CONFIG_FPU is not set CONFIG_FLASH_SIZE=2048 CONFIG_FLASH_BASE_ADDRESS=0x8000000 # CONFIG_GPIO_MCUX is not set # CONFIG_CPU_HAS_CUSTOM_FIXED_SOC_MPU_REGIONS is not set # CONFIG_TINYCRYPT is not set CONFIG_PINMUX_INIT_PRIORITY=45 CONFIG_SERIAL=y # CONFIG_UART_PL011 is not set CONFIG_CLOCK_CONTROL_STM32_CUBE=y CONFIG_UART_STM32=y CONFIG_GPIO_STM32=y CONFIG_PINMUX_STM32=y # CONFIG_SRAM_VECTOR_TABLE is not set # # Modules # # # Available modules. # # # hal_nordic (D:githubzephyrmoduleshalnordic) # CONFIG_ZEPHYR_HAL_NORDIC_MODULE=y # end of hal_nordic (D:githubzephyrmoduleshalnordic) # # loramac-node (D:githubzephyrmoduleslibloramac-node) # CONFIG_ZEPHYR_LORAMAC_NODE_MODULE=y # CONFIG_HAS_SEMTECH_RADIO_DRIVERS is not set # end of loramac-node (D:githubzephyrmoduleslibloramac-node) # # lz4 (D:githubzephyrmodulesliblz4) # CONFIG_ZEPHYR_LZ4_MODULE=y # CONFIG_LZ4 is not set # end of lz4 (D:githubzephyrmodulesliblz4) # # mbedtls (D:githubzephyrmodulescryptombedtls) # CONFIG_ZEPHYR_MBEDTLS_MODULE=y # CONFIG_MBEDTLS is not set # end of mbedtls (D:githubzephyrmodulescryptombedtls) # # nanopb (D:githubzephyrmoduleslibnanopb) # CONFIG_ZEPHYR_NANOPB_MODULE=y # CONFIG_NANOPB is not set # end of nanopb (D:githubzephyrmoduleslibnanopb) # # sof (D:githubzephyrmodulesaudiosof) # # CONFIG_DEBUG is not set CONFIG_ZEPHYR_SOF_MODULE=y # end of sof (D:githubzephyrmodulesaudiosof) # # tensorflow (D:githubzephyrmoduleslibtensorflow) # # CONFIG_TENSORFLOW_LITE_MICRO is not set CONFIG_ZEPHYR_TENSORFLOW_MODULE=y # end of tensorflow (D:githubzephyrmoduleslibtensorflow) # # TraceRecorder (D:githubzephyrmodulesdebugTraceRecorder) # CONFIG_ZEPHYR_TRACERECORDER_MODULE=y # end of TraceRecorder (D:githubzephyrmodulesdebugTraceRecorder) # # trusted-firmware-m (D:githubzephyrmodulesteetfm) # CONFIG_ZEPHYR_TRUSTED_FIRMWARE_M_MODULE=y # end of trusted-firmware-m (D:githubzephyrmodulesteetfm) # # Optional modules. Make sure they're installed, via the project manifest. # # CONFIG_CANOPENNODE is not set # CONFIG_CIVETWEB is not set CONFIG_HAS_CMSIS_CORE=y CONFIG_HAS_CMSIS_CORE_M=y # CONFIG_LIBMETAL is not set # CONFIG_HAS_MEC_HAL is not set # CONFIG_OPENAMP is not set # CONFIG_SOF is not set CONFIG_HAS_STM32CUBE=y CONFIG_USE_STM32_HAL_QSPI=y CONFIG_USE_STM32_LL_UTILS=y # CONFIG_MIPI_SYST_LIB is not set # CONFIG_TINYCBOR is not set # CONFIG_MCUBOOT_BOOTUTIL_LIB is not set # # Unavailable modules, please install those via the project manifest. # # end of Modules CONFIG_BOARD_STM32F769I_DISCO=y # # Board Options # # end of Board Options # CONFIG_SOC_SERIES_BEETLE is not set # CONFIG_SOC_SERIES_ARM_DESIGNSTART is not set # CONFIG_SOC_SERIES_MPS2 is not set # CONFIG_SOC_SERIES_MPS3 is not set # CONFIG_SOC_SERIES_MUSCA_B1 is not set # CONFIG_SOC_SERIES_MUSCA_S1 is not set # CONFIG_SOC_SERIES_SAMD20 is not set # CONFIG_SOC_SERIES_SAMD21 is not set # CONFIG_SOC_SERIES_SAMD51 is not set # CONFIG_SOC_SERIES_SAME51 is not set # CONFIG_SOC_SERIES_SAME53 is not set # CONFIG_SOC_SERIES_SAME54 is not set # CONFIG_SOC_SERIES_SAMR21 is not set # CONFIG_SOC_SERIES_SAM3X is not set # CONFIG_SOC_SERIES_SAM4E is not set # CONFIG_SOC_SERIES_SAM4L is not set # CONFIG_SOC_SERIES_SAM4S is not set # CONFIG_SOC_SERIES_SAME70 is not set # CONFIG_SOC_SERIES_SAMV71 is not set # CONFIG_SOC_SERIES_VALKYRIE is not set # CONFIG_SOC_SERIES_VIPER is not set # CONFIG_SOC_SERIES_PSOC62 is not set # CONFIG_SOC_SERIES_PSOC63 is not set # CONFIG_SOC_SERIES_XMC_4XXX is not set # CONFIG_SOC_SERIES_MEC1501X is not set # CONFIG_SOC_SERIES_MEC1701X is not set # CONFIG_SOC_SERIES_NRF51X is not set # CONFIG_SOC_SERIES_NRF52X is not set # CONFIG_SOC_SERIES_NRF53X is not set # CONFIG_SOC_SERIES_NRF91X is not set # CONFIG_SOC_SERIES_M48X is not set # CONFIG_SOC_SERIES_NPCX7 is not set # CONFIG_SOC_SERIES_NPCX9 is not set # CONFIG_SOC_SERIES_IMX_6X_M4 is not set # CONFIG_SOC_SERIES_IMX7_M4 is not set # CONFIG_SOC_SERIES_IMX8MM_M4 is not set # CONFIG_SOC_SERIES_IMX_RT6XX is not set # CONFIG_SOC_SERIES_IMX_RT is not set # CONFIG_SOC_SERIES_KINETIS_K2X is not set # CONFIG_SOC_SERIES_KINETIS_K6X is not set # CONFIG_SOC_SERIES_KINETIS_K8X is not set # CONFIG_SOC_SERIES_KINETIS_KE1XF is not set # CONFIG_SOC_SERIES_KINETIS_KL2X is not set # CONFIG_SOC_SERIES_KINETIS_KV5X is not set # CONFIG_SOC_SERIES_KINETIS_KWX is not set # CONFIG_SOC_SERIES_LPC11U6X is not set # CONFIG_SOC_SERIES_LPC54XXX is not set # CONFIG_SOC_SERIES_LPC55XXX is not set # CONFIG_SOC_EOS_S3 is not set # CONFIG_SOC_SERIES_RCAR_GEN3 is not set # CONFIG_SOC_SERIES_EFM32GG11B is not set # CONFIG_SOC_SERIES_EFM32HG is not set # CONFIG_SOC_SERIES_EFM32JG12B is not set # CONFIG_SOC_SERIES_EFM32PG12B is not set # CONFIG_SOC_SERIES_EFM32PG1B is not set # CONFIG_SOC_SERIES_EFM32WG is not set # CONFIG_SOC_SERIES_EFR32BG13P is not set # CONFIG_SOC_SERIES_EFR32FG13P is not set # CONFIG_SOC_SERIES_EFR32FG1P is not set # CONFIG_SOC_SERIES_EFR32MG12P is not set # CONFIG_SOC_SERIES_EFR32MG21 is not set # CONFIG_SOC_SERIES_STM32F0X is not set # CONFIG_SOC_SERIES_STM32F1X is not set # CONFIG_SOC_SERIES_STM32F2X is not set # CONFIG_SOC_SERIES_STM32F3X is not set # CONFIG_SOC_SERIES_STM32F4X is not set CONFIG_SOC_SERIES_STM32F7X=y # CONFIG_SOC_SERIES_STM32G0X is not set # CONFIG_SOC_SERIES_STM32G4X is not set # CONFIG_SOC_SERIES_STM32H7X is not set # CONFIG_SOC_SERIES_STM32L0X is not set # CONFIG_SOC_SERIES_STM32L1X is not set # CONFIG_SOC_SERIES_STM32L4X is not set # CONFIG_SOC_SERIES_STM32L5X is not set # CONFIG_SOC_SERIES_STM32MP1X is not set # CONFIG_SOC_SERIES_STM32WBX is not set # CONFIG_SOC_SERIES_STM32WLX is not set # CONFIG_SOC_TI_LM3S6965 is not set # CONFIG_SOC_SERIES_CC13X2_CC26X2 is not set # CONFIG_SOC_SERIES_CC32XX is not set # CONFIG_SOC_SERIES_MSP432P4XX is not set # CONFIG_SOC_XILINX_ZYNQMP_RPU is not set # # Hardware Configuration # CONFIG_CPU_HAS_ARM_MPU=y CONFIG_HAS_SWO=y CONFIG_SOC_FAMILY="st_stm32" CONFIG_SOC_FAMILY_STM32=y # CONFIG_STM32_BACKUP_SRAM is not set # CONFIG_SOC_STM32F723XX is not set # CONFIG_SOC_STM32F745XX is not set # CONFIG_SOC_STM32F746XX is not set # CONFIG_SOC_STM32F756XX is not set # CONFIG_SOC_STM32F767XX is not set CONFIG_SOC_STM32F769XX=y # CONFIG_SOC_LOG_LEVEL_OFF is not set # CONFIG_SOC_LOG_LEVEL_ERR is not set # CONFIG_SOC_LOG_LEVEL_WRN is not set CONFIG_SOC_LOG_LEVEL_INF=y # CONFIG_SOC_LOG_LEVEL_DBG is not set CONFIG_SOC_LOG_LEVEL=3 # end of Hardware Configuration # # ARM Options # CONFIG_ARCH="arm" CONFIG_CPU_CORTEX=y # CONFIG_CODE_DATA_RELOCATION is not set # CONFIG_CODE_DATA_RELOCATION_SRAM is not set CONFIG_CPU_CORTEX_M=y CONFIG_ISA_THUMB2=y CONFIG_ASSEMBLER_ISA_THUMB2=y CONFIG_COMPILER_ISA_THUMB2=y CONFIG_STACK_ALIGN_DOUBLE_WORD=y # CONFIG_RUNTIME_NMI is not set # CONFIG_PLATFORM_SPECIFIC_INIT is not set CONFIG_FAULT_DUMP=2 CONFIG_ARM_STACK_PROTECTION=y CONFIG_CPU_CORTEX_M7=y CONFIG_CPU_CORTEX_M_HAS_SYSTICK=y CONFIG_CPU_CORTEX_M_HAS_DWT=y CONFIG_CPU_CORTEX_M_HAS_BASEPRI=y CONFIG_CPU_CORTEX_M_HAS_VTOR=y CONFIG_CPU_CORTEX_M_HAS_PROGRAMMABLE_FAULT_PRIOS=y CONFIG_ARMV7_M_ARMV8_M_MAINLINE=y CONFIG_ARMV7_M_ARMV8_M_FP=y # # ARM Cortex-M0/M0+/M1/M3/M4/M7/M23/M33 options # CONFIG_GEN_ISR_TABLES=y # CONFIG_ZERO_LATENCY_IRQS is not set # CONFIG_SW_VECTOR_RELAY is not set # CONFIG_CORTEX_M_DWT is not set CONFIG_TEST_EXTRA_STACKSIZE=0 # end of ARM Cortex-M0/M0+/M1/M3/M4/M7/M23/M33 options CONFIG_NULL_POINTER_EXCEPTION_DETECTION_NONE=y # CONFIG_NULL_POINTER_EXCEPTION_DETECTION_DWT is not set # CONFIG_NULL_POINTER_EXCEPTION_DETECTION_MPU is not set CONFIG_GEN_IRQ_VECTOR_TABLE=y CONFIG_ARM_MPU=y CONFIG_ARM_MPU_REGION_MIN_ALIGN_AND_SIZE=32 CONFIG_MPU_STACK_GUARD=y CONFIG_MPU_ALLOW_FLASH_WRITE=y # CONFIG_CUSTOM_SECTION_ALIGN is not set CONFIG_CUSTOM_SECTION_MIN_ALIGN_SIZE=32 # end of ARM Options CONFIG_ARM=y CONFIG_ARCH_IS_SET=y # # General Architecture Options # # CONFIG_ARCH_LOG_LEVEL_OFF is not set # CONFIG_ARCH_LOG_LEVEL_ERR is not set # CONFIG_ARCH_LOG_LEVEL_WRN is not set CONFIG_ARCH_LOG_LEVEL_INF=y # CONFIG_ARCH_LOG_LEVEL_DBG is not set CONFIG_ARCH_LOG_LEVEL=3 # CONFIG_MPU_LOG_LEVEL_OFF is not set # CONFIG_MPU_LOG_LEVEL_ERR is not set # CONFIG_MPU_LOG_LEVEL_WRN is not set CONFIG_MPU_LOG_LEVEL_INF=y # CONFIG_MPU_LOG_LEVEL_DBG is not set CONFIG_MPU_LOG_LEVEL=3 CONFIG_SRAM_SIZE=384 CONFIG_SRAM_BASE_ADDRESS=0x20020000 CONFIG_HW_STACK_PROTECTION=y # CONFIG_USERSPACE is not set CONFIG_PRIVILEGED_STACK_SIZE=1024 CONFIG_KOBJECT_TEXT_AREA=256 CONFIG_KOBJECT_DATA_AREA_RESERVE_EXTRA_PERCENT=100 CONFIG_KOBJECT_RODATA_AREA_EXTRA_BYTES=16 CONFIG_GEN_PRIV_STACKS=y # CONFIG_STACK_GROWS_UP is not set # CONFIG_NOCACHE_MEMORY is not set # # Interrupt Configuration # # CONFIG_DYNAMIC_INTERRUPTS is not set CONFIG_GEN_SW_ISR_TABLE=y CONFIG_ARCH_SW_ISR_TABLE_ALIGN=0 CONFIG_GEN_IRQ_START_VECTOR=0 # CONFIG_EXTRA_EXCEPTION_INFO is not set # end of Interrupt Configuration # CONFIG_INIT_ARCH_HW_AT_BOOT is not set # end of General Architecture Options CONFIG_ARCH_HAS_SINGLE_THREAD_SUPPORT=y CONFIG_ARCH_HAS_TIMING_FUNCTIONS=y CONFIG_ARCH_HAS_STACK_PROTECTION=y CONFIG_ARCH_HAS_USERSPACE=y CONFIG_ARCH_HAS_EXECUTABLE_PAGE_BIT=y CONFIG_ARCH_HAS_NOCACHE_MEMORY_SUPPORT=y CONFIG_ARCH_HAS_RAMFUNC_SUPPORT=y CONFIG_ARCH_HAS_NESTED_EXCEPTION_DETECTION=y CONFIG_ARCH_SUPPORTS_COREDUMP=y CONFIG_ARCH_SUPPORTS_ARCH_HW_INIT=y CONFIG_ARCH_HAS_EXTRA_EXCEPTION_INFO=y CONFIG_ARCH_HAS_THREAD_LOCAL_STORAGE=y CONFIG_ARCH_HAS_THREAD_ABORT=y CONFIG_CPU_HAS_FPU=y CONFIG_CPU_HAS_FPU_DOUBLE_PRECISION=y CONFIG_CPU_HAS_MPU=y CONFIG_MPU=y CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT=y CONFIG_SRAM_REGION_PERMISSIONS=y # # Floating Point Options # # end of Floating Point Options # # Cache Options # # CONFIG_CACHE_MANAGEMENT is not set # end of Cache Options CONFIG_TOOLCHAIN_HAS_BUILTIN_FFS=y # # General Kernel Options # # CONFIG_KERNEL_LOG_LEVEL_OFF is not set # CONFIG_KERNEL_LOG_LEVEL_ERR is not set # CONFIG_KERNEL_LOG_LEVEL_WRN is not set CONFIG_KERNEL_LOG_LEVEL_INF=y # CONFIG_KERNEL_LOG_LEVEL_DBG is not set CONFIG_KERNEL_LOG_LEVEL=3 CONFIG_MULTITHREADING=y CONFIG_NUM_COOP_PRIORITIES=16 CONFIG_NUM_PREEMPT_PRIORITIES=15 CONFIG_MAIN_THREAD_PRIORITY=0 CONFIG_COOP_ENABLED=y CONFIG_PREEMPT_ENABLED=y CONFIG_PRIORITY_CEILING=-127 CONFIG_NUM_METAIRQ_PRIORITIES=0 # CONFIG_SCHED_DEADLINE is not set # CONFIG_SCHED_CPU_MASK is not set CONFIG_MAIN_STACK_SIZE=1024 CONFIG_IDLE_STACK_SIZE=320 CONFIG_ISR_STACK_SIZE=2048 CONFIG_THREAD_STACK_INFO=y # CONFIG_THREAD_CUSTOM_DATA is not set CONFIG_ERRNO=y CONFIG_SCHED_DUMB=y # CONFIG_SCHED_SCALABLE is not set # CONFIG_SCHED_MULTIQ is not set # CONFIG_WAITQ_SCALABLE is not set CONFIG_WAITQ_DUMB=y # # Kernel Debugging and Metrics # # CONFIG_INIT_STACKS is not set CONFIG_BOOT_BANNER=y CONFIG_BOOT_DELAY=0 # CONFIG_THREAD_MONITOR is not set # CONFIG_THREAD_NAME is not set # CONFIG_THREAD_RUNTIME_STATS is not set # end of Kernel Debugging and Metrics # # Work Queue Options # CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=1024 CONFIG_SYSTEM_WORKQUEUE_PRIORITY=-1 # CONFIG_SYSTEM_WORKQUEUE_NO_YIELD is not set # end of Work Queue Options # # Atomic Operations # CONFIG_ATOMIC_OPERATIONS_BUILTIN=y # end of Atomic Operations # # Timer API Options # CONFIG_TIMESLICING=y CONFIG_TIMESLICE_SIZE=0 CONFIG_TIMESLICE_PRIORITY=0 CONFIG_POLL=y # end of Timer API Options # # Other Kernel Object Options # # CONFIG_MEM_SLAB_TRACE_MAX_UTILIZATION is not set CONFIG_NUM_MBOX_ASYNC_MSGS=10 CONFIG_NUM_PIPE_ASYNC_MSGS=10 CONFIG_KERNEL_MEM_POOL=y # end of Other Kernel Object Options CONFIG_ARCH_HAS_CUSTOM_SWAP_TO_MAIN=y CONFIG_SWAP_NONATOMIC=y CONFIG_SYS_CLOCK_EXISTS=y CONFIG_TIMEOUT_64BIT=y CONFIG_XIP=y # # Initialization Priorities # CONFIG_KERNEL_INIT_PRIORITY_OBJECTS=30 CONFIG_KERNEL_INIT_PRIORITY_DEFAULT=40 CONFIG_KERNEL_INIT_PRIORITY_DEVICE=50 CONFIG_APPLICATION_INIT_PRIORITY=90 # end of Initialization Priorities # # Security Options # # end of Security Options # # SMP Options # CONFIG_MP_NUM_CPUS=1 # end of SMP Options CONFIG_TICKLESS_KERNEL=y # end of General Kernel Options CONFIG_HAS_DTS=y CONFIG_HAS_DTS_GPIO=y # # Device Drivers # # CONFIG_IEEE802154 is not set # CONFIG_LORA is not set CONFIG_UART_CONSOLE_ON_DEV_NAME="UART_1" CONFIG_CONSOLE=y CONFIG_CONSOLE_INPUT_MAX_LINE_LEN=128 CONFIG_CONSOLE_HAS_DRIVER=y # CONFIG_CONSOLE_HANDLER is not set CONFIG_UART_CONSOLE=y CONFIG_UART_CONSOLE_INIT_PRIORITY=60 # CONFIG_UART_CONSOLE_DEBUG_SERVER_HOOKS is not set # CONFIG_UART_CONSOLE_MCUMGR is not set # CONFIG_USB_UART_CONSOLE is not set # CONFIG_RAM_CONSOLE is not set # CONFIG_IPM_CONSOLE_SENDER is not set # CONFIG_IPM_CONSOLE_RECEIVER is not set # CONFIG_UART_PIPE is not set # CONFIG_UART_MCUMGR is not set # CONFIG_SEMIHOST_CONSOLE is not set # CONFIG_UART_CONSOLE_LOG_LEVEL_OFF is not set # CONFIG_UART_CONSOLE_LOG_LEVEL_ERR is not set # CONFIG_UART_CONSOLE_LOG_LEVEL_WRN is not set CONFIG_UART_CONSOLE_LOG_LEVEL_INF=y # CONFIG_UART_CONSOLE_LOG_LEVEL_DBG is not set CONFIG_UART_CONSOLE_LOG_LEVEL=3 # CONFIG_GSM_MUX is not set CONFIG_HAS_SEGGER_RTT=y # CONFIG_USE_SEGGER_RTT is not set # CONFIG_EC_HOST_CMD_PERIPH is not set # CONFIG_NET_LOOPBACK is not set # # Capabilities # CONFIG_SERIAL_HAS_DRIVER=y CONFIG_SERIAL_SUPPORT_INTERRUPT=y CONFIG_UART_USE_RUNTIME_CONFIGURE=y # CONFIG_UART_LINE_CTRL is not set # CONFIG_UART_DRV_CMD is not set # # Serial Drivers # # CONFIG_UART_ALTERA_JTAG is not set # CONFIG_UART_XLNX_UARTLITE is not set # # Interrupt Controllers # # CONFIG_SWERV_PIC is not set # CONFIG_MULTI_LEVEL_INTERRUPTS is not set CONFIG_EXTI_STM32=y CONFIG_EXTI_STM32_EXTI0_IRQ_PRI=0 CONFIG_EXTI_STM32_EXTI1_IRQ_PRI=0 CONFIG_EXTI_STM32_EXTI2_IRQ_PRI=0 CONFIG_EXTI_STM32_EXTI3_IRQ_PRI=0 CONFIG_EXTI_STM32_EXTI4_IRQ_PRI=0 CONFIG_EXTI_STM32_EXTI9_5_IRQ_PRI=0 CONFIG_EXTI_STM32_EXTI15_10_IRQ_PRI=0 CONFIG_EXTI_STM32_PVD_IRQ_PRI=0 CONFIG_EXTI_STM32_OTG_FS_WKUP_IRQ_PRI=0 CONFIG_EXTI_STM32_TAMP_STAMP_IRQ_PRI=0 CONFIG_EXTI_STM32_RTC_WKUP_IRQ_PRI=0 CONFIG_EXTI_STM32_LPTIM1_IRQ_PRI=0 # end of Interrupt Controllers # # Timer Drivers # # CONFIG_SYSTEM_CLOCK_DISABLE is not set # CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME is not set # CONFIG_SYSTEM_CLOCK_SLOPPY_IDLE is not set CONFIG_SYSTEM_CLOCK_INIT_PRIORITY=0 CONFIG_TICKLESS_CAPABLE=y # end of Timer Drivers # CONFIG_ENTROPY_GENERATOR is not set # CONFIG_PCIE is not set # CONFIG_PCIE_ENDPOINT is not set # CONFIG_GPIO_LOG_LEVEL_OFF is not set # CONFIG_GPIO_LOG_LEVEL_ERR is not set # CONFIG_GPIO_LOG_LEVEL_WRN is not set CONFIG_GPIO_LOG_LEVEL_INF=y # CONFIG_GPIO_LOG_LEVEL_DBG is not set CONFIG_GPIO_LOG_LEVEL=3 # CONFIG_GPIO_SHELL is not set # CONFIG_GPIO_DW is not set # CONFIG_GPIO_ITE_IT8XXX2 is not set # CONFIG_GPIO_INTEL is not set # CONFIG_GPIO_XLNX_AXI is not set # CONFIG_GPIO_EMUL is not set # CONFIG_SHARED_IRQ is not set # CONFIG_I2S is not set # CONFIG_PWM is not set CONFIG_PINMUX=y # CONFIG_PINMUX_ITE_IT8XXX2 is not set CONFIG_PINMUX_STM32_DEVICE_INITIALIZATION_PRIORITY=2 # CONFIG_ADC is not set # CONFIG_DAC is not set # CONFIG_CLOCK_CONTROL_LOG_LEVEL_OFF is not set # CONFIG_CLOCK_CONTROL_LOG_LEVEL_ERR is not set # CONFIG_CLOCK_CONTROL_LOG_LEVEL_WRN is not set CONFIG_CLOCK_CONTROL_LOG_LEVEL_INF=y # CONFIG_CLOCK_CONTROL_LOG_LEVEL_DBG is not set CONFIG_CLOCK_CONTROL_LOG_LEVEL=3 CONFIG_CLOCK_CONTROL_STM32_DEVICE_INIT_PRIORITY=1 CONFIG_CLOCK_STM32_HSE_CLOCK=25000000 CONFIG_CLOCK_CONTROL_STM32_HAS_DTS=y CONFIG_CLOCK_STM32_MCO1_SRC_NOCLOCK=y CONFIG_CLOCK_STM32_MCO2_SRC_NOCLOCK=y # CONFIG_PTP_CLOCK is not set # CONFIG_IPM is not set CONFIG_FLASH_HAS_DRIVER_ENABLED=y CONFIG_FLASH_HAS_PAGE_LAYOUT=y CONFIG_FLASH_JESD216=y # CONFIG_FLASH_JESD216_API is not set CONFIG_FLASH=y # CONFIG_FLASH_LOG_LEVEL_OFF is not set # CONFIG_FLASH_LOG_LEVEL_ERR is not set # CONFIG_FLASH_LOG_LEVEL_WRN is not set CONFIG_FLASH_LOG_LEVEL_INF=y # CONFIG_FLASH_LOG_LEVEL_DBG is not set CONFIG_FLASH_LOG_LEVEL=3 CONFIG_FLASH_SHELL=y CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_SOC_FLASH_STM32=y CONFIG_FLASH_STM32_QSPI=y # CONFIG_FLASH_SIMULATOR is not set # CONFIG_SENSOR is not set # CONFIG_COUNTER is not set # CONFIG_DMA is not set # CONFIG_USB is not set # CONFIG_CRYPTO is not set # CONFIG_DISPLAY is not set # CONFIG_LED_STRIP is not set # CONFIG_LED is not set # CONFIG_CAN is not set # CONFIG_AUDIO is not set # CONFIG_NEURAL_NET_ACCEL is not set # CONFIG_HWINFO is not set # CONFIG_ESPI is not set # CONFIG_PS2 is not set # CONFIG_VIDEO is not set # CONFIG_EEPROM is not set # CONFIG_PECI is not set # CONFIG_PECI_INTERRUPT_DRIVEN is not set # CONFIG_REGULATOR is not set # CONFIG_MEMC is not set # CONFIG_VIRTUALIZATION is not set # CONFIG_EDAC is not set # CONFIG_PM_CPU_OPS is not set # # Miscellaneous Drivers # # end of Miscellaneous Drivers # CONFIG_DISK_DRIVERS is not set # CONFIG_CACHE is not set # end of Device Drivers # # C Library # CONFIG_MINIMAL_LIBC=y # CONFIG_NEWLIB_LIBC is not set # CONFIG_EXTERNAL_LIBC is not set CONFIG_HAS_NEWLIB_LIBC_NANO=y CONFIG_MINIMAL_LIBC_MALLOC=y CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=0 CONFIG_MINIMAL_LIBC_CALLOC=y CONFIG_MINIMAL_LIBC_REALLOCARRAY=y # CONFIG_MINIMAL_LIBC_LL_PRINTF is not set CONFIG_STDOUT_CONSOLE=y # end of C Library # # Additional libraries # # CONFIG_LVGL is not set # # OS Support Library # # CONFIG_JSON_LIBRARY is not set CONFIG_RING_BUFFER=y # CONFIG_BASE64 is not set # CONFIG_SYS_HEAP_VALIDATE is not set CONFIG_SYS_HEAP_ALLOC_LOOPS=3 # CONFIG_PRINTK_SYNC is not set CONFIG_MPSC_PBUF=y # CONFIG_MPSC_CLEAR_ALLOCATED is not set # CONFIG_REBOOT is not set CONFIG_CBPRINTF_COMPLETE=y # CONFIG_CBPRINTF_NANO is not set CONFIG_CBPRINTF_FULL_INTEGRAL=y # CONFIG_CBPRINTF_REDUCED_INTEGRAL is not set # CONFIG_CBPRINTF_FP_SUPPORT is not set # CONFIG_CBPRINTF_FP_A_SUPPORT is not set # CONFIG_CBPRINTF_FP_ALWAYS_A is not set CONFIG_CBPRINTF_N_SPECIFIER=y # CONFIG_CBPRINTF_LIBC_SUBSTS is not set # CONFIG_CBPRINTF_PACKAGE_LONGDOUBLE is not set # CONFIG_CBPRINTF_STATIC_PACKAGE_CHECK_ALIGNMENT is not set # end of OS Support Library CONFIG_POSIX_MAX_FDS=4 # CONFIG_POSIX_API is not set # CONFIG_PTHREAD_IPC is not set # CONFIG_POSIX_CLOCK is not set CONFIG_MAX_TIMER_COUNT=5 # CONFIG_POSIX_MQUEUE is not set # CONFIG_POSIX_FS is not set # CONFIG_EVENTFD is not set # CONFIG_OPENAMP_RSC_TABLE is not set # # Util libraries # CONFIG_FNMATCH=y # CONFIG_GETOPT is not set # end of Util libraries # end of Additional libraries # # Sub Systems and OS Services # # CONFIG_BT is not set # # Controller Area Network (CAN) bus subsystem # # CONFIG_ISOTP is not set # end of Controller Area Network (CAN) bus subsystem # CONFIG_CONSOLE_SUBSYS is not set # CONFIG_CPLUSPLUS is not set # # System Monitoring Options # # CONFIG_THREAD_ANALYZER is not set # end of System Monitoring Options # # Debugging Options # # CONFIG_STACK_USAGE is not set # CONFIG_STACK_SENTINEL is not set CONFIG_PRINTK=y CONFIG_EARLY_CONSOLE=y # CONFIG_ASSERT is not set # CONFIG_FORCE_NO_ASSERT is not set CONFIG_ASSERT_VERBOSE=y # CONFIG_ASSERT_NO_FILE_INFO is not set # CONFIG_ASSERT_NO_COND_INFO is not set # CONFIG_ASSERT_NO_MSG_INFO is not set # CONFIG_OVERRIDE_FRAME_POINTER_DEFAULT is not set # CONFIG_DEBUG_INFO is not set # CONFIG_OPENOCD_SUPPORT is not set # CONFIG_DEBUG_THREAD_INFO is not set # CONFIG_DEBUG_COREDUMP is not set # end of Debugging Options # CONFIG_DISK_ACCESS is not set # CONFIG_EMUL is not set # CONFIG_CHARACTER_FRAMEBUFFER is not set # # File Systems # CONFIG_FILE_SYSTEM=y # CONFIG_FS_LOG_LEVEL_OFF is not set # CONFIG_FS_LOG_LEVEL_ERR is not set # CONFIG_FS_LOG_LEVEL_WRN is not set CONFIG_FS_LOG_LEVEL_INF=y # CONFIG_FS_LOG_LEVEL_DBG is not set CONFIG_FS_LOG_LEVEL=3 CONFIG_APP_LINK_WITH_FS=y CONFIG_FILE_SYSTEM_MAX_TYPES=2 CONFIG_FILE_SYSTEM_MAX_FILE_NAME=-1 CONFIG_FILE_SYSTEM_SHELL=y # CONFIG_FAT_FILESYSTEM_ELM is not set CONFIG_FILE_SYSTEM_LITTLEFS=y # # LittleFS Settings # CONFIG_FS_LITTLEFS_NUM_FILES=4 CONFIG_FS_LITTLEFS_NUM_DIRS=4 CONFIG_FS_LITTLEFS_READ_SIZE=16 CONFIG_FS_LITTLEFS_PROG_SIZE=16 CONFIG_FS_LITTLEFS_CACHE_SIZE=64 CONFIG_FS_LITTLEFS_LOOKAHEAD_SIZE=32 CONFIG_FS_LITTLEFS_BLOCK_CYCLES=512 # end of LittleFS Settings CONFIG_FS_LITTLEFS_FC_HEAP_SIZE=0 # CONFIG_FCB is not set # CONFIG_NVS is not set # end of File Systems # # Inter Processor Communication # # CONFIG_RPMSG_SERVICE is not set # end of Inter Processor Communication # CONFIG_JWT is not set CONFIG_LOG=y CONFIG_LOG_MODE_DEFERRED=y # CONFIG_LOG2_MODE_DEFERRED is not set # CONFIG_LOG2_MODE_IMMEDIATE is not set # CONFIG_LOG_MODE_IMMEDIATE is not set # CONFIG_LOG_MODE_MINIMAL is not set # CONFIG_LOG_FRONTEND is not set # # Logging levels filtering # CONFIG_LOG_RUNTIME_FILTERING=y CONFIG_LOG_DEFAULT_LEVEL=3 CONFIG_LOG_OVERRIDE_LEVEL=0 CONFIG_LOG_MAX_LEVEL=4 # end of Logging levels filtering # # Output Formatting # # # Prepend non-hexdump log message with function name # # CONFIG_LOG_FUNC_NAME_PREFIX_ERR is not set # CONFIG_LOG_FUNC_NAME_PREFIX_WRN is not set # CONFIG_LOG_FUNC_NAME_PREFIX_INF is not set CONFIG_LOG_FUNC_NAME_PREFIX_DBG=y # end of Prepend non-hexdump log message with function name # CONFIG_LOG_MIPI_SYST_ENABLE is not set # end of Output Formatting # # Processing # # CONFIG_LOG_PRINTK is not set CONFIG_LOG_MODE_OVERFLOW=y # CONFIG_LOG_BLOCK_IN_THREAD is not set CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD=10 CONFIG_LOG_PROCESS_THREAD=y CONFIG_LOG_PROCESS_THREAD_SLEEP_MS=1000 CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=2048 CONFIG_LOG_BUFFER_SIZE=1024 CONFIG_LOG_DETECT_MISSED_STRDUP=y CONFIG_LOG_STRDUP_MAX_STRING=32 CONFIG_LOG_STRDUP_BUF_COUNT=4 # CONFIG_LOG_STRDUP_POOL_PROFILING is not set # end of Processing # # Backends # # CONFIG_LOG_BACKEND_UART is not set # CONFIG_LOG_BACKEND_SWO is not set CONFIG_LOG_BACKEND_FS=y CONFIG_LOG_BACKEND_FS_OUTPUT_TEXT=y CONFIG_LOG_BACKEND_FS_OVERWRITE=y CONFIG_LOG_BACKEND_FS_FILE_PREFIX="log." CONFIG_LOG_BACKEND_FS_DIR="/lfs1" CONFIG_LOG_BACKEND_FS_FILE_SIZE=4096 CONFIG_LOG_BACKEND_FS_FILES_LIMIT=2 # end of Backends # # Misc # CONFIG_LOG_DOMAIN_ID=0 CONFIG_LOG_CMDS=y CONFIG_LOG2_USE_VLA=y # CONFIG_LOG2_ALWAYS_RUNTIME is not set # CONFIG_LOG2_FMT_SECTION is not set # end of Misc # # Device Management # # # Host command handler subsystem # # CONFIG_EC_HOST_CMD is not set # end of Host command handler subsystem # CONFIG_MCUMGR is not set # CONFIG_HAWKBIT is not set # CONFIG_UPDATEHUB is not set # CONFIG_OSDP is not set # end of Device Management # CONFIG_MODBUS is not set # # Networking # # CONFIG_NET_BUF is not set # CONFIG_NETWORKING is not set # end of Networking # # Portability # # end of Portability # # Power Management # # CONFIG_SYS_POWER_MANAGEMENT is not set # CONFIG_DEVICE_POWER_MANAGEMENT is not set # end of Power Management CONFIG_SHELL=y # CONFIG_SHELL_LOG_LEVEL_OFF is not set # CONFIG_SHELL_LOG_LEVEL_ERR is not set # CONFIG_SHELL_LOG_LEVEL_WRN is not set CONFIG_SHELL_LOG_LEVEL_INF=y # CONFIG_SHELL_LOG_LEVEL_DBG is not set CONFIG_SHELL_LOG_LEVEL=3 CONFIG_SHELL_BACKENDS=y CONFIG_SHELL_BACKEND_SERIAL=y CONFIG_SHELL_BACKEND_SERIAL_INIT_PRIORITY=0 CONFIG_SHELL_PROMPT_UART="uart:~$ " CONFIG_UART_SHELL_ON_DEV_NAME="UART_1" CONFIG_SHELL_BACKEND_SERIAL_INTERRUPT_DRIVEN=y CONFIG_SHELL_BACKEND_SERIAL_TX_RING_BUFFER_SIZE=8 CONFIG_SHELL_BACKEND_SERIAL_RX_RING_BUFFER_SIZE=64 CONFIG_SHELL_BACKEND_SERIAL_LOG_MESSAGE_QUEUE_TIMEOUT=100 CONFIG_SHELL_BACKEND_SERIAL_LOG_MESSAGE_QUEUE_SIZE=10 CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL_DEFAULT=y # CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL_DBG is not set # CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL_INF is not set # CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL_WRN is not set # CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL_ERR is not set # CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL_NONE is not set CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL=5 # CONFIG_SHELL_BACKEND_DUMMY is not set # CONFIG_SHELL_MINIMAL is not set CONFIG_SHELL_STACK_SIZE=2048 CONFIG_SHELL_BACKSPACE_MODE_DELETE=y CONFIG_SHELL_CMD_BUFF_SIZE=256 CONFIG_SHELL_PRINTF_BUFF_SIZE=30 CONFIG_SHELL_DEFAULT_TERMINAL_WIDTH=80 CONFIG_SHELL_DEFAULT_TERMINAL_HEIGHT=24 CONFIG_SHELL_ARGC_MAX=12 CONFIG_SHELL_TAB=y CONFIG_SHELL_TAB_AUTOCOMPLETION=y CONFIG_SHELL_WILDCARD=y CONFIG_SHELL_ECHO_STATUS=y # CONFIG_SHELL_START_OBSCURED is not set CONFIG_SHELL_VT100_COMMANDS=y CONFIG_SHELL_VT100_COLORS=y # CONFIG_SHELL_GETOPT is not set CONFIG_SHELL_METAKEYS=y CONFIG_SHELL_HELP=y CONFIG_SHELL_HELP_OPT_PARSE=y CONFIG_SHELL_HELP_ON_WRONG_ARGUMENT_COUNT=y CONFIG_SHELL_HISTORY=y CONFIG_SHELL_HISTORY_BUFFER=512 CONFIG_SHELL_STATS=y CONFIG_SHELL_CMDS=y CONFIG_SHELL_CMDS_RESIZE=y # CONFIG_SHELL_CMDS_SELECT is not set CONFIG_SHELL_CMD_ROOT="" CONFIG_SHELL_LOG_BACKEND=y CONFIG_KERNEL_SHELL=y CONFIG_DEVICE_SHELL=y # CONFIG_STATS is not set # CONFIG_IMG_MANAGER is not set # # Random Number Generators # # CONFIG_TEST_RANDOM_GENERATOR is not set # end of Random Number Generators # # Storage # CONFIG_FLASH_MAP=y # CONFIG_FLASH_MAP_SHELL is not set # CONFIG_FLASH_MAP_CUSTOM is not set # CONFIG_FLASH_AREA_CHECK_INTEGRITY is not set # CONFIG_STREAM_FLASH is not set # end of Storage # CONFIG_SETTINGS is not set # CONFIG_TASK_WDT is not set # # Testing # # CONFIG_ZTEST is not set # CONFIG_ZTEST_MOCKING is not set # CONFIG_TEST is not set # CONFIG_TEST_USERSPACE is not set # end of Testing # CONFIG_TIMING_FUNCTIONS is not set # CONFIG_TRACING is not set # end of Sub Systems and OS Services CONFIG_TOOLCHAIN_GNUARMEMB=y # # Build and Link Features # # # Linker Options # # CONFIG_LINKER_ORPHAN_SECTION_PLACE is not set CONFIG_LINKER_ORPHAN_SECTION_WARN=y # CONFIG_LINKER_ORPHAN_SECTION_ERROR is not set CONFIG_HAS_FLASH_LOAD_OFFSET=y # CONFIG_USE_DT_CODE_PARTITION is not set CONFIG_FLASH_LOAD_OFFSET=0 CONFIG_FLASH_LOAD_SIZE=0 # CONFIG_HAVE_CUSTOM_LINKER_SCRIPT is not set CONFIG_KERNEL_ENTRY="__start" CONFIG_LINKER_SORT_BY_ALIGNMENT=y CONFIG_SRAM_OFFSET=0 # # Linker Sections # # CONFIG_LINKER_USE_BOOT_SECTION is not set # CONFIG_LINKER_USE_PINNED_SECTION is not set # end of Linker Sections # end of Linker Options # # Compiler Options # # CONFIG_CODING_GUIDELINE_CHECK is not set # CONFIG_NATIVE_APPLICATION is not set CONFIG_SIZE_OPTIMIZATIONS=y # CONFIG_SPEED_OPTIMIZATIONS is not set # CONFIG_DEBUG_OPTIMIZATIONS is not set # CONFIG_NO_OPTIMIZATIONS is not set CONFIG_COMPILER_COLOR_DIAGNOSTICS=y CONFIG_COMPILER_OPT="" # CONFIG_MISRA_SANE is not set # end of Compiler Options # CONFIG_ASSERT_ON_ERRORS is not set # CONFIG_NO_RUNTIME_CHECKS is not set CONFIG_RUNTIME_ERROR_CHECKS=y # # Build Options # CONFIG_KERNEL_BIN_NAME="zephyr" CONFIG_OUTPUT_STAT=y CONFIG_OUTPUT_DISASSEMBLY=y # CONFIG_OUTPUT_DISASSEMBLE_ALL is not set CONFIG_OUTPUT_PRINT_MEMORY_USAGE=y # CONFIG_CLEANUP_INTERMEDIATE_FILES is not set # CONFIG_BUILD_NO_GAP_FILL is not set CONFIG_BUILD_OUTPUT_BIN=y # CONFIG_BUILD_OUTPUT_EXE is not set # CONFIG_BUILD_OUTPUT_S19 is not set # CONFIG_BUILD_OUTPUT_UF2 is not set # CONFIG_BUILD_OUTPUT_STRIPPED is not set # CONFIG_APPLICATION_DEFINED_SYSCALL is not set # CONFIG_MAKEFILE_EXPORTS is not set # end of Build Options # end of Build and Link Features # # Boot Options # # CONFIG_IS_BOOTLOADER is not set # CONFIG_BOOTLOADER_MCUBOOT is not set # CONFIG_BOOTLOADER_BOSSA is not set # end of Boot Options # # Compatibility # CONFIG_COMPAT_INCLUDES=y # end of Compatibility ```
ExtremeGTX commented 3 years ago

@MSyc-NS Could you please help me understand, Which case is being handled by the condition at line 295 ? https://github.com/zephyrproject-rtos/zephyr/blob/3221a1e8e703f94593c021c3434e135d05797f57/subsys/logging/log_backend_fs.c#L295 And why multiplying CONFIG_LOG_BACKEND_FS_FILES_LIMIT by 2 ?

elliot-wdtl commented 3 years ago

I thought that it was expected to create a new file on each boot but I noticed that it treated file with index 0 differently to the rest. https://github.com/zephyrproject-rtos/zephyr/pull/36946 addresses that but if it is intended to append to latest file on each boot additional changes will be required.

ExtremeGTX commented 3 years ago

@elliot-wdtl I could share my changes, if it is acceptable to change the behavior to "append to the last file" instead of "Just create new file". Also I have implemented log rotate functionality which will keep filenames between log.0000 and log.CONFIG_LOG_BACKEND_FS_FILES_LIMIT