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

pull in LUFA as a git submodule for simplified install procedure #4

Closed
iFreilicht opened this issue Jul 18, 2017 · 5 comments
Closed

Comments

@iFreilicht
Copy link
Collaborator

iFreilicht commented Jul 18, 2017

These are the installation instructions as of today:

  1. clone the repository, drop it in your arduino-x.x.x_LUFA/libraries (for instance, you should have arduino-x.x.x_LUFA/libraries/LUFA/LUFA.h after this step.
  2. download [LUFA], put everything under LUFA/ to arduino-x.x.x_LUFA/libraries/LUFA/LUFA (for instance, you should have arduino-x.x.x_LUFA/libraries/LUFA/LUFA/Drivers/USB/USB.h after this step)
  3. delete the stock USB stack from Arduino environment, there are 7 files to be deleted:
    1. arduino-x.x.x_LUFA/hardware/arduino/avr/cores/arduino/CDC.cpp
    2. arduino-x.x.x_LUFA/hardware/arduino/avr/cores/arduino/PluggableUSB.cpp
    3. arduino-x.x.x_LUFA/hardware/arduino/avr/cores/arduino/PluggableUSB.h
    4. arduino-x.x.x_LUFA/hardware/arduino/avr/cores/arduino/USBApi.h
    5. arduino-x.x.x_LUFA/hardware/arduino/avr/cores/arduino/USBCore.cpp
    6. arduino-x.x.x_LUFA/hardware/arduino/avr/cores/arduino/USBCore.h
    7. arduino-x.x.x_LUFA/hardware/arduino/avr/cores/arduino/USBDesc.h
  4. edit the following files and remove the shown lines:
    1. arduino-x.x.x_LUFA/hardware/arduino/avr/cores/arduino/Arduino.h
    * 233: #include "USBAPI.h"
    * 234: #if defined(HAVE_HWSERIAL0) && defined(HAVE_CDCSERIAL)
    * 235: #error "Targets with both UART0 and CDC serial not supported"
    * 236: #endif
    2. arduino-x.x.x_LUFA/hardware/arduino/avr/cores/arduino/main.cpp
    * 39: #if defined(USBCON)
    * 40: USBDevice.attach();
    * 41: #endif

I think a few things could be improved about this. First, it would be helpful to allow using LUFA as a git submodule instead of manually copying it. This way a user can just use git clone --recursive to get everything they need.

Additionally, it seems to me like there is little reason to actually execute step 3 of the installation instructions. Step 4 seems to be enough. I could see the argument of wanting to give more accurate error messages to people who accidentally import libraries using the USB core.
Either way, it would be enough to just append .removed to the filenames of these files and to enclose the lines in step 4 with #if 0 and #endif or /* and */. This way it would also be easier to activate and deactivate LUFA in a regular Arduino installation. To implement this, I'd write a simple script that does exactly what I described above, and another one to reverse these changes.

This would mean that to install LUFA for Arduino, this command would be enough:

$ git clone --recursive https://github.com/Palatis/Arduino-Lufa.git LUFA; ./LUFA/activate

I'd be willing to implement this myself, any thoughts on the general idea?

@Palatis
Copy link
Owner

Palatis commented Jul 18, 2017

LUFA itself is not a git repo.
if LUFA use any kinnd of RCS I'd be happily include that as a submodule.

@iFreilicht
Copy link
Collaborator Author

It has been for a while: https://github.com/abcminiuser/lufa

@Palatis
Copy link
Owner

Palatis commented Jul 19, 2017

ohh yeah? that's cool!

I'll add it in as a submodule when I have some free time, being super busy for the moment.

for now I'll leave this issue open as a reminder.

@Palatis Palatis changed the title Improve Installation pull in LUFA as a git submodule for simplified install procedure Jul 19, 2017
@iFreilicht
Copy link
Collaborator Author

I already did it on my home machine and changed all include paths accordingly, I'll create a PR this evening. Should I make a separate issue for tracking the activate/deactivate scripts idea?

@iFreilicht
Copy link
Collaborator Author

The PR was confirmed to be working properly now. The only disadvantage is that you always have to #include <LUFA/LUFA/whatever.h> instead of #include <LUFA/whatever.h>, but that seems like a trivial trade-off.

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