Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --entry-point parameter for xodc transpile #2020

Open
3 tasks
nkrkv opened this issue Aug 17, 2020 · 0 comments
Open
3 tasks

Add --entry-point parameter for xodc transpile #2020

nkrkv opened this issue Aug 17, 2020 · 0 comments

Comments

@nkrkv
Copy link
Member

nkrkv commented Aug 17, 2020

Rationale

The code generated by XOD assumes setup and loop will be used as program entry points. This is the case with most Arduino-compatible boards but does not cover all cases. For example, a user might have a board running FreeRTOS and define main himself. See https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/cores/nRF5/main.cpp as an example.

For such cases, it would be handy to have a single-function entry point generated. So that I can trivially call it from my own main or make it a FreeRTOS task.

User story

I run:

xodc transpile my-proj-qux.xodball main --entry-point my_qux_main

And the resulting code, along with the traditional setup and loop contains quite trivial:

// ... the usual code ...

extern void yield();

void my_qux_main(void*) {
    setup();
    while (true) {
        loop();
        yield();
    }
}

Acceptance criteria

  • The --entry-point argument is taken into account as shown
  • The value is validated to be a valid C++ identifier. If not, a clear error is shown and xodc exits with non-zero code
  • Multiple entry points can be be used together without conflicts

Out of scope

  • Providing own yield. It’s up to a user to guarantee its presence. E.g., use the mentioned Adafruit core
  • Providing own main. It’s up to a user to guarantee its presence.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants