0b90fd5adf
As both C and C++ standards require applications running under an OS to return 'int', adapt that for Zephyr to align with those standard. This also eliminates errors when building with clang when not using -ffreestanding, and reduces the need for compiler flags to silence warnings for both clang and gcc. Most of these changes were automated using coccinelle with the following script: @@ @@ - void + int main(...) { ... - return; + return 0; ... } Approximately 40 files had to be edited by hand as coccinelle was unable to fix them. Signed-off-by: Keith Packard <keithp@keithp.com> |
||
---|---|---|
.. | ||
src | ||
CMakeLists.txt | ||
README.md | ||
prj.conf | ||
prj_poll.conf | ||
sample.yaml |
README.md
Zephyr devmem load command
This module add a devmem load
command that allows data to be loaded into device memory.
The devmem load
command is supported by every transport the shell can run on.
After using a command in the Zephyr shell, the device reads all transferred data and writes to an address in the memory.
The transfer ends when the user presses ctrl-x + ctrl-q
.
Usage
Note: when using the devmem load command over UART it is recommended to use interrupts whenever possible. If this is not possible, reduce the baud rate to 9600.
If you use poll you should also use prj_poll.conf
instead of prj.conf
.
Building
The sample can be built for several platforms, the following commands build and run the application with a shell for the FRDM-K64F board.
west build -b frdm_k64f samples/subsys/shell/devmem_load
west flash
Building for boards without UART interrupt support:
west build -b native_posix -- -DOVERLAY_CONFIG=prj_poll.conf samples/subsys/shell/devmem_load
Running
After connecting to the UART console you should see the following output:
uart:~$
The devmem load
command can now be used (devmem load [option] [address]
):
uart:~$ devmem load 0x20020000
Loading...
press ctrl-x ctrl-q to escape
Now, the devmem load
is waiting for data.
You 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):
xxd -p data > /dev/ttyX
(It is important to use plain-style hex dump)
Once the data is transferred, use ctrl-x + ctrl-q
to quit the loader.
It will print the number of the bytes read and return to the shell:
Number of bytes read: 3442
uart:~$
Options
Currently, the devmem load
command supports the following argument:
-e
little endian parse e.g.0xDEADBEFF -> 0xFFBEADDE