Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Teensy 3.1, Compile - How to set options speed/keyboard etc. (Read 7872 times)
Nick Belmont
Newbies
*
Offline


Posts: 5
Joined: Nov 15th, 2014
Teensy 3.1, Compile - How to set options speed/keyboard etc.
Nov 15th, 2014 at 2:38am
Print Post  
Hi All,
I just setup Visual Community Edition 2013 and Visual Micro to try as my build environment for a project Im working on with a Teensy 3.1.

I am using a new project created from File/New/Sketch Project

Teensy sketches are able to compile in the arduino IDE, but when I try to compile from within Visual Studio with Visual Micro, I get errors such as 'error: 'Serial' was not declared in this scope'


I have gone into the configuration manager and setup a profile for teensy, pointing at my arduino install directory with my sketch directory blank (to use default).  I have also tried manually setting it.

Project Menu - Add/Import sketch library shows both User and Core libraries available, and inserts the headers when I select one.  While troubleshooting I have tried duplicating all my settings from Arduino IDE (such as programmer type), but without any success.

Can anyone provide any guidance to help get this working?
« Last Edit: Nov 15th, 2014 at 3:54pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
Nick Belmont
Newbies
*
Offline


Posts: 5
Joined: Nov 15th, 2014
Re: Teensy 3.1, Compile - How to set options speed/keyboard etc.
Reply #1 - Nov 15th, 2014 at 5:29am
Print Post  
To fix this error (Not being able to find standard directories despite compiling to the correct target in the output), I had to modify the boards.txt file in the teensy directory.

I found these lines listed twice, so I removed 1 set

Code
Select All
menu.usb=USB Type
menu.speed=CPU Speed
menu.keys=Keyboard Layout
 



Then I also had to uncomment these lines:


Code
Select All
#uncomment these 3 lines for use with Visual Micro + Studio 6
teensy31.build.option5=-DF_CPU=96000000
teensy31.build.option6=-DUSB_SERIAL
teensy31.build.option7=-DLAYOUT_US_ENGLISH

 

« Last Edit: Nov 15th, 2014 at 3:55pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Teensy 3.1, Compile - How to set options speed/keyboard etc.
Reply #2 - Nov 15th, 2014 at 3:53pm
Print Post  
Hi Nick,

As you have discovered for Teensy you have to define which options you would like to use. Normally this done by following the instructions on our Teensy page or as you have found by editing the boards.txt with the options that you want to use such as speed/keyboard/serial/midi etc.

Thanks
« Last Edit: Nov 15th, 2014 at 3:55pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Nick Belmont
Newbies
*
Offline


Posts: 5
Joined: Nov 15th, 2014
Re: Teensy 3.1, Compile - How to set options speed/keyboard etc.
Reply #3 - Nov 15th, 2014 at 5:54pm
Print Post  
I did follow the instructions on the teensy page, thats what lead to me poking around the boards.txt file, but after following the instructions, I was only able to compile sporadically (sometimes it would work, sometimes not). 

Un commenting the values in the boards.txt seems to have fixed it permanently (across projects)

Great product and great job!
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Teensy 3.1, Compile - How to set options speed/keyboard etc.
Reply #4 - Nov 15th, 2014 at 7:14pm
Print Post  
Hi Nick,

Thanks for the great info and support.

When you were relying on the project properties were you also switching between configurations such as Debug/Release?

Thanks
  
Back to top
IP Logged
 
Nick Belmont
Newbies
*
Offline


Posts: 5
Joined: Nov 15th, 2014
Re: Teensy 3.1, Compile - How to set options speed/keyboard etc.
Reply #5 - Nov 15th, 2014 at 10:54pm
Print Post  
I was changing debug/release mode while troubleshooting (as well as a number of other things), but editing the boards.txt seems to have been the most consistent solution for me.

Today I am able to switch between arduino and teensy projects with ease, both compiling to the correct targets, without having to assign the options as in the teensy page.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Teensy 3.1, Compile - How to set options speed/keyboard etc.
Reply #6 - Nov 15th, 2014 at 11:03pm
Print Post  
Thanks. Is it possible you added the project settings to "defines - configuration" instead of "defines - project"?

The Release/Debug combobox on the tool bar are called "Configurations" and allow for configuration specific defines. 

In the case of the teensy defines you certainly want them to apply to the project and therefore be used by the compile for all configurations.

The two sets are merged together at compile time allowing you to switch on and off your own code but also ensuring certain defines are always applied.

Sorry if you knew this?

  
Back to top
IP Logged
 
Nick Belmont
Newbies
*
Offline


Posts: 5
Joined: Nov 15th, 2014
Re: Teensy 3.1, Compile - How to set options speed/keyboard etc.
Reply #7 - Nov 15th, 2014 at 11:55pm
Print Post  
In Visual Studio 2013 Community, I selected the top level in solution explorer and filled out the properties from the teensy page in the properties editor.

The instructions on the teensy page didnt align 1:1 with the version of Visual Studio Im using, this was the only place I remember finding the options as specified from the teensy page before opening the boards.txt
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Teensy 3.1, Compile - How to set options speed/keyboard etc.
Reply #8 - Nov 16th, 2014 at 12:02am
Print Post  
Thanks, I'll re-visit the doc
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
ST Cortex M4?
Reply #9 - Nov 18th, 2014 at 1:44pm
Print Post  
Off-Topic replies have been moved to this Topic.
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint