1)I want to use "mktime" and "localtime" in my nrf52840 code ,how do i include time.h file?
2)I am using math.h file , in prj.conf i define "CONFIG_NEWLIB_LIBC=y" but I continuously get error as below ,how do i resolve it?
error:
1)I want to use "mktime" and "localtime" in my nrf52840 code ,how do i include time.h file?
2)I am using math.h file , in prj.conf i define "CONFIG_NEWLIB_LIBC=y" but I continuously get error as below ,how do i resolve it?
error:
yes i have did it, but i found time.h from nrf connect sdk which does not have 'mktime' and 'localtime' function.I want to use time.h from "usr/include/time.h" which has this function.
I have attache my cmakefile and prj.conf,
and after adding math.h i am getting error as above i mention
# # Copyright (c) 2021 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) # add_subdirectory(common) # add_subdirectory_ifdef(CONFIG_BT_HCI host) # add_subdirectory_ifdef(CONFIG_BT_SHELL shell) # add_subdirectory_ifdef(CONFIG_BT_CONN services) # add_subdirectory_ifdef(CONFIG_BT_MESH mesh) # add_subdirectory_ifdef(CONFIG_BT_AUDIO audio) # add_subdirectory_ifdef(CONFIG_BT_CRYPTO crypto) # if(CONFIG_BT_CTLR AND CONFIG_BT_LL_SW_SPLIT) # add_subdirectory(controller) # endif() zephyr_include_directories(${ZEPHYR_BASE}/subsys/bluetooth) # zephyr_include_directories(${ZEPHYR_BASE} # Target name project(repeater) set(APP_FIRMWARE_VERSION 0x1BD) set(CLIENT CLIENT_ILUMI) set(BOOTLOADER_VERSION 0x106) # Project root directory set(PROJ_DIR ../..) set(THIRD_PARTY ../../third_party) # set(CMAKE_C_STANDARD 11) # set(CMAKE_CXX_STANDARD 11) set(RTC_SYNC_V2 0) set(C_SRC ${PROJ_DIR}/app/src/main.c ${PROJ_DIR}/app/src/ilumi_pa_lna_assist.c ${PROJ_DIR}/app/src/mock_placeholder.c ${PROJ_DIR}/app/src/RTC.c ${PROJ_DIR}/app/src/i2c_nrf52.c ${PROJ_DIR}/app/src/timeout.c ${PROJ_DIR}/app/src/connect_notify.c ${PROJ_DIR}/app/src/rtc_func.c ${PROJ_DIR}/app/src/adv_timer.c ${PROJ_DIR}/app/src/internal_flash.c ${PROJ_DIR}/app/src/ilumi_app_timer.c ${PROJ_DIR}/app/src/ilumi_ble_app.c ${PROJ_DIR}/app/src/hal_uart.c ${PROJ_DIR}/app/src/ilumi_softdevice_handler_sdkv13.c ${PROJ_DIR}/app/src/uart.c ${PROJ_DIR}/app/src/uart_logf.c ${PROJ_DIR}/app/src/ilumi_api_type_define.c ${PROJ_DIR}/app/src/scene.c ${PROJ_DIR}/app/src/scene_predefine.c ${PROJ_DIR}/app/src/log.c ${PROJ_DIR}/app/src/OSAL_Nv.c ${PROJ_DIR}/app/src/ilumi_nv_data.c ${PROJ_DIR}/app/src/ilumi_user_data.c ${PROJ_DIR}/app/src/ilumi_recv_msg.c ${PROJ_DIR}/app/src/ilumi_common_msg.c ${PROJ_DIR}/app/src/ilumi_temp_compensation.c ${PROJ_DIR}/app/src/ilumi_circadian.c ${PROJ_DIR}/app/src/ilumi_api.c ${PROJ_DIR}/app/src/ble_stack_util.c ${PROJ_DIR}/app/src/user_interface.c ${PROJ_DIR}/app/src/ilumi_utility.c ${PROJ_DIR}/app/src/ilumi_timer_def.c ${PROJ_DIR}/app/src/ilumi_api_service.c ${PROJ_DIR}/app/src/ilumi_task_dispatch.c ${PROJ_DIR}/app/src/ilumi_user_action.c ${PROJ_DIR}/app/src/ilumi_uart_cmd.c ${PROJ_DIR}/app/src/ilumi_properties.c ${PROJ_DIR}/app/src/ilumi_mesh.c ${PROJ_DIR}/app/src/ilumi_mesh_config.c ${PROJ_DIR}/app/src/ilumi_special_effect.c ${PROJ_DIR}/app/src/ilumi_app_button_sdk13.c ${PROJ_DIR}/app/src/alarm_list.c ${PROJ_DIR}/app/src/alarm_manager.c ${PROJ_DIR}/app/src/color_util.c ${PROJ_DIR}/app/src/rtc_util.c ${PROJ_DIR}/app/src/time_util.c ${PROJ_DIR}/app/src/company.c ${PROJ_DIR}/app/src/ilumi_dfu_func.c ${PROJ_DIR}/app/src/ilumi_dfu_service.c # ${PROJ_DIR}/app/src/ilumi_queue.c # Source files from booloader section ${PROJ_DIR}/bootloader/src/bootloader_util_gcc.c ${THIRD_PARTY}/nrf_drv_gpiote.c ${THIRD_PARTY}/crc16.c ${THIRD_PARTY}/app_error.c ${THIRD_PARTY}/nrf_assert.c ${THIRD_PARTY}/app_util_platform.c ${THIRD_PARTY}/app_scheduler.c ${THIRD_PARTY}/nrf_drv_ppi.c ${THIRD_PARTY}/nrf_drv_pwm.c ${THIRD_PARTY}/nrf_drv_clock.c ${THIRD_PARTY}/nrf_drv_common.c ${THIRD_PARTY}/ble_flash.c # ${THIRD_PARTY}/nrf_drv_twis.c ${THIRD_PARTY}/nrf_drv_twi.c ${THIRD_PARTY}/nrf_drv_spi.c ${THIRD_PARTY}/ble_srv_common.c ${THIRD_PARTY}/ble_dis.c ${THIRD_PARTY}/ble_conn_params.c ${THIRD_PARTY}/softdevice_handler_appsh.c # ${THIRD_PARTY}system_nrf52.c ) # C++ source files set(CPP_SRC ${PROJ_DIR}/app/src/RouteCore.cpp ${PROJ_DIR}/app/src/routing_api.cpp ) set(INCLUDE_DIR # /usr/include/x86_64-linux-gnu/bits ${PROJ_DIR}/app/repeater ${PROJ_DIR}/app/inc ${PROJ_DIR}/bootloader/repeater ${PROJ_DIR}/bootloader/inc ${THIRD_PARTY} /usr/include ) # Header files from NRF Connect SDK # Add source files to the target target_sources(app PRIVATE ${C_SRC} ${CPP_SRC} ) target_include_directories(app PRIVATE ${INCLUDE_DIR} ) # target_compile_options(app PRIVATE # -Wno-unused-function # -Wno-unused-variable # -Wno-unused-but-set-variable # -mfloat-abi=hard # -mfpu=fpv4-sp-d16 # -mcpu=cortex-m4 # -mthumb # -mabi=aapcs # -DNRF52 # -Wall # # -Werror # -fno-exceptions # -fdata-sections # -ffunction-sections # -g # -Os # -std=gnu99 # ) # target_link_options(app PRIVATE # -mcpu=cortex-m4 # -mthumb # -mabi=aapcs # -specs=nano.specs # -specs=nano.specs # -Xlinker --cref # -Xlinker --gc-sections # -Xlinker --undefined=m_boot_settings # ) add_definitions(-DREPEATER) add_definitions(-DSDK_V13) add_definitions(-DSDK_V11) add_definitions(-DBLE_STACK_SUPPORT_REQD) add_definitions(-D${CLIENT}) add_definitions(-DAPP_FIRMWARE_VERSION=${APP_FIRMWARE_VERSION}) add_definitions(-DENABLE_RTC) add_definitions(-DUSER_DEFINED_COLOR) add_definitions(-DDEBUG) add_definitions(-DFDIN_SUPPORT) add_definitions(-DNRF52) add_definitions(-DNORDIC_PLATFORM) add_definitions(-DNRF52840_XXAA) # Set the ASM flags globally for all targets add_compile_options(-DNRF_SD_BLE_API_VERSION=5)
yes i have did it, but i found time.h from nrf connect sdk which does not have 'mktime' and 'localtime' function.I want to use time.h from "usr/include/time.h" which has this function.
I have attache my cmakefile and prj.conf,
and after adding math.h i am getting error as above i mention
# # Copyright (c) 2021 Nordic Semiconductor ASA # # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # cmake_minimum_required(VERSION 3.20.0) find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) # add_subdirectory(common) # add_subdirectory_ifdef(CONFIG_BT_HCI host) # add_subdirectory_ifdef(CONFIG_BT_SHELL shell) # add_subdirectory_ifdef(CONFIG_BT_CONN services) # add_subdirectory_ifdef(CONFIG_BT_MESH mesh) # add_subdirectory_ifdef(CONFIG_BT_AUDIO audio) # add_subdirectory_ifdef(CONFIG_BT_CRYPTO crypto) # if(CONFIG_BT_CTLR AND CONFIG_BT_LL_SW_SPLIT) # add_subdirectory(controller) # endif() zephyr_include_directories(${ZEPHYR_BASE}/subsys/bluetooth) # zephyr_include_directories(${ZEPHYR_BASE} # Target name project(repeater) set(APP_FIRMWARE_VERSION 0x1BD) set(CLIENT CLIENT_ILUMI) set(BOOTLOADER_VERSION 0x106) # Project root directory set(PROJ_DIR ../..) set(THIRD_PARTY ../../third_party) # set(CMAKE_C_STANDARD 11) # set(CMAKE_CXX_STANDARD 11) set(RTC_SYNC_V2 0) set(C_SRC ${PROJ_DIR}/app/src/main.c ${PROJ_DIR}/app/src/ilumi_pa_lna_assist.c ${PROJ_DIR}/app/src/mock_placeholder.c ${PROJ_DIR}/app/src/RTC.c ${PROJ_DIR}/app/src/i2c_nrf52.c ${PROJ_DIR}/app/src/timeout.c ${PROJ_DIR}/app/src/connect_notify.c ${PROJ_DIR}/app/src/rtc_func.c ${PROJ_DIR}/app/src/adv_timer.c ${PROJ_DIR}/app/src/internal_flash.c ${PROJ_DIR}/app/src/ilumi_app_timer.c ${PROJ_DIR}/app/src/ilumi_ble_app.c ${PROJ_DIR}/app/src/hal_uart.c ${PROJ_DIR}/app/src/ilumi_softdevice_handler_sdkv13.c ${PROJ_DIR}/app/src/uart.c ${PROJ_DIR}/app/src/uart_logf.c ${PROJ_DIR}/app/src/ilumi_api_type_define.c ${PROJ_DIR}/app/src/scene.c ${PROJ_DIR}/app/src/scene_predefine.c ${PROJ_DIR}/app/src/log.c ${PROJ_DIR}/app/src/OSAL_Nv.c ${PROJ_DIR}/app/src/ilumi_nv_data.c ${PROJ_DIR}/app/src/ilumi_user_data.c ${PROJ_DIR}/app/src/ilumi_recv_msg.c ${PROJ_DIR}/app/src/ilumi_common_msg.c ${PROJ_DIR}/app/src/ilumi_temp_compensation.c ${PROJ_DIR}/app/src/ilumi_circadian.c ${PROJ_DIR}/app/src/ilumi_api.c ${PROJ_DIR}/app/src/ble_stack_util.c ${PROJ_DIR}/app/src/user_interface.c ${PROJ_DIR}/app/src/ilumi_utility.c ${PROJ_DIR}/app/src/ilumi_timer_def.c ${PROJ_DIR}/app/src/ilumi_api_service.c ${PROJ_DIR}/app/src/ilumi_task_dispatch.c ${PROJ_DIR}/app/src/ilumi_user_action.c ${PROJ_DIR}/app/src/ilumi_uart_cmd.c ${PROJ_DIR}/app/src/ilumi_properties.c ${PROJ_DIR}/app/src/ilumi_mesh.c ${PROJ_DIR}/app/src/ilumi_mesh_config.c ${PROJ_DIR}/app/src/ilumi_special_effect.c ${PROJ_DIR}/app/src/ilumi_app_button_sdk13.c ${PROJ_DIR}/app/src/alarm_list.c ${PROJ_DIR}/app/src/alarm_manager.c ${PROJ_DIR}/app/src/color_util.c ${PROJ_DIR}/app/src/rtc_util.c ${PROJ_DIR}/app/src/time_util.c ${PROJ_DIR}/app/src/company.c ${PROJ_DIR}/app/src/ilumi_dfu_func.c ${PROJ_DIR}/app/src/ilumi_dfu_service.c # ${PROJ_DIR}/app/src/ilumi_queue.c # Source files from booloader section ${PROJ_DIR}/bootloader/src/bootloader_util_gcc.c ${THIRD_PARTY}/nrf_drv_gpiote.c ${THIRD_PARTY}/crc16.c ${THIRD_PARTY}/app_error.c ${THIRD_PARTY}/nrf_assert.c ${THIRD_PARTY}/app_util_platform.c ${THIRD_PARTY}/app_scheduler.c ${THIRD_PARTY}/nrf_drv_ppi.c ${THIRD_PARTY}/nrf_drv_pwm.c ${THIRD_PARTY}/nrf_drv_clock.c ${THIRD_PARTY}/nrf_drv_common.c ${THIRD_PARTY}/ble_flash.c # ${THIRD_PARTY}/nrf_drv_twis.c ${THIRD_PARTY}/nrf_drv_twi.c ${THIRD_PARTY}/nrf_drv_spi.c ${THIRD_PARTY}/ble_srv_common.c ${THIRD_PARTY}/ble_dis.c ${THIRD_PARTY}/ble_conn_params.c ${THIRD_PARTY}/softdevice_handler_appsh.c # ${THIRD_PARTY}system_nrf52.c ) # C++ source files set(CPP_SRC ${PROJ_DIR}/app/src/RouteCore.cpp ${PROJ_DIR}/app/src/routing_api.cpp ) set(INCLUDE_DIR # /usr/include/x86_64-linux-gnu/bits ${PROJ_DIR}/app/repeater ${PROJ_DIR}/app/inc ${PROJ_DIR}/bootloader/repeater ${PROJ_DIR}/bootloader/inc ${THIRD_PARTY} /usr/include ) # Header files from NRF Connect SDK # Add source files to the target target_sources(app PRIVATE ${C_SRC} ${CPP_SRC} ) target_include_directories(app PRIVATE ${INCLUDE_DIR} ) # target_compile_options(app PRIVATE # -Wno-unused-function # -Wno-unused-variable # -Wno-unused-but-set-variable # -mfloat-abi=hard # -mfpu=fpv4-sp-d16 # -mcpu=cortex-m4 # -mthumb # -mabi=aapcs # -DNRF52 # -Wall # # -Werror # -fno-exceptions # -fdata-sections # -ffunction-sections # -g # -Os # -std=gnu99 # ) # target_link_options(app PRIVATE # -mcpu=cortex-m4 # -mthumb # -mabi=aapcs # -specs=nano.specs # -specs=nano.specs # -Xlinker --cref # -Xlinker --gc-sections # -Xlinker --undefined=m_boot_settings # ) add_definitions(-DREPEATER) add_definitions(-DSDK_V13) add_definitions(-DSDK_V11) add_definitions(-DBLE_STACK_SUPPORT_REQD) add_definitions(-D${CLIENT}) add_definitions(-DAPP_FIRMWARE_VERSION=${APP_FIRMWARE_VERSION}) add_definitions(-DENABLE_RTC) add_definitions(-DUSER_DEFINED_COLOR) add_definitions(-DDEBUG) add_definitions(-DFDIN_SUPPORT) add_definitions(-DNRF52) add_definitions(-DNORDIC_PLATFORM) add_definitions(-DNRF52840_XXAA) # Set the ASM flags globally for all targets add_compile_options(-DNRF_SD_BLE_API_VERSION=5)