ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
emu_args.h File Reference

ra8_emulator command-line parsing (usage text + option decoding) More...

#include <stdint.h>
#include "board_periph.h"
#include "emu_run.h"
#include "emu_trace.h"
#include "ra8_attributes.h"
Include dependency graph for emu_args.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  emu_args_t
 Every value the ra8_emulator CLI parse produces for the setup phase. More...

Functions

bool emu_args_parse (int argc, char **argv, emu_args_t *out)
 Parse the ra8_emulator command line into out (or print usage).

Detailed Description

ra8_emulator command-line parsing (usage text + option decoding)

Decodes the ra8_emulator CLI into one emu_args_t bundle: the firmware image path, presentation options (–view / –ppm / –record / –rotate / –panel / –size), input injectors (–click / –touch-seq / –input / –keys / –usb-in / –button / –battery), storage attachments (–sd / –sd-new / –save-sd / –fast-sd / –eink / –modem), the probe family (–dump-sym / –stop-sym / –trace-sym), the TrustZone second image (–ns), and the device / core / power model selectors. Options that attach a peripheral model or set a global model knob take effect during the parse, exactly as the original inline loop did.

Split out of the ra8_emulator main translation unit; behaviour unchanged.

Since
0.1.0

Definition in file emu_args.h.

Function Documentation

◆ emu_args_parse()

bool emu_args_parse ( int argc,
char ** argv,
emu_args_t * out )

Parse the ra8_emulator command line into out (or print usage).

With no firmware argument the full usage text is printed to injected error sink and false is returned (the caller exits 2). Otherwise the option loop decodes argv[2..] into out with the original loop's exact semantics, including the parse-time side effects: –sd / –sd-new attach the SD model, –eink / –modem attach their device models, –fast-sd enables the block seam, and –low-power / –primary-core set the core-model knobs.

Parameters
[in]argcArgument count from main().
[in]argvArgument vector from main(); strings are aliased by out.
[out]outReceives every decoded option (fully overwritten).
Returns
Whether a firmware path was supplied and the parse ran.
Return values
trueout is populated; parse-time attachments are in effect.
falseNo firmware argument; usage was printed, nothing decoded.
Precondition
argv has argc entries that outlive the run (main's argv).
out is non-null.
Postcondition
On true, out->elf_path is argv[1] and all fields hold their defaults or decoded values.
On false, injected error sink carries the usage text and out is untouched.
Note
Not thread-safe; call once from main() before setup.
See also
emu_run_and_report() Consumes the values via emu_run_cfg_t.
Since
0.1.0

Definition at line 485 of file emu_args.c.

References internal_args_defaults(), internal_args_print_usage(), internal_args_try_control(), internal_args_try_display(), internal_args_try_input(), internal_args_try_mode(), internal_args_try_sd(), and internal_args_try_sym().

Referenced by main().