[ESP-IDF][VSCode][1] esp_timer 프로젝트 분석
:고해상도 타이머 예제로 ESP-IDF:Show Examples Project 을 이용해 프로젝트를 생성 할수 있습니다.
Visual Studio Code 를 IDE로 사용했습니다. 고해상도 인지는 모르지만 uSec 단위로 제어 가능합니다.
※ Espressif esp_timer 관련 문서 링크
https://docs.espressif.com/projects/esp-idf/en/v5.1.2/esp32c6/api-reference/system/esp_timer.html#
목차
ESP-IDF : Show Examples Project
:esp-idf > System > esp_timer 순서로 찾아주세요. >검색이 되면 좋을텐데 그건 없네요.
esp_timer 프로젝트 우측 창에 사용법도 간단히 보여 주네요.
"Create project using example esp_timer" 선택후 프로젝트 루트 디렉토리 선택하기
: 이창은 어디에도 프로젝트 루트 디렉토리라고 메시지/타이틀도 안나오니 잘 선택해주세요.
ESP-IDF SDK Configuration Editor 사용하기 > 특별히 수정 없이 저장만 했습니다.
: menuconfig > Component config > High resolution timer
Build Project
: 디바이스 타겟 설정은 미리 다 되어 있다는 가정하에 빌드를 실행합니다.
Executing task: ninja
[0/1] Re-running CMake...
-- git rev-parse returned 'fatal: not a git repository (or any of the parent directories): .git'
-- Could not use 'git describe' to determine PROJECT_VER.
-- Building ESP-IDF components for target esp32c6
-- Project sdkconfig file /home/xxx/Project/esp32/esp_timer/sdkconfig
Loading defaults file /home/xxx/Project/esp32/esp_timer/sdkconfig.defaults...
-- App "esp_timer_example" version: 1
-- Adding linker script /home/xxx/Project/esp32/esp_timer/build/esp-idf/esp_system/ld/memory.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_system/ld/esp32c6/sections.ld.in
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.api.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.rvfp.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.newlib.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.version.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.phy.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.coexist.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.net80211.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.pp.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.wdt.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.newlib-normal.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.heap.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/soc/esp32c6/ld/esp32c6.peripherals.ld
-- Components: app_trace app_update bootloader bootloader_support bt cmock console cxx driver efuse esp-tls esp_adc esp_app_format esp_coex esp_common esp_eth esp_event esp_gdbstub esp_hid esp_http_client esp_http_server esp_https_ota esp_https_server esp_hw_support esp_lcd esp_local_ctrl esp_mm esp_netif esp_netif_stack esp_partition esp_phy esp_pm esp_psram esp_ringbuf esp_rom esp_system esp_timer esp_wifi espcoredump esptool_py fatfs freertos hal heap http_parser idf_test ieee802154 json log lwip main mbedtls mqtt newlib nvs_flash openthread partition_table protobuf-c protocomm pthread riscv sdmmc soc spi_flash spiffs tcp_transport ulp unity usb vfs wear_levelling wifi_provisioning wpa_supplicant
-- Component paths: /home/xxx/esp/esp-idf/components/app_trace /home/xxx/esp/esp-idf/components/app_update /home/xxx/esp/esp-idf/components/bootloader /home/xxx/esp/esp-idf/components/bootloader_support /home/xxx/esp/esp-idf/components/bt /home/xxx/esp/esp-idf/components/cmock /home/xxx/esp/esp-idf/components/console /home/xxx/esp/esp-idf/components/cxx /home/xxx/esp/esp-idf/components/driver /home/xxx/esp/esp-idf/components/efuse /home/xxx/esp/esp-idf/components/esp-tls /home/xxx/esp/esp-idf/components/esp_adc /home/xxx/esp/esp-idf/components/esp_app_format /home/xxx/esp/esp-idf/components/esp_coex /home/xxx/esp/esp-idf/components/esp_common /home/xxx/esp/esp-idf/components/esp_eth /home/xxx/esp/esp-idf/components/esp_event /home/xxx/esp/esp-idf/components/esp_gdbstub /home/xxx/esp/esp-idf/components/esp_hid /home/xxx/esp/esp-idf/components/esp_http_client /home/xxx/esp/esp-idf/components/esp_http_server /home/xxx/esp/esp-idf/components/esp_https_ota /home/xxx/esp/esp-idf/components/esp_https_server /home/xxx/esp/esp-idf/components/esp_hw_support /home/xxx/esp/esp-idf/components/esp_lcd /home/xxx/esp/esp-idf/components/esp_local_ctrl /home/xxx/esp/esp-idf/components/esp_mm /home/xxx/esp/esp-idf/components/esp_netif /home/xxx/esp/esp-idf/components/esp_netif_stack /home/xxx/esp/esp-idf/components/esp_partition /home/xxx/esp/esp-idf/components/esp_phy /home/xxx/esp/esp-idf/components/esp_pm /home/xxx/esp/esp-idf/components/esp_psram /home/xxx/esp/esp-idf/components/esp_ringbuf /home/xxx/esp/esp-idf/components/esp_rom /home/xxx/esp/esp-idf/components/esp_system /home/xxx/esp/esp-idf/components/esp_timer /home/xxx/esp/esp-idf/components/esp_wifi /home/xxx/esp/esp-idf/components/espcoredump /home/xxx/esp/esp-idf/components/esptool_py /home/xxx/esp/esp-idf/components/fatfs /home/xxx/esp/esp-idf/components/freertos /home/xxx/esp/esp-idf/components/hal /home/xxx/esp/esp-idf/components/heap /home/xxx/esp/esp-idf/components/http_parser /home/xxx/esp/esp-idf/components/idf_test /home/xxx/esp/esp-idf/components/ieee802154 /home/xxx/esp/esp-idf/components/json /home/xxx/esp/esp-idf/components/log /home/xxx/esp/esp-idf/components/lwip /home/xxx/Project/esp32/esp_timer/main /home/xxx/esp/esp-idf/components/mbedtls /home/xxx/esp/esp-idf/components/mqtt /home/xxx/esp/esp-idf/components/newlib /home/xxx/esp/esp-idf/components/nvs_flash /home/xxx/esp/esp-idf/components/openthread /home/xxx/esp/esp-idf/components/partition_table /home/xxx/esp/esp-idf/components/protobuf-c /home/xxx/esp/esp-idf/components/protocomm /home/xxx/esp/esp-idf/components/pthread /home/xxx/esp/esp-idf/components/riscv /home/xxx/esp/esp-idf/components/sdmmc /home/xxx/esp/esp-idf/components/soc /home/xxx/esp/esp-idf/components/spi_flash /home/xxx/esp/esp-idf/components/spiffs /home/xxx/esp/esp-idf/components/tcp_transport /home/xxx/esp/esp-idf/components/ulp /home/xxx/esp/esp-idf/components/unity /home/xxx/esp/esp-idf/components/usb /home/xxx/esp/esp-idf/components/vfs /home/xxx/esp/esp-idf/components/wear_levelling /home/xxx/esp/esp-idf/components/wifi_provisioning /home/xxx/esp/esp-idf/components/wpa_supplicant
-- Configuring done
-- Generating done
-- Build files have been written to: /home/xxx/Project/esp32/esp_timer/build
[13/922] Generating ../../partition_table/partition-table.bin
Partition table binary generated. Contents:
*******************************************************************************
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,24K,
phy_init,data,phy,0xf000,4K,
factory,app,factory,0x10000,1M,
*******************************************************************************
[414/922] Performing configure step for 'bootloader'
-- Found Git: /usr/bin/git (found version "2.34.1")
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/xxx/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/riscv32-esp-elf-gcc
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/xxx/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/riscv32-esp-elf-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/xxx/.espressif/tools/riscv32-esp-elf/esp-12.2.0_20230208/riscv32-esp-elf/bin/riscv32-esp-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building ESP-IDF components for target esp32c6
-- Project sdkconfig file /home/xxx/Project/esp32/esp_timer/sdkconfig
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of time_t
-- Check size of time_t - done
-- Adding linker script /home/xxx/esp/esp-idf/components/soc/esp32c6/ld/esp32c6.peripherals.ld
-- App "bootloader" version: v5.1.2
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.api.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.rvfp.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.newlib.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.phy.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.wdt.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/esp_rom/esp32c6/ld/esp32c6.rom.version.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/bootloader/subproject/main/ld/esp32c6/bootloader.ld
-- Adding linker script /home/xxx/esp/esp-idf/components/bootloader/subproject/main/ld/esp32c6/bootloader.rom.ld
-- Components: bootloader bootloader_support efuse esp_app_format esp_common esp_hw_support esp_rom esp_system esptool_py freertos hal log main micro-ecc newlib partition_table riscv soc spi_flash
-- Component paths: /home/xxx/esp/esp-idf/components/bootloader /home/xxx/esp/esp-idf/components/bootloader_support /home/xxx/esp/esp-idf/components/efuse /home/xxx/esp/esp-idf/components/esp_app_format /home/xxx/esp/esp-idf/components/esp_common /home/xxx/esp/esp-idf/components/esp_hw_support /home/xxx/esp/esp-idf/components/esp_rom /home/xxx/esp/esp-idf/components/esp_system /home/xxx/esp/esp-idf/components/esptool_py /home/xxx/esp/esp-idf/components/freertos /home/xxx/esp/esp-idf/components/hal /home/xxx/esp/esp-idf/components/log /home/xxx/esp/esp-idf/components/bootloader/subproject/main /home/xxx/esp/esp-idf/components/bootloader/subproject/components/micro-ecc /home/xxx/esp/esp-idf/components/newlib /home/xxx/esp/esp-idf/components/partition_table /home/xxx/esp/esp-idf/components/riscv /home/xxx/esp/esp-idf/components/soc /home/xxx/esp/esp-idf/components/spi_flash
-- Configuring done
-- Generating done
-- Build files have been written to: /home/xxx/Project/esp32/esp_timer/build/bootloader
[519/922] Performing build step for 'bootloader'
[1/107] Generating project_elf_src_esp32c6.c
[2/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/dport_access_common.c.obj
[3/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/interrupts.c.obj
[4/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/gpio_periph.c.obj
[5/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/uart_periph.c.obj
[6/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/gdma_periph.c.obj
[7/107] Building C object CMakeFiles/bootloader.elf.dir/project_elf_src_esp32c6.c.obj
[8/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/lldesc.c.obj
[9/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/adc_periph.c.obj
[10/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/dedic_gpio_periph.c.obj
[11/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/spi_periph.c.obj
[12/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/ledc_periph.c.obj
[13/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/sdm_periph.c.obj
[14/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/pcnt_periph.c.obj
[15/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/rmt_periph.c.obj
[16/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/i2c_periph.c.obj
[17/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/temperature_sensor_periph.c.obj
[18/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/parlio_periph.c.obj
[19/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/ieee802154_periph.c.obj
[20/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/i2s_periph.c.obj
[21/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/timer_periph.c.obj
[22/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/mcpwm_periph.c.obj
[23/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/twai_periph.c.obj
[24/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/rtc_io_periph.c.obj
[25/107] Building C object esp-idf/soc/CMakeFiles/__idf_soc.dir/esp32c6/sdio_slave_periph.c.obj
[26/107] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/mpu_hal.c.obj
[27/107] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/efuse_hal.c.obj
[28/107] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/lp_timer_hal.c.obj
[29/107] Building C object esp-idf/esp_app_format/CMakeFiles/__idf_esp_app_format.dir/esp_app_desc.c.obj
[30/107] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/esp32c6/efuse_hal.c.obj
[31/107] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/cache_hal.c.obj
[32/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_clock_init.c.obj
[33/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_efuse.c.obj
[34/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_common.c.obj
[35/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_random_esp32c6.c.obj
[36/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_common_loader.c.obj
[37/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_random.c.obj
[38/107] Building C object esp-idf/spi_flash/CMakeFiles/__idf_spi_flash.dir/spi_flash_wrap.c.obj
[39/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_mem.c.obj
[40/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_encrypt.c.obj
[41/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/secure_boot.c.obj
[42/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/bootloader_flash/src/flash_qio_mode.c.obj
[43/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_clock_loader.c.obj
[44/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/flash_partitions.c.obj
[45/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/bootloader_flash/src/bootloader_flash_config_esp32c6.c.obj
[46/107] Building C object esp-idf/hal/CMakeFiles/__idf_hal.dir/mmu_hal.c.obj
[47/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/bootloader_flash/src/bootloader_flash.c.obj
[48/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_init.c.obj
[49/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_console.c.obj
[50/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_console_loader.c.obj
[51/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_panic.c.obj
[52/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32c6/bootloader_ecdsa.c.obj
[53/107] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32c6/esp_efuse_table.c.obj
[54/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32c6/bootloader_soc.c.obj
[55/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32c6/bootloader_sha.c.obj
[56/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/bootloader_utility.c.obj
[57/107] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32c6/esp_efuse_fields.c.obj
[58/107] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32c6/esp_efuse_rtc_calib.c.obj
[59/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp32c6/bootloader_esp32c6.c.obj
[60/107] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_api.c.obj
[61/107] Building C object esp-idf/esp_system/CMakeFiles/__idf_esp_system.dir/esp_err.c.obj
[62/107] Building C object esp-idf/bootloader_support/CMakeFiles/__idf_bootloader_support.dir/src/esp_image_format.c.obj
[63/107] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_fields.c.obj
[64/107] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/esp_memory_utils.c.obj
[65/107] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/esp32c6/esp_efuse_utility.c.obj
[66/107] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/cpu.c.obj
[67/107] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c.obj
[68/107] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c6/cpu_region_protect.c.obj
[69/107] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c6/pmu_param.c.obj
[70/107] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c6/chip_info.c.obj
[71/107] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c6/ocode_init.c.obj
[72/107] Building C object esp-idf/esp_common/CMakeFiles/__idf_esp_common.dir/src/esp_err_to_name.c.obj
[73/107] Building C object esp-idf/efuse/CMakeFiles/__idf_efuse.dir/src/esp_efuse_utility.c.obj
[74/107] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c6/rtc_clk.c.obj
[75/107] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_crc.c.obj
[76/107] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c6/pmu_init.c.obj
[77/107] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c6/rtc_clk_init.c.obj
[78/107] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_sys.c.obj
[79/107] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_uart.c.obj
[80/107] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_spiflash.c.obj
[81/107] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_efuse.c.obj
[82/107] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_systimer.c.obj
[83/107] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c6/pmu_sleep.c.obj
[84/107] Building C object esp-idf/esp_hw_support/CMakeFiles/__idf_esp_hw_support.dir/port/esp32c6/rtc_time.c.obj
[85/107] Building C object esp-idf/main/CMakeFiles/__idf_main.dir/bootloader_start.c.obj
[86/107] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_wdt.c.obj
[87/107] Building C object esp-idf/esp_rom/CMakeFiles/__idf_esp_rom.dir/patches/esp_rom_hp_regi2c_esp32c6.c.obj
[88/107] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log.c.obj
[89/107] Building C object esp-idf/micro-ecc/CMakeFiles/__idf_micro-ecc.dir/uECC_verify_antifault.c.obj
[90/107] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log_noos.c.obj
[91/107] Building C object esp-idf/log/CMakeFiles/__idf_log.dir/log_buffers.c.obj
[92/107] Linking C static library esp-idf/log/liblog.a
[93/107] Linking C static library esp-idf/esp_rom/libesp_rom.a
[94/107] Linking C static library esp-idf/esp_common/libesp_common.a
[95/107] Linking C static library esp-idf/esp_hw_support/libesp_hw_support.a
[96/107] Linking C static library esp-idf/esp_system/libesp_system.a
[97/107] Linking C static library esp-idf/efuse/libefuse.a
[98/107] Linking C static library esp-idf/bootloader_support/libbootloader_support.a
[99/107] Linking C static library esp-idf/esp_app_format/libesp_app_format.a
[100/107] Linking C static library esp-idf/spi_flash/libspi_flash.a
[101/107] Linking C static library esp-idf/hal/libhal.a
[102/107] Linking C static library esp-idf/micro-ecc/libmicro-ecc.a
[103/107] Linking C static library esp-idf/soc/libsoc.a
[104/107] Linking C static library esp-idf/main/libmain.a
[105/107] Linking C executable bootloader.elf
[106/107] Generating binary image from built executable
esptool.py v4.7.dev2
Creating esp32c6 image...
Merged 2 ELF sections
Successfully created esp32c6 image.
Generated /home/xxx/Project/esp32/esp_timer/build/bootloader/bootloader.bin
[107/107] cd /home/xxx/Project/esp32/esp_timer/build/bootloader/esp-idf/esptool_py && /home/xxx/.espressif/python_env/idf5.1_py3.10_env/bin/python /home/xxx/esp/esp-idf/components/partition_table/check_sizes.py --offset 0x8000 bootloader 0x0 /home/xxx/Project/esp32/esp_timer/build/bootloader/bootloader.bin
Bootloader binary size 0x5350 bytes. 0x2cb0 bytes (35%) free.
[921/922] Generating binary image from built executable
esptool.py v4.7.dev2
Creating esp32c6 image...
Merged 2 ELF sections
Successfully created esp32c6 image.
Generated /home/xxx/Project/esp32/esp_timer/build/esp_timer_example.bin
[922/922] cd /home/xxx/Project/esp32/esp_timer/build/esp-...e/xxx/Project/esp32/esp_timer/build/esp_timer_example.bin
esp_timer_example.bin binary size 0x22e20 bytes. Smallest app partition is 0x100000 bytes. 0xdd1e0 bytes (86%) free.
Flash Project
: select Flash method 에서 JTAG 선택후 실행했습니다.
Serial booting log
ESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0x1 (POWERON),boot:0x6f (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x4086c410,len:0xd4c
load:0x4086e610,len:0x2dd4
load:0x40875728,len:0x17d0
entry 0x4086c410
I (23) boot: ESP-IDF v5.1.2 2nd stage bootloader
I (24) boot: compile time Dec 14 2023 10:14:31
I (24) boot: chip revision: v0.0
I (26) boot.esp32c6: SPI Speed : 80MHz
I (31) boot.esp32c6: SPI Mode : DIO
I (36) boot.esp32c6: SPI Flash Size : 2MB
I (41) boot: Enabling RNG early entropy source...
I (46) boot: Partition Table:
I (50) boot: ## Label Usage Type ST Offset Length
I (57) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (64) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (72) boot: 2 factory factory app 00 00 00010000 00100000
I (79) boot: End of partition table
I (84) esp_image: segment 0: paddr=00010020 vaddr=42010020 size=07dc0h ( 32192) map
I (99) esp_image: segment 1: paddr=00017de8 vaddr=40800000 size=00230h ( 560) load
I (101) esp_image: segment 2: paddr=00018020 vaddr=42000020 size=0f04ch ( 61516) map
I (122) esp_image: segment 3: paddr=00027074 vaddr=40800230 size=0ab0ch ( 43788) load
I (132) esp_image: segment 4: paddr=00031b88 vaddr=4080ad40 size=01210h ( 4624) load
I (134) esp_image: segment 5: paddr=00032da0 vaddr=50000000 size=0005ch ( 92) load
I (141) boot: Loaded app from partition at offset 0x10000
I (144) boot: Disabling RNG early entropy source...
I (161) cpu_start: Unicore app
I (161) cpu_start: Pro cpu up.
W (170) clk: esp_perip_clk_init() has not been implemented yet
I (177) cpu_start: Pro cpu start user code
I (177) cpu_start: cpu freq: 160000000 Hz
I (182) cpu_start: Application information:
I (182) cpu_start: Project name: esp_timer_example
I (186) cpu_start: App version: 1
I (190) cpu_start: Compile time: Dec 14 2023 10:14:24
I (196) cpu_start: ELF file SHA256: 2b2801e79f6af1d1...
I (202) cpu_start: ESP-IDF: v5.1.2
I (207) cpu_start: Min chip rev: v0.0
I (212) cpu_start: Max chip rev: v0.99
I (217) cpu_start: Chip rev: v0.0
I (222) heap_init: Initializing. RAM available for dynamic allocation:
I (229) heap_init: At 4080CE60 len 0006F7B0 (445 KiB): D/IRAM
I (235) heap_init: At 4087C610 len 00002F54 (11 KiB): STACK/DIRAM
I (242) heap_init: At 5000005C len 00003F8C (15 KiB): RTCRAM
I (249) spi_flash: detected chip: generic
I (253) spi_flash: flash io: dio
W (257) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (270) sleep: Configure to isolate all GPIO pins in sleep state
I (277) sleep: Enable automatic switching of GPIO sleep configuration
I (284) coexist: coex firmware version: b6d5e8c
I (289) coexist: coexist rom version 5b8dcfa
I (294) app_start: Starting scheduler on CPU0
I (299) main_task: Started on CPU0
I (299) main_task: Calling app_main()
I (349) example: Started timers, time since boot: 353748 us
Timer stats:
Name Period Alarm Times_armed Times_trigg Times_skip Cb_exec_time
periodic 500000 853740 1 0 0 0
one-shot 0 5353745 1 0 0 0
ETSTimer 0 0 0 0 0 0
I (849) example: Periodic timer called, time since boot: 853765 us
I (1349) example: Periodic timer called, time since boot: 1353748 us
I (1849) example: Periodic timer called, time since boot: 1853748 us
I (2349) example: Periodic timer called, time since boot: 2353748 us
Timer stats:
Name Period Alarm Times_armed Times_trigg Times_skip Cb_exec_time
periodic 500000 2853740 1 4 0 940
one-shot 0 5353745 1 0 0 0
ETSTimer 0 0 0 0 0 0
I (2849) example: Periodic timer called, time since boot: 2853748 us
I (3349) example: Periodic timer called, time since boot: 3353748 us
I (3849) example: Periodic timer called, time since boot: 3853748 us
I (4349) example: Periodic timer called, time since boot: 4353748 us
Timer stats:
Name Period Alarm Times_armed Times_trigg Times_skip Cb_exec_time
periodic 500000 4853740 1 8 0 1868
one-shot 0 5353745 1 0 0 0
ETSTimer 0 0 0 0 0 0
I (4849) example: Periodic timer called, time since boot: 4853748 us
I (5349) example: Periodic timer called, time since boot: 5353748 us
I (5349) example: One-shot timer called, time since boot: 5353983 us
I (5349) example: Restarted periodic timer with 1s period, time since boot: 5356853 us
I (6349) example: Periodic timer called, time since boot: 6356856 us
Timer stats:
Name Period Alarm Times_armed Times_trigg Times_skip Cb_exec_time
periodic 1000000 7356848 2 11 0 2564
one-shot 0 0 1 1 0 11483
ETSTimer 0 0 0 0 0 0
I (7349) example: Periodic timer called, time since boot: 7356856 us
I (8349) example: Periodic timer called, time since boot: 8356856 us
Timer stats:
Name Period Alarm Times_armed Times_trigg Times_skip Cb_exec_time
periodic 1000000 9356848 2 13 0 3028
one-shot 0 0 1 1 0 11483
ETSTimer 0 0 0 0 0 0
I (9349) example: Periodic timer called, time since boot: 9356856 us
I (10349) example: Periodic timer called, time since boot: 10356856 us
I (10459) example: Entering light sleep for 0.5s, time since boot: 10459491 us
I (10459) example: Woke up from light sleep, time since boot: 10958565 us
I (10849) example: Periodic timer called, time since boot: 11356856 us
I (11849) example: Periodic timer called, time since boot: 12356856 us
I (12459) example: Stopped and deleted timers
I (12459) main_task: Returned from app_main()
소스코드 분석
→ 타이머 생성 및 시작하기 (esp_timer_create , esp_timer_create_args_t )
const esp_timer_create_args_t oneshot_timer_args = {
.callback = &oneshot_timer_callback,
/* argument specified here will be passed to timer callback function */
.arg = (void*) periodic_timer,
.name = "one-shot"
};
esp_timer_handle_t oneshot_timer;
esp_timer_create(&oneshot_timer_args, &oneshot_timer);
→ 타이머 start /stop (esp_timer_start_once, esp_timer_start_periodic, esp_timer_stop )
esp_timer_start_once(oneshot_timer, 5000000); // 5초 oneshot 타이머 시작
// esp_timer_start_periodic(....) // periodic 타이머 시작함수도 별도 존재함.
esp_timer_stop(oneshot_timer); >> oneshot timer 종료후에는 호출 안해 줘도 됩니다.
> 한번만 호출되는 타이머 시작함수
> period 에 들어온 기간 간격으로 주기적으로 호출되는 타이머 시작함수
→ 타이머 callback 함수
(타이머 Expire 시 호출되는 함수로 esp_timer_create_args_t 인자중 callback 에 등록)
static void oneshot_timer_callback(void* arg)
{
int64_t time_since_boot = esp_timer_get_time();
ESP_LOGI(TAG, "One-shot timer called, time since boot: %lld us", time_since_boot);
esp_timer_handle_t periodic_timer_handle = (esp_timer_handle_t) arg;
/* To start the timer which is running, need to stop it first */
ESP_ERROR_CHECK(esp_timer_stop(periodic_timer_handle));
ESP_ERROR_CHECK(esp_timer_start_periodic(periodic_timer_handle, 1000000));
time_since_boot = esp_timer_get_time();
ESP_LOGI(TAG, "Restarted periodic timer with 1s period, time since boot: %lld us",
time_since_boot);
}
void app_main(void)
{
~~ 중략 ~~
const esp_timer_create_args_t oneshot_timer_args = {
.callback = &oneshot_timer_callback, // 타이머 expire 시 호출되는 함수
/* argument specified here will be passed to timer callback function */
.arg = (void*) periodic_timer, // callback 함수의 인자로 넘어가는 값
.name = "one-shot"
};
esp_timer_handle_t oneshot_timer;
esp_timer_create(&oneshot_timer_args, &oneshot_timer); // 타이머 생성
~~ 중략 ~~
esp_timer_start_once(oneshot_timer, 5000000); // 타이머 시작
~~ 중략 ~~
}
→타이머 제거 (esp_timer_delete)
esp_timer_delete(oneshot_timer)
→ light sleep
esp_sleep_enable_timer_wakeup(500000); // light sleep 에서 0.5초후 깨우기 설정
esp_light_sleep_start(); // light sleep
→ 현재 시간 얻기 > 부팅후 켜져있는 시간 표시 단위는 usec
: esp_timer_get_time();
그럼 수고하세요.