Go Down

Topic: How is the Due / SAM core arranged in the Arduino IDE ? (Read 3207 times) previous topic - next topic


So I recently learnt the Arduino open source IDE is on Github and that includes the Arduino SAM core.

I'm curious to know how the Githib structure relates to the Arduino IDE for Due (under C:\Program Files (x86)\Arduino on my PC).

For example the other day I was trying to get Wire1 port SDA1/SCl1 working on my Due and went looking for the relevant Wire.h / Wire.cpp and twi.h.c for SAM/Due. But the sub-drectory C:\Program Files (x86)\Arduino\hardware\arduino only has the AVR core. The is no SAM sub-directory here, and elsewhere only an unhelpful directory containing a ServoTimer library

Maybe Wire/twi is not best example as under avr I can see the Wire library and (mutiple) copies of twi, and maybe these are what Due uses anyway. But my question is a general one: to what extent is the github structure replicated on my PC, and why don't I find any sam core sub-directories?



1) You have to "install" the Due boards before the compiler and core and such exist within your IDE installation.
2) Turn on the verbose compilation option in the IDE preferences to see where it has put everything (yeah, it has a standard place, but that place changes depending on version and installation settings.  Looking at the compiler output ALWAYS shows you where they are.)
3) I'm not quite sure how the core/etc goes from github "part of the IDE" to production "separately installable module."  It's obvious for the SAMD (Zero) boards - they have a separate github repository as well...


My board manager shows I have the Due installed (SAM 32bits ARM-Cortex-M3) which is no surprise as I have compiled/run maybe 10 different sketches on my Due over recent weeks.

I'll try verbose mode as you suggest, maybe that will unravel the mystery a little!



In very generic way - after loading the compiled IDE you have  download/Arduino  structure and allegedly after first execution another directory structure -  in Linux .Arduino15 is build.
In  non tech description - you have a copy of Github  and a work copy you can modify.
Most of the shared core code have preprocessor  switches to select correct hardware , some hardware  depended cod eis in its own subdirectory - for example  there is "sam" directory.
Again - in very general - the "Open" concept is there , but the directory structure makes it difficult to implement in custom software.
But on the other and more prevalent philosophy of "this is for beginners " it is understandable why most of this is not published and left for  guesses. ( try to find how WDT is implemented in ARM / Due )



I like to invoke the "portable" option by creating the "portable" directory in the arduino install directory.
Then all of the board-manager installed stuff appears under <Arduinoinstall>/portable/packages/
(Due core would be in .../portable/packages/arduino/hardware/sam/1.6.9/cores/arduino/ )
On modern windows systems, this seems to require some fiddling with the directory permissions for "portable", and may have other detrimental effects, since preferences are also stored there.  (So it's not so good for multi-user PCs?)

I think it's horrible that the IDE installs add-on compilers in user-specific directories, but apparently that's the only "good" way to allow the add-ons to be installed by users running the IDE, according to microsoft :-(


well this is all interesting, but as mentioned I don't have any \sam directories like those on GitHub on my Win10 single user PC, but I can use Due just fine?? So I'd say nothing is missing ...


This probably won't help to answer the OP question, but try " tree " command.
It is actually overwhelming on Linux , but I did not check for options.


Finally I found my sam directories ! ... using verbose compile as suggested (thanks)

I was only looking under: C:\Program Files (x86)\Arduino

but I found them  under: C:\Users\<username>\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.9

It's good to know, but I wonder why the IDE copies / puts the sam files there? Presumably a multi-user machine would have many copies, and aren't these files only ever read, i.e. not changed by compilation?


For Linux it is under: /home/user/.arduino15/packages/arduino/hardware/sam


I have the same problem as the original writer but under Ubuntu 16.04. My installation folder is /usr/share/arduino-1.8.7 and my arduino verison is (obviously then) 1.8.7.

I have installed the SAM boards through the boards manager in the IDE, and have been able to compile code for my Arduino DUE. But there is no sam/ folder under /home/<user>/.arduino15/ nor under /usr/share/arduino-1.8.7/hardware/arduino/ .

I actually went so far as to search my complete system for directories called sam/ but only found /usr/share/arduino-1.8.7/libraries/Servo/src/sam which contains nothing more than the source and header for that Arduino library.

Where could the files be hiding?


May 15, 2019, 05:03 pm Last Edit: May 15, 2019, 05:04 pm by ard_newbie
I know nothing about Ubuntu but, but in an IDE window, select File>Preferences, click in the URL at the bottom :

On my PC (and I guess this is more or less equivalent for you) this is C:\Users\xxx\AppData\Local\Arduino 15\preferences.txt

Then follow the path:

Go Up