From ca175857d10b1e9081c33319d0e496ccee8167fd Mon Sep 17 00:00:00 2001 From: morris Date: Tue, 2 Aug 2022 18:08:23 +0800 Subject: [PATCH] pcnt: add test with -O0 --- components/driver/test_apps/pulse_cnt/sdkconfig.ci.iram_safe | 2 +- components/hal/esp32/include/hal/pcnt_ll.h | 4 ++++ components/hal/esp32s2/include/hal/pcnt_ll.h | 4 ++++ components/hal/esp32s3/include/hal/pcnt_ll.h | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/components/driver/test_apps/pulse_cnt/sdkconfig.ci.iram_safe b/components/driver/test_apps/pulse_cnt/sdkconfig.ci.iram_safe index 08e342339f..875989040c 100644 --- a/components/driver/test_apps/pulse_cnt/sdkconfig.ci.iram_safe +++ b/components/driver/test_apps/pulse_cnt/sdkconfig.ci.iram_safe @@ -2,6 +2,6 @@ CONFIG_COMPILER_DUMP_RTL_FILES=y CONFIG_PCNT_CTRL_FUNC_IN_IRAM=y CONFIG_PCNT_ISR_IRAM_SAFE=y CONFIG_GPIO_CTRL_FUNC_IN_IRAM=y - +CONFIG_COMPILER_OPTIMIZATION_NONE=y # silent the error check, as the error string are stored in rodata, causing RTL check failure CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y diff --git a/components/hal/esp32/include/hal/pcnt_ll.h b/components/hal/esp32/include/hal/pcnt_ll.h index 5d601b80c7..4bbf7eefe5 100644 --- a/components/hal/esp32/include/hal/pcnt_ll.h +++ b/components/hal/esp32/include/hal/pcnt_ll.h @@ -89,6 +89,7 @@ static inline void pcnt_ll_set_level_action(pcnt_dev_t *hw, uint32_t unit, uint3 * @param unit Pulse Counter unit number * @return PCNT count value (a signed integer) */ +__attribute__((always_inline)) static inline int pcnt_ll_get_count(pcnt_dev_t *hw, uint32_t unit) { typeof(hw->cnt_unit[unit]) cnt_reg = hw->cnt_unit[unit]; @@ -102,6 +103,7 @@ static inline int pcnt_ll_get_count(pcnt_dev_t *hw, uint32_t unit) * @param hw Peripheral PCNT hardware instance address. * @param unit PCNT unit number */ +__attribute__((always_inline)) static inline void pcnt_ll_stop_count(pcnt_dev_t *hw, uint32_t unit) { hw->ctrl.val |= 1 << (2 * unit + 1); @@ -113,6 +115,7 @@ static inline void pcnt_ll_stop_count(pcnt_dev_t *hw, uint32_t unit) * @param hw Peripheral PCNT hardware instance address. * @param unit PCNT unit number, select from uint32_t */ +__attribute__((always_inline)) static inline void pcnt_ll_start_count(pcnt_dev_t *hw, uint32_t unit) { hw->ctrl.val &= ~(1 << (2 * unit + 1)); @@ -124,6 +127,7 @@ static inline void pcnt_ll_start_count(pcnt_dev_t *hw, uint32_t unit) * @param hw Peripheral PCNT hardware instance address. * @param unit PCNT unit number, select from uint32_t */ +__attribute__((always_inline)) static inline void pcnt_ll_clear_count(pcnt_dev_t *hw, uint32_t unit) { hw->ctrl.val |= 1 << (2 * unit); diff --git a/components/hal/esp32s2/include/hal/pcnt_ll.h b/components/hal/esp32s2/include/hal/pcnt_ll.h index 67a8ebafda..5e9897d6b3 100644 --- a/components/hal/esp32s2/include/hal/pcnt_ll.h +++ b/components/hal/esp32s2/include/hal/pcnt_ll.h @@ -89,6 +89,7 @@ static inline void pcnt_ll_set_level_action(pcnt_dev_t *hw, uint32_t unit, uint3 * @param unit Pulse Counter unit number * @return PCNT count value (a signed integer) */ +__attribute__((always_inline)) static inline int pcnt_ll_get_count(pcnt_dev_t *hw, uint32_t unit) { pcnt_un_cnt_reg_t cnt_reg = hw->cnt_unit[unit]; @@ -102,6 +103,7 @@ static inline int pcnt_ll_get_count(pcnt_dev_t *hw, uint32_t unit) * @param hw Peripheral PCNT hardware instance address. * @param unit PCNT unit number */ +__attribute__((always_inline)) static inline void pcnt_ll_stop_count(pcnt_dev_t *hw, uint32_t unit) { hw->ctrl.val |= 1 << (2 * unit + 1); @@ -113,6 +115,7 @@ static inline void pcnt_ll_stop_count(pcnt_dev_t *hw, uint32_t unit) * @param hw Peripheral PCNT hardware instance address. * @param unit PCNT unit number, select from uint32_t */ +__attribute__((always_inline)) static inline void pcnt_ll_start_count(pcnt_dev_t *hw, uint32_t unit) { hw->ctrl.val &= ~(1 << (2 * unit + 1)); @@ -124,6 +127,7 @@ static inline void pcnt_ll_start_count(pcnt_dev_t *hw, uint32_t unit) * @param hw Peripheral PCNT hardware instance address. * @param unit PCNT unit number, select from uint32_t */ +__attribute__((always_inline)) static inline void pcnt_ll_clear_count(pcnt_dev_t *hw, uint32_t unit) { hw->ctrl.val |= 1 << (2 * unit); diff --git a/components/hal/esp32s3/include/hal/pcnt_ll.h b/components/hal/esp32s3/include/hal/pcnt_ll.h index 58e428ad8b..5ed492cef3 100644 --- a/components/hal/esp32s3/include/hal/pcnt_ll.h +++ b/components/hal/esp32s3/include/hal/pcnt_ll.h @@ -89,6 +89,7 @@ static inline void pcnt_ll_set_level_action(pcnt_dev_t *hw, uint32_t unit, uint3 * @param unit Pulse Counter unit number * @return PCNT count value (a signed integer) */ +__attribute__((always_inline)) static inline int pcnt_ll_get_count(pcnt_dev_t *hw, uint32_t unit) { pcnt_un_cnt_reg_t cnt_reg = hw->cnt_unit[unit]; @@ -102,6 +103,7 @@ static inline int pcnt_ll_get_count(pcnt_dev_t *hw, uint32_t unit) * @param hw Peripheral PCNT hardware instance address. * @param unit PCNT unit number */ +__attribute__((always_inline)) static inline void pcnt_ll_stop_count(pcnt_dev_t *hw, uint32_t unit) { hw->ctrl.val |= 1 << (2 * unit + 1); @@ -113,6 +115,7 @@ static inline void pcnt_ll_stop_count(pcnt_dev_t *hw, uint32_t unit) * @param hw Peripheral PCNT hardware instance address. * @param unit PCNT unit number, select from uint32_t */ +__attribute__((always_inline)) static inline void pcnt_ll_start_count(pcnt_dev_t *hw, uint32_t unit) { hw->ctrl.val &= ~(1 << (2 * unit + 1)); @@ -124,6 +127,7 @@ static inline void pcnt_ll_start_count(pcnt_dev_t *hw, uint32_t unit) * @param hw Peripheral PCNT hardware instance address. * @param unit PCNT unit number, select from uint32_t */ +__attribute__((always_inline)) static inline void pcnt_ll_clear_count(pcnt_dev_t *hw, uint32_t unit) { hw->ctrl.val |= 1 << (2 * unit);