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

RawFrameMonitor example seems to be missing something... #33

Closed
Pragmataraxia opened this issue Apr 6, 2023 · 12 comments
Closed

RawFrameMonitor example seems to be missing something... #33

Pragmataraxia opened this issue Apr 6, 2023 · 12 comments
Labels
question Further information is requested

Comments

@Pragmataraxia
Copy link

Would it not make more sense to put #define QNETHERNET_ENABLE_RAW_FRAME_SUPPORT at the top of the file rather than saying to do so in the header?

Regardless, after defining this macro, the linker still can't find the implementation for EthernetFrameClass::parseFrame(). Maybe some cpp file didn't get checked in?

@ssilverman ssilverman added the question Further information is requested label Apr 6, 2023
@ssilverman
Copy link
Owner

Thank you for your question.

That configuration macro must be defined when compiling all the files. In general, all the configuration macros need to be set at the project level because they usually affect more than one file. It's a lot easier to do if you don't use the Arduino IDE. For example, just add to build_flags in platformio.ini if you're using PlatformIO.

I just did a search for how to do this with the Arduino IDE and came up with this:

I know it's not the most convenient answer, but the Arduino IDE, while simple, is a little more difficult to use for more complex projects.

One of the reasons I decided to exclude the option by default is that it adds code size to projects that don't use it, and I'm assuming the majority of projects don't.

@ssilverman
Copy link
Owner

Here's another link about modifying platform.txt or platform.local.txt:
https://forum.arduino.cc/t/additional-compiler-options/631297

@ssilverman
Copy link
Owner

Okay, I figured it out. Teensyduino doesn't support those "extra_flags" options in its platform.txt file. So I did this:

  1. Modified it to include those "extra_flags" options,
  2. Added a platform.local.txt with the above "compiler.cpp.extra_flags" suggestion (compiler.cpp.extra_flags=-DQNETHERNET_ENABLE_RAW_FRAME_SUPPORT), and
  3. Restarted the Arduino IDE (I'm using v2.0.4), and then the compilation worked.

On my system, platform.txt can be found here:
~/Library/Arduino15/packages/teensy/hardware/avr/0.59.1
(or whichever version you have installed)

I attached my modified platform.txt to this comment. I also attached the diff.
diff.txt
platform.txt

Another reference link:
https://arduino.github.io/arduino-cli/latest/platform-specification/

@ssilverman
Copy link
Owner

I just made a post over in the Teensy forum to request a fix:
https://forum.pjrc.com/threads/72556-Request-for-Arduino-IDE-quot-extra_flags-quot-support

@Pragmataraxia
Copy link
Author

Wow... I left to get my kids and make dinner, and you've already advanced the state of Teensy development. I hope the people around you appreciate you nearly as much as you deserve.
Cheers Man!

@ssilverman
Copy link
Owner

I also updated the RawFrameMonitor example commants:

// In order to use this example, define the QNETHERNET_ENABLE_RAW_FRAME_SUPPORT
// macro in the project build options.

@ssilverman
Copy link
Owner

Turns out you need both these lines, per my setup:

compiler.cpp.extra_flags=-DQNETHERNET_ENABLE_RAW_FRAME_SUPPORT
compiler.c.extra_flags=-DQNETHERNET_ENABLE_RAW_FRAME_SUPPORT

@Pragmataraxia
Copy link
Author

You were right though; it was simpler in PlatformIO. I also appreciate that it's more apparent what's going on in PlatformIO than in the Arduino IDE. For example, I hadn't realized that the "libraries" were actually just source code. If the Arduino IDE had bothered to mention that it was compiling QNEthernetFrame.cpp, it would have been a powerful clue that simply defining the macro before the include statement was insufficient.

@ssilverman
Copy link
Owner

It wouldn’t have been sufficient because more than one file looks at the option. You’d have to set it in all those places, and that’s subject to change.

@ssilverman
Copy link
Owner

@Pragmataraxia Would you consider this issue closed?

@Pragmataraxia
Copy link
Author

I sure would. Thanks!

@ssilverman
Copy link
Owner

I added a qnethernet_opts.h file where you can configure the QNETHERNET_* options instead of the platform.local.txt approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants