Part 1
요약·해설
storage_partition, 8개 test와 전체 주소·값 출력을 보존합니다.
storage_partition
8
256
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
5EB5DCEEE94E1FEF01B810C1DD144B79A9825BF8CEE0BA9B77897748B9DB972F
.. zephyr:code-sample:: soc-flash-nrf
:name: nRF SoC Internal Storage
:relevant-api: flash_interface flash_area_api
Use the flash API to interact with the SoC flash.
Overview
********
This sample demonstrates using the :ref:`Flash API <flash_api>` on an SoC internal storage.
The sample uses :ref:`Flash map API <flash_map_api>` to obtain a device that has
partition defined with label `storage_partition`, then uses :ref:`Flash API <flash_api>`
to directly access and modify contents of a device, within area defined for said
partition.
Within the sample, user may observe how read/write/erase operations
are performed on a device, and how to first check whether device is
ready for operation.
Building and Running
********************
The application will build for any SoC with internal storage
access enabled, as it is default for SoC devices with defined
fixed-partition, over that internal storage, labeled `storage_partition`.
.. zephyr-app-commands::
:zephyr-app: samples/drivers/soc_flash_nrf
:board: nrf52840dk/nrf52840
:goals: build flash
:compact:
Sample Output
=============
.. code-block:: console
*** Booting Zephyr OS build v2.7.99-17621-g54832687bcbb ***
Nordic nRF5 Internal Storage Sample
===================================
Test 1: Flash erase page at 0x82000
Flash erase succeeded!
Test 2: Flash write (word array 1)
Attempted to write 1122 at 0x82000
Attempted to read 0x82000
Data read: 1122
Data read matches data written. Good!
Attempted to write aabb at 0x82004
Attempted to read 0x82004
Data read: aabb
Data read matches data written. Good!
Attempted to write abcd at 0x82008
Attempted to read 0x82008
Data read: abcd
Data read matches data written. Good!
Attempted to write 1234 at 0x8200c
Attempted to read 0x8200c
Data read: 1234
Data read matches data written. Good!
Test 3: Flash erase (2 pages at 0x80000)
Flash erase succeeded!
Test 4: Flash write (word array 2)
Attempted to write 1234 at 0x82000
Attempted to read 0x82000
Data read: 1234
Data read matches data written. Good!
Attempted to write aabb at 0x82004
Attempted to read 0x82004
Data read: aabb
Data read matches data written. Good!
Attempted to write abcd at 0x82008
Attempted to read 0x82008
Data read: abcd
Data read matches data written. Good!
Attempted to write 1122 at 0x8200c
Attempted to read 0x8200c
Data read: 1122
Data read matches data written. Good!
Test 5: Flash erase page at 0x82000
Flash erase succeeded!
Test 6: Non-word aligned write (word array 3)
Attempted to write 1122 at 0x82001
Attempted to read 0x82001
Data read: 1122
Data read matches data written. Good!
Attempted to write aabb at 0x82005
Attempted to read 0x82005
Data read: aabb
Data read matches data written. Good!
Attempted to write abcd at 0x82009
Attempted to read 0x82009
Data read: abcd
Data read matches data written. Good!
Attempted to write 1234 at 0x8200d
Attempted to read 0x8200d
Data read: 1234
Data read matches data written. Good!
Attempted to write 1122 at 0x82011
Attempted to read 0x82011
Data read: 1122
Data read matches data written. Good!
Attempted to write aabb at 0x82015
Attempted to read 0x82015
Data read: aabb
Data read matches data written. Good!
Attempted to write abcd at 0x82019
Attempted to read 0x82019
Data read: abcd
Data read matches data written. Good!
Attempted to write 1234 at 0x8201d
Attempted to read 0x8201d
Data read: 1234
Data read matches data written. Good!
Test 7: Page layout API
Offset 0x00041234:
belongs to the page 65 of start offset 0x00041000
and the size of 0x00001000 B.
Page of number 37 has start offset 0x00025000
and size of 0x00001000 B.
Page index resolved properly
SoC flash consists of 256 pages.
Test 8: Write block size API
write-block-size = 1
Finished!
Part 3
한국어 전문 번역
개요
이 sample은 SoC internal storage에서 Flash API를 사용하는 방법을 보여줍니다. Flash map API로 storage_partition label의 partition이 정의된 device를 얻은 다음, Flash API로 해당 partition 영역 안의 내용을 직접 읽고 수정합니다.
Sample에서는 device가 동작 준비 상태인지 먼저 확인하는 방법과 read, write, erase operation을 수행하는 방법을 볼 수 있습니다.
Build와 실행
Internal storage 접근이 활성화된 모든 SoC에서 application을 build할 수 있습니다. Internal storage 위에 storage_partition label의 fixed partition이 정의된 SoC device에서는 이것이 기본 설정입니다.
west build -b nrf52840dk/nrf52840 samples/drivers/soc_flash_nrf
west flash
Sample 출력
*** Booting Zephyr OS build v2.7.99-17621-g54832687bcbb ***
Nordic nRF5 Internal Storage Sample
===================================
Test 1: Flash erase page at 0x82000
Flash erase succeeded!
Test 2: Flash write (word array 1)
Attempted to write 1122 at 0x82000
Attempted to read 0x82000
Data read: 1122
Data read matches data written. Good!
Attempted to write aabb at 0x82004
Attempted to read 0x82004
Data read: aabb
Data read matches data written. Good!
Attempted to write abcd at 0x82008
Attempted to read 0x82008
Data read: abcd
Data read matches data written. Good!
Attempted to write 1234 at 0x8200c
Attempted to read 0x8200c
Data read: 1234
Data read matches data written. Good!
Test 3: Flash erase (2 pages at 0x80000)
Flash erase succeeded!
Test 4: Flash write (word array 2)
Attempted to write 1234 at 0x82000
Attempted to read 0x82000
Data read: 1234
Data read matches data written. Good!
Attempted to write aabb at 0x82004
Attempted to read 0x82004
Data read: aabb
Data read matches data written. Good!
Attempted to write abcd at 0x82008
Attempted to read 0x82008
Data read: abcd
Data read matches data written. Good!
Attempted to write 1122 at 0x8200c
Attempted to read 0x8200c
Data read: 1122
Data read matches data written. Good!
Test 5: Flash erase page at 0x82000
Flash erase succeeded!
Test 6: Non-word aligned write (word array 3)
Attempted to write 1122 at 0x82001
Attempted to read 0x82001
Data read: 1122
Data read matches data written. Good!
Attempted to write aabb at 0x82005
Attempted to read 0x82005
Data read: aabb
Data read matches data written. Good!
Attempted to write abcd at 0x82009
Attempted to read 0x82009
Data read: abcd
Data read matches data written. Good!
Attempted to write 1234 at 0x8200d
Attempted to read 0x8200d
Data read: 1234
Data read matches data written. Good!
Attempted to write 1122 at 0x82011
Attempted to read 0x82011
Data read: 1122
Data read matches data written. Good!
Attempted to write aabb at 0x82015
Attempted to read 0x82015
Data read: aabb
Data read matches data written. Good!
Attempted to write abcd at 0x82019
Attempted to read 0x82019
Data read: abcd
Data read matches data written. Good!
Attempted to write 1234 at 0x8201d
Attempted to read 0x8201d
Data read: 1234
Data read matches data written. Good!
Test 7: Page layout API
Offset 0x00041234:
belongs to the page 65 of start offset 0x00041000
and the size of 0x00001000 B.
Page of number 37 has start offset 0x00025000
and size of 0x00001000 B.
Page index resolved properly
SoC flash consists of 256 pages.
Test 8: Write block size API
write-block-size = 1
Finished!
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.