I am wondering if colored debugged message can be enabled in xrun terminal output when --xscope option is added.
I tried the traditional escape sequence, it did not work. It seems the part of the XTC toolchain do support colored text display, like in xmake compiler outputs.
Any suggestions?
color terminal display on xrun with --xscope option
-
- Member
- Posts: 14
- Joined: Wed Sep 25, 2024 5:46 am
-
Verified
- Active Member
- Posts: 41
- Joined: Wed May 22, 2024 2:36 pm
hey, I just tested it out and the following works in both xsim and xrun --xscope:
Code: Select all
#include <stdio.h>
#define ANSI_RED "\x1b[31m"
#define ANSI_GREEN "\x1b[32m"
#define ANSI_YELLOW "\x1b[33m"
#define ANSI_BLUE "\x1b[34m"
#define ANSI_MAGENTA "\x1b[35m"
#define ANSI_CYAN "\x1b[36m"
#define ANSI_RESET "\x1b[0m"
int main() {
printf(ANSI_RED "This text is red\n" ANSI_RESET);
printf(ANSI_GREEN "This text is green\n" ANSI_RESET);
printf(ANSI_YELLOW "This text is yellow\n" ANSI_RESET);
printf(ANSI_BLUE "This text is blue\n" ANSI_RESET);
printf(ANSI_MAGENTA "This text is magenta\n" ANSI_RESET);
printf(ANSI_CYAN "This text is cyan\n" ANSI_RESET);
return 0;
}
XMOS Software Engineer


-
- Member
- Posts: 14
- Joined: Wed Sep 25, 2024 5:46 am
It does not work on my side. I am on XTC 15.3 on Windows 10 LTSC.xhuw wrote: ↑Mon Jan 27, 2025 9:43 am hey, I just tested it out and the following works in both xsim and xrun --xscope:
Code: Select all
#include <stdio.h> #define ANSI_RED "\x1b[31m" #define ANSI_GREEN "\x1b[32m" #define ANSI_YELLOW "\x1b[33m" #define ANSI_BLUE "\x1b[34m" #define ANSI_MAGENTA "\x1b[35m" #define ANSI_CYAN "\x1b[36m" #define ANSI_RESET "\x1b[0m" int main() { printf(ANSI_RED "This text is red\n" ANSI_RESET); printf(ANSI_GREEN "This text is green\n" ANSI_RESET); printf(ANSI_YELLOW "This text is yellow\n" ANSI_RESET); printf(ANSI_BLUE "This text is blue\n" ANSI_RESET); printf(ANSI_MAGENTA "This text is magenta\n" ANSI_RESET); printf(ANSI_CYAN "This text is cyan\n" ANSI_RESET); return 0; }
It prints out like this:
←[32m CLK_GEAR: 0 GPIO2: 0 GPIO1: 0 ←[0m ←[42m OC_R: 0 OC_L: 0 AUTOMUTE_R: 0 AUTOMUTE_L: 1 ←[0m
-
Verified
- Active Member
- Posts: 41
- Joined: Wed May 22, 2024 2:36 pm
I expect this is an issue with your terminal emulator as I believe xrun does not modify the output of the commands. Do you get colours if you compile the same application using your native compiler? (e.g. gcc, clang, cl). If you do not, you will need to solve this before getting colours from any other application (xrun etc.).
XMOS Software Engineer


-
- Member
- Posts: 14
- Joined: Wed Sep 25, 2024 5:46 am
I got all the colored compiled information in the same terminal, but not the xscope output.xhuw wrote: ↑Tue Jan 28, 2025 10:25 am I expect this is an issue with your terminal emulator as I believe xrun does not modify the output of the commands. Do you get colours if you compile the same application using your native compiler? (e.g. gcc, clang, cl). If you do not, you will need to solve this before getting colours from any other application (xrun etc.).
I am using the standard "XTC Tools 15.3.0 Command Prompt" that the XTC tools installer added in Windows 10. Can you recommend a terminal that works on Windows ?