-
Notifications
You must be signed in to change notification settings - Fork 296
Compiling g2core on Windows 10 and Atmel Studio 7
This page is for compiling the G2core project on Windows 10 with Atmel Studio 10. Please see Getting Started with G2core for information about hardware and compiling on other platforms.
📓
|
At this point we have given up on VMware and switched to Parallels 12 Desktop for Mac. Parallels compiles much faster due to better file system handling and has fewer problems. (For VMware the camel’s back was waking up one morning and finding Windows did an overnight update (I thought I turned that off) which doubled the size of the VM and broke the Z: drive connection. Can’t get it back.) |
📓
|
If you are using Windows inside VMWare, please see the VMWare Setup section of our Troubleshooting page. |
Go with a 64 bit Windows, AS7, Git setup all the way if you can. Support is gradually disappearing for 32 bit packages, so this project is transitioning to 64 bit only configs. This is not our fault, as the tools for 32 bit setups are starting to go away.
Don’t confuse the bit widths for Windows 10 or the ARMs, the ARMs are still 32 bits and various toolchain elements mentioned below are labeled as 32 bits referring the ARM’s bit width.
Atmel Studio 7 weighs in at a portly 2.01 Gb, so you need this much space on your C: drive (virtual or otherwise). The g2gore project itself downloads the entire tool chain (in g2/Motate/Tools/win32) so it’s also pretty big - currently almost 800Mb. You should have at least 1 Gb free on the drive where the repo is, which might not be `C:`.
To compile g2core on Windows with Atmel Studio you will want the Atmel Studio 7.0.1188 (or greater). We recommend a clean machine or VM.
-
Go to Atmel and download the Atmel Studio 7 Installer install package. Either Web or Online versions should work.
-
There may also be USB driver updates that are not in the main file. If so, you might want these as well. You should not need any of the Part Packs or other files.
-
They require you to either register or fill out a "guest" form. Otherwise it’s free.
-
-
Walk through the entire installation process
-
It should install .NET, Microsoft Studio, Atmel Drivers, Atmel Studio.
-
Install the Smart ARM 32 architecture. You do not need the 32 bit AVR architecture. If you want to also use this package to work on TinyG v8 you will need the AVR8 bit architecture. The 32 bit toolchain is currently required even though the g2core project downloads its complete toolchain.
-
We do not install the Atmel Studio Framework Code or Examples. You do NOT want this, as we don’t use it, and it takes up a lot of space.
-
-
Fire up AS7 for the first time
-
You do not want the Atmel Solutions Framework (ASF) when asked. You won’t want to update it and you can turn off notifications about it. Do NOT use an ASF project (like the Arduino Due board) if you are playing with g2core or you will have a lot of stuff to back out. The g2core project provides Makefiles and project files for you to use.
-
You will need the USB drivers when asked (Jungo or something like that)
-
-
-
Start AS7 by clicking the
g2core.atsln
file in the g2 directory. This should load the g2core and Motate projects in AS7. Yes, you trust it, when asked. If for some reason the Motate project does not load it may because you didn’t initialize the Motate directory usinggit submodule update --init
-
Configuring Atmel Studio 7 There are a few things you need to do make sure of once you have it installed
-
Verify GDB is the selected debugger
-
Bring up the g2core Properties window by right clicking the
g2core
project symbol in the Solution Explorer window and selectingProperties
(at the bottom) -
Select the
Advanced
tab -
Make sure
Use GDB
is checked, andOverride Current GDB Path
is not
-
-
Make sure project dependencies and ordering are correct
-
Right click the
Solution 'g2core' (2 projects)
icon at the top of the Solution Explorer.-
Set
Startup Project
to Single Startup Project:g2core
-
Confirm
Motate
is unchecked inProject Dependencies
(it doesn’t ever compile here). OK. -
Right click
Solution 'g2core'
again and confirm or setProject Build Order
to be g2core before Motate. OK.
-
-
-
From top menu bar select Tools / Options / Text Editor / All Languages / Tabs. Change the default TAB mode from tabs to spaces (especially if you are going to contribute back to the project). Choose the Insert Spaces option. Leave the tab spacing at 4.
-
From top menu bar hit File / Save All to make sure this sticks.
-
The project Makefiles rely on the git
command, so Git for Windows needs to be installed in your Windows environment even if you use GitHub Desktop or you’re using Windows in a VM and use Git on your host OS.
-
Go to the official Git site and download and install the Git for Windows. Get the right one for your Windows - 64 bit is preferred (version 2.10.0 at the time of this writing). It may automatically DL the Windows 32 bit version. Don’t be fooled if this is not what you want.
-
Option Dialog 1: Choose
Use Git from Windows Command Prompt
(default, but any should work) -
Option Dialog 2: Choose option 2, Checkout as-is, Unix style line endings
-
Option Dialog 3: Choose MinTTY (default, but doesn’t matter for our uses)
-
Option Dialog 4: Both boxes checked ON, but turn OFF if windows weirdness (works for us)
-
When it asks you if you want icons on your desktop you might want this to get Git Bash so you can debug the Windows environment (should it come to that).
-
📓
|
The Makefiles also rely on the curl command that comes along with Git for Windows. If it weren’t for that chicken-and-egg, then we could curl to get the "portable" zip-install of Git for Windows and you wouldn’t have to do anything.
|
See Cloning the Repo if you haven’t already.
📓
|
These instructions are for the Atmel-ICE debugger. Many of these instructions will work with the Atmel SAM-ICE as well. The J-Link Segger works as well and is faster and cheaper than the Atmel ICE (Student model on Adafruit), but we haven’t documented it yet - so you are on your own - or be a pal and update this page. It’s also possible to upload directly through the USB or serial ports, but there is no real-time debugger in that case. |
-
The
g2
project directory is the parent for all of the source files and the Atmel project files. theg2core
subdirectory contains the main project and the g2core project fileg2core.cppproj
, andMotate
contains the module and its project file. Generally you shouldn’t need to work in Motate. It’s best to start AS7 by clicking ong2core.atsln
in theg2
directory - or a shortcut to it. This should load both projects. -
If you have changed your git branch you need to run
git submodule update
to make sure the right commit of Motate is associated with the g2core you have. It’s a good idea to run this before opening the project in any case. -
Open AS7 by double clicking on
g2core.atsln
in the parent g2 directory. AS7 should fire up - tell it to trust us. AS7 has a bug so you might get this warning which can be ignored:[warning] Error updating project settings:Object reference not set to an instance of an object
📓
|
Git is configured to ignore the changes to some of the project’s dependent files so that they don’t cause havoc. This means that to commit changes to those files, they need to specifically be added to the commit by name. |
📓
|
If the g2core project is present but the Motate project is missing in AS7 check out this troubleshooting item: https://github.com/synthetos/g2/wiki/Troubleshooting#problem-the-motate-directory-is-empty-the-motate-project-is-missing |
To compile the project:
-
Choose the platform you are building for (for the Due with gShield pinout, choose
gShield
) -
Click either the "Build Project" or "Build Solution" buttons — they are the same in this case. (These can also be found in the Build menu.)
-
This will create a file named
g2core.elf
and in thebin/$(CONFIG)-$(BOARD)/
directory for the board you are building -
This will also create a
g2core.elf
file in theg2core
directory (see note below) -
You will need one of these files to upload to the board. With option 5, below, it will use this file automatically. All other ways of uploading to the board will require you to locate this file manually
-
The first time it compiles the project it will download the entire toolchain and install it in the Motate Tools directory. This can take a while (~200 Mbytes). You will want a good Internet connection.
-
-
Configure the Device and Atmel-ICE Tool in the g2core project Properties window, which can be found by right clicking the g2core root directory in the Solution Explorer pane.
-
In the Device tab select one of:
ATSAM3X8C
for a v9 board, orATSAM3X8E
for the Due, or the right M4 or M7 processor for your particular board (gQuadratic and gQuintic use ATSAMS70N19) -
In the Tool tab select your
Atmel-ICE
, which must be plugged in for it to appear. If you have more than one plugged in you can identify them by the last 4 digits of the serial number -
The Interface should be
SWD
. JTAG doesn’t always work. Max out clock speed to 10 MHz for best operation -
You can now program and debug the buttons labeled '5' in the picture, as per step 5, below.
-
-
(Alternately) Connect, configure and test the Atmel-ICE Tool in the Device Programming window:
-
The Tool should be Atmel-ICE. If you have more than one connected identify by the last 4 digits of the serial number.
-
The Device is one of:
ATSAM3X8C
for a v9 board, orATSAM3X8E
for the Due, or the right M4 or M7 processor for your particular board (gQuadratic and gQuintic use ATSAMS70N19) -
The Interface should be
SWD
. JTAG doesn’t always work. Max out clock speed to 10 MHz for best operation -
Hit Apply
-
You can hit Read the Device Signature to verify that you are connected. Or just hit the Memories tab
-
Program from the Memories tab. Make sure the file selected is the
g2core.elf
in the the correctbin/$(CONFIG)-$(BOARD)/
directory. (See Adding and Revising Boards for an explanation ofCONFIG
andBOARD
.) You can also use this option to program any valid binary (particularly useful if you didn’t compile it).
-
-
To compile and upload without debugging (left) or with debugging (right) click one of these two buttons. These are also available from the Debug menu.
📓
|
The build will copy g2core.elf , and g2core.map to the top directory after build only in Atmel Studio. This is because Atmel Studio requires those files to be in that exact location with those exact names in order to consider building successful and to know what file to flash. Be warned that this file will always contain the result of the last profile built if you build several profiles.
|
📓
|
We try to eliminate all compiler errors and warnings from the project. However, there is (we believe) a GCC linker bug that will sometimes reports that the base address (BSS) has been moved by 8 or 12 bytes. This can be ignored. |
To flash g2core (using the g2core.elf
file you just made in step 2 above) onto a target board without using a debugger such as the Atmel ICE or Atmel SAM-ICE, please visit the Flashing g2core with Windows page.
This is a collection of random things we’ve found help when using our standard toolchain -→ OSX 10.11 (El Capitan), Parallels VM, Windows 10, Atmel Studio 7.0.1188, Atmel-ICE.
-
A common mistake is to not update the Motate submodule after switching to a new branch or pulling a branch. Whenever you pull from github be sure to run
git submodule update
from the command line (e.g. OSX Terminal) to make sure the right commit of Motate is associated with the g2core you have. The short-SHA for the Motate commit can be found by going to the github, selecting the branch you are on in the Code tab, and looking for theMotate @ ba0db89
entry in the file listing. The SHA provided should match thegit submodule
command from the command line. -
Whenever you pull from github you must CLEAN the g2core project. While running Clean or Rebuild should do this sometimes things get messed up due to Windows permissions. Clean clears out the /bin and /build directories, but we recommend just deleting the /bin and /build directories completely. If your build behaves badly (goes into panic, does completely unexpected things) you should delete these directories and recompile.
-
The Atmel ICE works best when connected as SWD, clock speed maxed out to 10 MHz.
-
When firing up a new instance of AS7 you may get an error trying to connect to the ICE. This may occur when you try to program, or enter Debug. Disconnect / reconnect the ICE - in Parallels: /Devices/External Devices, Atmel-ICE… Disconnect it, wait a second, then reconnect it.
-
If the USB gets thoroughly confused it’s time for a VM and OSX reboot. Happens occasionally.
-
If g2core project does not load it may be because the g2core.cppproj doesn’t pass the AS7 XML parser - especially after a conflicted merge. A merge conflict can be caused a collision of the Atmel ICE settings in the g2core.cppproj file. In this case open the file manually or with a mergetool and select one or the other Atmel-ICE settings. Either one is OK because you can change to the right one once AS7 is open.
See the Issues with compiling on Windows section of the Troubleshooting page.
Getting Started Pages
- Home
- What is g2core?
- Who uses g2core?
- Jerk-Controlled Motion
- Getting Started with g2core
- Connecting to g2core
- Configuring g2core
- Flashing g2core
- Troubleshooting
Reference Pages
- Gcodes
- Mcodes
- Text Mode
- JSON Communications
- GPIO Digital IO
- Alarms & Exceptions
- Power Management
- Coordinate Systems
- Status Reports
- Status Codes
- G2 Communications
- Tool Offsets and Selection
- Probing
- Feedhold, Resume, Job Kill
- Marlin Compatibility
- 9 Axis UVW Operation
- gQuintic Specs
Discussion Topics
- Roadmap
- GPIO for 1.X Releases
- Toolheads
- Raster Streaming Prototol
- g2core REST Interface
- Gcode Parsing
- G2 3DP Dialect
- Consensus Gcode
- Digital DRO
- Overview of Motion Processing
Developer Pages
- Development & Contribution
- Branching and Release - DRAFT
- Getting Started with g2core Development
- Project Structure & Motate
- Compiling G2
- OSX w/Xcode
- OSX/Linux Command Line
- Windows10 w/AtmelStudio7
- Debugging G2 on OSX
- Board and Machine Profiles
- Arduino Due Pinout
- Arduino DUE External Interfaces
- Diagnostics
- Debugging w/Motate Pins
- Development Troubleshooting
- g2core Communications
- Git Procedures
- Windows 10 / VMware 8 Issues
- Dual Endpoint USB Internals
- G2core License
- VSCode Setup
- Compatibility Axioms
- Wiki History