Skip to content
This repository has been archived by the owner on Jul 22, 2020. It is now read-only.

runner.plugins

Klemens Morgenstern edited this page Apr 4, 2018 · 2 revisions

Exit Code

The simplest provided plugin is the metal-exitcode plugin. It is used on an embedded system without an operating system. In order to use it you need to have an exit function in your code, as provided by newlib. The function usually looks like this:

void _exit(int code);

The plugin will put a breakpoint into this function and try to take the first value passed, which will be used as the exit-code of the metal.runner process.

The exit function must be named _exit and take an integer as it's first argument.

Newlib System Calls

The newlib syscalls plugin provides the same functionality as [link runner.faq#why-not-semihosting] but does not require you to interact with the debugger.

Stubbing the syscalls allows the embedded program to interact with the console and the filesystem on the host system. Since it is stubbed at the lowest level functions like printf and the C++ objects like std::cout or std::fstream will be usable without visible changes.

[note If you don't use the I/O library in the code otherwise, it might incurr a too large increase in binary size. For this case you can develop custom plugins.]

You need to use the provided stub code (example/metal_newlib_syscalls.c) in your project in order to enable it.

It does stub the system-calls and redirects them into one function call[footnote to minimize the breakpoint usage] in which the plugin sets the breakpoint.

We do not have support for semihosting yet, so this might cause an parser error.