How to completely disable RTEMS Monitor and remove "go" command from shell?

I’m using RTEMS with a custom shell setup and noticed the go command is still available. It appears to be an alias for the Monitor’s continue command. I don’t need the RTEMS Monitor and would like to remove it entirely to reduce binary size and avoid unintended usage.

How can I fully disable the RTEMS Monitor and remove all related shell commands like go?

My current configuration:

#include <user_command.h>

#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER

#define CONFIGURE_RTEMS_INIT_TASKS_ENABLE
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE

#define CONFIGURE_POSIX_INIT

#define CONFIGURE_SHELL_USER_COMMANDS &user_command_test, &user_command_info, &user_command_run

#define CONFIGURE_SHELL_COMMANDS_INIT
#undef  CONFIGURE_SHELL_COMMANDS_ALL
#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK

#define CONFIGURE_MAXIMUM_TASKS                 5
#define CONFIGURE_MAXIMUM_POSIX_THREADS         5
#define CONFIGURE_MAXIMUM_POSIX_KEYS            16

#define CONFIGURE_MAXIMUM_DRIVERS               10
#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS      10
#define CONFIGURE_HEAP_SIZE                     (64 * 1024)

#define CONFIGURE_INIT

#include <rtems/confdefs.h>
#include <rtems/shellconfig.h>

Thanks in advance!

Thanks for the interesting question.

Please try and experiment with what you can disable. We test a number of combinations but we cannot test all and we welcome user feedback or better merge requests to get allow results. If you find a solution to making it as small you need and you provide a merge request the code will be able to support your set up.

As you have found the shell can increase the size of your executable because of the calls is makes. If you have the RFS format command included your application will include the RFS file system, a lot of general file system code and the block cache support (libblock).

1 Like

The answer is that the monitor commands cannot currently be disabled. They are added at line 200 of shell.h.

You can experiment by commenting out that line and seeing how much smaller your executable becomes.

There should be a way to disable this set of commands. The way they are registered is as a set and the shell commands are wrappers for underlying monitor commands. Being able to configure them as a set should be fairly straightforward.

Long term, it would be great to have a way to disable the commands individually. I have looked at this in the past but so far haven’t seen a clean way to unravel this and make it more configurable.

1 Like

Hi! I have an another question: how can I disable the console driver in the BSP? When building RTEMS, it expects the console driver to be present.

nfdefs/iodrivers.h:126:(.data._IO_Driver_address_table+0x0): undefined reference to `console_initialize'
C:/msys64/home/SimTech/toolchain/bin/../lib/gcc/arm-rtems7/13.3.0/../../../../arm-rtems7/bin/ld.exe: testsuites/samples/capture/init.c.90.o:(.data._IO_Driver_address_table+0x4): undefined reference to `console_open'
C:/msys64/home/SimTech/toolchain/bin/../lib/gcc/arm-rtems7/13.3.0/../../../../arm-rtems7/bin/ld.exe: testsuites/samples/capture/init.c.90.o:(.data._IO_Driver_address_table+0x8): undefined reference to `console_close'
C:/msys64/home/SimTech/toolchain/bin/../lib/gcc/arm-rtems7/13.3.0/../../../../arm-rtems7/bin/ld.exe: testsuites/samples/capture/init.c.90.o:(.data._IO_Driver_address_table+0xc): undefined reference to `console_read'
C:/msys64/home/SimTech/toolchain/bin/../lib/gcc/arm-rtems7/13.3.0/../../../../arm-rtems7/bin/ld.exe: testsuites/samples/capture/init.c.90.o:(.data._IO_Driver_address_table+0x10): undefined reference to `console_write'
C:/msys64/home/SimTech/toolchain/bin/../lib/gcc/arm-rtems7/13.3.0/../../../../arm-rtems7/bin/ld.exe: testsuites/samples/capture/init.c.90.o:(.data._IO_Driver_address_table+0x14): undefined reference to `console_control'

For now, I’ve implemented this workaround:

#include <rtems.h>
#include <rtems/termiostypes.h>
#include <rtems/libio.h>
#include <rtems/bspIo.h>

rtems_device_driver console_initialize(rtems_device_major_number major, rtems_device_minor_number minor, void *arg) {
    return RTEMS_SUCCESSFUL;
}

rtems_device_driver console_open(rtems_device_major_number major, rtems_device_minor_number minor, void *arg) {
    return RTEMS_SUCCESSFUL;
}

rtems_device_driver console_close(rtems_device_major_number major, rtems_device_minor_number minor, void *arg) {
    return RTEMS_SUCCESSFUL;
}

rtems_device_driver console_read(rtems_device_major_number major, rtems_device_minor_number minor, void *arg) {
    return RTEMS_SUCCESSFUL;
}

rtems_device_driver console_write(rtems_device_major_number major, rtems_device_minor_number minor, void *arg) {
    return RTEMS_SUCCESSFUL;
}

rtems_device_driver console_control(rtems_device_major_number major, rtems_device_minor_number minor, void *arg) {
    return RTEMS_SUCCESSFUL;
}

static void output_char(char c)
{
}

BSP_output_char_function_type BSP_output_char = output_char;

BSP_polling_getchar_function_type BSP_poll_char = NULL;