官方SDK参考路径如下最好是先找一个空白工程不要直接使用官方例程便于后续移植开发移植如下1、新建freertos组对文件进行管理添加的文件路径如下这些文件路径为路径为路径为路径为还需要添加官方对freertos二次封装的api文件路径为然后添加头路径索引这里需要根据自己的路径我这个仅作参考2、进行编译编译之后可能会报一个定时器的错误直接去FREERTOS_CONFIG.h文件中把定时器宏开启即可清除这个报错之后还会有另个报错报错是定时器中断重复定义port_cmsis_systick.oFreeRTOS CMSIS 移植层自带 RTC1 中断服务函数drv_rtc.onrf_drv_rtc 驱动自带RTC1_IRQHandler直接不使用nrf_drv_rtc工程移除drv_rtc.c全程只用 FreeRTOS 系统定时器即可路径一般在这个组下有个drv_rtc.c直接移除就行三、解决main报错头文件包含如下#include stdbool.h #include stdint.h #include string.h #include nordic_common.h #include nrf.h #include app_error.h #include app_timer.h #include app_uart.h #include app_scheduler.h #include nrf_log.h #include nrf_log_ctrl.h #include nrf_log_default_backends.h #include nrf_pwr_mgmt.h #include nrf_drv_clock.h #include nrf_drv_saadc.h #if defined (UART_PRESENT) #include nrf_uart.h #endif #if defined (UARTE_PRESENT) #include nrf_uarte.h #endif #include bsp.h #include bsp_btn_ble.h #include ble.h #include ble_hci.h #include ble_srv_common.h #include ble_advdata.h #include ble_advertising.h #include ble_conn_params.h #include ble_conn_state.h #include nrf_ble_gatt.h #include nrf_ble_qwr.h #include nrf_ble_lesc.h #include ble_bas.h #include ble_lbs.h #include ble_hrs.h #include ble_dis.h #include ble_hts.h #include my_ble_uarts.h #include sensorsim.h #include fds.h #include device_name_op.h #include nrf_sdh_soc.h #include nrf_sdh_ble.h #include nrf_sdh_freertos.h #include peer_manager.h #include peer_manager_handler.h #includenrf_sdh.h #include FreeRTOS.h #include task.h #include timers.h #include semphr.h开始解决报错首先sdk_config.h里搜索NRF_SDH_DISPATCH_MODEL把这个宏定义为2即可然后是定时器函数我们需要把组中的定时器app_timer2.c函数移除然后添加app_timer_freertos.c函数路径为现在只剩最后一个报错这个是空闲钩子函数打开freertos_config.h确保参数置1然后在main中进行实现//log #if NRF_LOG_ENABLED static TaskHandle_t m_logger_thread; /** Definition of Logger thread. */ #endif void vApplicationIdleHook( void ) { #if NRF_LOG_ENABLED vTaskResume(m_logger_thread); #endif }至此结束关于函数的使用以及初始化部分在下一篇有问题评论区见