From 3d0b50734652fad3ec6dce55070e05eddc2b5147 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Fri, 12 Jul 2024 14:18:56 +0200 Subject: [PATCH] fix(ieee802154): fix linker error due to static function being inlined When the compiler decides to inline a static function, linker script generator will complain about the missing function. --- components/ieee802154/driver/esp_ieee802154_dev.c | 2 +- components/ieee802154/driver/esp_ieee802154_frame.c | 8 ++++---- components/ieee802154/linker.lf | 1 + .../ieee802154/private_include/esp_ieee802154_dev.h | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/components/ieee802154/driver/esp_ieee802154_dev.c b/components/ieee802154/driver/esp_ieee802154_dev.c index c537181479..d7f98198cc 100644 --- a/components/ieee802154/driver/esp_ieee802154_dev.c +++ b/components/ieee802154/driver/esp_ieee802154_dev.c @@ -136,7 +136,7 @@ static IRAM_ATTR void receive_ack_timeout_timer_start(uint32_t duration) } #endif -static void ieee802154_rx_frame_info_update(void) +static IEEE802154_NOINLINE void ieee802154_rx_frame_info_update(void) { uint8_t len = s_rx_frame[s_rx_index][0]; int8_t rssi = s_rx_frame[s_rx_index][len - 1]; // crc is not written to rx buffer diff --git a/components/ieee802154/driver/esp_ieee802154_frame.c b/components/ieee802154/driver/esp_ieee802154_frame.c index e32e338ae0..9bc2305806 100644 --- a/components/ieee802154/driver/esp_ieee802154_frame.c +++ b/components/ieee802154/driver/esp_ieee802154_frame.c @@ -49,7 +49,7 @@ IEEE802154_STATIC IEEE802154_INLINE bool is_suported_frame_type(uint8_t frame_ty frame_type == IEEE802154_FRAME_TYPE_ACK || frame_type == IEEE802154_FRAME_TYPE_COMMAND); } -IEEE802154_STATIC bool is_dst_panid_present(const uint8_t *frame) +IEEE802154_STATIC IEEE802154_NOINLINE bool is_dst_panid_present(const uint8_t *frame) { uint8_t dst_mode = dst_addr_mode(frame); bool dst_panid_present = false; @@ -79,7 +79,7 @@ IEEE802154_STATIC bool is_dst_panid_present(const uint8_t *frame) return dst_panid_present; } -IEEE802154_STATIC bool is_src_panid_present(const uint8_t *frame) +IEEE802154_STATIC IEEE802154_NOINLINE bool is_src_panid_present(const uint8_t *frame) { uint8_t src_mode = src_addr_mode(frame); bool panid_compression = is_panid_compression(frame); @@ -160,7 +160,7 @@ IEEE802154_STATIC IRAM_ATTR uint8_t ieee802154_frame_address_size(const uint8_t return address_size; } -IEEE802154_STATIC uint8_t ieee802154_frame_security_header_offset(const uint8_t *frame) +IEEE802154_STATIC IEEE802154_NOINLINE uint8_t ieee802154_frame_security_header_offset(const uint8_t *frame) { ESP_RETURN_ON_FALSE_ISR(is_suported_frame_type(ieee802154_frame_get_type(frame)), IEEE802154_FRAME_INVALID_ADDR_MODE, IEEE802154_TAG, "invalid frame type"); uint8_t offset = ieee802154_frame_address_offset(frame); @@ -174,7 +174,7 @@ IEEE802154_STATIC uint8_t ieee802154_frame_security_header_offset(const uint8_t return offset; } -IEEE802154_STATIC uint8_t ieee802154_frame_get_security_field_len(const uint8_t *frame) +IEEE802154_STATIC IEEE802154_NOINLINE uint8_t ieee802154_frame_get_security_field_len(const uint8_t *frame) { ESP_RETURN_ON_FALSE_ISR(is_suported_frame_type(ieee802154_frame_get_type(frame)), IEEE802154_FRAME_INVALID_OFFSET, IEEE802154_TAG, "invalid frame type"); diff --git a/components/ieee802154/linker.lf b/components/ieee802154/linker.lf index b0a01b70c0..e78d00a5db 100644 --- a/components/ieee802154/linker.lf +++ b/components/ieee802154/linker.lf @@ -2,6 +2,7 @@ archive: libieee802154.a entries: if IEEE802154_ENABLED = y: + # When adding static functions here, add IEEE802154_NOINLINE attribute to them esp_ieee802154_ack: ieee802154_ack_config_pending_bit (noflash) esp_ieee802154_dev: ieee802154_rx_frame_info_update (noflash) esp_ieee802154_dev: ieee802154_isr (noflash) diff --git a/components/ieee802154/private_include/esp_ieee802154_dev.h b/components/ieee802154/private_include/esp_ieee802154_dev.h index ace28cd5f7..76db12a243 100644 --- a/components/ieee802154/private_include/esp_ieee802154_dev.h +++ b/components/ieee802154/private_include/esp_ieee802154_dev.h @@ -245,6 +245,7 @@ extern void esp_ieee802154_timer1_done(void); #define IEEE802154_STATIC static #define IEEE802154_INLINE inline #endif // CONFIG_IEEE802154_TEST +#define IEEE802154_NOINLINE __attribute__((noinline)) #ifdef __cplusplus }