Merge 3b28818ba4f1c0ace850ddd893cf28bcf71f2407 into 0461e2ff88369c3da0d4caced31e8488f53376cd

This commit is contained in:
Darian 2025-02-27 07:00:18 +00:00 committed by GitHub
commit 2019b16a9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 45 additions and 55 deletions

View File

@ -1,17 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
PARAM=""
# Retrive the target from the current filename, if no target specified,
# the variable will be empty
TARGET=$(echo $0 | cut -s -f2 -d- | cut -s -f1 -d.)
if [[ -n $TARGET ]]
then
# Target is not null, specify the build parameters
PARAM="-DCMAKE_TOOLCHAIN_FILE=$IDF_PATH/tools/cmake/toolchain-${TARGET}.cmake -DTARGET=${TARGET} -GNinja"
fi
rm -rf build && mkdir build && cd build
cmake .. $PARAM
cmake --build .

View File

@ -0,0 +1 @@
build.sh

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
cd build
python $IDF_PATH/components/esptool_py/esptool/esptool.py -p $1 write_flash @flash_project_args
python -m esp_idf_monitor -p $1 idf_as_lib.elf

View File

@ -0,0 +1 @@
run-esp32.sh

View File

@ -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)

View File

@ -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

View File

@ -1,10 +0,0 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
int spi_flash_get_chip_size(void)
{
return (1024 * 1024 * 1024);
}

View File

@ -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)

View File

@ -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

View File

@ -1,19 +0,0 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#pragma once
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
int spi_flash_get_chip_size(void);
#ifdef __cplusplus
}
#endif

View File

@ -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;
}