Skip to content

Commit

Permalink
Revert changes and deprecate function. To be addressed more fully in …
Browse files Browse the repository at this point in the history
…a future PR.
  • Loading branch information
mikee47 committed Nov 3, 2019
1 parent 745a8c8 commit b4f975f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Sming/Arch/Esp8266/Components/spi_flash/component.mk
Original file line number Diff line number Diff line change
@@ -1 +1 @@
COMPONENT_DEPENDS := esp8266 rboot
COMPONENT_DEPENDS := esp8266
10 changes: 0 additions & 10 deletions Sming/Arch/Esp8266/Components/spi_flash/flashmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#include "include/esp_spi_flash.h"
#include "espinc/peri.h"
#include <rboot-api.h>

extern char _flash_code_end[];

Expand All @@ -41,15 +40,6 @@ static inline uint32_t min(uint32_t a, uint32_t b)
return (a < b) ? a : b;
}

uint32_t flashmem_get_address(const void* memptr)
{
rboot_config config = rboot_get_config();
uint32_t addr = config.roms[config.current_rom];
addr -= (BOOT_CONFIG_SECTOR + 1) * INTERNAL_FLASH_SECTOR_SIZE;
addr += (uint32_t)memptr - INTERNAL_FLASH_START_ADDRESS;
return addr;
}

uint32_t flashmem_write(const void* from, uint32_t toaddr, uint32_t size)
{
if(IS_ALIGNED(from) && IS_ALIGNED(toaddr) && IS_ALIGNED(size))
Expand Down
10 changes: 7 additions & 3 deletions Sming/Arch/Esp8266/Components/spi_flash/include/esp_spi_flash.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,14 @@ typedef struct
* @param memptr
* @retval uint32_t Offset from start of flash memory
* @note If memptr is not in valid flash memory it will return an offset which exceeds
* the internal flash memory size.
* @note The flash location is dependent on where rBoot has mapped the firmware.
* the internal flash memory size. This is caught by constructors using getMaxSize()
* to provide a zero-length extent.
* @deprecated This function only works if rBoot is running from slot #0.
*/
uint32_t flashmem_get_address(const void* memptr);
static inline uint32_t flashmem_get_address(const void* memptr) SMING_DEPRECATED
{
return (uint32_t)memptr - INTERNAL_FLASH_START_ADDRESS;
}

/** @brief Write a block of data to flash
* @param from Buffer to obtain data from
Expand Down

0 comments on commit b4f975f

Please sign in to comment.