README.md
1# Zephyr devmem load command
2This module add a `devmem load` command that allows data to be loaded into device memory.
3The `devmem load` command is supported by every transport the shell can run on.
4
5After using a command in the Zephyr shell, the device reads all transferred data and writes to an address in the memory.
6The transfer ends when the user presses `ctrl-x + ctrl-q`.
7
8## Usage
9Note: when using the devmem load command over UART it is recommended to use interrupts whenever possible.
10If this is not possible, reduce the baud rate to 9600.
11
12If you use poll you should also use `prj_poll.conf` instead of `prj.conf`.
13## Building
14
15The sample can be built for several platforms, the following commands build and run the application with a shell for the FRDM-K64F board.
16```bash
17west build -b frdm_k64f samples/subsys/shell/devmem_load
18west flash
19```
20
21Building for boards without UART interrupt support:
22```bash
23west build -b native_posix -- -DOVERLAY_CONFIG=prj_poll.conf samples/subsys/shell/devmem_load
24```
25## Running
26After connecting to the UART console you should see the following output:
27```bash
28uart:~$
29```
30The `devmem load` command can now be used (`devmem load [option] [address]`):
31```bash
32uart:~$ devmem load 0x20020000
33Loading...
34press ctrl-x ctrl-q to escape
35```
36
37Now, the `devmem load` is waiting for data.
38You can either type it directly from the console or send it from the host PC (replace `ttyX` with the appropriate one for your UART console):
39```bash
40xxd -p data > /dev/ttyX
41```
42(It is important to use plain-style hex dump)
43Once the data is transferred, use `ctrl-x + ctrl-q` to quit the loader.
44It will print the number of the bytes read and return to the shell:
45```bash
46Number of bytes read: 3442
47uart:~$
48```
49
50## Options
51Currently, the `devmem load` command supports the following argument:
52* `-e` little endian parse e.g. `0xDEADBEFF -> 0xFFBEADDE`
53