mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 17:19:09 -04:00
fix(examples): idf_as_lib linux build
The Linux build was broken after IDF flash API was updated without updating the Linux stub library in the example. This commit updates the spi_flash stub library such that: - The API now matches same API as IDF's spi_flash component - Links the stub_esp32 library to pull in basic types and defines
This commit is contained in:
parent
0b6922405d
commit
3b28818ba4
@ -1,5 +1,3 @@
|
|||||||
add_library(stub_esp32 STATIC system_api.c cpu_start.c)
|
add_library(stub_esp32 STATIC system_api.c cpu_start.c)
|
||||||
target_include_directories(stub_esp32 PUBLIC .)
|
target_include_directories(stub_esp32 PUBLIC .)
|
||||||
add_library(stub::esp32 ALIAS stub_esp32)
|
add_library(stub::esp32 ALIAS stub_esp32)
|
||||||
|
|
||||||
target_link_libraries(stub_esp32 stub::spi_flash)
|
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define ESP_OK 0 /*!< esp_err_t value indicating success (no error) */
|
||||||
|
|
||||||
|
typedef int esp_err_t;
|
||||||
|
|
||||||
void esp_restart(void);
|
void esp_restart(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
add_library(stub_spi_flash STATIC flash_ops.c)
|
add_library(stub_spi_flash STATIC flash_ops.c)
|
||||||
target_include_directories(stub_spi_flash INTERFACE .)
|
target_include_directories(stub_spi_flash PUBLIC .)
|
||||||
add_library(stub::spi_flash ALIAS stub_spi_flash)
|
add_library(stub::spi_flash ALIAS stub_spi_flash)
|
||||||
|
target_link_libraries(stub_spi_flash PUBLIC stub_esp32)
|
||||||
|
@ -1,18 +1,21 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stdint.h>
|
||||||
|
#include "esp_system.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int spi_flash_get_chip_size(void);
|
typedef void * esp_flash_t;
|
||||||
|
|
||||||
|
esp_err_t esp_flash_get_size(esp_flash_t *chip, uint32_t *out_size);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int spi_flash_get_chip_size(void)
|
#include "esp_flash.h"
|
||||||
|
|
||||||
|
esp_err_t esp_flash_get_size(esp_flash_t *chip, uint32_t *out_size)
|
||||||
{
|
{
|
||||||
return (1024 * 1024 * 1024);
|
*out_size = 1024 * 1024 * 1024;
|
||||||
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user