Skip to content

Commit fd584b4

Browse files
Zhiqiang-Houdleach02
authored andcommitted
snippets: add ram-console snippet support
The ram-console snippet disabled UART console and enabled the RAM console with the option link the RAM console buffer to a dedicate section in a new added memory-region. Signed-off-by: Hou Zhiqiang <[email protected]>
1 parent 1cd37f2 commit fd584b4

File tree

7 files changed

+146
-0
lines changed

7 files changed

+146
-0
lines changed

snippets/ram-console/README.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
.. _snippet-ram-console:
2+
3+
RAM Console Snippet (ram-console)
4+
#################################
5+
6+
.. code-block:: console
7+
8+
west build -S ram-console [...]
9+
10+
Overview
11+
********
12+
13+
This snippet redirects console output to a RAM buffer. The RAM console
14+
buffer is a global array located in RAM region by default, whose address
15+
is unknown before building. The RAM console driver also supports using
16+
a dedicated section for the RAM console buffer with prefined address.
17+
18+
How to enable RAM console buffer section
19+
****************************************
20+
21+
Add board dts overlay to this snippet to add property ``zephyr,ram-console``
22+
in the chosen node and memory-region node with compatible string
23+
:dtcompatible:`zephyr,memory-region` as the following:
24+
25+
.. code-block:: DTS
26+
27+
/ {
28+
chosen {
29+
zephyr,ram-console = &snippet_ram_console;
30+
};
31+
32+
snippet_ram_console: memory@93d00000 {
33+
compatible = "zephyr,memory-region";
34+
reg = <0x93d00000 DT_SIZE_K(4)>;
35+
zephyr,memory-region = "RAM_CONSOLE";
36+
};
37+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright 2024 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
chosen {
9+
zephyr,ram-console = &snippet_ram_console;
10+
};
11+
12+
snippet_ram_console: memory@93d00000 {
13+
compatible = "zephyr,memory-region";
14+
reg = <0x93d00000 DT_SIZE_K(4)>;
15+
zephyr,memory-region = "RAM_CONSOLE";
16+
};
17+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright 2024 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
chosen {
9+
zephyr,ram-console = &snippet_ram_console;
10+
};
11+
12+
snippet_ram_console: memory@93d00000 {
13+
compatible = "zephyr,memory-region";
14+
reg = <0x93d00000 DT_SIZE_K(4)>;
15+
zephyr,memory-region = "RAM_CONSOLE";
16+
};
17+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright 2024 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
chosen {
9+
zephyr,ram-console = &snippet_ram_console;
10+
};
11+
12+
snippet_ram_console: memory@c0100000 {
13+
compatible = "zephyr,memory-region";
14+
reg = <0xc0100000 DT_SIZE_K(4)>;
15+
zephyr,memory-region = "RAM_CONSOLE";
16+
};
17+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright 2024 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
chosen {
9+
zephyr,ram-console = &snippet_ram_console;
10+
};
11+
12+
snippet_ram_console: memory@d0100000 {
13+
compatible = "zephyr,memory-region";
14+
reg = <0xd0100000 DT_SIZE_K(4)>;
15+
zephyr,memory-region = "RAM_CONSOLE";
16+
};
17+
};

snippets/ram-console/ram-console.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# Copyright 2024 NXP
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
# Disable UART Console
7+
CONFIG_UART_CONSOLE=n
8+
# Enable RAM Console
9+
CONFIG_RAM_CONSOLE=y

snippets/ram-console/snippet.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# Copyright 2024 NXP
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
7+
name: ram-console
8+
append:
9+
EXTRA_CONF_FILE: ram-console.conf
10+
11+
boards:
12+
imx8mm_evk/mimx8mm6/a53:
13+
append:
14+
EXTRA_DTC_OVERLAY_FILE: boards/imx8mm_evk_mimx8mm6_a53.overlay
15+
imx8mm_evk/mimx8mm6/a53/smp:
16+
append:
17+
EXTRA_DTC_OVERLAY_FILE: boards/imx8mm_evk_mimx8mm6_a53.overlay
18+
imx8mn_evk/mimx8mn6/a53:
19+
append:
20+
EXTRA_DTC_OVERLAY_FILE: boards/imx8mn_evk_mimx8mn6_a53.overlay
21+
imx8mn_evk/mimx8mn6/a53/smp:
22+
append:
23+
EXTRA_DTC_OVERLAY_FILE: boards/imx8mn_evk_mimx8mn6_a53.overlay
24+
imx8mp_evk/mimx8ml8/a53:
25+
append:
26+
EXTRA_DTC_OVERLAY_FILE: boards/imx8mp_evk_mimx8ml8_a53.overlay
27+
imx8mp_evk/mimx8ml8/a53/smp:
28+
append:
29+
EXTRA_DTC_OVERLAY_FILE: boards/imx8mp_evk_mimx8ml8_a53.overlay
30+
imx93_evk/mimx9352/a55:
31+
append:
32+
EXTRA_DTC_OVERLAY_FILE: boards/imx93_evk_mimx9352_a55.overlay

0 commit comments

Comments
 (0)