esp_flash: correct veriable 'size' description

pull/11147/head
Cao Sen Miao 2022-11-28 16:54:03 +08:00
rodzic c07c9083c1
commit a645015dee
3 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -322,7 +322,7 @@ esp_err_t esp_flash_init_default_chip(void)
if (default_chip.size > legacy_chip->chip_size) { if (default_chip.size > legacy_chip->chip_size) {
ESP_EARLY_LOGW(TAG, "Detected size(%dk) larger than the size in the binary image header(%dk). Using the size in the binary image header.", default_chip.size/1024, legacy_chip->chip_size/1024); ESP_EARLY_LOGW(TAG, "Detected size(%dk) larger than the size in the binary image header(%dk). Using the size in the binary image header.", default_chip.size/1024, legacy_chip->chip_size/1024);
} }
// Set chip->size equal to ROM flash size(also equal to menuconfig flash size), which means the available size that can be used // Set chip->size equal to ROM flash size(also equal to the size in binary image header), which means the available size that can be used
default_chip.size = legacy_chip->chip_size; default_chip.size = legacy_chip->chip_size;
esp_flash_default_chip = &default_chip; esp_flash_default_chip = &default_chip;

Wyświetl plik

@ -100,7 +100,7 @@ struct esp_flash_t {
void *os_func_data; ///< Pointer to argument for os-specific hooks. Left NULL and will be initialized with ``os_func``. void *os_func_data; ///< Pointer to argument for os-specific hooks. Left NULL and will be initialized with ``os_func``.
esp_flash_io_mode_t read_mode; ///< Configured SPI flash read mode. Set before ``esp_flash_init`` is called. esp_flash_io_mode_t read_mode; ///< Configured SPI flash read mode. Set before ``esp_flash_init`` is called.
uint32_t size; ///< Size of SPI flash in bytes. If 0, size will be detected during initialisation. Note: Only stands for the available size (`CONFIG_ESPTOOLPY_FLASHSIZE`), If you want to get the flash physical size, please call `esp_flash_get_physical_size`. uint32_t size; ///< Size of SPI flash in bytes. If 0, size will be detected during initialisation. Note: this stands for the size in the binary image header. If you want to get the flash physical size, please call `esp_flash_get_physical_size`.
uint32_t chip_id; ///< Detected chip id. uint32_t chip_id; ///< Detected chip id.
uint32_t busy :1; ///< This flag is used to verify chip's status. uint32_t busy :1; ///< This flag is used to verify chip's status.
uint32_t hpm_dummy_ena :1; ///< This flag is used to verify whether flash works under HPM status. uint32_t hpm_dummy_ena :1; ///< This flag is used to verify whether flash works under HPM status.
@ -148,11 +148,11 @@ esp_err_t esp_flash_read_id(esp_flash_t *chip, uint32_t *out_id);
/** @brief Detect flash size based on flash ID. /** @brief Detect flash size based on flash ID.
* *
* @param chip Pointer to identify flash chip. Must have been successfully initialised via esp_flash_init() * @param chip Pointer to identify flash chip. Must have been successfully initialised via esp_flash_init()
* @param[out] out_size Detected size in bytes, standing for the available size (`CONFIG_ESPTOOLPY_FLASHSIZE`). * @param[out] out_size Detected size in bytes, standing for the size in the binary image header.
* *
* @note 1. Most flash chips use a common format for flash ID, where the lower 4 bits specify the size as a power of 2. If * @note 1. Most flash chips use a common format for flash ID, where the lower 4 bits specify the size as a power of 2. If
* the manufacturer doesn't follow this convention, the size may be incorrectly detected. * the manufacturer doesn't follow this convention, the size may be incorrectly detected.
* 2. The out_size returned only stands for the size selected in menuconfig. * 2. The out_size returned only stands for The out_size stands for the size in the binary image header.
* If you want to get the real size of the chip, please call `esp_flash_get_physical_size` instead. * If you want to get the real size of the chip, please call `esp_flash_get_physical_size` instead.
* *
* @return ESP_OK on success, or a flash error code if operation failed. * @return ESP_OK on success, or a flash error code if operation failed.

Wyświetl plik

@ -102,7 +102,7 @@ esp_err_t spi_flash_chip_generic_detect_size(esp_flash_t *chip, uint32_t *size)
However, some other flash vendors also have their own rule, we will add them in chip specific files. However, some other flash vendors also have their own rule, we will add them in chip specific files.
*/ */
uint32_t mem_density = (id & 0xFF); uint32_t mem_density = (id & 0xFF);
if (mem_density > SPI_FLASH_LINEAR_DENSITY_LAST_VALUE ) { if (mem_density > SPI_FLASH_LINEAR_DENSITY_LAST_VALUE) {
mem_density -= SPI_FLASH_HEX_A_F_RANGE; mem_density -= SPI_FLASH_HEX_A_F_RANGE;
} }