Adding SPI Flash support, bump version.
This commit is contained in:
@ -12,7 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
VERSION=7.0.6.10
|
||||
VERSION=7.0.6.11
|
||||
STABLE_VERSION=7.0.5.4
|
||||
REVISION=$(shell git rev-parse HEAD | head -c 20)
|
||||
REVSHORT=$(shell echo $(REVISION) | head -c 7)
|
||||
|
||||
@ -78,6 +78,45 @@ transfer{
|
||||
forth definitions
|
||||
[THEN]
|
||||
|
||||
DEFINED? spi_flash_init [IF]
|
||||
vocabulary spi_flash spi_flash definitions
|
||||
transfer{
|
||||
spi_flash_init spi_flash_get_chip_size
|
||||
spi_flash_erase_sector spi_flash_erase_range
|
||||
spi_flash_write spi_flash_write_encrypted
|
||||
spi_flash_read spi_flash_read_encrypted
|
||||
spi_flash_mmap spi_flash_mmap_pages spi_flash_munmap
|
||||
spi_flash_mmap_dump spi_flash_mmap_get_free_pages
|
||||
spi_flash_cache2phys spi_flash_phys2cache spi_flash_cache_enabled
|
||||
esp_partition_find esp_partition_find_first esp_partition_get
|
||||
esp_partition_next esp_partition_iterator_release
|
||||
esp_partition_verify esp_partition_read esp_partition_write
|
||||
esp_partition_erase_range esp_partition_mmap
|
||||
esp_partition_get_sha256 esp_partition_check_identity
|
||||
}transfer
|
||||
0 constant SPI_PARTITION_TYPE_APP
|
||||
1 constant SPI_PARTITION_TYPE_DATA
|
||||
$ff constant SPI_PARTITION_SUBTYPE_ANY
|
||||
( Work around changing struct layout )
|
||||
: p>common ( part -- part' ) esp_partition_t_size 44 >= if cell+ then ;
|
||||
: p>type ( part -- n ) p>common @ ;
|
||||
: p>subtype ( part -- n ) p>common cell+ @ ;
|
||||
: p>address ( part -- n ) p>common 2 cells + @ ;
|
||||
: p>size ( part -- n ) p>common 3 cells + @ ;
|
||||
: p>label ( part -- a n ) p>common 4 cells + z>s ;
|
||||
: p. ( part -- )
|
||||
base @ >r >r decimal
|
||||
." TYPE: " r@ p>type . ." SUBTYPE: " r@ p>subtype .
|
||||
." ADDR: " r@ hex p>address . ." SIZE: " r@ p>size .
|
||||
." LABEL: " r> p>label type cr r> base ! ;
|
||||
: list-partition-type ( type -- )
|
||||
SPI_PARTITION_SUBTYPE_ANY 0 esp_partition_find
|
||||
begin dup esp_partition_get p. esp_partition_next dup 0= until drop ;
|
||||
: list-partitions SPI_PARTITION_TYPE_APP list-partition-type
|
||||
SPI_PARTITION_TYPE_DATA list-partition-type ;
|
||||
forth definitions
|
||||
[THEN]
|
||||
|
||||
vocabulary SPIFFS SPIFFS definitions
|
||||
transfer{
|
||||
SPIFFS.begin SPIFFS.end
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#define ENABLE_INTERRUPTS_SUPPORT
|
||||
#define ENABLE_LEDC_SUPPORT
|
||||
#define ENABLE_SD_SUPPORT
|
||||
#define ENABLE_SPI_FLASH_SUPPORT
|
||||
|
||||
// SD_MMC does not work on ESP32-S2 / ESP32-C3
|
||||
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
@ -117,6 +118,7 @@
|
||||
OPTIONAL_INTERRUPTS_SUPPORT \
|
||||
OPTIONAL_RMT_SUPPORT \
|
||||
OPTIONAL_OLED_SUPPORT \
|
||||
OPTIONAL_SPI_FLASH_SUPPORT \
|
||||
USER_WORDS
|
||||
|
||||
#define REQUIRED_MEMORY_SUPPORT \
|
||||
@ -202,6 +204,66 @@
|
||||
Y(dacWrite, dacWrite(n1, n0); DROPn(2))
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_SPI_FLASH_SUPPORT
|
||||
# define OPTIONAL_SPI_FLASH_SUPPORT
|
||||
#else
|
||||
# include "esp_spi_flash.h"
|
||||
# include "esp_partition.h"
|
||||
# define OPTIONAL_SPI_FLASH_SUPPORT \
|
||||
Y(spi_flash_init, spi_flash_init()) \
|
||||
Y(spi_flash_get_chip_size, PUSH spi_flash_get_chip_size()) \
|
||||
Y(spi_flash_erase_sector, n0 = spi_flash_erase_sector(n0)) \
|
||||
Y(spi_flash_erase_range, n0 = spi_flash_erase_range(n1, n0); DROP) \
|
||||
Y(spi_flash_write, n0 = spi_flash_write(n2, a1, n0); NIPn(2)) \
|
||||
Y(spi_flash_write_encrypted, n0 = spi_flash_write_encrypted(n2, a1, n0); NIPn(2)) \
|
||||
Y(spi_flash_read, n0 = spi_flash_read(n2, a1, n0); NIPn(2)) \
|
||||
Y(spi_flash_read_encrypted, n0 = spi_flash_read_encrypted(n2, a1, n0); NIPn(2)) \
|
||||
Y(spi_flash_mmap, \
|
||||
n0 = spi_flash_mmap(n4, n3, (spi_flash_mmap_memory_t) n2, \
|
||||
(const void **) a1, (spi_flash_mmap_handle_t *) a0); NIPn(4)) \
|
||||
Y(spi_flash_mmap_pages, \
|
||||
n0 = spi_flash_mmap_pages((const int *) a4, n3, (spi_flash_mmap_memory_t) n2, \
|
||||
(const void **) a1, (spi_flash_mmap_handle_t *) a0); NIPn(4)) \
|
||||
Y(spi_flash_munmap, spi_flash_munmap((spi_flash_mmap_handle_t) a0); DROP) \
|
||||
Y(spi_flash_mmap_dump, spi_flash_mmap_dump()) \
|
||||
Y(spi_flash_mmap_get_free_pages, \
|
||||
n0 = spi_flash_mmap_get_free_pages((spi_flash_mmap_memory_t) n0)) \
|
||||
Y(spi_flash_cache2phys, n0 = spi_flash_cache2phys(a0)) \
|
||||
Y(spi_flash_phys2cache, \
|
||||
n0 = (cell_t) spi_flash_phys2cache(n1, (spi_flash_mmap_memory_t) n0); NIP) \
|
||||
Y(spi_flash_cache_enabled, PUSH spi_flash_cache_enabled()) \
|
||||
Y(esp_partition_find, \
|
||||
n0 = (cell_t) esp_partition_find((esp_partition_type_t) n2, \
|
||||
(esp_partition_subtype_t) n1, c0); NIPn(2)) \
|
||||
Y(esp_partition_find_first, \
|
||||
n0 = (cell_t) esp_partition_find_first((esp_partition_type_t) n2, \
|
||||
(esp_partition_subtype_t) n1, c0); NIPn(2)) \
|
||||
Y(esp_partition_t_size, PUSH sizeof(esp_partition_t)) \
|
||||
Y(esp_partition_get, \
|
||||
n0 = (cell_t) esp_partition_get((esp_partition_iterator_t) a0)) \
|
||||
Y(esp_partition_next, \
|
||||
n0 = (cell_t) esp_partition_next((esp_partition_iterator_t) a0)) \
|
||||
Y(esp_partition_iterator_release, \
|
||||
esp_partition_iterator_release((esp_partition_iterator_t) a0); DROP) \
|
||||
Y(esp_partition_verify, n0 = (cell_t) esp_partition_verify((esp_partition_t *) a0)) \
|
||||
Y(esp_partition_read, \
|
||||
n0 = esp_partition_read((const esp_partition_t *) a3, n2, a1, n0); NIPn(3)) \
|
||||
Y(esp_partition_write, \
|
||||
n0 = esp_partition_write((const esp_partition_t *) a3, n2, a1, n0); NIPn(3)) \
|
||||
Y(esp_partition_erase_range, \
|
||||
n0 = esp_partition_erase_range((const esp_partition_t *) a2, n1, n0); NIPn(2)) \
|
||||
Y(esp_partition_mmap, \
|
||||
n0 = esp_partition_mmap((const esp_partition_t *) a5, n4, n3, \
|
||||
(spi_flash_mmap_memory_t) n2, \
|
||||
(const void **) a1, \
|
||||
(spi_flash_mmap_handle_t *) a0); NIPn(5)) \
|
||||
Y(esp_partition_get_sha256, \
|
||||
n0 = esp_partition_get_sha256((const esp_partition_t *) a1, b0); NIP) \
|
||||
Y(esp_partition_check_identity, \
|
||||
n0 = esp_partition_check_identity((const esp_partition_t *) a1, \
|
||||
(const esp_partition_t *) a0); NIP)
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE_SPIFFS_SUPPORT
|
||||
// Provide a default failing SPIFFS.begin
|
||||
# define OPTIONAL_SPIFFS_SUPPORT \
|
||||
|
||||
@ -455,6 +455,41 @@ WiFi.getTxPower ( -- powerx4 ) Get power x4
|
||||
MDNS.begin ( name-z -- ) Start multicast dns
|
||||
</pre>
|
||||
|
||||
<h5>SPI Flash</h5>
|
||||
These words are inside the <code>spi_flash</code> vocabulary.
|
||||
<pre>
|
||||
spi_flash_init ( -- ) Init driver access.
|
||||
spi_flash_get_chip_size ( -- n ) Get flash size.
|
||||
spi_flash_erase_sector ( sector -- err ) Erase a sector.
|
||||
spi_flash_erase_range ( addr size -- err ) Erase a range.
|
||||
spi_flash_write ( destaddr src size -- err ) Write to flash.
|
||||
spi_flash_write_encrypted ( destaddr src size -- err ) Write encrypted.
|
||||
spi_flash_read ( srcaddr dst size -- err ) Read from flash.
|
||||
spi_flash_read_encrypted ( srcaddr dst size -- err ) Read encrypted.
|
||||
spi_flash_mmap ( srcaddr size memtype out outhandle -- err ) Map region.
|
||||
spi_flash_mmap_pages ( pages pages# memtype out outhandle -- err ) Map pages.
|
||||
spi_flash_munmap ( handle -- ) Unmap region.
|
||||
spi_flash_mmap_dump ( -- ) Dump memory map.
|
||||
spi_flash_mmap_get_free_pages ( memtype -- n ) Get free pages.
|
||||
spi_flash_cache2phys ( a -- addr ) Get flash addr.
|
||||
spi_flash_phys2cache ( addr memtype -- a ) Get mapped flash addr.
|
||||
spi_flash_cache_enabled ( -- f ) Is flash enabled.
|
||||
|
||||
esp_partition_t_size ( -- n ) sizeof(esp_parition_t).
|
||||
esp_partition_find ( type subtype szlabel -- it ) Get partition iterator.
|
||||
esp_partition_find_first ( type subtype szlabel -- part ) Get first partition.
|
||||
esp_partition_get ( it -- part ) Get current partition.
|
||||
esp_partition_next ( it -- it' ) Get next partition.
|
||||
esp_partition_iterator_release ( it -- ) Free iterator.
|
||||
esp_partition_verify ( part -- part' ) Verify partition.
|
||||
esp_partition_read ( part srcoff dst size -- err ) Read from partition.
|
||||
esp_partition_write ( part dstoff src size -- err ) Write to partition.
|
||||
esp_partition_erase_range ( part start size -- err ) Erase range.
|
||||
esp_partition_mmap ( part off size memtype out outhandle -- err ) Map memory.
|
||||
esp_partition_get_sha256 ( part a -- err ) Get sha256 digest.
|
||||
esp_partition_check_identity ( part part -- f ) Check partitions for equality.
|
||||
</pre>
|
||||
|
||||
<h5>SPIFFS</h5>
|
||||
These words are inside the <code>SPIFFS</code> vocabulary.
|
||||
<pre>
|
||||
|
||||
Reference in New Issue
Block a user