Teensy for Microsoft Visual Studio and Atmel Studio

The Teensy platform from PJRC is fully compatible with the Arduino IDE, and Visual Micro shares the same configuration and tools making things simpler.

Installation

If you have already installed this for Arduino it will work with Visual Micro already, and if not, simply follow the same instructions above to install Teensy for Arduino and Visual Micro.

To get up and running with your Teensy for the first time please follow the manufacturer's installation guide below to add Teensy to the Arduino IDE:

See our Compatibles Download page for links and more information, and our Installation video, and our walkthrough on Arduino Project Hub.

 

Using the Teensy Board Options

Build programs and uploading to Teensy boards is simple in Visual Micro using the "Board Options" menus. The Visual Studio Intellisense system provides dynamic assistance in the code editor, based on the menu options selected, and automatically changes as these options are changed.

If options are not altered then the first item in each list will automatically be applied, and these options can be changed at any time and the project rebuilt.

Note IconNote:

Changing the Teensy Options will cause a full recompile of the project


1. The "Tools>Visual Micro>Board Options" menu will automatically display the published options for each type of Teensy board.  

Using the Board Options Menu in Visual Micro


This may also be displayed as a toolbar if you have the Micro Board Options Toolbar displayed.

Note IconNote:

As with all tool bars, this bar can be hidden or removed if required (right click>customise) it will not re-appear until you unhide it or use the reset command described above.

Using the Board Options Toolbars in Visual Micro


Teensy - Serial and More!

With Teensy we can configure how the USB port will perform. For example; as Serial, joystick, keyboard, MIDI etc. To do this we select the USBType from the Board Menu. One point to note is that by default Teensy does not enable the USBType:Serial by default, so we can not use Serial.println() in code and the Visual Micro debugger will not work (in its default state).

Teensy has another serial port called Serial1. You can connect the Serial1 pins>USB and use it for your own serial communications or as an alternative debugger port.



Serial Debugging for Teensy


Please note that the default Visual Micro debugger transport is SerialUSB. With Teensy the USB can be disabled entirely, in which case the debugger will not work unless you switch to using alternative port or pins (see user guide). RemotePort can also be equal to Serial1 or you can use SoftwareSerial.

Alternatively, switch off debug (change the configuration from Debug to Release) and do not use Serial.print in your own code.


GDB Stub Debugging for Teensy

Using the GDBStub library published by Fernando Trias, you can quickly and easily start debugging with GDBStub in Visual Micro. With no additional hardware or wiring needed, and the pre-configured options in Visual Micro, you debug those Teensy Arduino Projects in no time... With the Teensy Boards supporting more than one Serial device, you can run the GDBStub through one port, and keep all of your Serial messages coming back to the PC from another.


Library Specific Defines

Example Library: https://github.com/mgergos/Opus4Teensy

Additional Build flags are needed to correctly build this library, which can be added in Visual Micro easily in the project configuration properties.

OPUS_BUILD;FIXED_POINT;OVERRIDE_OPUS_ALLOC;OVERRIDE_OPUS_FREE;VAR_ARRAYS;HAVE_CONFIG_H;OVERRIDE_OPUS_ALLOC_SCRATCH;DISABLE_FLOAT_API;OPUS_ARM_INLINE_EDSP;EMBEDDED_ARM;OPUS_ARM_ASM;opus_alloc(x)=NULL;opus_free(x)=NULL

To set these for all build configurations use the "Defines" option shown above.

If you only want these flags set per build configuration (e.g. Debug or Release) then use the "Configuration Defines".

More information about setting project properties can be found on this page:

Using Project Properties as defines in your code


Further Information

PJRC Website