Skip to content

Commit

Permalink
samples: flash_shell: remove sample code and use FLASH_SHELL
Browse files Browse the repository at this point in the history
The flash sample and flash shell have implementations that differ
providing similar features.
This commit removes all the code in main.c, only `main()` remains to
reduce redundancy.

Features or improved implementations has not been merged into the flash
shell in this commit.
It should be possible to do in future commits if desired.

Signed-off-by: Jeppe Odgaard <[email protected]>
  • Loading branch information
Jeppe Odgaard authored and carlescufi committed Oct 20, 2023
1 parent 9211040 commit f1ae151
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 788 deletions.
9 changes: 0 additions & 9 deletions samples/drivers/flash_shell/Kconfig

This file was deleted.

37 changes: 21 additions & 16 deletions samples/drivers/flash_shell/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,24 @@ Sample Output

.. code-block:: console
uart:~$ flash_sample page_count
Flash device contains 1024 pages.
uart:~$ flash_sample page_erase 1023
Erasing page 1023 (start offset 0xffc00, size 0x400)
uart:~$ flash_sample page_write 1023 8 17 19 28 39
Reading back written bytes:
11 13 1c 27
uart:~$ flash_sample page_write 1023 4 77 9 1 2
Reading back written bytes:
4d 09 01 02
uart:~$ flash_sample page_read 1023 4 12
4d 09 01 02 | 11 13 1c 27
ff ff ff ff
uart:~$ flash_sample page_read 1023 0 16
ff ff ff ff | 4d 09 01 02
11 13 1c 27 | ff ff ff ff
uart:~$ flash page_info 0
Page for address 0x0:
start offset: 0x0
size: 4096
index: 0
uart:~$ flash erase 0x1000
Erase success.
uart:~$ flash write 0x1000 0x12345678 0x9abcdef0
Write OK.
Verified.
uart:~$ flash write 0x1000 0x11111111
Write internal ERROR!
uart:~$ flash read 0x1000 0x10
00001000: 78 56 34 12 f0 de bc 9a ff ff ff ff ff ff ff ff |xV4..... ........|
uart:~$ flash write 0x101c 0xabcd1234
Write OK.
Verified.
uart:~$ flash read 0x1000 0x20
00001000: 78 56 34 12 f0 de bc 9a ff ff ff ff ff ff ff ff |xV4..... ........|
00001010: ff ff ff ff ff ff ff ff ff ff ff ff 34 12 cd ab |........ ....4...|
7 changes: 2 additions & 5 deletions samples/drivers/flash_shell/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@ CONFIG_PRINTK=y
CONFIG_SHELL=y
CONFIG_LOG=y
CONFIG_FLASH=y
# Your flash driver may not enable this, even if it's supported.
# If that's the case and you're interested in the flash layout, enable
# it here.
# CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_HEAP_MEM_POOL_SIZE=16384
CONFIG_FLASH_SHELL=y
CONFIG_FLASH_SHELL_TEST_COMMANDS=y
Loading

0 comments on commit f1ae151

Please sign in to comment.