From bfe2fc9d3ee1df4e4e8cd28bc5e8204a6848d53a Mon Sep 17 00:00:00 2001 From: Florian Fleissner Date: Tue, 11 Jun 2019 17:21:27 +0200 Subject: [PATCH] Added a weak callback for command line parsing Consumer code can access the command line via an additional callback of the virtual hardware. This makes it possible to access the name of the executable that is currently executed. Signed-off-by: Florian Fleissner --- virtual/cores/virtual/main.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/virtual/cores/virtual/main.cpp b/virtual/cores/virtual/main.cpp index c7c1fd1..a744f72 100644 --- a/virtual/cores/virtual/main.cpp +++ b/virtual/cores/virtual/main.cpp @@ -29,6 +29,9 @@ void initVariant() { } void setupUSB() __attribute__((weak)); void setupUSB() { } +void parseCommandLine(int argc, char* argv[]) __attribute__((weak)); +void parseCommandLine(int argc, char* argv[]) { } + // This function can be overridden in other libraries // e.g. to run a testing framework. // @@ -41,6 +44,11 @@ void init(void) { } int main(int argc, char* argv[]) { + + // Enable consumer code to read command line args. + // + parseCommandLine(argc, argv); + if (!initVirtualInput(argc, argv)) return 1; if(testFunctionExecutionRequested()) {