Skip to content

Conversation

seuros
Copy link

@seuros seuros commented Sep 7, 2025

Problem

The enum declaration for esp_image_spi_freq_t in components/bootloader_support/include/esp_image_format.h line 40 is missing the typedef keyword.

This causes the compiler to create a global variable instead of a type definition, resulting in "multiple definition" linker errors when building with stricter toolchains (e.g., PlatformIO's xtensa-lx106-elf gcc 10.3.0).

Error Example

ld: libbootloader_support.a(bootloader_init.o):/esp8266-rtos-sdk/components/bootloader_support/include/esp_image_format.h:45: 
    multiple definition of `esp_image_spi_freq_t'

Solution

Add the missing typedef keyword to make it consistent with the enum declaration above it (lines 34-37).

Before

enum {
    ESP_IMAGE_SPI_SPEED_40M,
    ESP_IMAGE_SPI_SPEED_26M,
    ESP_IMAGE_SPI_SPEED_20M,
    ESP_IMAGE_SPI_SPEED_80M = 0xF
} esp_image_spi_freq_t;

After

typedef enum {
    ESP_IMAGE_SPI_SPEED_40M,
    ESP_IMAGE_SPI_SPEED_26M,
    ESP_IMAGE_SPI_SPEED_20M,
    ESP_IMAGE_SPI_SPEED_80M = 0xF
} esp_image_spi_freq_t;

Testing

  • Built successfully with PlatformIO xtensa toolchain
  • Resolves linker errors
  • One-word fix that maintains full backward compatibility

The enum declaration for esp_image_spi_freq_t was missing the typedef keyword,
causing it to declare a global variable instead of a type definition. This
resulted in multiple definition linker errors when the header was included
in multiple compilation units.

This commit adds the missing typedef to make it consistent with other enum
declarations in the same file and resolves the linker errors.
@CLAassistant
Copy link

CLAassistant commented Sep 7, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot changed the title Fix missing typedef causing multiple definition linker errors Fix missing typedef causing multiple definition linker errors (GIT8266O-886) Sep 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants