ESP8266 SPI Write and read to energy independent memory

I'm trying to deal with (addresses) reading and writing to the memory of the ESP8266. Here is the code

   char copy[1000];
   spi_flash_erase_sector(0x7c); //Очистка зачем она нужна непонятно но без нее не работает
   spi_flash_write(0x7c000, (uint32 *)&copy, sizeof(copy)); //Непосредствено запись
   ...
   char ssidAp[1000];
   spi_flash_read(0x7c000, (uint32 *)&ssidAp, sizeof(ssidAp)); //Чтение

Everything works but if I specify the address in the cleanup not 0x7c but 0x7c000 As in other places, the record does not work. The number seems to be the same. What is the problem and how to fix it, someone knows. (I want to convert the addresses to the decimal system, but until I solve this issue, it is not possible)

===Structuring The Response===

Thanks for the answer to sort everything out it worked as it should.

7C000 = 507904 (Bytes)

7C = 124 (Just A Number)

Sector size in bytes = 4096

The byte from which the record starts = 507904 The number of the sector that wakes up erased = 124

It turned out the initial sector from which to start erasing = Number * Size = 124 * 4096;

In such cases with in the decimal system it wakes up like this

spi_flash_erase_sector(124);
spi_flash_write(507904, (uint32 *)&copy, sizeof(copy));

Or

int Num = 124;
spi_flash_erase_sector(Num);
spi_flash_write(Num * 4096, (uint32 *)&copy, sizeof(copy)); 
Author: Юрій Писанка, 2020-08-16

1 answers

Spi_flash_erase_sector-asks for the sector number, not the byte.

Sector size 4096 == 0x1000

The sector with the address 0x7c000 has the address 0x7c000 // 0x1000 Erased to 0x7cfff - keep this in mind if you store some data still in this sector. Erasing is required because this is how the SPI flash drive is organized. If you need to store some data, it is better to solder the nand. SPI is not intended for permanent overwrites.

 1
Author: eri, 2020-08-16 22:17:04