Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix idf_as_lib example (IDFGH-14655) #15401

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions examples/build_system/cmake/idf_as_lib/build-esp32p4.sh

This file was deleted.

1 change: 1 addition & 0 deletions examples/build_system/cmake/idf_as_lib/build-esp32p4.sh
4 changes: 0 additions & 4 deletions examples/build_system/cmake/idf_as_lib/run-esp32p4.sh

This file was deleted.

1 change: 1 addition & 0 deletions examples/build_system/cmake/idf_as_lib/run-esp32p4.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
add_library(stub_esp32 STATIC system_api.c flash_ops.c cpu_start.c)
add_library(stub_esp32 STATIC system_api.c cpu_start.c)
target_include_directories(stub_esp32 PUBLIC .)
add_library(stub::esp32 ALIAS stub_esp32)

target_link_libraries(stub_esp32 stub::spi_flash)
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
extern "C" {
#endif

#define ESP_OK 0 /*!< esp_err_t value indicating success (no error) */

typedef int esp_err_t;

void esp_restart(void);

#ifdef __cplusplus
Expand Down
10 changes: 0 additions & 10 deletions examples/build_system/cmake/idf_as_lib/stubs/esp32/flash_ops.c

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
add_library(stub_spi_flash INTERFACE)
target_include_directories(stub_spi_flash INTERFACE .)
add_library(stub_spi_flash STATIC flash_ops.c)
target_include_directories(stub_spi_flash PUBLIC .)
add_library(stub::spi_flash ALIAS stub_spi_flash)
target_link_libraries(stub_spi_flash PUBLIC stub_esp32)
22 changes: 22 additions & 0 deletions examples/build_system/cmake/idf_as_lib/stubs/spi_flash/esp_flash.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/

#pragma once

#include <stdint.h>
#include "esp_system.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef void * esp_flash_t;

esp_err_t esp_flash_get_size(esp_flash_t *chip, uint32_t *out_size);

#ifdef __cplusplus
}
#endif

This file was deleted.

13 changes: 13 additions & 0 deletions examples/build_system/cmake/idf_as_lib/stubs/spi_flash/flash_ops.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/

#include "esp_flash.h"

esp_err_t esp_flash_get_size(esp_flash_t *chip, uint32_t *out_size)
{
*out_size = 1024 * 1024 * 1024;
return ESP_OK;
}