Teensy 4.1: Copy code from a programmed board?

BrotherTheo

New member
Hi, We bought a company and need to program Teensy 4.1s but the code we got will not compile. We do have a working unit. Is it possible to copy the program off of a Teensy 4.1 and burn it onto a new teensy?

Thanks!

--Tim Ressel
 
Are you able to link to the code? Perhaps someone here could help find what’s causing the compile to fail.
 
The code is proprietary and I cannot share it. This code did compile and work but on a different computer. I suspect it is a driver issue.
 
Hi, We bought a company and need to program Teensy 4.1s but the code we got will not compile. We do have a working unit. Is it possible to copy the program off of a Teensy 4.1 and burn it onto a new teensy?

Thanks!

--Tim Ressel

I am afraid not.
 
Assuming it's not a locked Teensy you could take the flash chip off and read it with something but that's probably going to be a lot more work than fixing the program to compile properly (and a lot less flexible since you'll only end up with an unmaintainable binary blob).
 
The code is proprietary and I cannot share it. This code did compile and work but on a different computer. I suspect it is a driver issue.

Do you mean the code compiled and ran on some target other than Teensy? Or the code compiled successfully on some host, and you no longer have access to that host?
 
The second one. This is a shipping product but we do not have access to the laptop there it was compiled. We have downloads of the code and libraries but the libraries were incomplete.
 
Are these libraries ones that can be found publicly, or something custom where you might need a rewrite if you can't find the originals?
 
The second one. This is a shipping product but we do not have access to the laptop there it was compiled. We have downloads of the code and libraries but the libraries were incomplete.

The T4.1 microcontroller chip has no internal flash, so the code is stored on an external serial flash chip on the T4.1 board. As @jmarsh said, if the Teensy was not "locked", then it's theoretically possible to remove that chip and install it some other board designed to allow you to read it. There are companies that provide that as a service, though I'm sure it's not cheap. If you have the source code, but can't get a successful build due to a missing or wrong version of library, or different version of Arduino/TeensyDuino, that's usually not very difficult to resolve.

EDIT: Unless, like Shawn asked, there were custom libraries involved :)
 
And if the Flash were removed and the stored program area copied to a 'stored file' that would not be a complete solution.

The Teensy Loader wouldn't facilitate programming that to other Teensys? Unless that 'stored file' could be restored to a usable .HEX file? Otherwise one or more Flash 'duplicate' chips could be made from the working donor, but they would need to be soldered in place onto recipient Teensy units?

Then there is the question of the recipient Teensy and bootloader detecting a mismatch of the MAC/Serial number of the MCU on the recipient having some conflict if the Flash were serialized to the original donor MCU. This may not be the case and PJRC could confirm that. Maybe that could be avoided by only doing partial Flash copies of the code area of the Flash and leaving the upper areas untouched and returning the same Flash to the recipient Teensy. There is the one block marked Read Only in the flash with the factory Restore code and the EEPROM area.

Though perhaps a custom version of FlasherX type programming could be made to manage non-Hex but rather Block writes of the donor code area to the recipient Flash rather than external flash writes with chips removed and restored.
 
well at this point it is probably easiest to hire someone with teensy knowledge to look at the issues. pay him something and make him sign an agreement not to share any code bits... if it did compile at some point it should not be such a big task to get it running again. or share the error messages you get here, maybe something can be concluded out of them.

or preferably get in touch with the original programmer and tell him to fix the dependency issues.
 
Back
Top