mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-01 04:50:58 +02:00
Update IDF, fix SS definition, add custom partitions and debug level selection (#174)
* Add build time partitions compilation * Fix wrong definition of SS pin * Add support for core debug level selection * update idf libs
This commit is contained in:
@ -31,6 +31,8 @@ extern "C" {
|
||||
|
||||
#define SPI_FLASH_SEC_SIZE 4096 /**< SPI Flash sector size */
|
||||
|
||||
#define SPI_FLASH_MMU_PAGE_SIZE 0x10000 /**< Flash cache MMU mapping page size */
|
||||
|
||||
/**
|
||||
* @brief Initialize SPI flash access driver
|
||||
*
|
||||
@ -92,14 +94,18 @@ esp_err_t spi_flash_write(size_t dest_addr, const void *src, size_t size);
|
||||
*
|
||||
* @note Flash encryption must be enabled for this function to work.
|
||||
*
|
||||
* @note Address in flash, dest, has to be 32-byte aligned.
|
||||
* @note Flash encryption must be enabled when calling this function.
|
||||
* If flash encryption is disabled, the function returns
|
||||
* ESP_ERR_INVALID_STATE. Use esp_flash_encryption_enabled()
|
||||
* function to determine if flash encryption is enabled.
|
||||
*
|
||||
* @note If source address is in DROM, this function will return
|
||||
* ESP_ERR_INVALID_ARG.
|
||||
* @note Both dest_addr and size must be multiples of 16 bytes. For
|
||||
* absolute best performance, both dest_addr and size arguments should
|
||||
* be multiples of 32 bytes.
|
||||
*
|
||||
* @param dest_addr destination address in Flash. Must be a multiple of 32 bytes.
|
||||
* @param dest_addr destination address in Flash. Must be a multiple of 16 bytes.
|
||||
* @param src pointer to the source buffer.
|
||||
* @param size length of data, in bytes. Must be a multiple of 32 bytes.
|
||||
* @param size length of data, in bytes. Must be a multiple of 16 bytes.
|
||||
*
|
||||
* @return esp_err_t
|
||||
*/
|
||||
@ -116,6 +122,23 @@ esp_err_t spi_flash_write_encrypted(size_t dest_addr, const void *src, size_t si
|
||||
*/
|
||||
esp_err_t spi_flash_read(size_t src_addr, void *dest, size_t size);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Read data from Encrypted Flash.
|
||||
*
|
||||
* If flash encryption is enabled, this function will transparently decrypt data as it is read.
|
||||
* If flash encryption is not enabled, this function behaves the same as spi_flash_read().
|
||||
*
|
||||
* See esp_flash_encryption_enabled() for a function to check if flash encryption is enabled.
|
||||
*
|
||||
* @param src source address of the data in Flash.
|
||||
* @param dest pointer to the destination buffer
|
||||
* @param size length of data
|
||||
*
|
||||
* @return esp_err_t
|
||||
*/
|
||||
esp_err_t spi_flash_read_encrypted(size_t src, void *dest, size_t size);
|
||||
|
||||
/**
|
||||
* @brief Enumeration which specifies memory space requested in an mmap call
|
||||
*/
|
||||
@ -140,7 +163,8 @@ typedef uint32_t spi_flash_mmap_handle_t;
|
||||
* page allocation, use spi_flash_mmap_dump function.
|
||||
*
|
||||
* @param src_addr Physical address in flash where requested region starts.
|
||||
* This address *must* be aligned to 64kB boundary.
|
||||
* This address *must* be aligned to 64kB boundary
|
||||
* (SPI_FLASH_MMU_PAGE_SIZE).
|
||||
* @param size Size of region which has to be mapped. This size will be rounded
|
||||
* up to a 64k boundary.
|
||||
* @param memory Memory space where the region should be mapped
|
||||
@ -181,16 +205,44 @@ typedef void (*spi_flash_guard_start_func_t)(void);
|
||||
* @brief SPI flash critical section exit function.
|
||||
*/
|
||||
typedef void (*spi_flash_guard_end_func_t)(void);
|
||||
/**
|
||||
* @brief SPI flash operation lock function.
|
||||
*/
|
||||
typedef void (*spi_flash_op_lock_func_t)(void);
|
||||
/**
|
||||
* @brief SPI flash operation unlock function.
|
||||
*/
|
||||
typedef void (*spi_flash_op_unlock_func_t)(void);
|
||||
|
||||
/**
|
||||
* Structure holding SPI flash access critical section management functions
|
||||
* Structure holding SPI flash access critical sections management functions.
|
||||
*
|
||||
* Flash API uses two types of flash access management functions:
|
||||
* 1) Functions which prepare/restore flash cache and interrupts before calling
|
||||
* appropriate ROM functions (SPIWrite, SPIRead and SPIEraseBlock):
|
||||
* - 'start' function should disables flash cache and non-IRAM interrupts and
|
||||
* is invoked before the call to one of ROM function above.
|
||||
* - 'end' function should restore state of flash cache and non-IRAM interrupts and
|
||||
* is invoked after the call to one of ROM function above.
|
||||
* 2) Functions which synchronizes access to internal data used by flash API.
|
||||
* This functions are mostly intended to synchronize access to flash API internal data
|
||||
* in multithreaded environment and use OS primitives:
|
||||
* - 'op_lock' locks access to flash API internal data.
|
||||
* - 'op_unlock' unlocks access to flash API internal data.
|
||||
* Different versions of the guarding functions should be used depending on the context of
|
||||
* execution (with or without functional OS). In normal conditions when flash API is called
|
||||
* from task the functions use OS primitives. When there is no OS at all or when
|
||||
* it is not guaranteed that OS is functional (accessing flash from exception handler) these
|
||||
* functions cannot use OS primitives or even does not need them (multithreaded access is not possible).
|
||||
*
|
||||
* @note Structure and corresponding guard functions should not reside in flash.
|
||||
* For example structure can be placed in DRAM and functions in IRAM sections.
|
||||
*/
|
||||
typedef struct {
|
||||
spi_flash_guard_start_func_t start; /**< critical section start func */
|
||||
spi_flash_guard_end_func_t end; /**< critical section end func */
|
||||
spi_flash_guard_start_func_t start; /**< critical section start func */
|
||||
spi_flash_guard_end_func_t end; /**< critical section end func */
|
||||
spi_flash_op_lock_func_t op_lock; /**< flash access API lock func */
|
||||
spi_flash_op_unlock_func_t op_unlock; /**< flash access API unlock func */
|
||||
} spi_flash_guard_funcs_t;
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user