こんにちは、 ダックです。

 

これまで C 言語に関する記事を多く書いてきました。

In an embedded system, the flash memory is the place where the code written in C is compiled and written.

What kind of memory is Flash memory?

Memory type

Let's take a look at how Flash memory is positioned.

The classification of memory is as follows.

RAM DRAM/SRAM/MRAM etc.
ROM EEPROM/Flash/CDROM etc.

もともとは、

・RAM: Volatile memory that operates quickly but does not retain data when the power is turned off
・ROM: Non-volatile memory that operates slowly but retains data

However, in recent years, unexpected RAM such as MRAM has also appeared. 

 

The flash memory that we are dealing with here is non-volatile memory.

Data can be easily changed, and in familiar terms, this flash memory is used in USB memory.

Features of Flash memory

I thought that USB memory was convenient because I could overwrite it freely, but I was shocked by a word from the in-house training instructor.

 

講師 「 Flash ってデータの書き換えできないのは知っている?」

私  「・・・・・え?」

 

どういうことなのでしょうか?

Flash memory operation 1 - data writing -

The initial state of Flash memory is a state in which all bits are 1.

 

The only write operation in Flash memory is to change 1 data to 0.

逆の操作になる0から1にすることはできません。また書き込める単位としてはデバイスにより差はありますが、1 Byte 単位、Word (2 Byte) 単位が一般的です。

Flash memory write operation

  

しかしこれでは、一度書きこんだデータを変更できません。どうすればいいのでしょうか。

Flash memory operation 2 - data erasure -

Another operation that Flash memory can do is erasing data.

 

しかし、このイレーズ動作はすべて 0 になっているデータをブロックごとに 1 にします。

ブロックのサイズはデバイスにより異なりますが、64 KB など、書き込みに対して非常に大きなサイズになります。

Flash memory erase operation

  

There are only two ways to change data in Flash memory.

 

したがって上書きするには、少し手間がかかります。

As an example, let's use the PC as the host and change the yellow colored part of the data in the Flash memory.

How to overwrite Flash memory

  

You save it in a buffer once, modify that data, and write it to Flash memory.

Also, if the process of writing all 0s to the flash memory is automatically performed by the flash memory, there is no need to be aware of it.

このように、Flash では 1 bit 変更するだけでも、多くのステップが必要となります。

覚えておきたい+α

Since FPGAs are generally volatile, it is necessary to use a non-volatile memory called configuration ROM to store design data.

Flash memory is mainly used.

Intel provides EPCQ and EPCQA as serial Flash memory dedicated to configuration.

Also, after doing some research, I found out that Intel has released MAX® 10 devices, which are FPGAs with a built-in configuration ROM.