Compiling Teensy Sketches with VisualCode (Win10)

Yep !

[HEX] bin\visual_teensy_testproj.hex
text data bss dec hex filename
40924 3476 34044 78444 1326c bin\visual_teensy_testproj.elf
Sucessfully built project

That worked. Thanks for the fix!
 
Maybe another small issue? :

The std uploader seems to work fine. However when I run Terminal/Run Task/Upload(TyCommander):

Code:
> Executing task: C:/Users/user2/Documents/VisualTeensy_V0.84/make.exe uploadTy -j -Otarget <

I get this error:

Code:
process_begin: CreateProcess(NULL, \tyCommanderC upload bin\visual_teensy_testproj.hex --autostart --wait --multi, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [makefile:154: uploadTy] Error 2
The terminal process terminated with exit code: 1

The file is there for sure.

When I run it from Terminal/Run Build Task/Upload(TyCommander):
Then it works. It seems to be two Menus under Terminal (Run Task and Run build task).
 
Did you set the path to the TyTools correctly (settings tab). You can check in the generated makefile. The variable UPL_TYCMD_B should be set to your TyTools folder

Code:
#******************************************************************************
# Generated by VisualTeensy (https://github.com/luni64/VisualTeensy)
#
# Board              Teensy 3.2 / 3.1
# USB Type           Serial
# CPU Speed          96 MHz (overclock)
# Optimize           Faster
# Keyboard Layout    US English
#
# 10.11.2018 17:25
#******************************************************************************
SHELL            := cmd.exe
export SHELL

TARGET_NAME      := newProject
BOARD_ID         := TEENSY31

LIBS_SHARED_BASE := C:\Users\lutz\Documents\Arduino\libraries
LIBS_SHARED      := 

LIBS_LOCAL_BASE  := lib
LIBS_LOCAL       := 

CORE_BASE        := C:\PROGRA~1\Arduino\ARDUIN~1.5\hardware\teensy\avr\cores\teensy3
GCC_BASE         := C:\PROGRA~1\Arduino\ARDUIN~1.5\hardware\tools\arm
UPL_PJRC_B       := C:\PROGRA~1\Arduino\ARDUIN~1.5\hardware\tools
UPL_TYCMD_B      := C:\toolchain\TyTools
UPL_CLICMD_B     := 
....
 
How can I make a keyboard shortcut so that when I press for example SHIFT+F10 the Terminal/Run Build task / Upload (Teensy Uploader) is run.

I would like to avoid having to use the mouse to go into that menu every time.
 
CTRL+SHIFT+B opens the "Terminal/Run/Build Task" menu. The menu remembers the last selection. So after the first time all you have to do is "CTRL+SHIFT+B RETURN" to trigger a rebuild followed by an upload. No need for the mouse at all.
 
I just want to thank you so much for this great toolchain!

Getting rid of that sucky Arduino IDE was a big relief. And being able to see the .h files and have an editor with .cpp on the left and .h on the right or pressing Alt+O to swap to the header is great. Now coding Arduino / Teensy is fun!

You should really spread the word and possibly get support from Paul Stoffregen to try to have more people use this toolchain.

The only thing missing now is a proper debugger integrated in the toolchain.
 
VisualTeensy for Sublime

Just tried to compile a existing VisualTeensy generated project with Sublime and it works nicely :) If anyone is interested in a quick experiment you can do the follwing steps:

1) copy the code below in a file called "test.sublime-project" in the root folder of the project and open it with Project | open Project
2) adjust the path to make.exe in this file
3) In Tools | Build System select VisualTeensy Build

Then a CTRL+SHIFT+B should open a menu where you can select from build, clean, and upload

Here a very first proof of principle build-system:

Code:
{
	"folders":
	[
		{			
			"path": ".",
		}
	],
	"build_systems":
    [
        {   
        	"name":"Visual Teensy - Build",
        	"working_dir": "${project_path}",         
        	"shell_cmd": "c:\\toolchain\\make\\make -f${project_path}\\makefile all",
            "variants": [            
            {
             	"name": "Clean",
             	"shell_cmd": "c:\\toolchain\\make\\make -f${project_path}\\makefile clean",
             },
             {
               "name": "Upload",
               "shell_cmd": "c:\\toolchain\\make\\make -f${project_path}\\makefile uploadTy",
             }
          ]
        }
    ]
}


sublime.jpg

Could add a "Sublime Option" in VisualTeensy if anyone is interested.
 
Yes, I've seen that post and thought: "since I don't like the Arduino Build system I'll stick with my makefiles!" :) "Dem ein' sin Uhl is dem annern sin Nachtigall" as they used to say :) It is always good to have more than one option, and most of the users will be just happy with the Arduino Builder I'm sure.

Anyway, I'm not : https://forum.pjrc.com/threads/5360...alCode-(Win10)?p=188069&viewfull=1#post188069 But: hey, that's my personal preference, not your problem! - really, please don't feel offended! :)
 
I like SublimeText - though just installed Eclipse for another project. I trust the Arduino Build system to work as long as Paul and PJRC are making Teensy. With ZIP installs the prior version is unchanged when new version of anything drops as it goes to a new directory - and copies of the old installers will still work to recreate when it does break in Beta … or versions after. A full IDE/TDuino install is under 700 MB { half that for the installers } and the libraries needed.

Also Frank_B shows how the Arduino build system can be run in place with a Batch file - which is cool since I'm on Windows :) I've not looked into Sublime to see if it might have a way to spawn that - but that would still leave the settings to be managed ...
 
Taking up Franks idea to use the arduino-builder instead of makefiles I added an option to VisualTeensy which generates vsCode projects using the arduino builder as build system. You can select the corresponding option on the settings tab.

builder1.PNG
As always, you can use the comboboxes to select board, usb type and the other teensy settings. File|Save generates / updates the vsCode project


The generated tasks.json now directly calls arduino builder.
builder2.PNG

This is a little bit experimental at the moment but it already works nicely :)
CTRL+SHIFT+B in vsCode opens the build task menu with the build and upload commands. The output messages of the arduino builder are a bit messy but I currently don't see how to improve that.
 
What means messy output? Same as in Arduino? :)
Sort of, I didn't find out yet how to switch of word wrapping in the output window of vsCode which makes it even worse :-/

I somehow prefer the clean output of my makefiles :)

builder3.PNG
 
hm . word wrapping makes it more difficult to see errors or warnings. can you redirect stderr, and show it if the builder exits with return codes>0? the atom plugin I use does it this way, and opens a nice window with the text of stderr.
 
Support for ATOM and Arduino-Builder

New features in v.0.9.0

  • Additionally to vsCode, VisualTeensy now supports the ATOM editor as alternative target editor.
  • For those who like builds as close to the Arduino IDE as possible I implemented Frank's Arduino-Builder idea as alternative build system

Repository and download: https://github.com/luni64/VisualTeensy/releases/tag/0.9.0

Usage
In vsCode the key combination ctrl-shift-b opens the standard vsCode build menu where the required build action (build, clean, upload-PJRC upload-TyTools) can be selected. In ATOM a VisualTeensy menu with the corresponding build entries is generated automatically. Please note: ATOM requires the process-palette package installe to work with VisualTeensy. (https://atom.io/packages/process-palette).

Both, target IDE and build system can be selected on the setup tab. A simple File|Save automatically generates (or updates) the corresponding project folder for the target IDE.

atom.PNG
 
I had a similar problem to @Hughby's post when I tried to launch VisualTeensy (v0.9.0) for the first time:
> Object reference not set to an instance of an object ... at VisualTeensy.App.loadSetup() ...

My Arduino installation is here:
D:\Dropbox\Arduino

So I edited VisualTeensy.exe.config as follows:
<setting name="arduinoBase" serializeAs="String">
<value>"D:\Dropbox\Arduino"<value/>

Since that edit, when trying to launch there is no error message but the application does not open either - nothing at all happens.
(Visual Studio Code is installed, as well as the C/C++ extension, and runs OK without VisualTeensy)

@luni: Pls can you point me to some instructions on how to set up the config file for non-standard installation locations, or advise on what else to try. Thanks.
 
Sorry for that, I didn't have much time the last weeks to work on VisualTeensy. Will be difficult to fix it today but I can have a look tomorrow...
 
My Arduino installation is here:
D:\Dropbox\Arduino

So I edited VisualTeensy.exe.config as follows:
<setting name="arduinoBase" serializeAs="String">
<value>"D:\Dropbox\Arduino"<value/>

Since that edit, when trying to launch there is no error message but the application does not open either - nothing at all happens.
(Visual Studio Code is installed, as well as the C/C++ extension, and runs OK without VisualTeensy)

@luni: Pls can you point me to some instructions on how to set up the config file for non-standard installation locations, or advise on what else to try. Thanks.

I have non standard locations of Arduino and changed that with the expert tab. no big deal. or do I misread your problem?
 
Back
Top