teensy and sublime text 3 help

Status
Not open for further replies.
Hello all, this is my first post on the PJRC forum. I am new to Teensy, having just acquired a Teensy 3.6. I have some experience of programming Arduino Mega 2560 and until now I have used the Arduino IDE. However, I have installed Sublime text 3 and some packages to enhance it and would like to use it to generate my Teensy code and compile and upload.

I have read this thread post #90
https://forum.pjrc.com/threads/3839...DE-replacement?p=193211&viewfull=1#post193211

and it was helpful to understand the context. I also went to defragster on github:

https://github.com/Defragster/Tset

and read there about using Tset

and also here to use tycmd https://github.com/Koromix/tytools

So with my limited knowledge of this, I have installed the arduino ide and teensyduino, installed Tset and tycmd. I have Run Tset.cmd and edited Tset.cmd1 to have folder paths to my local system as follows.

rem Edit these paths:
set arduino=c:\arduino
set TyTools=C:\Arduino\tytools-master
set libs=C:\Arduino\libraries
set tools=C:\Tset-master


Sublime text is installed here: C:\Program Files\Sublime Text 3

In sublime text, i have added this (from defragster github) in tools>build system > new build system:

>> FORMAT CODE when using installed package :: SublimeAStyleFormatter
Ctrl+ Alt+ f


>> USER BUILD FILE for Teensy :: Teensy.sublime-build
>> Ctrl+ Shift+ B to select below and F7 to repeat last build command
"%AppData%\Sublime Text 3\Packages\User\Teensy.sublime-build"
----
{
"shell_cmd": ".\\Compile.cmd 1",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",

"variants":
[
{
"name": "Clean",
"shell_cmd": ".\\Compile.cmd 2",
},
{
"name": "New Sketch",
"shell_cmd": "start T:\\Programs\\TSet\\open_new.cmd",
},
{
"name": "Verify",
"shell_cmd": ".\\Compile.cmd 0",
},
{
"name": "Tools Set",
"shell_cmd": "start T:\\Programs\\TSet\\TSet.cmd",
}
]


}

But I am not sure how to modify the above code to make it fit with my installed folders. Please could anyone advise me how to modify the above code to fit with my directories?

Also I did not quite understand this in defragster's github readme :
"Run Tset.cmd ( must include extention .cmd )" i have done this, and it goes on to say

"from the Sketch folder where the INO is stored for IDE usage. It can run from within your IDE or from CMD line or Explorer window." - what does it mean "where the INO is stored" - is this the arduino files directory??

So any further explanation would be greatly appreciated.

Also any help with ensuring I have the key components installed in the correct places would be helpful.

Many thanks for your help,
Paul
 
This is something that @defragster is better able to edit...

But assuming you have everything in the right places. What I do is have my sublime text window open, with the current file as one of my .ino files.

I then hit <ctrl><shift>B
Which brings up tools build menu... I then choose Teensy tools set menu item
Then walk through the prompts for the build I want...

Then again hit <ctrl><shift>B
And then just choose: Teensy

Then when it compiles you see a window pane with build info. If you get compiler errors or warnings, you can hit F4 to see those errors...
To then build again just hit: <ctrl>B

There are a few hidden gotchas. with this, If your sketch has tabs in it with .h or .cpp files or the like, and you have compiler errors/warning. The F4 will show you the files in your temp directory where Arduino copies the stuff. I have several times made changes, do a build and changes are gone... Need to do the edits in this case in the actual source files.

Hope that helps a little before Defragster can fill in pieces.
 
Thanks Kurt,

When I load an arduino sketch into sublime text 3 and hit <ctrl><shift.<b>, i get " Arduino IDE, teensy, avr, teensy 4.9 600Mhz US English, Faster , Serial COM 1 No build system".

I'm sure it's not a big problem, I'll wait and see if anyone can help further. Thanks for your reply,
Paul
 
Just seeing this … it is working for me with what I have the same as github AFAIK - just updated local dirs. to 1.8.11 and all good.

Question I see is about SubLime build strings? Like : "start T:\\Programs\\TSet\\open_new.cmd",

For your case with "set tools=C:\Tset-master" Those string would replace "T:\\Programs" with "C:\\Tset-master"

Let me know if there is more not working with links to what you tried. I got it set up so long ago I may need a refresher.
 
Thanks, I have changed my code to this, to reflect file paths:

>> FORMAT CODE when using installed package :: SublimeAStyleFormatter
Ctrl+ Alt+ f


>> USER BUILD FILE for Teensy :: Teensy.sublime-build
>> Ctrl+ Shift+ B to select below and F7 to repeat last build command
"%AppData%\Sublime Text 3\Packages\User\Teensy.sublime-build"
----
{
"shell_cmd": ".\\Compile.cmd 1",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",

"variants":
[
{
"name": "Clean",
"shell_cmd": ".\\Compile.cmd 2",
},
{
"name": "New Sketch",
"shell_cmd": "start C:\\Tset-master\\open_new.cmd",
},
{
"name": "Verify",
"shell_cmd": ".\\Compile.cmd 0",
},
{
"name": "Tools Set",

"shell_cmd": "start C:\\Tset-master\\TSet.cmd",
}
]


}

but I still get the error "no build system" when I do <ctrl>< shift ><b>

Considering this line from the above code:
"%AppData%\Sublime Text 3\Packages\User\Teensy.sublime-build"

this probably needs to be customised to reflect my setup - its obviously a path, but I don't know what is supposed to be there....

BTW I am on U.K. time so may not post again for 8 hours or so.

thanks again
Paul
 
Hello again,

I have made progress by editing the build system code as below and the key things I did were:

1 - put in the file path to my teensy sketch as "working_dir"
2 - put in local paths in the "variants" section

I can now do <ctrl>< shilft>< b> to get an on screen popup list of the available variants, from which I can choose.

If I pick the "Verify" option it compiles my code - brilliant.

I still have to sort out 'new sketch' , but I think I can do that now.

Thanks to all the github contributors for this nice code and also for help provided by folks on this thread.

Best wishes
Paul

{
"shell_cmd": ".\\Compile.cmd 1",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${C:\\Arduino_Projects\\Test sketches\\Encoder_Nodetest9600}",
"selector": "source.c, source.c++",

"variants":
[
{
"name": "Clean",
"shell_cmd": ".\\Compile.cmd 2",
},
{
"name": "New Sketch",
"shell_cmd": "start C:\\Tset-master\\open_new.cmd",
},
{
"name": "Verify",
"shell_cmd": ".\\Compile.cmd 0",
},
{
"name": "Tools Set",

"shell_cmd": "start C:\\Tset-master\\TSet.cmd",
}
]


}
 
Sounds like good progress!

Hopefully NEW works for you - I see that file has embedded paths as well:
Code:
set sbook=T:\tCode
set srcdir=T:\Programs\TSet

They need to point to your local SKETCHBOOK directory and also your C:\Tset-master directory to be able to find the 'New Sketch.ino;.

It does this funny/ugly line to copy that INO file :: if not exist %sbook%\%bar%\%foo%\%foo%.ino copy %srcdir%\new_ino.ino %sbook%\%bar%\%foo%\%foo%.ino
> That creates the IDE expected folder name of the Sketch name in the end, and sets the base sketch as copied from in my case :: T:\Programs\TSet\new_ino.ino

In SublimeText F7 works for me to 'run the last build' - which is good to rebuild after selected with the <ctrl>< shilft>< b>


Let me know if you see any HOLES in the system. It lets me live and work in SubLime text and do what I can do in the IDE.

The only thing missing is the IDE / RECENT as a way to see what sketches were recently opened. I could have those written to a file probably - when ever a COMPILE.CMD is created - and the power of SubLimeText would probably allow opening that file to open the indicated SOURCE file … but that seemed like work.
 
That is great it is working! Enjoy!

Seems I should add notes on customizing the 'NEW' feature. I added that a bit casually when I got tired of manually creating the dir and file and finding the starting minimal sketch the IDE does nicely for New sketches - then never thought about documenting the needed edits to items embedded in the added batch file.

The Find Results in sublime has parsing and double click feature to open a file - I suppose the script/code for that is on the system. Perhaps there is a way to abuse that to a RECENT file that might give the hyperlink ability to a list of files where a COMPILE.CMD was created?
 
Status
Not open for further replies.
Back
Top