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

Additional board definitions for #89 #124

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Doom4535
Copy link

@Doom4535 Doom4535 commented May 29, 2019

Highlights

Added entries for additional boards listed in #89 :

  • Nano (defaults to v3, includes v2 as well)
  • Mega1280
  • Adafruit Grand Central M4 Express

Issues Fixed

Changed processor used for Arduino due from atmega/avr to atmel sam

Notes

  • No action has been taken as of yet to expose additional analog pins on Nano
  • No action has been take to expose additional features of the Grand Central beyond the standard M4 at this time

Doom4535 and others added 3 commits May 28, 2019 21:53
Added entry for Arduino mega1280 boards
Added additional board entries, change due uC
Fixing improper name for due microcontroller
Added in arduino nano_v2
@Doom4535
Copy link
Author

Doom4535 commented May 29, 2019

Issues seem to stem from changing the Due from the avr chip to the sam3x8
I believe the Arduino.h file used by Godmode for this will need to be swapped out for a ARM/SAM version from here: https://github.com/arduino/ArduinoCore-sam/blob/master/cores/arduino/Arduino.h

*Found the section that triggers the errors:
bundle exec arduino_ci_remote.rb

@ianfixes
Copy link
Collaborator

ianfixes commented May 29, 2019

Originally posted at https://github.com/ianfixes/arduino_ci/pull/123#issuecomment-496894658

This looks like a good start. Don't be too concerned about the compiler errors, this simply means that we need to do some intelligent mocking out of defines, possibly in cpp/arduino/ArduinoDefines.h.

The most ominous warning (about device type not defined) is coming direction from avr/io.h, where I don't see __AVR_ATSAM3X8E__ listed.

Could it be that I'm using an outdated set of library files from the Arduino library (io.h in particular)?

Squashed commit

Setup for Travis-CI integration
Tweaked misc/default.yml
* Due now builds with defines for ATmega2560 as that is closer to the ATSAM3X8E (ATSAM3X8E causes Godmode tests to fail currently), was originally using ATmega328
@Doom4535
Copy link
Author

I believe that the device type not defined warning is related to the ATSAM3X8E not being an AVR board (none of the ARM boards are in io.h). I'm not entirely sure how the Arduino IDE does the build behind the scenes, but I want to say they switch to a separate ARM chain?

The Godmode is probably currently limited to AVR devices only? How are the ESP builds handled? I may try to use the same procedure for SAM devices.

@@ -17,9 +17,13 @@ matrix:
- os: osx
env: BADGE=linux

#before_install: gem install bundler -v 1.15.4
before_install:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not necessarily opposed to whatever is happening here but if you could give some context on how this relates to the problem being solved, that would be helpful (up to and including opening an issue).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am indifferent to it ultimately, that is there because my CI is defaulting to bundler 2.01, which complains about not being compatible with the older version. I set the version so that I don't cause any issues with anyone else.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm understanding you correctly, there is a more recent version of bundler that we could be using? I wouldn't mind taking some time to update that if it's causing problems -- please open an issue with the details of what you're seeing and I'll take a look at it.

@ianfixes
Copy link
Collaborator

In this project (without official support from Arduino) I'm generating my best guess at the compiler commands from scratch. I have to pull in a lot of the header files from the Arduino library to make this happen.

This makes things a bit strange, because it means that I'm compiling & running the test on a desktop architecture -- not the Arduino target architecture(s). So I need to bring in as many of the board-specific #defines as I can (from the official IDE's package), but not things like data types or other built-ins.

Nothing in Godmode itself should be limited to AVR devices. Or rather, any functions that are limited in such a way should be put behind the appropriate #ifdef directives, just like you would for (e.g.) serial port variable definitions.

Am I answering your questions? I apologize, because faking out the compiler is the most complex and most fragile part of this project, despite all the work put into exposing the definitions via yaml config.

@Doom4535
Copy link
Author

I believe so, the project is impressive. Having an open source software-in-the-loop system is very exciting.

@ianfixes
Copy link
Collaborator

Thanks, that's nice of you to say 😄

@ianfixes
Copy link
Collaborator

Picking up this project again after a hiatus. @RobTillaart or @per1234 can you speak to whether the compiler flags listed here are comprehensive?

@Doom4535 can you rebase this off what I'm working on in the #338 PR?

@RobTillaart
Copy link

Picking up this project again after a hiatus. @RobTillaart or @per1234 can you speak to whether the compiler flags listed here are comprehensive?

@ianfixes
Not understand your question I'm afraid.

If I need a board unique define (most often to make a library work) I select that board in the IDE.
Then I compile the code - verbose mode always on.
I copy the output in my editor and search the -D flags to find "Arduino_ARCH_boardname".
These defines allows me to add a patch for specific boards relative easily as these defines can be hard to find otherwise.
(or I just don't know where to look :)

Does this answer your question?

Comment on lines +52 to +55
# The due should use the ATSAM3X8E; however, that component does not seem
# to be defined for the Godmode tests/components
# The next closest part would be the AVR_ATmega2560 as both boards
# use the mega form factor
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Doom4535 can you explain this comment a bit? I'm not sure why the fix belongs here and not in Godmode.h

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's been a while since I looked at this, I believe I made that change because the Arduino Duo is most like an Arduino Mega based on pinout. Updating godmode.h to include the equivalent for the SAM board would be the technically correct result, and allow for including support for any extra features the SAM board supports that can't be done with the AVR board.

I'm not sure what the replacement should be, on windows it would likely be something inside of %LocalAppData%\Arduino15\packages\arduino\hardware\sam, maybe %LocalAppData%\Arduino15\packages\arduino\hardware\sam\1.6.12\variants\arduino_due_x\variant.h?

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

Successfully merging this pull request may close these issues.

3 participants