host_test: cleanup of make based obsolete code in wl, fatfs and spi_flash

pull/11283/head
radek.tandler 2023-04-19 15:06:50 +02:00
rodzic 0078025d7b
commit 13a305656d
48 zmienionych plików z 0 dodań i 1897 usunięć

Wyświetl plik

@ -40,12 +40,6 @@ test_partition_table_on_host:
- cd components/partition_table/test_gen_esp32part_host
- ./gen_esp32part_tests.py
test_fatfs_on_host:
extends: .host_test_template
script:
- cd components/fatfs/test_fatfs_host/
- make test
test_ldgen_on_host:
extends: .host_test_template
script:

Wyświetl plik

@ -1,106 +0,0 @@
ifndef COMPONENT
COMPONENT := fatfs
endif
COMPONENT_LIB := lib$(COMPONENT).a
TEST_PROGRAM := test_$(COMPONENT)
STUBS_LIB_DIR := ../../../components/spi_flash/sim/stubs
STUBS_LIB_BUILD_DIR := $(STUBS_LIB_DIR)/build
STUBS_LIB := libstubs.a
SPI_FLASH_SIM_DIR := ../../../components/spi_flash/sim
SPI_FLASH_SIM_BUILD_DIR := $(SPI_FLASH_SIM_DIR)/build
SPI_FLASH_SIM_LIB := libspi_flash.a
WEAR_LEVELLING_DIR := ../../../components/wear_levelling/test_wl_host
WEAR_LEVELLING_BUILD_DIR := $(WEAR_LEVELLING_DIR)/build
WEAR_LEVELLING_LIB := libwl.a
include Makefile.files
all: test
ifndef SDKCONFIG
SDKCONFIG_DIR := $(dir $(realpath sdkconfig/sdkconfig.h))
SDKCONFIG := $(SDKCONFIG_DIR)sdkconfig.h
else
SDKCONFIG_DIR := $(dir $(realpath $(SDKCONFIG)))
endif
INCLUDE_FLAGS := $(addprefix -I, $(INCLUDE_DIRS) $(SDKCONFIG_DIR) ../../../tools/catch)
CPPFLAGS += $(INCLUDE_FLAGS) -g -m32
CXXFLAGS += $(INCLUDE_FLAGS) -std=c++11 -g -m32
# Build libraries that this component is dependent on
$(STUBS_LIB_BUILD_DIR)/$(STUBS_LIB): force
$(MAKE) -C $(STUBS_LIB_DIR) lib SDKCONFIG=$(SDKCONFIG)
$(SPI_FLASH_SIM_BUILD_DIR)/$(SPI_FLASH_SIM_LIB): force
$(MAKE) -C $(SPI_FLASH_SIM_DIR) lib SDKCONFIG=$(SDKCONFIG)
$(WEAR_LEVELLING_BUILD_DIR)/$(WEAR_LEVELLING_LIB): force
$(MAKE) -C $(WEAR_LEVELLING_DIR) lib SDKCONFIG=$(SDKCONFIG)
# Create target for building this component as a library
CFILES := $(filter %.c, $(SOURCE_FILES))
CPPFILES := $(filter %.cpp, $(SOURCE_FILES))
CTARGET = ${2}/$(patsubst %.c,%.o,$(notdir ${1}))
CPPTARGET = ${2}/$(patsubst %.cpp,%.o,$(notdir ${1}))
ifndef BUILD_DIR
BUILD_DIR := build
endif
OBJ_FILES := $(addprefix $(BUILD_DIR)/, $(filter %.o, $(notdir $(SOURCE_FILES:.cpp=.o) $(SOURCE_FILES:.c=.o))))
define COMPILE_C
$(call CTARGET, ${1}, $(BUILD_DIR)) : ${1} $(SDKCONFIG)
mkdir -p $(BUILD_DIR)
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $(call CTARGET, ${1}, $(BUILD_DIR)) ${1}
endef
define COMPILE_CPP
$(call CPPTARGET, ${1}, $(BUILD_DIR)) : ${1} $(SDKCONFIG)
mkdir -p $(BUILD_DIR)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $(call CPPTARGET, ${1}, $(BUILD_DIR)) ${1}
endef
$(BUILD_DIR)/$(COMPONENT_LIB): $(OBJ_FILES) $(SDKCONFIG)
mkdir -p $(BUILD_DIR)
$(AR) rcs $@ $^
lib: $(BUILD_DIR)/$(COMPONENT_LIB)
$(foreach cfile, $(CFILES), $(eval $(call COMPILE_C, $(cfile))))
$(foreach cxxfile, $(CPPFILES), $(eval $(call COMPILE_CPP, $(cxxfile))))
# Create target for building this component as a test
TEST_SOURCE_FILES = \
test_fatfs.cpp \
main.cpp \
TEST_OBJ_FILES = $(filter %.o, $(TEST_SOURCE_FILES:.cpp=.o) $(TEST_SOURCE_FILES:.c=.o))
$(TEST_PROGRAM): lib $(TEST_OBJ_FILES) $(WEAR_LEVELLING_BUILD_DIR)/$(WEAR_LEVELLING_LIB) $(SPI_FLASH_SIM_BUILD_DIR)/$(SPI_FLASH_SIM_LIB) $(STUBS_LIB_BUILD_DIR)/$(STUBS_LIB) partition_table.bin $(SDKCONFIG)
g++ $(LDFLAGS) $(CXXFLAGS) -o $@ $(TEST_OBJ_FILES) -L$(BUILD_DIR) -l:$(COMPONENT_LIB) -L$(WEAR_LEVELLING_BUILD_DIR) -l:$(WEAR_LEVELLING_LIB) -L$(SPI_FLASH_SIM_BUILD_DIR) -l:$(SPI_FLASH_SIM_LIB) -L$(STUBS_LIB_BUILD_DIR) -l:$(STUBS_LIB)
test: $(TEST_PROGRAM)
./$(TEST_PROGRAM)
# Create other necessary targets
partition_table.bin: partition_table.csv
python ../../../components/partition_table/gen_esp32part.py --verify $< $@
force:
# Create target to cleanup files
clean:
$(MAKE) -C $(STUBS_LIB_DIR) clean
$(MAKE) -C $(SPI_FLASH_SIM_DIR) clean
$(MAKE) -C $(WEAR_LEVELLING_DIR) clean
rm -f $(OBJ_FILES) $(TEST_OBJ_FILES) $(TEST_PROGRAM) $(COMPONENT_LIB) partition_table.bin
.PHONY: all lib test clean force

Wyświetl plik

@ -1,44 +0,0 @@
SOURCE_FILES := \
$(addprefix ../src/, \
ff.c \
ffunicode.c \
) \
$(addprefix ../diskio/,\
diskio.c \
diskio_wl.c \
) \
../port/linux/ffsystem.c
INCLUDE_DIRS := \
. \
../diskio \
../src \
$(addprefix ../../spi_flash/sim/stubs/, \
app_update/include \
driver/include \
freertos/include \
newlib/include \
sdmmc/include \
vfs/include \
) \
$(addprefix ../../../components/, \
esp_rom/include \
esp_hw_support/include \
esp_hw_support/include/soc \
esp_system/include \
log/include \
xtensa/include \
xtensa/esp32/include \
soc/esp32/include \
heap/include \
soc/include \
esp32/include \
esp_common/include \
bootloader_support/include \
bootloader_support/bootloader_flash/include \
app_update/include \
hal/include \
spi_flash/include \
wear_levelling/include \
esp_partition/include \
)

Wyświetl plik

@ -1,17 +0,0 @@
include $(COMPONENT_PATH)/Makefile.files
COMPONENT_OWNBUILDTARGET := 1
COMPONENT_OWNCLEANTARGET := 1
COMPONENT_ADD_INCLUDEDIRS := $(INCLUDE_DIRS)
.PHONY: build
build: $(SDKCONFIG_HEADER)
$(MAKE) -C $(COMPONENT_PATH) lib SDKCONFIG=$(SDKCONFIG_HEADER) BUILD_DIR=$(COMPONENT_BUILD_DIR) COMPONENT=$(COMPONENT_NAME)
CLEAN_FILES := component_project_vars.mk
.PHONY: clean
clean:
$(summary) RM $(CLEAN_FILES)
rm -f $(CLEAN_FILES)
$(MAKE) -C $(COMPONENT_PATH) clean SDKCONFIG=$(SDKCONFIG_HEADER) BUILD_DIR=$(COMPONENT_BUILD_DIR) COMPONENT=$(COMPONENT_NAME)

Wyświetl plik

@ -1,2 +0,0 @@
#define CATCH_CONFIG_MAIN
#include "catch.hpp"

Wyświetl plik

@ -1,6 +0,0 @@
# Name, Type, SubType, Offset, Size, Flags
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
nvs, data, nvs, 0x9000, 0x6000,
phy_init, data, phy, 0xf000, 0x1000,
factory, app, factory, 0x10000, 1M,
storage, data, fat, , 1M,
1 # Name, Type, SubType, Offset, Size, Flags
2 # Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
3 nvs, data, nvs, 0x9000, 0x6000,
4 phy_init, data, phy, 0xf000, 0x1000,
5 factory, app, factory, 0x10000, 1M,
6 storage, data, fat, , 1M,

Wyświetl plik

@ -1,14 +0,0 @@
# pragma once
#define CONFIG_IDF_TARGET_ESP32 1
#define CONFIG_WL_SECTOR_SIZE 4096
// for the Linux log component
#define CONFIG_LOG_TIMESTAMP_SOURCE_RTOS 1
#define CONFIG_LOG_DEFAULT_LEVEL 3
#define CONFIG_LOG_MAXIMUM_LEVEL 3
#define CONFIG_PARTITION_TABLE_OFFSET 0x8000
#define CONFIG_ESPTOOLPY_FLASHSIZE "8MB"
#define CONFIG_FATFS_VOLUME_COUNT 2
#define CONFIG_MMU_PAGE_SIZE 0X10000 // 64KB

Wyświetl plik

@ -1,94 +0,0 @@
#include <stdio.h>
#include <string.h>
#include "ff.h"
#include "esp_partition.h"
#include "wear_levelling.h"
#include "diskio_impl.h"
#include "diskio_wl.h"
#include "catch.hpp"
extern "C" void _spi_flash_init(const char* chip_size, size_t block_size, size_t sector_size, size_t page_size, const char* partition_bin);
TEST_CASE("create volume, open file, write and read back data", "[fatfs]")
{
_spi_flash_init(CONFIG_ESPTOOLPY_FLASHSIZE, CONFIG_WL_SECTOR_SIZE * 16, CONFIG_WL_SECTOR_SIZE, CONFIG_WL_SECTOR_SIZE, "partition_table.bin");
FRESULT fr_result;
BYTE pdrv;
FATFS fs;
FIL file;
UINT bw;
esp_err_t esp_result;
const esp_partition_t *partition = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_FAT, "storage");
// Mount wear-levelled partition
wl_handle_t wl_handle;
esp_result = wl_mount(partition, &wl_handle);
REQUIRE(esp_result == ESP_OK);
// Get a physical drive
esp_result = ff_diskio_get_drive(&pdrv);
REQUIRE(esp_result == ESP_OK);
// Register physical drive as wear-levelled partition
esp_result = ff_diskio_register_wl_partition(pdrv, wl_handle);
// Create FAT volume on the entire disk
LBA_t part_list[] = {100, 0, 0, 0};
BYTE work_area[FF_MAX_SS];
fr_result = f_fdisk(pdrv, part_list, work_area);
REQUIRE(fr_result == FR_OK);
const MKFS_PARM opt = {(BYTE)FM_ANY, 0, 0, 0, 0};
fr_result = f_mkfs("", &opt, work_area, sizeof(work_area)); // Use default volume
// Mount the volume
fr_result = f_mount(&fs, "", 0);
REQUIRE(fr_result == FR_OK);
// Open, write and read data
fr_result = f_open(&file, "test.txt", FA_OPEN_ALWAYS | FA_READ | FA_WRITE);
REQUIRE(fr_result == FR_OK);
// Generate data
uint32_t data_size = 100000;
char *data = (char*) malloc(data_size);
char *read = (char*) malloc(data_size);
for(uint32_t i = 0; i < data_size; i += sizeof(i))
{
*((uint32_t*)(data + i)) = i;
}
// Write generated data
fr_result = f_write(&file, data, data_size, &bw);
REQUIRE(fr_result == FR_OK);
REQUIRE(bw == data_size);
// Move to beginning of file
fr_result = f_lseek(&file, 0);
REQUIRE(fr_result == FR_OK);
// Read written data
fr_result = f_read(&file, read, data_size, &bw);
REQUIRE(fr_result == FR_OK);
REQUIRE(bw == data_size);
REQUIRE(memcmp(data, read, data_size) == 0);
// Close file
fr_result = f_close(&file);
REQUIRE(fr_result == FR_OK);
// Unmount default volume
fr_result = f_mount(0, "", 0);
REQUIRE(fr_result == FR_OK);
free(read);
free(data);
}

Wyświetl plik

@ -1,65 +0,0 @@
ifndef COMPONENT
COMPONENT := spi_flash
endif
COMPONENT_LIB := lib$(COMPONENT).a
include Makefile.files
all: lib
ifndef SDKCONFIG
SDKCONFIG_DIR := $(dir $(realpath sdkconfig/sdkconfig.h))
SDKCONFIG := $(SDKCONFIG_DIR)sdkconfig.h
else
SDKCONFIG_DIR := $(dir $(realpath $(SDKCONFIG)))
endif
INCLUDE_FLAGS := $(addprefix -I, $(INCLUDE_DIRS) $(SDKCONFIG_DIR))
CPPFLAGS += $(INCLUDE_FLAGS) -g -m32
CXXFLAGS += $(INCLUDE_FLAGS) -std=c++11 -g -m32
CFILES := $(filter %.c, $(SOURCE_FILES))
CPPFILES := $(filter %.cpp, $(SOURCE_FILES))
CTARGET = ${2}/$(patsubst %.c,%.o,$(notdir ${1}))
CPPTARGET = ${2}/$(patsubst %.cpp,%.o,$(notdir ${1}))
ifndef BUILD_DIR
BUILD_DIR := build
endif
OBJ_FILES := $(addprefix $(BUILD_DIR)/, $(filter %.o, $(notdir $(SOURCE_FILES:.cpp=.o) $(SOURCE_FILES:.c=.o))))
%.o : %.c $(SDKCONFIG)
$(CC) $(CPPFLAGS) $(CFLAGS) $< - o $@
%.o : %.cpp $(SDKCONFIG)
$(CC) $(CPPFLAGS) $(CFLAGS) $< - o $@
define COMPILE_C
$(call CTARGET, ${1}, $(BUILD_DIR)) : ${1}
mkdir -p $(BUILD_DIR)
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $(call CTARGET, ${1}, $(BUILD_DIR)) ${1}
endef
define COMPILE_CPP
$(call CPPTARGET, ${1}, $(BUILD_DIR)) : ${1}
mkdir -p $(BUILD_DIR)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $(call CPPTARGET, ${1}, $(BUILD_DIR)) ${1}
endef
$(BUILD_DIR)/$(COMPONENT_LIB): $(OBJ_FILES) $(SDKCONFIG)
mkdir -p $(BUILD_DIR)
$(AR) rcs $@ $^
clean:
rm -f $(OBJ_FILES) $(BUILD_DIR)/$(COMPONENT_LIB)
lib: $(BUILD_DIR)/$(COMPONENT_LIB)
$(foreach cfile, $(CFILES), $(eval $(call COMPILE_C, $(cfile))))
$(foreach cxxfile, $(CPPFILES), $(eval $(call COMPILE_CPP, $(cxxfile))))
.PHONY: all lib clean

Wyświetl plik

@ -1,50 +0,0 @@
SOURCE_FILES := \
SpiFlash.cpp \
flash_mock.cpp \
flash_mock_util.c \
$(addprefix ../, \
../esp_partition/partition.c \
../esp_partition/partition_target.c \
flash_ops.c \
../esp_rom/linux/esp_rom_efuse.c \
) \
INCLUDE_DIRS := \
. \
../ \
../include \
../private_include \
$(addprefix stubs/, \
app_update/include \
bsd/include \
driver/include \
esp_app_format/include \
esp_timer/include \
freertos/include \
log/include \
newlib/include \
sdmmc/include \
vfs/include \
) \
$(addprefix ../../../components/, \
esp_rom/include \
esp_common/include \
esp_hw_support/include \
esp_hw_support/include/soc \
esp_system/include \
xtensa/include \
xtensa/esp32/include \
soc/esp32/include \
heap/include \
soc/include \
esp32/include \
esp_timer/include \
bootloader_support/include \
bootloader_support/bootloader_flash/include \
app_update/include \
hal/include \
hal/esp32/include \
hal/platform_port/include \
spi_flash/include \
esp_partition/include \
)

Wyświetl plik

@ -1,259 +0,0 @@
// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "SpiFlash.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fstream>
#include <iostream>
#include <vector>
#include <string>
#include "sdkconfig.h"
#include "esp_flash_partitions.h"
using namespace std;
#define DIV_AND_CEIL(x, y) ((x) / (y) + ((x) % (y) > 0))
SpiFlash::SpiFlash()
{
return;
}
SpiFlash::~SpiFlash()
{
deinit();
}
void SpiFlash::init(uint32_t chip_size, uint32_t block_size, uint32_t sector_size, uint32_t page_size, const char* partitions_bin)
{
// De-initialize first
deinit();
// Initialize values and alloc memory
this->chip_size = chip_size;
this->block_size = block_size;
this->sector_size = sector_size;
this->page_size = page_size;
this->blocks = DIV_AND_CEIL(this->chip_size, this->block_size);
this->sectors = DIV_AND_CEIL(this->chip_size, this->sector_size);
this->pages = DIV_AND_CEIL(this->chip_size, this->page_size);
this->erase_cycles = (uint32_t*) calloc(this->sectors, sizeof(uint32_t));
this->erase_states = (bool*) calloc(this->sectors, sizeof(bool));
memset(this->erase_states, 0xFF, this->sectors * sizeof(bool));
this->total_erase_cycles_limit = 0;
this->erase_cycles_limit = 0;
this->total_erase_cycles = 0;
// Load partitions table bin
this->memory = (uint8_t *) malloc(this->chip_size);
memset(this->memory, 0xFF, this->chip_size);
ifstream ifd(partitions_bin, ios::binary | ios::ate);
int size = ifd.tellg();
ifd.seekg(0, ios::beg);
vector<char> buffer;
buffer.resize(size);
ifd.read(buffer.data(), size);
memcpy(&this->memory[CONFIG_PARTITION_TABLE_OFFSET], buffer.data(), buffer.size());
}
void SpiFlash::deinit()
{
// Free all allocated memory
free(this->memory);
free(this->erase_cycles);
free(this->erase_states);
}
uint32_t SpiFlash::get_chip_size()
{
return this->chip_size;
}
uint32_t SpiFlash::get_block_size()
{
return this->block_size;
}
uint32_t SpiFlash::get_sector_size()
{
return this->sector_size;
}
uint32_t SpiFlash::get_page_size()
{
return this->page_size;
}
esp_rom_spiflash_result_t SpiFlash::erase_block(uint32_t block)
{
uint32_t sectors_per_block = (this->block_size / this->sector_size);
uint32_t start_sector = block * sectors_per_block;
for (int i = start_sector; i < start_sector + sectors_per_block; i++) {
this->erase_sector(i);
}
return ESP_ROM_SPIFLASH_RESULT_OK;
}
esp_rom_spiflash_result_t SpiFlash::erase_sector(uint32_t sector)
{
if (this->total_erase_cycles_limit != 0 &&
this->total_erase_cycles >= this->total_erase_cycles_limit) {
return ESP_ROM_SPIFLASH_RESULT_ERR;
}
if (this->erase_cycles_limit != 0 &&
this->erase_cycles[sector] >= this->erase_cycles_limit) {
return ESP_ROM_SPIFLASH_RESULT_ERR;
}
uint32_t pages_per_sector = (this->sector_size / this->page_size);
uint32_t start_page = sector * pages_per_sector;
if (this->erase_states[sector]) {
goto out;
}
for (int i = start_page; i < start_page + pages_per_sector; i++) {
this->erase_page(i);
}
this->erase_cycles[sector]++;
this->total_erase_cycles++;
this->erase_states[sector] = true;
out:
return ESP_ROM_SPIFLASH_RESULT_OK;
}
esp_rom_spiflash_result_t SpiFlash::erase_page(uint32_t page)
{
memset(&this->memory[page * this->page_size], 0xFF, this->page_size);
return ESP_ROM_SPIFLASH_RESULT_OK;
}
esp_rom_spiflash_result_t SpiFlash::write(uint32_t dest_addr, const void *src, uint32_t size)
{
// Update reset states and check for failure
int start = 0;
int end = 0;
if (this->total_erase_cycles_limit != 0 &&
this->total_erase_cycles >= this->total_erase_cycles_limit) {
return ESP_ROM_SPIFLASH_RESULT_ERR;
}
start = dest_addr / this->get_sector_size();
end = size > 0 ? (dest_addr + size - 1) / this->get_sector_size() : start;
for (int i = start; i <= end; i++) {
if (this->erase_cycles_limit != 0 &&
this->erase_cycles[i] >= this->erase_cycles_limit) {
return ESP_ROM_SPIFLASH_RESULT_ERR;
}
this->erase_states[i] = false;
}
// Do the write
for(uint32_t ctr = 0; ctr < size; ctr++)
{
uint8_t data = ((uint8_t*)src)[ctr];
uint8_t written = this->memory[dest_addr + ctr];
// Emulate inability to set programmed bits without erasing
data &= written;
this->memory[dest_addr + ctr] = data;
}
return ESP_ROM_SPIFLASH_RESULT_OK;
}
esp_rom_spiflash_result_t SpiFlash::read(uint32_t src_addr, void *dest, uint32_t size)
{
// Check for failure
int start = 0;
int end = 0;
if (this->total_erase_cycles_limit != 0 &&
this->total_erase_cycles >= this->total_erase_cycles_limit) {
return ESP_ROM_SPIFLASH_RESULT_ERR;
}
start = src_addr / this->get_sector_size();
end = size > 0 ? (src_addr + size - 1) / this->get_sector_size() : start;
for (int i = start; i <= end; i++) {
if (this->erase_cycles_limit != 0 &&
this->erase_cycles[i] >= this->erase_cycles_limit) {
return ESP_ROM_SPIFLASH_RESULT_ERR;
}
}
// Do the read
memcpy(dest, &this->memory[src_addr], size);
return ESP_ROM_SPIFLASH_RESULT_OK;
}
uint8_t* SpiFlash::get_memory_ptr(uint32_t src_address)
{
return &this->memory[src_address];
}
uint32_t SpiFlash::get_erase_cycles(uint32_t sector)
{
return this->erase_cycles[sector];
}
uint32_t SpiFlash::get_total_erase_cycles()
{
return this->total_erase_cycles;
}
void SpiFlash::set_erase_cycles_limit(uint32_t limit)
{
this->erase_cycles_limit = limit;
}
void SpiFlash::set_total_erase_cycles_limit(uint32_t limit)
{
this->total_erase_cycles_limit = limit;
}
void SpiFlash::reset_erase_cycles()
{
memset(this->erase_cycles, 0, sizeof(this->sectors * sizeof(uint32_t)));
}
void SpiFlash::reset_total_erase_cycles()
{
this->total_erase_cycles = 0;
}

Wyświetl plik

@ -1,73 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _SpiFlash_H_
#define _SpiFlash_H_
#include <stdbool.h>
#include "esp_err.h"
#include "esp_rom_spiflash.h"
/**
* @brief This class is used to emulate flash devices.
*
*/
class SpiFlash
{
public:
SpiFlash();
~SpiFlash();
void init(uint32_t chip_size, uint32_t block_size, uint32_t sector_size, uint32_t page_size, const char* partitions_bin);
uint32_t get_chip_size();
uint32_t get_block_size();
uint32_t get_sector_size();
uint32_t get_page_size();
esp_rom_spiflash_result_t erase_block(uint32_t block);
esp_rom_spiflash_result_t erase_sector(uint32_t sector);
esp_rom_spiflash_result_t erase_page(uint32_t page);
esp_rom_spiflash_result_t write(uint32_t dest_addr, const void *src, uint32_t size);
esp_rom_spiflash_result_t read(uint32_t src_addr, void *dest, uint32_t size);
uint32_t get_erase_cycles(uint32_t sector);
uint32_t get_total_erase_cycles();
void set_erase_cycles_limit(uint32_t limit);
void set_total_erase_cycles_limit(uint32_t limit);
void reset_erase_cycles();
void reset_total_erase_cycles();
uint8_t* get_memory_ptr(uint32_t src_address);
private:
uint32_t chip_size;
uint32_t block_size;
uint32_t sector_size;
uint32_t page_size;
uint32_t blocks;
uint32_t sectors;
uint32_t pages;
uint8_t* memory;
bool* erase_states;
uint32_t* erase_cycles;
uint32_t erase_cycles_limit;
uint32_t total_erase_cycles;
uint32_t total_erase_cycles_limit;
void deinit();
};
#endif // _SpiFlash_H_

Wyświetl plik

@ -1,17 +0,0 @@
include $(COMPONENT_PATH)/Makefile.files
COMPONENT_OWNBUILDTARGET := 1
COMPONENT_OWNCLEANTARGET := 1
COMPONENT_ADD_INCLUDEDIRS := $(INCLUDE_DIRS)
.PHONY: build
build: $(SDKCONFIG_HEADER)
$(MAKE) -C $(COMPONENT_PATH) lib SDKCONFIG=$(SDKCONFIG_HEADER) BUILD_DIR=$(COMPONENT_BUILD_DIR) COMPONENT=$(COMPONENT_NAME)
CLEAN_FILES := component_project_vars.mk
.PHONY: clean
clean:
$(summary) RM $(CLEAN_FILES)
rm -f $(CLEAN_FILES)
$(MAKE) -C $(COMPONENT_PATH) clean SDKCONFIG=$(SDKCONFIG_HEADER) BUILD_DIR=$(COMPONENT_BUILD_DIR) COMPONENT=$(COMPONENT_NAME)

Wyświetl plik

@ -1,145 +0,0 @@
#include <string.h>
#include <stdlib.h>
#include "SpiFlash.h"
#include "spi_flash_mmap.h"
#include "esp_err.h"
#include "esp_rom_spiflash.h"
#include "esp_flash.h"
#include "bsd_strings.h"
SpiFlash spiflash = SpiFlash();
esp_rom_spiflash_chip_t g_rom_flashchip;
size_t convert_chip_size_string(const char* chip_size_str)
{
int size = 0;
if (strcmp(chip_size_str, "1MB") == 0) {
size = 0x100000;
}
else if (strcmp(chip_size_str, "2MB") == 0) {
size = 0x200000;
}
else if (strcmp(chip_size_str, "4MB") == 0) {
size = 0x400000;
}
else if (strcmp(chip_size_str, "8MB") == 0) {
size = 0x800000;
}
else if (strcmp(chip_size_str, "16MB") == 0) {
size = 0x1000000;
} else {
size = 0;
}
return size;
}
extern "C" void _spi_flash_init(const char* chip_size, size_t block_size, size_t sector_size, size_t page_size, const char* partitions_bin)
{
size_t size = convert_chip_size_string(chip_size);
assert(size != 0);
spiflash.init(size, block_size, sector_size, page_size, partitions_bin);
g_rom_flashchip.chip_size = size;
g_rom_flashchip.block_size = block_size;
g_rom_flashchip.sector_size = sector_size;
g_rom_flashchip.page_size = page_size;
}
extern "C" esp_err_t spi_flash_mmap(size_t src_addr, size_t size, spi_flash_mmap_memory_t memory,
const void** out_ptr, spi_flash_mmap_handle_t* out_handle)
{
*out_handle = 0;
*out_ptr = (void*)spiflash.get_memory_ptr(src_addr);
return ESP_OK;
}
extern "C" void spi_flash_munmap(spi_flash_mmap_handle_t handle)
{
return;
}
extern "C" int spi_flash_get_total_erase_cycles(void)
{
return spiflash.get_total_erase_cycles();
}
extern "C" int spi_flash_get_erase_cycles(size_t sector)
{
return spiflash.get_erase_cycles(sector);
}
extern "C" esp_err_t bootloader_flash_unlock(void)
{
return ESP_OK;
}
esp_rom_spiflash_result_t esp_rom_spiflash_read(uint32_t target, uint32_t *dest, int32_t len)
{
return spiflash.read(target, dest, len);
}
extern "C" esp_err_t esp_flash_read(esp_flash_t *chip, void *buffer, uint32_t address, uint32_t length)
{
return spiflash.read(address, buffer, length);
}
esp_rom_spiflash_result_t esp_rom_spiflash_erase_block(uint32_t block)
{
return spiflash.erase_block(block);
}
esp_rom_spiflash_result_t esp_rom_spiflash_erase_sector(uint32_t sector)
{
return spiflash.erase_sector(sector);
}
esp_rom_spiflash_result_t esp_rom_spiflash_erase_page(uint32_t page)
{
return spiflash.erase_page(page);
}
extern "C" esp_err_t esp_flash_erase_region(esp_flash_t *chip, uint32_t start_addr, uint32_t size)
{
size_t start = start_addr / SPI_FLASH_SEC_SIZE;
size_t end = start + size / SPI_FLASH_SEC_SIZE;
const size_t sectors_per_block = 65536 / SPI_FLASH_SEC_SIZE;
esp_rom_spiflash_result_t rc = ESP_ROM_SPIFLASH_RESULT_OK;
for (size_t sector = start; sector != end && rc == ESP_ROM_SPIFLASH_RESULT_OK; ) {
rc = spiflash.erase_sector(sector);
++sector;
}
return rc;
}
esp_rom_spiflash_result_t esp_rom_spiflash_write(uint32_t target, const uint32_t *src, int32_t len)
{
return spiflash.write(target, src, len);
}
extern "C" esp_err_t esp_flash_write(esp_flash_t *chip, const void *buffer, uint32_t address, uint32_t length)
{
return spiflash.write(address, buffer, length);
}
esp_rom_spiflash_result_t esp_rom_spiflash_write_encrypted(uint32_t flash_addr, uint32_t *data, uint32_t len)
{
return spiflash.write(flash_addr, data, len);
}
void *heap_caps_malloc( size_t size, uint32_t caps )
{
return NULL;
}
esp_rom_spiflash_result_t esp_rom_spiflash_write_disable(void)
{
return ESP_ROM_SPIFLASH_RESULT_OK;
}
esp_flash_t* esp_flash_default_chip = NULL;

Wyświetl plik

@ -1,47 +0,0 @@
#include "esp_err.h"
#include "esp_rom_spiflash.h"
bool spi_flash_check_and_flush_cache(size_t start_addr, size_t length)
{
return true;
}
esp_rom_spiflash_result_t esp_rom_spiflash_unlock(void)
{
return ESP_ROM_SPIFLASH_RESULT_OK;
}
void spi_flash_init_lock(void)
{
return;
}
void spi_flash_op_lock(void)
{
return;
}
void spi_flash_op_unlock(void)
{
return;
}
void spi_flash_disable_interrupts_caches_and_other_cpu(void)
{
return;
}
void spi_flash_enable_interrupts_caches_and_other_cpu(void)
{
return;
}
void spi_flash_disable_interrupts_caches_and_other_cpu_no_os(void)
{
return;
}
void spi_flash_enable_interrupts_caches_no_os(void)
{
return;
}

Wyświetl plik

@ -1,3 +0,0 @@
#pragma once
#define CONFIG_PARTITION_TABLE_OFFSET 0x8000

Wyświetl plik

@ -1,65 +0,0 @@
ifndef COMPONENT
COMPONENT := stubs
endif
COMPONENT_LIB := lib$(COMPONENT).a
include Makefile.files
all: lib
ifndef SDKCONFIG
SDKCONFIG_DIR := $(dir $(realpath sdkconfig/sdkconfig.h))
SDKCONFIG := $(SDKCONFIG_DIR)sdkconfig.h
else
SDKCONFIG_DIR := $(dir $(realpath $(SDKCONFIG)))
endif
INCLUDE_FLAGS := $(addprefix -I, $(INCLUDE_DIRS) $(SDKCONFIG_DIR))
CPPFLAGS += $(INCLUDE_FLAGS) -g -m32
CXXFLAGS += $(INCLUDE_FLAGS) -std=c++11 -g -m32
CFILES := $(filter %.c, $(SOURCE_FILES))
CPPFILES := $(filter %.cpp, $(SOURCE_FILES))
CTARGET = ${2}/$(patsubst %.c,%.o,$(notdir ${1}))
CPPTARGET = ${2}/$(patsubst %.cpp,%.o,$(notdir ${1}))
ifndef BUILD_DIR
BUILD_DIR := build
endif
OBJ_FILES := $(addprefix $(BUILD_DIR)/, $(filter %.o, $(notdir $(SOURCE_FILES:.cpp=.o) $(SOURCE_FILES:.c=.o))))
%.o : %.c $(SDKCONFIG)
$(CC) $(CPPFLAGS) $(CFLAGS) $< - o $@
%.o : %.cpp $(SDKCONFIG)
$(CC) $(CPPFLAGS) $(CFLAGS) $< - o $@
define COMPILE_C
$(call CTARGET, ${1}, $(BUILD_DIR)) : ${1}
mkdir -p $(BUILD_DIR)
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $(call CTARGET, ${1}, $(BUILD_DIR)) ${1}
endef
define COMPILE_CPP
$(call CPPTARGET, ${1}, $(BUILD_DIR)) : ${1}
mkdir -p $(BUILD_DIR)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $(call CPPTARGET, ${1}, $(BUILD_DIR)) ${1}
endef
$(BUILD_DIR)/$(COMPONENT_LIB): $(OBJ_FILES) $(SDKCONFIG)
mkdir -p $(BUILD_DIR)
$(AR) rcs $@ $^
clean:
rm -f $(OBJ_FILES) $(BUILD_DIR)/$(COMPONENT_LIB)
lib: $(BUILD_DIR)/$(COMPONENT_LIB)
$(foreach cfile, $(CFILES), $(eval $(call COMPILE_C, $(cfile))))
$(foreach cxxfile, $(CPPFILES), $(eval $(call COMPILE_CPP, $(cxxfile))))
.PHONY: all lib clean

Wyświetl plik

@ -1,42 +0,0 @@
SOURCE_FILES := \
app_update/esp_ota_eps.c \
log/log.c \
newlib/lock.c \
esp32/crc.cpp \
esp32/esp_random.c \
esp_timer/src/esp_timer.c \
bsd/strlcpy.c\
bootloader_support/src/bootloader_common.c
INCLUDE_DIRS := \
../include \
../private_include \
app_update/include \
bsd/include \
driver/include \
esp_app_format/include \
esp_timer/include \
freertos/include \
log/include \
newlib/include \
sdmmc/include \
vfs/include \
$(addprefix ../../../../components/, \
esp_common/include \
esp_hw_support/include \
esp_hw_support/include/soc \
esp_system/include \
soc/esp32/include \
heap/include \
soc/include \
xtensa/include \
xtensa/esp32/include \
esp32/include \
esp_timer/include \
bootloader_support/include \
bootloader_support/bootloader_flash/include \
app_update/include \
hal/include \
esp_partition/include \
spi_flash/include \
)

Wyświetl plik

@ -1,21 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE used when compiling ESP-IDF to run tests on the host system.
* The source file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#include "esp_ota_ops.h"
#include "esp_partition.h"
const esp_partition_t* esp_ota_get_running_partition(void)
{
// Return first instance of an app partition
const esp_partition_t* partition = esp_partition_find_first(ESP_PARTITION_TYPE_APP,
ESP_PARTITION_SUBTYPE_ANY,
NULL);
assert(partition != NULL);
return partition;
}

Wyświetl plik

@ -1,14 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE HEADER used when compiling ESP-IDF to run tests on the host system.
* The header file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#pragma once
#include <stdint.h>
#include <stdio.h>
#include "esp_err.h"
esp_err_t bootloader_common_get_sha256_of_partition(uint32_t address, uint32_t size, int type, uint8_t *out_sha_256);

Wyświetl plik

@ -1,14 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE used when compiling ESP-IDF to run tests on the host system.
* The source file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#include "esp_err.h"
esp_err_t bootloader_common_get_sha256_of_partition (uint32_t address, uint32_t size, int type, uint8_t *out_sha_256)
{
return ESP_OK;
}

Wyświetl plik

@ -1,8 +0,0 @@
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
size_t strlcpy(char *dst, const char *src, size_t dsize);

Wyświetl plik

@ -1,60 +0,0 @@
/* $OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $ */
/*-
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <string.h>
/*
* Copy string src to buffer dst of size dsize. At most dsize-1
* chars will be copied. Always NUL terminates (unless dsize == 0).
* Returns strlen(src); if retval >= dsize, truncation occurred.
*/
size_t
strlcpy(char *dst, const char *src, size_t dsize)
{
const char *osrc = src;
size_t nleft = dsize;
/* Copy as many bytes as will fit. */
if (nleft != 0) {
while (--nleft != 0) {
if ((*dst++ = *src++) == '\0')
break;
}
}
/* Not enough room in dst, add NUL and traverse rest of src. */
if (nleft == 0) {
if (dsize != 0)
*dst = '\0'; /* NUL-terminate dst */
while (*src++)
;
}
return(src - osrc - 1); /* count does not include NUL */
}

Wyświetl plik

@ -1,17 +0,0 @@
include $(COMPONENT_PATH)/Makefile.files
COMPONENT_OWNBUILDTARGET := 1
COMPONENT_OWNCLEANTARGET := 1
COMPONENT_ADD_INCLUDEDIRS := $(INCLUDE_DIRS)
.PHONY: build
build: $(SDKCONFIG_HEADER)
$(MAKE) -C $(COMPONENT_PATH) lib SDKCONFIG=$(SDKCONFIG_HEADER) BUILD_DIR=$(COMPONENT_BUILD_DIR) COMPONENT=$(COMPONENT_NAME)
CLEAN_FILES := component_project_vars.mk
.PHONY: clean
clean:
$(summary) RM $(CLEAN_FILES)
rm -f $(CLEAN_FILES)
$(MAKE) -C $(COMPONENT_PATH) clean SDKCONFIG=$(SDKCONFIG_HEADER) BUILD_DIR=$(COMPONENT_BUILD_DIR) COMPONENT=$(COMPONENT_NAME)

Wyświetl plik

@ -1,13 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE HEADER used when compiling ESP-IDF to run tests on the host system.
* The header file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#pragma once
#include <stdlib.h>
#include "sdmmc_types.h"

Wyświetl plik

@ -1,19 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE HEADER used when compiling ESP-IDF to run tests on the host system.
* The header file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#pragma once
#if defined(__cplusplus)
extern "C" {
#endif
typedef int sdmmc_card_t;
#if defined(__cplusplus)
}
#endif

Wyświetl plik

@ -1,58 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE used when compiling ESP-IDF to run tests on the host system.
* The source file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#include <stdint.h>
#include <stdbool.h>
static const unsigned int crc32_le_table[256] = {
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, 0x706af48fL, 0xe963a535L, 0x9e6495a3L,
0x0edb8832L, 0x79dcb8a4L, 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, 0x90bf1d91L,
0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L,
0x136c9856L, 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, 0xfa0f3d63L, 0x8d080df5L,
0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L,
0x26d930acL, 0x51de003aL, 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, 0xb8bda50fL,
0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL,
0x76dc4190L, 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, 0x9fbfe4a5L, 0xe8b8d433L,
0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L,
0x65b0d9c6L, 0x12b7e950L, 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, 0xfbd44c65L,
0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL,
0x4369e96aL, 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, 0xaa0a4c5fL, 0xdd0d7cc9L,
0x5005713cL, 0x270241aaL, 0xbe0b1010L, 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL,
0xedb88320L, 0x9abfb3b6L, 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, 0x73dc1683L,
0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L,
0xf00f9344L, 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, 0x196c3671L, 0x6e6b06e7L,
0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL,
0xd80d2bdaL, 0xaf0a1b4cL, 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, 0x4669be79L,
0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL,
0xc5ba3bbeL, 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, 0x2cd99e8bL, 0x5bdeae1dL,
0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L,
0x86d3d2d4L, 0xf1d4e242L, 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, 0x18b74777L,
0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L,
0xa00ae278L, 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, 0x4969474dL, 0x3e6e77dbL,
0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, 0xcdd70693L, 0x54de5729L, 0x23d967bfL,
0xb3667a2eL, 0xc4614ab8L, 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, 0x2d02ef8dL
};
extern "C" unsigned int crc32_le(unsigned int crc, unsigned char const * buf,unsigned int len)
{
unsigned int i;
crc = ~crc;
for(i=0;i<len;i++){
crc = crc32_le_table[(crc^buf[i])&0xff]^(crc>>8);
}
return ~crc;
}

Wyświetl plik

@ -1,21 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE used when compiling ESP-IDF to run tests on the host system.
* The source file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <time.h>
#include <string.h>
#include <stddef.h>
#include "esp_system.h"
uint32_t esp_random(void)
{
return (uint32_t)rand();
}

Wyświetl plik

@ -1,47 +0,0 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE used when compiling ESP-IDF to run tests on the host system.
* The source file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include "esp_err.h"
#include "esp_assert.h"
#ifdef __cplusplus
extern "C"
{
#endif
#define ESP_APP_DESC_MAGIC_WORD (0xABCD5432) /*!< The magic word for the esp_app_desc structure that is in DROM. */
/**
* @brief Description about application.
*/
typedef struct {
uint32_t magic_word; /*!< Magic word ESP_APP_DESC_MAGIC_WORD */
uint32_t secure_version; /*!< Secure version */
uint32_t reserv1[2]; /*!< reserv1 */
char version[32]; /*!< Application version */
char project_name[32]; /*!< Project name */
char time[16]; /*!< Compile time */
char date[16]; /*!< Compile date*/
char idf_ver[32]; /*!< Version IDF */
uint8_t app_elf_sha256[32]; /*!< sha256 of elf file */
uint32_t reserv2[20]; /*!< reserv2 */
} esp_app_desc_t;
/** @cond */
ESP_STATIC_ASSERT(sizeof(esp_app_desc_t) == 256, "esp_app_desc_t should be 256 bytes");
/** @endcond */
#ifdef __cplusplus
}
#endif

Wyświetl plik

@ -1,22 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE HEADER used when compiling ESP-IDF to run tests on the host system.
* The header file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#pragma once
#include <stdint.h>
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
int64_t esp_timer_get_time(void);
#ifdef __cplusplus
}
#endif

Wyświetl plik

@ -1,14 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE used when compiling ESP-IDF to run tests on the host system.
* The source file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#include "esp_timer.h"
int64_t esp_timer_get_time(void)
{
return 0;
}

Wyświetl plik

@ -1,12 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE HEADER used when compiling ESP-IDF to run tests on the host system.
* The header file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#pragma once
#include "projdefs.h"
#include "semphr.h"

Wyświetl plik

@ -1,19 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE HEADER used when compiling ESP-IDF to run tests on the host system.
* The header file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#pragma once
#if defined(__cplusplus)
extern "C" {
#endif
#define pdTRUE 1
#if defined(__cplusplus)
}
#endif

Wyświetl plik

@ -1,24 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE HEADER used when compiling ESP-IDF to run tests on the host system.
* The header file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#pragma once
#if defined(__cplusplus)
extern "C" {
#endif
#define vSemaphoreDelete( xSemaphore )
#define xSemaphoreCreateMutex() ((void*)(1))
#define xSemaphoreGive( xSemaphore )
#define xSemaphoreTake( xSemaphore, xBlockTime ) pdTRUE
typedef void* SemaphoreHandle_t;
#if defined(__cplusplus)
}
#endif

Wyświetl plik

@ -1,9 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE HEADER used when compiling ESP-IDF to run tests on the host system.
* The header file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#pragma once

Wyświetl plik

@ -1,65 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE HEADER used when compiling ESP-IDF to run tests on the host system.
* The header file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include "sdkconfig.h"
#ifdef __cplusplus
extern "C" {
#endif
#define heap_caps_malloc(a, b) NULL
#define MALLOC_CAP_INTERNAL 0
#define MALLOC_CAP_8BIT 0
#define LOG_LOCAL_LEVEL CONFIG_LOG_DEFAULT_LEVEL
typedef enum {
ESP_LOG_NONE, /*!< No log output */
ESP_LOG_ERROR, /*!< Critical errors, software module can not recover on its own */
ESP_LOG_WARN, /*!< Error conditions from which recovery measures have been taken */
ESP_LOG_INFO, /*!< Information messages which describe normal flow of events */
ESP_LOG_DEBUG, /*!< Extra information which is not necessary for normal use (values, pointers, sizes, etc). */
ESP_LOG_VERBOSE /*!< Bigger chunks of debugging information, or frequent messages which can potentially flood the output. */
} esp_log_level_t;
#define LOG_COLOR_E
#define LOG_COLOR_W
#define LOG_COLOR_I
#define LOG_COLOR_D
#define LOG_COLOR_V
#define LOG_RESET_COLOR
#undef ESP_STATIC_ASSERT
#define ESP_STATIC_ASSERT(cond, message)
uint32_t esp_log_timestamp(void);
void esp_log_write(esp_log_level_t level, const char* tag, const char* format, ...) __attribute__ ((format (printf, 3, 4)));
#define LOG_FORMAT(letter, format) LOG_COLOR_ ## letter #letter " (%d) %s: " format LOG_RESET_COLOR "\n"
#define ESP_LOGE( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_ERROR) { esp_log_write(ESP_LOG_ERROR, tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#define ESP_LOGW( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_WARN) { esp_log_write(ESP_LOG_WARN, tag, LOG_FORMAT(W, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#define ESP_LOGI( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_INFO) { esp_log_write(ESP_LOG_INFO, tag, LOG_FORMAT(I, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#define ESP_LOGD( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_DEBUG) { esp_log_write(ESP_LOG_DEBUG, tag, LOG_FORMAT(D, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#define ESP_LOGV( tag, format, ... ) if (LOG_LOCAL_LEVEL >= ESP_LOG_VERBOSE) { esp_log_write(ESP_LOG_VERBOSE, tag, LOG_FORMAT(V, format), esp_log_timestamp(), tag, ##__VA_ARGS__); }
#define esp_flash_encryption_enabled() false
#ifdef __cplusplus
}
#endif

Wyświetl plik

@ -1,29 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE used when compiling ESP-IDF to run tests on the host system.
* The source file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <time.h>
#include "esp_log.h"
void esp_log_write(esp_log_level_t level,
const char *tag,
const char *format, ...)
{
va_list arg;
va_start(arg, format);
vprintf(format, arg);
va_end(arg);
}
uint32_t esp_log_timestamp(void)
{
return 0;
}

Wyświetl plik

@ -1,26 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE HEADER used when compiling ESP-IDF to run tests on the host system.
* The header file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#pragma once
#include <time.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef int _lock_t;
void _lock_acquire(_lock_t *lock);
void _lock_close(_lock_t *lock);
void _lock_init(_lock_t *lock);
void _lock_release(_lock_t *lock);
#ifdef __cplusplus
}
#endif

Wyświetl plik

@ -1,29 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE used when compiling ESP-IDF to run tests on the host system.
* The source file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#include "sys/lock.h"
void _lock_acquire(_lock_t *lock)
{
return;
}
void _lock_close(_lock_t *lock)
{
return;
}
void _lock_init(_lock_t *lock)
{
return;
}
void _lock_release(_lock_t *lock)
{
return;
}

Wyświetl plik

@ -1,8 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE HEADER used when compiling ESP-IDF to run tests on the host system.
*/
#pragma once

Wyświetl plik

@ -1,11 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE HEADER used when compiling ESP-IDF to run tests on the host system.
* The header file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#pragma once
#include "esp_err.h"

Wyświetl plik

@ -1,90 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE HEADER used when compiling ESP-IDF to run tests on the host system.
* The header file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#ifndef __ESP_PARTITION_H__
#define __ESP_PARTITION_H__
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include "esp_err.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
ESP_PARTITION_TYPE_APP = 0x00, //!< Application partition type
ESP_PARTITION_TYPE_DATA = 0x01, //!< Data partition type
} esp_partition_type_t;
typedef enum {
ESP_PARTITION_SUBTYPE_APP_FACTORY = 0x00, //!< Factory application partition
ESP_PARTITION_SUBTYPE_APP_OTA_MIN = 0x10, //!< Base for OTA partition subtypes
ESP_PARTITION_SUBTYPE_APP_OTA_0 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 0, //!< OTA partition 0
ESP_PARTITION_SUBTYPE_APP_OTA_1 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 1, //!< OTA partition 1
ESP_PARTITION_SUBTYPE_APP_OTA_2 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 2, //!< OTA partition 2
ESP_PARTITION_SUBTYPE_APP_OTA_3 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 3, //!< OTA partition 3
ESP_PARTITION_SUBTYPE_APP_OTA_4 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 4, //!< OTA partition 4
ESP_PARTITION_SUBTYPE_APP_OTA_5 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 5, //!< OTA partition 5
ESP_PARTITION_SUBTYPE_APP_OTA_6 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 6, //!< OTA partition 6
ESP_PARTITION_SUBTYPE_APP_OTA_7 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 7, //!< OTA partition 7
ESP_PARTITION_SUBTYPE_APP_OTA_8 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 8, //!< OTA partition 8
ESP_PARTITION_SUBTYPE_APP_OTA_9 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 9, //!< OTA partition 9
ESP_PARTITION_SUBTYPE_APP_OTA_10 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 10,//!< OTA partition 10
ESP_PARTITION_SUBTYPE_APP_OTA_11 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 11,//!< OTA partition 11
ESP_PARTITION_SUBTYPE_APP_OTA_12 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 12,//!< OTA partition 12
ESP_PARTITION_SUBTYPE_APP_OTA_13 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 13,//!< OTA partition 13
ESP_PARTITION_SUBTYPE_APP_OTA_14 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 14,//!< OTA partition 14
ESP_PARTITION_SUBTYPE_APP_OTA_15 = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 15,//!< OTA partition 15
ESP_PARTITION_SUBTYPE_APP_OTA_MAX = ESP_PARTITION_SUBTYPE_APP_OTA_MIN + 16,//!< Max subtype of OTA partition
ESP_PARTITION_SUBTYPE_APP_TEST = 0x20, //!< Test application partition
ESP_PARTITION_SUBTYPE_DATA_OTA = 0x00, //!< OTA selection partition
ESP_PARTITION_SUBTYPE_DATA_PHY = 0x01, //!< PHY init data partition
ESP_PARTITION_SUBTYPE_DATA_NVS = 0x02, //!< NVS partition
ESP_PARTITION_SUBTYPE_DATA_COREDUMP = 0x03, //!< COREDUMP partition
ESP_PARTITION_SUBTYPE_DATA_NVS_KEYS = 0x04, //!< Partition for NVS keys
ESP_PARTITION_SUBTYPE_DATA_EFUSE_EM = 0x05, //!< Partition for emulate eFuse bits
ESP_PARTITION_SUBTYPE_DATA_UNDEFINED = 0x06, //!< Undefined (or unspecified) data partition
ESP_PARTITION_SUBTYPE_DATA_ESPHTTPD = 0x80, //!< ESPHTTPD partition
ESP_PARTITION_SUBTYPE_DATA_FAT = 0x81, //!< FAT partition
ESP_PARTITION_SUBTYPE_DATA_SPIFFS = 0x82, //!< SPIFFS partition
ESP_PARTITION_SUBTYPE_ANY = 0xff, //!< Used to search for partitions with any subtype
} esp_partition_subtype_t;
/**
* @brief Opaque partition iterator type
*/
typedef struct esp_partition_iterator_opaque_* esp_partition_iterator_t;
/**
* @brief partition information structure
*
* This is not the format in flash, that format is esp_partition_info_t.
*
* However, this is the format used by this API.
*/
typedef struct {
void* flash_chip; /*!< SPI flash chip on which the partition resides */
esp_partition_type_t type; /*!< partition type (app/data) */
esp_partition_subtype_t subtype; /*!< partition subtype */
uint32_t address; /*!< starting address of the partition in flash */
uint32_t size; /*!< size of the partition, in bytes */
char label[17]; /*!< partition label, zero-terminated ASCII string */
bool encrypted; /*!< flag is set to true if partition is encrypted */
} esp_partition_t;
#ifdef __cplusplus
}
#endif
#endif /* __ESP_PARTITION_H__ */

Wyświetl plik

@ -1,14 +0,0 @@
/*
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*
* This is a STUB FILE HEADER used when compiling ESP-IDF to run tests on the host system.
* The header file used normally for ESP-IDF has the same name but is located elsewhere.
*/
#pragma once
#include "esp_err.h"
#define ESP_VFS_FLAG_CONTEXT_PTR 1
#define ESP_VFS_PATH_MAX 15

Wyświetl plik

@ -1,98 +0,0 @@
ifndef COMPONENT
COMPONENT := wl
endif
COMPONENT_LIB := lib$(COMPONENT).a
TEST_PROGRAM := test_$(COMPONENT)
STUBS_LIB_DIR := ../../../components/spi_flash/sim/stubs
STUBS_LIB_BUILD_DIR := $(STUBS_LIB_DIR)/build
STUBS_LIB := libstubs.a
SPI_FLASH_SIM_DIR := ../../../components/spi_flash/sim
SPI_FLASH_SIM_BUILD_DIR := $(SPI_FLASH_SIM_DIR)/build
SPI_FLASH_SIM_LIB := libspi_flash.a
include Makefile.files
all: test
ifndef SDKCONFIG
SDKCONFIG_DIR := $(dir $(realpath sdkconfig/sdkconfig.h))
SDKCONFIG := $(SDKCONFIG_DIR)sdkconfig.h
else
SDKCONFIG_DIR := $(dir $(realpath $(SDKCONFIG)))
endif
INCLUDE_FLAGS := $(addprefix -I, $(INCLUDE_DIRS) -I../../../heap/include/soc $(SDKCONFIG_DIR) ../../../tools/catch)
CPPFLAGS += $(INCLUDE_FLAGS) -g -m32
CXXFLAGS += $(INCLUDE_FLAGS) -std=c++11 -g -m32
# Build libraries that this component is dependent on
$(STUBS_LIB_BUILD_DIR)/$(STUBS_LIB): force
$(MAKE) -C $(STUBS_LIB_DIR) lib SDKCONFIG=$(SDKCONFIG)
$(SPI_FLASH_SIM_BUILD_DIR)/$(SPI_FLASH_SIM_LIB): force
$(MAKE) -C $(SPI_FLASH_SIM_DIR) lib SDKCONFIG=$(SDKCONFIG)
# Create target for building this component as a library
CFILES := $(filter %.c, $(SOURCE_FILES))
CPPFILES := $(filter %.cpp, $(SOURCE_FILES))
CTARGET = ${2}/$(patsubst %.c,%.o,$(notdir ${1}))
CPPTARGET = ${2}/$(patsubst %.cpp,%.o,$(notdir ${1}))
ifndef BUILD_DIR
BUILD_DIR := build
endif
OBJ_FILES := $(addprefix $(BUILD_DIR)/, $(filter %.o, $(notdir $(SOURCE_FILES:.cpp=.o) $(SOURCE_FILES:.c=.o))))
define COMPILE_C
$(call CTARGET, ${1}, $(BUILD_DIR)) : ${1} $(SDKCONFIG)
mkdir -p $(BUILD_DIR)
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $(call CTARGET, ${1}, $(BUILD_DIR)) ${1}
endef
define COMPILE_CPP
$(call CPPTARGET, ${1}, $(BUILD_DIR)) : ${1} $(SDKCONFIG)
mkdir -p $(BUILD_DIR)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $(call CPPTARGET, ${1}, $(BUILD_DIR)) ${1}
endef
$(BUILD_DIR)/$(COMPONENT_LIB): $(OBJ_FILES) $(SDKCONFIG)
mkdir -p $(BUILD_DIR)
$(AR) rcs $@ $^
clean:
$(MAKE) -C $(STUBS_LIB_DIR) clean
$(MAKE) -C $(SPI_FLASH_SIM_DIR) clean
rm -f $(OBJ_FILES) $(TEST_OBJ_FILES) $(TEST_PROGRAM) $(COMPONENT_LIB) partition_table.bin
lib: $(BUILD_DIR)/$(COMPONENT_LIB)
$(foreach cfile, $(CFILES), $(eval $(call COMPILE_C, $(cfile))))
$(foreach cxxfile, $(CPPFILES), $(eval $(call COMPILE_CPP, $(cxxfile))))
# Create target for building this component as a test
TEST_SOURCE_FILES = \
test_wl.cpp \
main.cpp \
TEST_OBJ_FILES = $(filter %.o, $(TEST_SOURCE_FILES:.cpp=.o) $(TEST_SOURCE_FILES:.c=.o))
$(TEST_PROGRAM): lib $(TEST_OBJ_FILES) $(SPI_FLASH_SIM_BUILD_DIR)/$(SPI_FLASH_SIM_LIB) $(STUBS_LIB_BUILD_DIR)/$(STUBS_LIB) partition_table.bin $(SDKCONFIG)
g++ $(LDFLAGS) $(CXXFLAGS) -o $@ $(TEST_OBJ_FILES) -L$(BUILD_DIR) -l:$(COMPONENT_LIB) -L$(SPI_FLASH_SIM_BUILD_DIR) -l:$(SPI_FLASH_SIM_LIB) -L$(STUBS_LIB_BUILD_DIR) -l:$(STUBS_LIB)
test: $(TEST_PROGRAM)
./$(TEST_PROGRAM)
# Create other necessary targets
partition_table.bin: partition_table.csv
python ../../../components/partition_table/gen_esp32part.py --verify $< $@
force:
.PHONY: all lib test clean force

Wyświetl plik

@ -1,44 +0,0 @@
SOURCE_FILES := \
$(addprefix ../, \
wear_levelling.cpp \
crc32.cpp \
../esp_rom/linux/esp_rom_crc.c \
WL_Flash.cpp \
Partition.cpp \
)
INCLUDE_DIRS := \
. \
../ \
../include \
../private_include \
../../spi_flash/sim \
$(addprefix ../../spi_flash/sim/stubs/, \
app_update/include \
driver/include \
freertos/include \
log/include \
newlib/include \
sdmmc/include \
vfs/include \
) \
$(addprefix ../../../components/, \
heap/include \
esp_rom/include \
esp_system/include \
esp_common/include \
esp_hw_support/include \
esp_hw_support/include/soc \
xtensa/include \
xtensa/esp32/include \
soc/esp32/include \
heap/include \
soc/include \
esp32/include \
bootloader_support/include \
bootloader_support/bootloader_flash/include \
app_update/include \
hal/include \
spi_flash/include \
esp_partition/include \
)

Wyświetl plik

@ -1,17 +0,0 @@
include $(COMPONENT_PATH)/Makefile.files
COMPONENT_OWNBUILDTARGET := 1
COMPONENT_OWNCLEANTARGET := 1
COMPONENT_ADD_INCLUDEDIRS := $(INCLUDE_DIRS)
.PHONY: build
build: $(SDKCONFIG_HEADER)
$(MAKE) -C $(COMPONENT_PATH) lib SDKCONFIG=$(SDKCONFIG_HEADER) BUILD_DIR=$(COMPONENT_BUILD_DIR) COMPONENT=$(COMPONENT_NAME)
CLEAN_FILES := component_project_vars.mk
.PHONY: clean
clean:
$(summary) RM $(CLEAN_FILES)
rm -f $(CLEAN_FILES)
$(MAKE) -C $(COMPONENT_PATH) clean SDKCONFIG=$(SDKCONFIG_HEADER) BUILD_DIR=$(COMPONENT_BUILD_DIR) COMPONENT=$(COMPONENT_NAME)

Wyświetl plik

@ -1,14 +0,0 @@
/*
* SPDX-FileCopyrightText: 2016-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#define CONFIG_IDF_TARGET_ESP32 1
#define CONFIG_WL_SECTOR_SIZE 4096
#define CONFIG_LOG_DEFAULT_LEVEL 3
#define CONFIG_PARTITION_TABLE_OFFSET 0x8000
#define CONFIG_ESPTOOLPY_FLASHSIZE "8MB"
//currently use the legacy implementation, since the stubs for new HAL are not done yet
#define CONFIG_SPI_FLASH_USE_LEGACY_IMPL 1
#define CONFIG_MMU_PAGE_SIZE 0X10000 // 64KB

Wyświetl plik

@ -1021,11 +1021,6 @@ components/spi_flash/include/spi_flash_chip_generic.h
components/spi_flash/include/spi_flash_chip_issi.h
components/spi_flash/include/spi_flash_chip_mxic.h
components/spi_flash/include/spi_flash_chip_winbond.h
components/spi_flash/sim/SpiFlash.cpp
components/spi_flash/sim/flash_mock.cpp
components/spi_flash/sim/flash_mock_util.c
components/spi_flash/sim/sdkconfig/sdkconfig.h
components/spi_flash/sim/stubs/bsd/strlcpy.c
components/spi_flash/spi_flash_chip_boya.c
components/spi_flash/spi_flash_chip_issi.c
components/spi_flash/spi_flash_chip_mxic.c