teensyduino in Code::Blocks: Adding the teensy loader

Status
Not open for further replies.

christoph

Well-known member
Code::Blocks supports custom tools that can be installed in the main menu. They are meant to be "click to execute" tools. The teensy loader is a bit different, and I have not yet found a way to make it work like in the arduino IDE. My setup simply allows starting the teensy loader, and that's it. The hex file is not selected automatically, and you have to press the teensy's program button to load the file.

In the main menu, go to "Tools"->"Configure Tools...":
01_tools_window.png
Click on "Add".

Give the new tool a name and select the binary (replace the arduino root directory with the one in your system). Also select "Launch tool visible detached":
02_loader_config.png

It should now appear in the Tools menu, so you can start it from within Code::Blocks. You can see in the first screenshot that I also tried to get teensy_post_compile to work (this is what is used in the arduino IDE), but I couldn't get it to work as intended.
 
Code::Blocks supports custom tools that can be installed in the main menu. They are meant to be "click to execute" tools. The teensy loader is a bit different, and I have not yet found a way to make it work like in the arduino IDE. My setup simply allows starting the teensy loader, and that's it. The hex file is not selected automatically, and you have to press the teensy's program button to load the file.

I don't know if the following helps, but my makefile (copied earlier from a post of this forum) has the following lines that allow me to create the hex file and download the file.
Code:
post_compile: $(TARGET).hex
	@$(TOOLSPATH)\teensy_post_compile -file="$(basename $<)" -path=$(ROOT) -tools="$(TOOLSPATH)"

reboot:
	@-$(TOOLSPATH)\teensy_reboot 

upload: post_compile reboot

So, I simply execute "make upload" to compile and upload the code.
I do not know (yet?) code::blocks but there must be a post compilation stage where similar things could be done.
 
I never got two executables to work together in one tool. Maybe I'm just not seeing how it could be done.

Adding the download to the post-build steps might work indeed, but I don't like the idea of downloading a hex file each time the code is compiled. Sometimes I just want to see if something actually compiles, and sometimes I let my board do something useful while it is connected to the computer.
 
I never got two executables to work together in one tool. Maybe I'm just not seeing how it could be done.

Adding the download to the post-build steps might work indeed, but I don't like the idea of downloading a hex file each time the code is compiled. Sometimes I just want to see if something actually compiles, and sometimes I let my board do something useful while it is connected to the computer.

That is, why I have in my Makefile different targets: "make all" to compile and link and "make upload" to compile, link and upload.
 
Yes, I understand that and it makes sense for a makefile.

In C::B, the teensy loader tool uses the current target's output hex file, which is extracted from the current target. If I add a third build target that is meant for downloading, it would lose the current selection of "Debug" or "Release" and it would also not automatically know where the hex file is. The consequence is that there would need to be an individual download target for Debug and Release, and that's inconvenient and tedious to set up as well. This is just not how the IDE is meant to work.

I'll think of something, maybe an additional script that handles the two steps.
 
Status
Not open for further replies.
Back
Top