Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions ARM.CMSIS-Compiler.pdsc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
Active Development ...
CLANG:
- Added standard I/O stream support for LLVM-libc
I/O Retarget:
- Added reargeting to RTT
</release>
</releases>

Expand Down Expand Up @@ -105,6 +107,11 @@
<require condition="CORE"/>
<require condition="CortexDevice_ITM"/>
</condition>
<condition id="CORE RTT">
<description>CMSIS-Compiler CORE component and RTT</description>
<require condition="CORE"/>
<require Cclass="SEGGER" Cgroup="RTT"/>
</condition>
<condition id="CORE UART_CMSIS">
<description>CMSIS-Compiler CORE component and CMSIS-Driver USART</description>
<require condition="CORE"/>
Expand Down Expand Up @@ -138,6 +145,12 @@
<require condition="CORE"/>
<require condition="CortexDevice_ITM"/>
</condition>
<condition id="ARMCC CORE RTT">
<description>ARMCC and CORE component and RTT</description>
<require Tcompiler="ARMCC"/>
<require condition="CORE"/>
<require Cclass="SEGGER" Cgroup="RTT"/>
</condition>

<condition id="ARMCC CORE CMSIS-RTOS2">
<description>ARMCC and CORE component and CMSIS-RTOS2</description>
Expand Down Expand Up @@ -328,6 +341,16 @@
<file category="sourceC" name="source/stderr/stderr_itm.c"/>
</files>
</component>
<component Cclass="CMSIS-Compiler" Cgroup="STDERR" Csub="RTT" Capiversion="1.1.0" Cversion="1.0.0" condition="CORE RTT">
<description>Redirect STDERR to RTT (Channel 0)</description>
<RTE_Components_h>
#define RTE_CMSIS_Compiler_STDERR /* CMSIS-Compiler STDERR */
#define RTE_CMSIS_Compiler_STDERR_RTT /* CMSIS-Compiler STDERR: RTT */
</RTE_Components_h>
<files>
<file category="sourceC" name="source/stderr/stderr_rtt.c"/>
</files>
</component>
<component Cclass="CMSIS-Compiler" Cgroup="STDERR" Csub="UART" Cvariant="CMSIS" Capiversion="1.1.0" Cversion="1.0.0" condition="CORE UART_CMSIS">
<description>Redirect STDERR to a CMSIS-Driver USART</description>
<RTE_Components_h>
Expand Down Expand Up @@ -370,6 +393,16 @@
<file category="sourceC" name="source/stdin/stdin_itm.c"/>
</files>
</component>
<component Cclass="CMSIS-Compiler" Cgroup="STDIN" Csub="RTT" Capiversion="1.1.0" Cversion="1.0.0" condition="CORE RTT">
<description>Retrieve STDIN from RTT (Channel 0)</description>
<RTE_Components_h>
#define RTE_CMSIS_Compiler_STDIN /* CMSIS-Compiler STDIN */
#define RTE_CMSIS_Compiler_STDIN_RTT /* CMSIS-Compiler STDIN: RTT */
</RTE_Components_h>
<files>
<file category="sourceC" name="source/stdin/stdin_rtt.c"/>
</files>
</component>
<component Cclass="CMSIS-Compiler" Cgroup="STDIN" Csub="UART" Cvariant="CMSIS" Capiversion="1.1.0" Cversion="1.0.0" condition="CORE UART_CMSIS">
<description>Retrieve STDIN from a CMSIS-Driver USART</description>
<RTE_Components_h>
Expand Down Expand Up @@ -422,6 +455,16 @@
<file category="sourceC" name="source/stdout/stdout_itm.c"/>
</files>
</component>
<component Cclass="CMSIS-Compiler" Cgroup="STDOUT" Csub="RTT" Capiversion="1.1.0" Cversion="1.0.0" condition="CORE RTT">
<description>Redirect STDOUT to RTT (Channel 0)</description>
<RTE_Components_h>
#define RTE_CMSIS_Compiler_STDOUT /* CMSIS-Compiler STDOUT */
#define RTE_CMSIS_Compiler_STDOUT_RTT /* CMSIS-Compiler STDOUT: RTT */
</RTE_Components_h>
<files>
<file category="sourceC" name="source/stdout/stdout_rtt.c"/>
</files>
</component>
<component Cclass="CMSIS-Compiler" Cgroup="STDOUT" Csub="UART" Cvariant="CMSIS" Capiversion="1.1.0" Cversion="1.0.0" condition="CORE UART_CMSIS">
<description>Redirect STDOUT to a CMSIS-Driver USART</description>
<RTE_Components_h>
Expand Down Expand Up @@ -464,6 +507,16 @@
<file category="sourceC" name="source/tty/tty_itm.c"/>
</files>
</component>
<component Cclass="CMSIS-Compiler" Cgroup="TTY" Csub="RTT" Capiversion="1.1.0" Cversion="1.0.0" condition="ARMCC CORE RTT">
<description>Redirect TTY to RTT (Channel 0)</description>
<RTE_Components_h>
#define RTE_CMSIS_Compiler_TTY /* CMSIS-Compiler TTY */
#define RTE_CMSIS_Compiler_TTY_RTT /* CMSIS-Compiler TTY: RTT */
</RTE_Components_h>
<files>
<file category="sourceC" name="source/tty/tty_rtt.c"/>
</files>
</component>

<!-- OS Interface -->
<component Cclass="CMSIS-Compiler" Cgroup="OS Interface" Csub="Custom" Capiversion="1.1.0" Cversion="2.1.0" custom="1" condition="ARMCC CORE">
Expand Down
39 changes: 39 additions & 0 deletions source/stderr/stderr_rtt.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (C) 2026 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "retarget_stderr.h"

#include "SEGGER_RTT.h"

/**
Put a character to the stderr

\param[in] ch Character to output
\return The character written, or -1 on write error.
*/
int stderr_putchar (int ch) {
unsigned res;

res = SEGGER_RTT_PutChar(0U, (char)ch);

if (res != 1U) {
return -1;
}

return (ch);
}
34 changes: 34 additions & 0 deletions source/stdin/stdin_rtt.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (C) 2026 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "retarget_stdin.h"

#include "SEGGER_RTT.h"

/**
Get a character from the stdio

\return The next character from the input, or -1 on read error.
*/
int stdin_getchar (void) {
int ret;

ret = SEGGER_RTT_WaitKey();

return ret;
}
39 changes: 39 additions & 0 deletions source/stdout/stdout_rtt.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (C) 2026 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "retarget_stdout.h"

#include "SEGGER_RTT.h"

/**
Put a character to the stdout

\param[in] ch Character to output
\return The character written, or -1 on write error.
*/
int stdout_putchar (int ch) {
unsigned res;

res = SEGGER_RTT_PutChar(0U, (char)ch);

if (res != 1U) {
return -1;
}

return (ch);
}
30 changes: 30 additions & 0 deletions source/tty/tty_rtt.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (C) 2026 ARM Limited or its affiliates. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "retarget_tty.h"

#include "SEGGER_RTT.h"

/**
Put a character to the teletypewritter

\param[in] ch Character to output
*/
void ttywrch (int ch) {
SEGGER_RTT_PutChar(0U, (char)ch);
}
Loading