-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add teensy_secure support #98
base: develop
Are you sure you want to change the base?
Conversation
291ff82
to
67ef88f
Compare
I just added the ability to use a custom key via the |
c079298
to
bb8065e
Compare
May be a stupid question but I'm not all the good with Github. |
This PR works well for me to do automatic EHEX uploads and creation. I chose the name because it's my understanding that any custom PlatformIO options need to be prefixed with "custom_". To make the change yourself, just put the changes in that builder/main.py file. (On a Mac, the full path is ~/.platformio/platforms/teensy/builder/main.py.) |
I realized I didn't completely answer your question. To use it with a key in a specific location, add a
Alternatively, if you don't add that property, the behaviour should be the same as the Arduino IDE with Teensyduino. It will use the key from the default location. In other words, "do nothing" is a valid option. |
@ssilverman Is this implemented in the latest teensy pio package? |
I’m unclear what you’re asking? |
Does the latest release of Teensy for PlatformIO contain the ability to generate and flash an ehex? |
It should. I'm able to use it. Have you tried it? |
I have tried it on Windows. It doesn't work. I have just updated PIO, and i've tried to write the folder path and the direct key.pem file. There's no EHEX being created. Only HEX. |
Have you first generated a key? You’ll need to do that with the latest 1.8.x Teensyduino IDE. |
I've gotten it to do it's thing, but I'm using a TeensyMM, so had to add that into main.py, now the problem is this:
I've searched for the text "This board does not support code encryption" but can't find it anywhere. |
You need to use a lockable version and follow the instructions here: https://www.pjrc.com/teensy/td_code_security.html Here’s the lockable version: https://www.sparkfun.com/products/18771 |
Fully aware of this. The board I use is a fully custom board which is lockable. It's been used with Arduino IDE EHEX already. |
I’m happy to test that it works with a TeensyMM if you’re willing to send me one (plus a carrier board). I don’t own one myself. Did you set |
I'll send you one. Please email me directly. |
The Teensy MM is specified as "teensymm" in the platform.ini. In your main.py file there's no support for that. However, I did add such support. The "This board does not support code encryption" is most likely coming from some other place. And thus the EHEX is never created. I also want to underline that this happens regardless of "Build" or "Upload". If the only way is to send you that stuff, then I will do that. But let's try to find out where that non-support messages comes from. I've used google to try to find a file with that inside of it, no luck. Perhaps coming from the compiler? I got this to work by simply specifying "board = teensy41" instead of "board = teensymm". |
This was the reminder I needed. Thanks for that. |
You don't need a MM to test this. Just use "board = teensymm" in the platform.ini and then Build, you'll get the non-support message. |
It turns out that my main.py modifications do include TeensyMM support because its build_core is still "teensy4". I'm still looking because I see the error you mention. |
Did you test “board = teensymm”? If you do that, you’ll get the same issues as me. Using teensy41 does work, it’s not correct and teensyloader won’t upload it to the Micromod board because it’s wrong. |
bb8065e
to
87a4ff0
Compare
I just pushed a fix. |
Wonderful news. I’ll test this tomorrow when I’m by the computer. Big thanks! |
I just tested. Perhaps a little bug was introduced. It doesn't find the key.pem file. Note that it's the exact same path as yesterday. The key file is there. Also note that there's a space in the error text "key .pem" perhaps there's a space somewhere.
|
What does your |
The same as yesterday when it worked with Teensy4. I’ve changed nothing in the ini file since yesterday. I just updated with your main.py file. custom_secure_key = ~C:\Users\MrFringe\Documents\Arduino\key.pem |
I don’t think Windows paths can start with a ‘~’ character before the drive. |
It worked yesterday, alltho not with teensymm but with teensy4. |
Did you try it without the ‘~’? It appeared to work yesterday because it didn’t actually do anything with the key; the board name was wrong before my fix. |
Good news! Flashed the device and the EHEX runs fine. Good work ssilverman! Just for the formality of it. The correct way to specify the path on Windows is: |
Was just wondering about getting this PR in? The notes:
One points 1 and 2 are resolved, I think this PR would be ready, but I could use some help with them. @ivankravets should this be merged into |
87a4ff0
to
6c32917
Compare
Perhaps checking the exit code... |
6c32917
to
589c151
Compare
Just following up on this PR. See: #98 (comment) |
This is a first attempt.
Some notes:
teensy_secure
fails to encrypt. While it still works because theteensy_secure
program, when told to upload a '.ehex' file, will find the '.hex' file, I don't like how it still saysUploading .pio/build/teensy41/firmware.ehex
.Inspiration for this PR found here:
Resolves #93