Teensyduino 1.55 Beta #2

Status
Not open for further replies.
Going through : Teensy 4 Security

In the end going to LOCK the second Beta unit.

Using : "Fuse Write Sketch" :: Still has HAB Check TODO

Good: Created a second Pem.Key and the first was preserved

Good: First tried on Early Production unit : Error: Key can not be used

Bad : Tried on LOCKED T4 with alternate security code, of course it didn't work
->> But Loader is stuck in an odd state with that image and Teensy has to be unpowered
->> Similar to prior notes. Would be nice to have UI Alive to load proper eHex for this unit.

Odd : Today verbiage suggests that written key is fused and one time only, even before locking?
->> Something led me to believe before being Locked that 'Writing public key hash' would allow rewriting

It seems the 'Fuse Write Sketch' doesn't check that the fuses were already set with a prior key. When it writes a second time added bits are set.
It is Unlocked and it can still run .hex
But it cannot run 'LockSecureMode.ino', or any Secure .eHex with mismatched 'double written' key fuses.
>> That sketch should refuse to Re-Fuse when already FUSED for Secure Mode
--> Yes, I asked for this perhaps not knowing/following the rules - but in a production environment, similar mistakes could happen
Code:
Set Lockable Teensy into secure mode
Fail: This program is not properly encrypted.

Before it was passing - as tested by isEncrypt
Code:
Pass: Bus Encryption Engine is active
Pass: Encryption region starts at proper address
Pass: Program data is entirely within encrypted region
Pass: isEncrypt() is within encrypted region
Pass: title_text[] is within encrypted region
Pass: csf is PJRC
NOTE: hab_version == 0x40307
NOTE: hab_status == 0xF0
Secure mode NOT SET :: Fuses == 0x8B018

10379960

After running 'FuseWrite.ino' - with a second unique key I get:
Code:
Fail: Bus Encryption Engine is not active
Fail: Encryption region starts at wrong address
Fail: Program data is not within encrypted region
Fail: isEncrypt() is not in encrypted region
Fail: title_text[] is not in encrypted region
Fail: csf not PJRC
NOTE: hab_version == 0x40307
NOTE: hab_status == 0xF0
Secure mode NOT SET :: Fuses == 0x8B018

10379960

<Edit> below is the Locked with Required HASH that started in both - and the 'Optional' is he Hash reported after the fuse bits were erroneously set a second time with a second pem.key.
Code:
23:56:33.619 (loader): encryption is required, public key hash: 85A79CC1 B7C7F866 7F5BB3ED 0F9C9BA5 B4149EE2 72846D35 86B63863 B0699942

23:55:31.561 (loader): encryption is optional, public key hash: 9DE7DFD3 FFD7F86F 7F5FF7ED DFFEDFB7 F517FFEB FAA57FB5 BFFEF867 F669BFC3
 
Last edited:
Installed Mac version of beta...

copied security key from PC to MAC.

Ran the Verify secure sketch on the locked T4:
Code:
Verify secure code is running properly

Pass: Bus Encryption Engine is active
Pass: Encryption region starts at proper address
Pass: Program data is entirely within encrypted region
Pass: title_function() is within encrypted region

All Tests Passed.  :-)

So it was able to update the sketch on the secured board... Paul do you see any benefit of me leaving one secured and unlocked or would you like to see testing with both locked?
 
@Paul
Been uploading one of our MTP test sketches that sets up drives for USB drive, SPI, Program, RAM and a external SD Card in order to work out some bugs. But the point of the post been pretty much abusing the Locked T4 with uploads and have not had a problem loading the sketch as I said in post #21.

Going to keep loading and testing to see if anything strange happens on uploads but so far all is good.
 
@Paul ...

I too have also playing with an MTPD sketch similar to @mjs513 (with external SD, PROGRAM, RAM)...

I also went ahead and locked the 2nd board, which I am using on this one.

I have had a couple of times, where the board would not reboot until I hit the button to program... But again not sure if because it is secure or because of MTP interactions.
 
Out of curiosity wanted to try and compare temps apples to apples:
Capture.PNG
 
do you see any benefit of me leaving one secured and unlocked or would you like to see testing with both locked?

Unless something goes wrong, probably not much point locking both boards with the same key.

Locking them both with different keys might be helpful. I still have several cases where unexpected results hang the Teensy Loader GUI, so probably not worth spending much time to test this on 1.55-beta2. Was hoping to get all that cleaned up, but spent more time on MacOS and Windows 7.

My hope is to fix those remaining GUI stall issues and merge a few low-risk contributions, then start 1.55-beta3 and hopefully get to a stable 1.55 by the end of next week.
 
@Paul two things:

#1: Unlocked HAB as you noted can overwrite 32KB ( a bit less )
>> When Secure mode Locked that overwrite extends to 0xffff==65535 beyond 0x20200000 to 0x2020ffff.
-> This explains why <edit - finish sentence> the LittleFS DMAMEM versions differ in function in post #9

>> This #2 isn't sketch dependent : Just did a Repro with examples/basic/blink.ino

#2: Doing an IDE Verify then Button or TyComm 'Bootloader' ( with Serial OFF ) :: { Secure Mode T4 Locked or Not locked }
-> works to Upload last compiled program
Then doing a TyComm 'Reset' (with Serial OFF ) - but it still sends out RESET command to the Teensy
-> Second time (and more) after Upload Teensy Loader passively allows the Teensy Reset
-> FIRST TIME: Bootloader is Active and shows Image "1062 Program" as it were to begin programming?
--->> May also bring up 'Erasing' and 'Download Error' images
> Then in TyComm Enable Serial to start the sketch, and disable Serial in TyComm
-> Bootloader goes through some steps in Verbose and results in taking "AUTO" off in Teensy Loader.
{{ It is like the Teensy or Teensy Loader is in some 'unfinished state' after uploading - and Reset catches it unready ? }}
--->> Not sure if there is an alternate way to trigger Teensy Reset like TyComm does over USB?
Code:
21:18:23.353 (ports 5): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
21:18:23.354 (ports 5): remove: loc=usb:0/140000/0/6/1/1
21:18:23.354 (ports 5): usb_remove: usb:0/140000/0/6/1/1
21:18:23.354 (ports 5): nothing new, skipping HID & Ports enum
21:18:23.516 (ports 5): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
21:18:23.516 (ports 5): nothing new, skipping HID & Ports enum
21:18:23.516 (ports 5): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
21:18:23.517 (ports 5): nothing new, skipping HID & Ports enum
21:18:23.708 (ports 5): WM_DEVICECHANGE DBT_DEVICEARRIVAL
21:18:23.710 (ports 5): nothing new, skipping HID & Ports enum
21:18:23.953 (loader): handle ecc
21:18:23.953 (loader): Device came online, code_size = 100
21:18:23.953 (loader): Board is: NXP IMXRT1062 ROM
21:18:23.953 (loader): begin operation
21:18:23.972 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_694440\DMAMEMt.ino.hex", 105472 bytes
21:18:23.984 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_694440\DMAMEMt.ino.ehex", 105472 bytes, 4960 extra
21:18:23.984 (loader): ehex is valid, key hash: 85A79CC1 B7C7F866 7F5BB3ED 0F9C9BA5 B4149EE2 72846D35 86B63863 B0699942
21:18:23.992 (loader): set background IMG_ONLINE
21:18:24.003 (loader): state STATE_NXP_BEGIN
21:18:24.003 (loader): nxp_write: handle ecc, size=17  01 02 02 20 20
21:18:24.003 (loader): nxp_write: success
21:18:24.003 (loader):  security: 03  12 34 34 12
21:18:24.003 (loader):  response: 04  12 8A 8A 12
21:18:24.003 (loader): HAB locked secure mode
21:18:24.014 (loader): state STATE_NXP_CLOSED
21:18:24.014 (loader): sending ehex access, 4960 bytes
21:18:24.018 (loader): nxp_write: handle ecc, size=17  01 04 04 20 20
21:18:24.018 (loader): nxp_write: success
21:18:24.022 (loader): nxp_write: handle ecc, size=1025  02 D1 00 20 40
21:18:24.022 (loader): nxp_write: success
21:18:24.022 (loader): nxp_write: handle ecc, size=1025  02 20 46 1F 40
21:18:24.022 (loader): nxp_write: success
21:18:24.022 (loader): nxp_write: handle ecc, size=1025  02 A9 57 3D EA
21:18:24.032 (loader): nxp_write: success
21:18:24.034 (loader): nxp_write: handle ecc, size=1025  02 09 60 86 48
21:18:24.034 (loader): nxp_write: success
21:18:24.034 (loader): nxp_write: handle ecc, size=1025  02 00 00 00 00
21:18:24.042 (loader): nxp_write: success
21:18:24.042 (loader):  security: 03  12 34 34 12
21:18:24.047 (loader):  response: 04  88 88 88 88
21:18:24.047 (loader): run it..
21:18:24.050 (loader): nxp_write: handle ecc, size=17  01 0B 0B 20 20
21:18:24.052 (loader): nxp_write: success
21:18:24.057 (loader):  security: 03  12 34 34 12
21:18:24.066 (loader): end operation, total time = 0.114 seconds
21:18:24.073 (ports 5): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
21:18:24.074 (ports 5): nothing new, skipping HID & Ports enum
21:18:24.077 (loader): redraw timer set, image 80 to show for 2000 ms
21:18:24.083 (ports 5): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
21:18:24.084 (ports 5): nothing new, skipping HID & Ports enum
21:18:24.203 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:24.203 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:24.212 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:24.212 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/3
21:18:24.212 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:24.222 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/3
21:18:24.228 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/3
21:18:24.228 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:24.261 (ports 5): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
21:18:24.262 (ports 5): nothing new, skipping HID & Ports enum
21:18:24.444 (ports 5): WM_DEVICECHANGE DBT_DEVICEARRIVAL
21:18:24.447 (ports 5): found_usb_device, id=\\?\usb#vid_16c0&pid_0478#000fd6ad#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
21:18:24.447 (ports 5): found_usb_device, loc=usb:0/140000/0/6/1/1    Port_#0001.Hub_#0009
21:18:24.447 (ports 5): found_usb_device, hwid=USB\VID_16C0&PID_0478&REV_0107
21:18:24.447 (ports 5): found_usb_device, devinst=0000001a
21:18:24.447 (ports 5): add: loc=usb:0/140000/0/6/1/1, class=HID, vid=16C0, pid=0478, ver=0107, serial=000fd6ad, dev=\\?\usb#vid_16c0&pid_0478#000fd6ad#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
21:18:24.447 (ports 5): hiddev_from_devinst_list: iface=0
21:18:24.447 (ports 5): found_usb_device complete
21:18:24.448 (ports 5): usb_add: usb:0/140000/0/6/1/1  [no_device] (Teensy 4.0) Bootloader
21:18:24.496 (loader): encryption is required, public key hash: 85A79CC1 B7C7F866 7F5BB3ED 0F9C9BA5 B4149EE2 72846D35 86B63863 B0699942
21:18:24.496 (loader): Device came online, code_size = 2031616
21:18:24.496 (loader): Board is: Teensy 4.0 (IMXRT1062), version 1.07
21:18:24.512 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_694440\DMAMEMt.ino.hex", 105472 bytes
21:18:24.543 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_694440\DMAMEMt.ino.ehex", 105472 bytes, 4960 extra
21:18:24.543 (loader): ehex is valid, key hash: 85A79CC1 B7C7F866 7F5BB3ED 0F9C9BA5 B4149EE2 72846D35 86B63863 B0699942
21:18:24.552 (loader): set background IMG_ONLINE
21:18:24.575 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_694440\DMAMEMt.ino.hex", 105472 bytes
21:18:24.591 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_694440\DMAMEMt.ino.ehex", 105472 bytes, 4960 extra
21:18:24.591 (loader): ehex is valid, key hash: 85A79CC1 B7C7F866 7F5BB3ED 0F9C9BA5 B4149EE2 72846D35 86B63863 B0699942
21:18:24.591 (loader): elf appears to be for Teensy 4.0 (IMXRT1062) (2031616 bytes)
21:18:24.606 (loader): elf binary data matches hex file
21:18:24.606 (loader): elf file is for Teensy 4.0 (IMXRT1062)
21:18:24.606 (loader): using encrypted ehex (required - secure mode is locked)
21:18:24.654 (loader): begin operation
21:18:24.680 (loader): flash, block=0, bs=1024, auto=1
21:18:24.680 (ports 5): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
21:18:24.682 (ports 5): hid, found devinst=0000001B
21:18:24.682 (ports 5): hid, path=\\?\hid#vid_16c0&pid_0478#8&31719e78&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
21:18:24.682 (ports 5): hid,  opened handle
21:18:24.682 (ports 5):  devinst=0000001B, location=usb:0/140000/0/6/1/1
21:18:24.682 (ports 5):  vid=16C0, pid=0478, ver=0107, usepage=FF9C, use=0024
21:18:24.682 (ports 5):  devpath=\\?\hid#vid_16c0&pid_0478#8&31719e78&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
21:18:24.682 (ports 5): usb_add: usb:0/140000/0/6/1/1  hid#vid_16c0&pid_0478 (Teensy 4.0) Bootloader
21:18:24.727 (loader): flash, block=1, bs=1024, auto=1
21:18:24.743 (loader): flash, block=2, bs=1024, auto=1
21:18:24.994 (loader): flash, block=3, bs=1024, auto=1
21:18:24.994 (loader): flash, block=4, bs=1024, auto=1
21:18:25.016 (loader): flash, block=5, bs=1024, auto=1
21:18:25.023 (loader): flash, block=6, bs=1024, auto=1
21:18:25.024 (ports 5): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
21:18:25.025 (ports 5): nothing new, skipping HID & Ports enum
21:18:25.044 (loader): flash, block=7, bs=1024, auto=1
21:18:25.060 (loader): flash, block=8, bs=1024, auto=1
21:18:25.060 (loader): flash, block=9, bs=1024, auto=1
21:18:25.076 (loader): flash, block=10, bs=1024, auto=1
21:18:25.076 (loader): flash, block=11, bs=1024, auto=1
21:18:25.076 (loader): flash, block=12, bs=1024, auto=1
21:18:25.092 (loader): flash, block=13, bs=1024, auto=1
21:18:25.092 (loader): flash, block=14, bs=1024, auto=1
21:18:25.092 (loader): flash, block=15, bs=1024, auto=1
21:18:25.107 (loader): flash, block=16, bs=1024, auto=1
21:18:25.107 (loader): flash, block=17, bs=1024, auto=1
21:18:25.107 (loader): flash, block=18, bs=1024, auto=1
21:18:25.107 (loader): flash, block=19, bs=1024, auto=1
21:18:25.123 (loader): flash, block=20, bs=1024, auto=1
21:18:25.123 (loader): flash, block=21, bs=1024, auto=1
21:18:25.123 (loader): flash, block=22, bs=1024, auto=1
21:18:25.139 (loader): flash, block=23, bs=1024, auto=1
21:18:25.139 (loader): flash, block=24, bs=1024, auto=1
21:18:25.139 (loader): flash, block=25, bs=1024, auto=1
21:18:25.154 (loader): flash, block=26, bs=1024, auto=1
21:18:25.154 (loader): flash, block=27, bs=1024, auto=1
21:18:25.154 (loader): flash, block=28, bs=1024, auto=1
21:18:25.170 (loader): flash, block=29, bs=1024, auto=1
21:18:25.170 (loader): flash, block=30, bs=1024, auto=1
21:18:25.170 (loader): flash, block=31, bs=1024, auto=1
21:18:25.185 (loader): flash, block=32, bs=1024, auto=1
21:18:25.185 (loader): flash, block=33, bs=1024, auto=1
21:18:25.185 (loader): flash, block=34, bs=1024, auto=1
21:18:25.201 (loader): flash, block=35, bs=1024, auto=1
21:18:25.202 (loader): flash, block=36, bs=1024, auto=1
21:18:25.202 (loader): flash, block=37, bs=1024, auto=1
21:18:25.202 (loader): flash, block=38, bs=1024, auto=1
21:18:25.218 (loader): flash, block=39, bs=1024, auto=1
21:18:25.218 (loader): flash, block=40, bs=1024, auto=1
21:18:25.218 (loader): flash, block=41, bs=1024, auto=1
21:18:25.233 (loader): flash, block=42, bs=1024, auto=1
21:18:25.233 (loader): flash, block=43, bs=1024, auto=1
21:18:25.233 (loader): flash, block=44, bs=1024, auto=1
21:18:25.249 (loader): flash, block=45, bs=1024, auto=1
21:18:25.254 (loader): flash, block=46, bs=1024, auto=1
21:18:25.254 (loader): flash, block=47, bs=1024, auto=1
21:18:25.265 (loader): flash, block=48, bs=1024, auto=1
21:18:25.265 (loader): flash, block=49, bs=1024, auto=1
21:18:25.265 (loader): flash, block=50, bs=1024, auto=1
21:18:25.281 (loader): flash, block=51, bs=1024, auto=1
21:18:25.289 (loader): flash, block=52, bs=1024, auto=1
21:18:25.293 (loader): flash, block=53, bs=1024, auto=1
21:18:25.298 (loader): flash, block=54, bs=1024, auto=1
21:18:25.302 (loader): flash, block=55, bs=1024, auto=1
21:18:25.305 (loader): flash, block=56, bs=1024, auto=1
21:18:25.305 (loader): flash, block=57, bs=1024, auto=1
21:18:25.305 (loader): flash, block=58, bs=1024, auto=1
21:18:25.305 (loader): flash, block=59, bs=1024, auto=1
21:18:25.321 (loader): flash, block=60, bs=1024, auto=1
21:18:25.321 (loader): flash, block=61, bs=1024, auto=1
21:18:25.321 (loader): flash, block=62, bs=1024, auto=1
21:18:25.336 (loader): flash, block=63, bs=1024, auto=1
21:18:25.336 (loader): flash, block=64, bs=1024, auto=1
21:18:25.336 (loader): flash, block=65, bs=1024, auto=1
21:18:25.354 (loader): flash, block=66, bs=1024, auto=1
21:18:25.354 (loader): flash, block=67, bs=1024, auto=1
21:18:25.354 (loader): flash, block=68, bs=1024, auto=1
21:18:25.369 (loader): flash, block=69, bs=1024, auto=1
21:18:25.370 (loader): flash, block=70, bs=1024, auto=1
21:18:25.370 (loader): flash, block=71, bs=1024, auto=1
21:18:25.370 (loader): flash, block=72, bs=1024, auto=1
21:18:25.389 (loader): flash, block=73, bs=1024, auto=1
21:18:25.389 (loader): flash, block=74, bs=1024, auto=1
21:18:25.389 (loader): flash, block=75, bs=1024, auto=1
21:18:25.389 (loader): flash, block=76, bs=1024, auto=1
21:18:25.404 (loader): flash, block=77, bs=1024, auto=1
21:18:25.404 (loader): flash, block=78, bs=1024, auto=1
21:18:25.404 (loader): flash, block=79, bs=1024, auto=1
21:18:25.420 (loader): flash, block=80, bs=1024, auto=1
21:18:25.420 (loader): flash, block=81, bs=1024, auto=1
21:18:25.420 (loader): flash, block=82, bs=1024, auto=1
21:18:25.420 (loader): flash, block=83, bs=1024, auto=1
21:18:25.436 (loader): flash, block=84, bs=1024, auto=1
21:18:25.436 (loader): flash, block=85, bs=1024, auto=1
21:18:25.436 (loader): flash, block=86, bs=1024, auto=1
21:18:25.454 (loader): flash, block=87, bs=1024, auto=1
21:18:25.454 (loader): flash, block=88, bs=1024, auto=1
21:18:25.467 (loader): flash, block=89, bs=1024, auto=1
21:18:25.467 (loader): flash, block=90, bs=1024, auto=1
21:18:25.467 (loader): flash, block=91, bs=1024, auto=1
21:18:25.483 (loader): flash, block=92, bs=1024, auto=1
21:18:25.483 (loader): flash, block=93, bs=1024, auto=1
21:18:25.483 (loader): flash, block=94, bs=1024, auto=1
21:18:25.499 (loader): flash, block=95, bs=1024, auto=1
21:18:25.499 (loader): flash, block=96, bs=1024, auto=1
21:18:25.499 (loader): flash, block=97, bs=1024, auto=1
21:18:25.514 (loader): flash, block=98, bs=1024, auto=1
21:18:25.514 (loader): flash, block=99, bs=1024, auto=1
21:18:25.514 (loader): flash, block=100, bs=1024, auto=1
21:18:25.530 (loader): flash, block=101, bs=1024, auto=1
21:18:25.530 (loader): flash, block=102, bs=1024, auto=1
21:18:25.545 (loader): sending reboot
21:18:25.545 (loader): begin wait_until_offline
21:18:25.580 (ports 5): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
21:18:25.581 (ports 5): remove: loc=usb:0/140000/0/6/1/1
21:18:25.581 (ports 5): usb_remove: usb:0/140000/0/6/1/1
21:18:25.581 (ports 5): nothing new, skipping HID & Ports enum
21:18:25.608 (loader): offline, waited 1
21:18:25.608 (loader): end operation, total time = 0.955 seconds
21:18:25.640 (loader): set background IMG_REBOOT_OK
21:18:25.671 (loader): redraw timer set, image 14 to show for 1200 ms
21:18:25.782 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:25.782 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:25.782 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:25.798 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/3
21:18:25.798 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:25.798 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/3
21:18:25.798 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/3
21:18:25.814 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:25.970 (ports 5): WM_DEVICECHANGE DBT_DEVICEARRIVAL
21:18:25.971 (ports 5): found_usb_device, id=\\?\usb#vid_16c0&pid_0483#10379970#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
21:18:25.971 (ports 5): found_usb_device, loc=usb:0/140000/0/6/1/1    Port_#0001.Hub_#0009
21:18:25.972 (ports 5): found_usb_device, hwid=USB\VID_16C0&PID_0483&REV_0279
21:18:25.972 (ports 5): found_usb_device, devinst=00000005
21:18:25.972 (ports 5): add: loc=usb:0/140000/0/6/1/1, class=USB, vid=16C0, pid=0483, ver=0279, serial=10379970, dev=\\?\usb#vid_16c0&pid_0483#10379970#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
21:18:25.972 (ports 5):   comport_from_devinst_list attempt
21:18:25.972 (ports 5): found_usb_device complete
21:18:25.973 (ports 5): usb_add: usb:0/140000/0/6/1/1  [no_device] (Teensy 4.0) Serial
21:18:26.014 (ports 5): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
21:18:26.016 (ports 5): update_usb_device, devinst list change, old had 1, new has 2
21:18:26.016 (ports 5):   comport_from_devinst_list attempt
21:18:26.016 (ports 5):   found Ports in classguid_list at index=1
21:18:26.016 (ports 5):   port COM9 found from devnode
21:18:26.016 (ports 5): usb_add: usb:0/140000/0/6/1/1  COM9 (Teensy 4.0) Serial
21:18:26.599 (ports 5): WM_DEVICECHANGE DBT_DEVICEARRIVAL
21:18:26.600 (ports 5): nothing new, skipping HID & Ports enum
21:18:26.877 (loader): redraw, image 9
21:18:30.618 (ports 5): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
21:18:30.619 (ports 5): nothing new, skipping HID & Ports enum
21:18:34.853 (ports 5): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
21:18:34.854 (ports 5): remove: loc=usb:0/140000/0/6/1/1
21:18:34.854 (ports 5): usb_remove: usb:0/140000/0/6/1/1
21:18:34.854 (ports 5): nothing new, skipping HID & Ports enum
21:18:35.092 (ports 5): WM_DEVICECHANGE DBT_DEVICEARRIVAL
21:18:35.094 (ports 5): nothing new, skipping HID & Ports enum
21:18:35.341 (loader): handle 11dc
21:18:35.341 (loader): Device came online, code_size = 100
21:18:35.341 (loader): Board is: NXP IMXRT1062 ROM
21:18:35.356 (loader): begin operation
21:18:35.374 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_694440\DMAMEMt.ino.hex", 105472 bytes
21:18:35.389 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_694440\DMAMEMt.ino.ehex", 105472 bytes, 4960 extra
21:18:35.405 (loader): ehex is valid, key hash: 85A79CC1 B7C7F866 7F5BB3ED 0F9C9BA5 B4149EE2 72846D35 86B63863 B0699942
21:18:35.405 (loader): set background IMG_ONLINE
21:18:35.420 (loader): state STATE_NXP_BEGIN
21:18:35.420 (loader): nxp_write: handle 11dc, size=17  01 02 02 20 20
21:18:35.420 (loader): nxp_write: success
21:18:35.420 (loader):  security: 03  12 34 34 12
21:18:35.436 (loader):  response: 04  12 8A 8A 12
21:18:35.436 (loader): HAB locked secure mode
21:18:35.436 (loader): state STATE_NXP_CLOSED
21:18:35.455 (loader): sending ehex access, 4960 bytes
21:18:35.456 (loader): nxp_write: handle 11dc, size=17  01 04 04 20 20
21:18:35.460 (loader): nxp_write: success
21:18:35.468 (loader): nxp_write: handle 11dc, size=1025  02 D1 00 20 40
21:18:35.468 (loader): nxp_write: success
21:18:35.468 (loader): nxp_write: handle 11dc, size=1025  02 20 46 1F 40
21:18:35.483 (loader): nxp_write: success
21:18:35.483 (loader): nxp_write: handle 11dc, size=1025  02 A9 57 3D EA
21:18:35.483 (loader): nxp_write: success
21:18:35.499 (loader): nxp_write: handle 11dc, size=1025  02 09 60 86 48
21:18:35.501 (loader): nxp_write: success
21:18:35.501 (loader): nxp_write: handle 11dc, size=1025  02 00 00 00 00
21:18:35.501 (loader): nxp_write: success
21:18:35.517 (loader):  security: 03  12 34 34 12
21:18:35.517 (loader):  response: 04  88 88 88 88
21:18:35.517 (loader): run it..
21:18:35.533 (loader): nxp_write: handle 11dc, size=17  01 0B 0B 20 20
21:18:35.533 (loader): nxp_write: success
21:18:35.533 (loader):  security: 03  12 34 34 12
21:18:35.560 (loader): end operation, total time = 0.200 seconds
21:18:35.564 (loader): redraw timer set, image 80 to show for 2000 ms
21:18:35.596 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:35.606 (ports 5): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
21:18:35.607 (ports 5): nothing new, skipping HID & Ports enum
21:18:35.611 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:35.627 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:35.627 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/3
21:18:35.627 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:35.642 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/3
21:18:35.642 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/3
21:18:35.660 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:36.039 (ports 5): WM_DEVICECHANGE DBT_DEVICEARRIVAL
21:18:36.045 (ports 5): found_usb_device, id=\\?\usb#vid_16c0&pid_0478#000fd6ad#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
21:18:36.045 (ports 5): found_usb_device, loc=usb:0/140000/0/6/1/1    Port_#0001.Hub_#0009
21:18:36.045 (ports 5): found_usb_device, hwid=USB\VID_16C0&PID_0478&REV_0107
21:18:36.045 (ports 5): found_usb_device, devinst=0000001a
21:18:36.045 (ports 5): add: loc=usb:0/140000/0/6/1/1, class=HID, vid=16C0, pid=0478, ver=0107, serial=000fd6ad, dev=\\?\usb#vid_16c0&pid_0478#000fd6ad#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
21:18:36.045 (ports 5): hiddev_from_devinst_list: iface=0
21:18:36.046 (ports 5): found_usb_device complete
21:18:36.047 (ports 5): usb_add: usb:0/140000/0/6/1/1  [no_device] (Teensy 4.0) Bootloader
21:18:36.141 (loader): encryption is required, public key hash: 85A79CC1 B7C7F866 7F5BB3ED 0F9C9BA5 B4149EE2 72846D35 86B63863 B0699942
21:18:36.157 (loader): Device came online, code_size = 2031616
21:18:36.157 (loader): Board is: Teensy 4.0 (IMXRT1062), version 1.07
21:18:36.188 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_694440\DMAMEMt.ino.hex", 105472 bytes
21:18:36.208 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_694440\DMAMEMt.ino.ehex", 105472 bytes, 4960 extra
21:18:36.212 (loader): ehex is valid, key hash: 85A79CC1 B7C7F866 7F5BB3ED 0F9C9BA5 B4149EE2 72846D35 86B63863 B0699942
21:18:36.219 (loader): set background IMG_ONLINE
21:18:36.228 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_694440\DMAMEMt.ino.hex", 105472 bytes
21:18:36.259 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_694440\DMAMEMt.ino.ehex", 105472 bytes, 4960 extra
21:18:36.259 (loader): ehex is valid, key hash: 85A79CC1 B7C7F866 7F5BB3ED 0F9C9BA5 B4149EE2 72846D35 86B63863 B0699942
21:18:36.259 (loader): elf appears to be for Teensy 4.0 (IMXRT1062) (2031616 bytes)
21:18:36.275 (loader): elf binary data matches hex file
21:18:36.296 (ports 5): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
21:18:36.297 (ports 5): remove: loc=usb:0/140000/0/6/1/1
21:18:36.297 (ports 5): usb_remove: usb:0/140000/0/6/1/1
21:18:36.297 (ports 5): nothing new, skipping HID & Ports enum
21:18:36.306 (loader): elf file is for Teensy 4.0 (IMXRT1062)
21:18:36.306 (loader): using encrypted ehex (required - secure mode is locked)
21:18:36.353 (loader): begin operation
21:18:36.410 (loader): flash, block=0, bs=1024, auto=1
21:18:36.744 (ports 5): WM_DEVICECHANGE DBT_DEVICEARRIVAL
21:18:36.748 (ports 5): found_usb_device, id=\\?\usb#vid_16c0&pid_0483#10379970#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
21:18:36.748 (ports 5): found_usb_device, loc=usb:0/140000/0/6/1/1    Port_#0001.Hub_#0009
21:18:36.748 (ports 5): found_usb_device, devinst=00000005
21:18:36.748 (ports 5): found_usb_device, hwid=USB\VID_16C0&PID_0483&REV_0279
21:18:36.748 (ports 5): add: loc=usb:0/140000/0/6/1/1, class=USB, vid=16C0, pid=0483, ver=0279, serial=10379970, dev=\\?\usb#vid_16c0&pid_0483#10379970#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
21:18:36.748 (ports 5):   comport_from_devinst_list attempt
21:18:36.748 (ports 5): found_usb_device complete
21:18:36.748 (ports 5): usb_add: usb:0/140000/0/6/1/1  [no_device] (Teensy 4.0) Serial
21:18:42.428 (loader): HID/win32:   write failure, num = 0
21:18:42.428 (loader): program: write error
21:18:42.428 (loader): HID/win32: HidD_GetPreparsedData failed, device assumed disconnected
21:18:42.428 (loader): end operation, total time = 6.075 seconds
21:18:42.444 (loader): set background IMG_DOWNLOAD_ERROR
21:18:42.444 (loader): redraw timer set, image 11 to show for 4000 ms
21:18:42.557 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:42.557 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:42.573 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:42.636 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/3
21:18:42.651 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:42.651 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/3
21:18:42.698 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/3
21:18:42.698 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:18:46.445 (loader): redraw, image 9
21:19:24.461 (ports 5): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
21:19:24.463 (ports 5): remove: loc=usb:0/140000/0/6/1/1
21:19:24.463 (ports 5): usb_remove: usb:0/140000/0/6/1/1
21:19:24.463 (ports 5): nothing new, skipping HID & Ports enum
21:19:24.640 (ports 5): WM_DEVICECHANGE DBT_DEVICEARRIVAL
21:19:24.641 (ports 5): nothing new, skipping HID & Ports enum
21:19:24.669 (ports 5): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
21:19:24.669 (ports 5): nothing new, skipping HID & Ports enum
21:19:24.669 (ports 5): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
21:19:24.670 (ports 5): nothing new, skipping HID & Ports enum
21:19:24.840 (loader): handle 81c
21:19:24.845 (loader): Device came online, code_size = 100
21:19:24.850 (loader): Board is: NXP IMXRT1062 ROM
21:19:24.850 (loader): begin operation
21:19:24.875 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_694440\DMAMEMt.ino.hex", 105472 bytes
21:19:24.896 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_694440\DMAMEMt.ino.ehex", 105472 bytes, 4960 extra
21:19:24.900 (loader): ehex is valid, key hash: 85A79CC1 B7C7F866 7F5BB3ED 0F9C9BA5 B4149EE2 72846D35 86B63863 B0699942
21:19:24.910 (loader): set background IMG_ONLINE
21:19:24.931 (loader): state STATE_NXP_BEGIN
21:19:24.935 (loader): nxp_write: handle 81c, size=17  01 02 02 20 20
21:19:24.940 (loader): nxp_write: success
21:19:24.940 (loader):  security: 03  12 34 34 12
21:19:24.986 (loader):  response: 04  12 8A 8A 12
21:19:24.991 (loader): HAB locked secure mode
21:19:24.996 (loader): state STATE_NXP_CLOSED
21:19:25.000 (loader): sending ehex access, 4960 bytes
21:19:25.007 (loader): nxp_write: handle 81c, size=17  01 04 04 20 20
21:19:25.025 (loader): nxp_write: success
21:19:25.031 (loader): nxp_write: handle 81c, size=1025  02 D1 00 20 40
21:19:25.031 (loader): nxp_write: success
21:19:25.039 (loader): nxp_write: handle 81c, size=1025  02 20 46 1F 40
21:19:25.041 (loader): nxp_write: success
21:19:25.081 (loader): nxp_write: handle 81c, size=1025  02 A9 57 3D EA
21:19:25.086 (loader): nxp_write: success
21:19:25.091 (loader): nxp_write: handle 81c, size=1025  02 09 60 86 48
21:19:25.097 (loader): nxp_write: success
21:19:25.101 (loader): nxp_write: handle 81c, size=1025  02 00 00 00 00
21:19:25.101 (loader): nxp_write: success
21:19:25.101 (loader):  security: 03  12 34 34 12
21:19:25.113 (loader):  response: 04  88 88 88 88
21:19:25.113 (loader): run it..
21:19:25.113 (loader): nxp_write: handle 81c, size=17  01 0B 0B 20 20
21:19:25.121 (loader): nxp_write: success
21:19:25.121 (loader):  security: 03  12 34 34 12
21:19:25.136 (loader): end operation, total time = 0.280 seconds
21:19:25.145 (ports 5): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
21:19:25.146 (ports 5): nothing new, skipping HID & Ports enum
21:19:25.151 (loader): redraw timer set, image 80 to show for 2000 ms
21:19:25.156 (ports 5): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
21:19:25.156 (ports 5): nothing new, skipping HID & Ports enum
21:19:25.353 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:19:25.353 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:19:25.361 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:19:25.366 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/3
21:19:25.371 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:19:25.371 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/3
21:19:25.376 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/3
21:19:25.381 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
21:19:25.427 (ports 5): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
21:19:25.428 (ports 5): nothing new, skipping HID & Ports enum
21:19:25.514 (ports 5): WM_DEVICECHANGE DBT_DEVICEARRIVAL
21:19:25.515 (ports 5): found_usb_device, id=\\?\usb#vid_16c0&pid_0478#000fd6ad#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
21:19:25.515 (ports 5): found_usb_device, loc=usb:0/140000/0/6/1/1    Port_#0001.Hub_#0009
21:19:25.515 (ports 5): found_usb_device, hwid=USB\VID_16C0&PID_0478&REV_0107
21:19:25.515 (ports 5): found_usb_device, devinst=0000001a
21:19:25.515 (ports 5): add: loc=usb:0/140000/0/6/1/1, class=HID, vid=16C0, pid=0478, ver=0107, serial=000fd6ad, dev=\\?\usb#vid_16c0&pid_0478#000fd6ad#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
21:19:25.515 (ports 5): hiddev_from_devinst_list: iface=0
21:19:25.516 (ports 5): found_usb_device complete
21:19:25.516 (ports 5): usb_add: usb:0/140000/0/6/1/1  [no_device] (Teensy 4.0) Bootloader
21:19:25.611 (loader): encryption is required, public key hash: 85A79CC1 B7C7F866 7F5BB3ED 0F9C9BA5 B4149EE2 72846D35 86B63863 B0699942
21:19:25.621 (loader): Device came online, code_size = 2031616
21:19:25.626 (loader): Board is: Teensy 4.0 (IMXRT1062), version 1.07
21:19:25.646 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_694440\DMAMEMt.ino.hex", 105472 bytes
21:19:25.661 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_694440\DMAMEMt.ino.ehex", 105472 bytes, 4960 extra
21:19:25.666 (loader): ehex is valid, key hash: 85A79CC1 B7C7F866 7F5BB3ED 0F9C9BA5 B4149EE2 72846D35 86B63863 B0699942
21:19:25.676 (loader): set background IMG_ONLINE
21:19:25.689 (ports 5): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
21:19:25.690 (ports 5): hid, found devinst=0000001B
21:19:25.690 (ports 5): hid, path=\\?\hid#vid_16c0&pid_0478#8&31719e78&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
21:19:25.690 (ports 5): hid,  opened handle
21:19:25.690 (ports 5):  devinst=0000001B, location=usb:0/140000/0/6/1/1
21:19:25.690 (ports 5):  vid=16C0, pid=0478, ver=0107, usepage=FF9C, use=0024
21:19:25.690 (ports 5):  devpath=\\?\hid#vid_16c0&pid_0478#8&31719e78&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
21:19:25.690 (ports 5): usb_add: usb:0/140000/0/6/1/1  hid#vid_16c0&pid_0478 (Teensy 4.0) Bootloader
21:19:25.861 (loader): HID/win32: HidD_GetPreparsedData ok, device still online :-)
21:19:25.890 (ports 5): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
21:19:25.891 (ports 5): nothing new, skipping HID & Ports enum
 
Last edited:
FWIW - did github.com/PaulStoffregen/LittleFS/pull/25

on RAM in \src\ removed delete from _dcache_flush()

Edited RAM to not confuse with DMAMEM - cleaner RAM only:
Code:
char buf[ 190 * 1024 ];	// BUFFER in RAM1 :: Lost on any restart

Updated copies of function.ino in (moved) folders for DirVerify to validate expected file characters

Added a version of DMAMEM.ino:
Code:
#define LFS_BUF_SIZE 430*1024 // Define the desired size that fits in DMAMEM : above any sketch usage
// This memory is not 'allocated' - dynamic malloc or other system use may violate this area
// avoid lower 32KB (64KB with Secure Teensy), and upper CrashReport area
void *LFS_BUF = (void*)(0x2027ff00 - LFS_BUF_SIZE); // RAM2 Addr :: typically survives Restart/Upload
 
@Paul - Re p#32 item #2:

<edit>: This is very repeatable and seemingly NEW behavior. I would have noticed this before it seems with the number of Resets in testing LittleFS drive, though those likely without Teensy.exe active - just using TyCommander for Upload and SerMon.
> Just took T_4's offline, using a T_4.1 to test other test_integrity sketches only it can do and I see the same behavior, so not just related to Beta Hardware bootloader online.

IDE Upload with IDE and SerMon controlling Locked T4_#9970

Other unLockable T4_#9960 online running same code with TyComm as SerMon.

On that #9960 in TyComm hit Reset - it prompts the item #2 observation: "Erasing" ... (faster fail than prior post in this case ) ... "Download Error"
> TLoader triggers on that 9960 T4
> This last time is actually triggered a Program of New Code on the 9960 being USB Reset
-->> Normally { except on the first Reset after Upload } - Teensy Loader does nothing, sometimes on the Second Reset after Upload it will change 'Press Button..." To an MCU image for just a flash.

Here is what showed in Teensy.exe Verbose - cleared after the Upload:
Code:
00:27:48.544 (ports 2): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
00:27:48.544 (serialmon 19): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
00:27:48.545 (ports 2): remove: loc=usb:0/140000/0/6/3
00:27:48.545 (ports 2): usb_remove: usb:0/140000/0/6/3
00:27:48.545 (ports 2): nothing new, skipping HID & Ports enum
00:27:48.545 (serialmon 19): remove: loc=usb:0/140000/0/6/3
00:27:48.545 (serialmon 19): usb_remove: usb:0/140000/0/6/3
00:27:48.546 (serialmon 19): nothing new, skipping HID & Ports enum
00:27:48.561 (serialmon 19): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
00:27:48.562 (serialmon 19): nothing new, skipping HID & Ports enum
00:27:48.562 (serialmon 19): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
00:27:48.562 (serialmon 19): nothing new, skipping HID & Ports enum
00:27:48.672 (ports 2): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
00:27:48.672 (ports 2): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
00:27:48.673 (ports 2): nothing new, skipping HID & Ports enum
00:27:48.762 (serialmon 19): WM_DEVICECHANGE DBT_DEVICEARRIVAL
00:27:48.762 (ports 2): WM_DEVICECHANGE DBT_DEVICEARRIVAL
00:27:48.762 (serialmon 19): found_usb_device, id=\\?\usb#vid_16c0&pid_0478#000fd6ac#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
00:27:48.762 (serialmon 19): found_usb_device, loc=usb:0/140000/0/6/3    Port_#0003.Hub_#0005
00:27:48.762 (serialmon 19): found_usb_device, hwid=USB\VID_16C0&PID_0478&REV_0107
00:27:48.762 (serialmon 19): found_usb_device, devinst=0000001d
00:27:48.762 (serialmon 19): add: loc=usb:0/140000/0/6/3, class=HID, vid=16C0, pid=0478, ver=0107, serial=000fd6ac, dev=\\?\usb#vid_16c0&pid_0478#000fd6ac#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
00:27:48.763 (serialmon 19): hiddev_from_devinst_list: iface=0
00:27:48.763 (ports 2): found_usb_device, id=\\?\usb#vid_16c0&pid_0478#000fd6ac#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
00:27:48.763 (ports 2): found_usb_device, loc=usb:0/140000/0/6/3    Port_#0003.Hub_#0005
00:27:48.763 (ports 2): found_usb_device, hwid=USB\VID_16C0&PID_0478&REV_0107
00:27:48.763 (ports 2): found_usb_device, devinst=0000001e
00:27:48.763 (ports 2): add: loc=usb:0/140000/0/6/3, class=HID, vid=16C0, pid=0478, ver=0107, serial=000fd6ac, dev=\\?\usb#vid_16c0&pid_0478#000fd6ac#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
00:27:48.763 (ports 2): hiddev_from_devinst_list: iface=0
00:27:48.763 (serialmon 19): found_usb_device complete
00:27:48.764 (ports 2): found_usb_device complete
00:27:48.765 (serialmon 19): found new COM port, devinst=0000001C
00:27:48.765 (serialmon 19):   portname=COM9
00:27:48.765 (serialmon 19): usb_add: usb:0/140000/0/6/3
00:27:48.765 (serialmon 19): ignoring partial USB device discovery (Windows XP issue?)
00:27:48.765 (serialmon 19): usb_add: usb:0/140000/0/6/1/1
00:27:48.765 (ports 2): usb_add: usb:0/140000/0/6/3  [no_device] (Teensy 4.0) Bootloader
00:27:48.887 (loader): can't read feature report
00:27:48.890 (loader): Device came online, code_size = 2031616
00:27:48.894 (ports 2): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
00:27:48.895 (serialmon 19): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
00:27:48.895 (loader): Board is: Teensy 4.0 (IMXRT1062), version 1.07
00:27:48.896 (ports 2): remove: loc=usb:0/140000/0/6/3
00:27:48.896 (ports 2): usb_remove: usb:0/140000/0/6/3
00:27:48.896 (ports 2): nothing new, skipping HID & Ports enum
00:27:48.896 (serialmon 19): remove: loc=usb:0/140000/0/6/3
00:27:48.896 (serialmon 19): usb_remove: usb:0/140000/0/6/3
00:27:48.896 (serialmon 19): nothing new, skipping HID & Ports enum
00:27:48.921 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_776093\DMAMEM.ino.hex", 105472 bytes
00:27:48.940 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_776093\DMAMEM.ino.ehex", 105472 bytes, 4960 extra
00:27:48.944 (loader): ehex is valid, key hash: 85A79CC1 B7C7F866 7F5BB3ED 0F9C9BA5 B4149EE2 72846D35 86B63863 B0699942
00:27:48.948 (loader): set background IMG_ONLINE
00:27:48.969 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_776093\DMAMEM.ino.hex", 105472 bytes
00:27:48.987 (loader): File "C:\Users\Tim\AppData\Local\Temp\arduino_build_776093\DMAMEM.ino.ehex", 105472 bytes, 4960 extra
00:27:48.992 (loader): ehex is valid, key hash: 85A79CC1 B7C7F866 7F5BB3ED 0F9C9BA5 B4149EE2 72846D35 86B63863 B0699942
00:27:48.996 (loader): elf appears to be for Teensy 4.0 (IMXRT1062) (2031616 bytes)
00:27:49.000 (loader): elf binary data matches hex file
00:27:49.003 (loader): elf file is for Teensy 4.0 (IMXRT1062)
00:27:49.008 (loader): using hex file - Teensy not configured for encryption
00:27:49.051 (loader): begin operation
00:27:49.074 (serialmon 19): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
00:27:49.074 (serialmon 19): nothing new, skipping HID & Ports enum
00:27:49.094 (loader): flash, block=0, bs=1024, auto=1
00:27:49.174 (serialmon 19): WM_DEVICECHANGE DBT_DEVICEARRIVAL
00:27:49.174 (ports 2): WM_DEVICECHANGE DBT_DEVICEARRIVAL
00:27:49.175 (serialmon 19): found_usb_device, id=\\?\usb#vid_16c0&pid_0483#10379960#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
00:27:49.175 (serialmon 19): found_usb_device, loc=usb:0/140000/0/6/3    Port_#0003.Hub_#0005
00:27:49.175 (serialmon 19): found_usb_device, hwid=USB\VID_16C0&PID_0483&REV_0279
00:27:49.175 (serialmon 19): found_usb_device, devinst=00000004
00:27:49.175 (serialmon 19): add: loc=usb:0/140000/0/6/3, class=USB, vid=16C0, pid=0483, ver=0279, serial=[B]10379960[/B], dev=\\?\usb#vid_16c0&pid_0483#10379960#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
00:27:49.175 (serialmon 19):   comport_from_devinst_list attempt
00:27:49.175 (serialmon 19): found_usb_device complete
00:27:49.175 (ports 2): found_usb_device, id=\\?\usb#vid_16c0&pid_0483#10379960#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
00:27:49.175 (ports 2): found_usb_device, loc=usb:0/140000/0/6/3    Port_#0003.Hub_#0005
00:27:49.175 (ports 2): found_usb_device, hwid=USB\VID_16C0&PID_0483&REV_0279
00:27:49.175 (ports 2): found_usb_device, devinst=0000001c
00:27:49.175 (ports 2): add: loc=usb:0/140000/0/6/3, class=USB, vid=16C0, pid=0483, ver=0279, serial=10379960, dev=\\?\usb#vid_16c0&pid_0483#10379960#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
00:27:49.175 (ports 2):   comport_from_devinst_list attempt
00:27:49.175 (ports 2): found_usb_device complete
00:27:49.176 (serialmon 19): usb_add: usb:0/140000/0/6/3
00:27:49.176 (serialmon 19): ignoring partial USB device discovery (Windows XP issue?)
00:27:49.176 (ports 2): usb_add: usb:0/140000/0/6/3  [no_device] (Teensy 4.0) Serial
00:27:49.208 (ports 2): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
00:27:49.208 (ports 2): update_usb_device, devinst list change, old had 1, new has 2
00:27:49.208 (ports 2):   comport_from_devinst_list attempt
00:27:49.208 (ports 2):   found Ports in classguid_list at index=1
00:27:49.208 (ports 2):   port COM8 found from devnode
00:27:49.209 (ports 2): usb_add: usb:0/140000/0/6/3  COM8 (Teensy 4.0) Serial
00:27:54.188 (serialmon 19): WM_DEVICECHANGE DBT_DEVICEARRIVAL
00:27:54.188 (serialmon 19): update_usb_device, devinst list change, old had 1, new has 2
00:27:54.188 (serialmon 19):   comport_from_devinst_list attempt
00:27:54.188 (serialmon 19):   found Ports in classguid_list at index=1
00:27:54.188 (serialmon 19):   port COM8 found from devnode
00:27:54.189 (serialmon 19): usb_add: usb:0/140000/0/6/3
00:27:54.264 (serialmon 19): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
00:27:54.265 (serialmon 19): nothing new, skipping HID & Ports enum
00:27:54.342 (ports 2): WM_DEVICECHANGE DBT_DEVICEARRIVAL
00:27:54.343 (ports 2): nothing new, skipping HID & Ports enum
00:27:54.450 (ports 2): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
00:27:54.451 (ports 2): nothing new, skipping HID & Ports enum
00:27:55.109 (loader): HID/win32:   write failure, num = 0
00:27:55.112 (loader): program: write error
00:27:55.116 (loader): HID/win32: HidD_GetPreparsedData failed, device assumed disconnected
00:27:55.121 (loader): end operation, total time = 6.066 seconds
00:27:55.126 (loader): set background IMG_DOWNLOAD_ERROR
00:27:55.129 (loader): redraw timer set, image 11 to show for 4000 ms
00:27:55.157 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
00:27:55.163 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
00:27:55.169 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
00:27:55.175 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/3
00:27:55.182 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
00:27:55.186 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/3
00:27:55.192 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/3
00:27:55.198 (loader): HID/win32:  vid:046D pid:C52B ver:1211  usb:0/140000/0/9/4/2/4
00:27:59.146 (loader): redraw, image 9
 
Last edited:
It seems the 'Fuse Write Sketch' doesn't check that the fuses were already set with a prior key. When it writes a second time added bits are set.

Yup, that's a bug. I will fix it for 1.55-beta3.



2 comments regarding this code

Code:
  uint32_t hab_PJRC = 0x403000D4; // https://forum.pjrc.com/threads/67989-Teensyduino-1-55-Beta-1?p=286356&viewfull=1#post286356
  if ( hab_PJRC == hab_csf[0] ) {
    Serial.println("Pass: csf is PJRC");

1: While the current teensy_secure utility writes 0x403000D4, that is not necessarily always guaranteed to be true in the future (eg, 1170 chip...)

This would be a better test:

Code:
  if ((hab_csf[0] & 0xF80000FF) == 0x400000D4) {
    uint16_t hab_size = (hab_csf[0] >> 16) & 0xFF;
    hab_size |= ((hab_csf[0] >> 8) & 0xFF) << 8;
    uint8_t hab_minor = (hab_csf[0] >> 24) & 7;
    Serial.printf("Pass: CSF is %u bytes with HAB version 4.%u", hab_size, hab_minor);
  }

This 4 byte header corresponds to "[Header]" in NXP/Freescale CSF language.

The remaining CSF bytes follow a similar format, where the low 8 bits tell the purpose of each field, middle 16 bits are the size of each field (including the 4 byte header), and top 8 bits are flags (which are zero in every case I understand). CSF generated by teensy_secure as it exists today should have these 3 fields. The page numbers are from the HAB4_API.pdf.

1: Length 12, type 0xBE "[Install SRK]" - 4.3.7 Install Key, page 33, HAB_CMD_INS_KEY=0xBE page 62
2: Length 12, type 0xCA "[Authenticate CSF]" - 4.3.8 Authenticate Data, page 40, HAB_CMD_AUT_DAT=0xCA page 62
3: Length 20, type 0xCA "[Authenticate Data]" - 4.3.8 Authenticate Data, page 40, HAB_CMD_AUT_DAT=0xCA page 62

Some aspects of CSF still don't make any sense to me, especially why there is no header or bytes for "[Install NOCAK]" and how it knows where to find the X509 cert within the data following the 48 CSF bytes, so I just tried to create the same data as NXP's CST program (I looked over so many hexdumps of its output....) The offsets of the public key and CMS signatures are encoded in those 3 fields, so at least that stuff makes good sense and fits nicely with the HAB4_API.pdf documentation.

If you parse the "[Install SRK]" field you can find the size and offset of the public key within the data appended after the 48 bytes (or whatever size the first header says the CSF bytes really are). If you skip the first 4 bytes and compute SHA256 over the rest, then do SHA256 again on first SHA256 output, you'll get the public key hash. That's what Teensy Loader does when it reads the EHEX file...



2: Saying "is PJRC" isn't appropriate. The identify of the CSF, who it actually is, comes from the public key. Computing the public key hash is really the correct way to state the identity of who created the CSF.

Please, at the very least change this to "is HAB 4.0". While that may seem like a minor detail, please keep in mind this is cryptographic authentication. Stating that such data is a particular organization or person is deeply meaningful in this context. This sort of code should say "is PJRC" (or anyone else) only the public key or its hash are specifically known to be a key used by that person or organization. Parsing the first 4 bytes only means the data is HAB comforming to a particular version and it's total length (for just the CSF commands, not including the appended data).
 
Last edited:
Paul - I have been doing program loading and the like on Locked T4, running MTP test code...

So far everything appears to work well.

I did however have one time, when I hit the Program button on the T4, and then the board went into both LEDS flashing mode. It stayed in that mode for awhile (felt like 20-30 seconds), and then the Teensy program went and reprogrammed it as I expected it to do...

Again no idea what was different this time:

Not sure if log would help or not:
 

Attachments

  • teensy_log.txt
    93.3 KB · Views: 70
I've done more than a few uploads - generally good and 'as expected', except the notes I've left.

Paul - I have been doing program loading and the like on Locked T4, running MTP test code...

So far everything appears to work well.

I did however have one time, when I hit the Program button on the T4, and then the board went into both LEDS flashing mode. It stayed in that mode for awhile (felt like 20-30 seconds), and then the Teensy program went and reprogrammed it as I expected it to do...

Again no idea what was different this time:

Not sure if log would help or not:

Sounds like my experiences, not seen yet with Beta 2 - not sure if new log info there yet to help - but added notes might give a pointer.

@Paul: What does Teensy_reset.exe do? I was looking for non TyCommander way to trigger the 'parade of images' On a reset after an Upload.
> Teensy_reboot w/no params found and caused a Teensy Upload

Teensy_reset didn't offer help and I didn't find command line details noted to point it at a Teensy or have it work here.
 
@Paul

Pretty much doing the same type of testing with the locked T4 as @KurtE with 1.55beta2 and not seen any issues with uploads.

Tried to duplicate @KurtE's issue with the both LEDs flashing on pressing the PGM button on the T4 - did it 10 times with the same sketch with no issues with uploading the sketch.
 
@Paul

Pretty much doing the same type of testing with the locked T4 as @KurtE with 1.55beta2 and not seen any issues with uploads.

Tried to duplicate @KurtE's issue with the both LEDs flashing on pressing the PGM button on the T4 - did it 10 times with the same sketch with no issues with uploading the sketch.

I did Beta 1 'Ten' of a few things after I saw it - and could not prompt it to re-appear ... link to Beta 1 was reposted in p#9 : Teensyduino-1-55-Beta-2

Wondering if it relates to the Post #32, #34 'State Memory' that Teensy loader is expressing? Though none of those tests triggered it - I wasn't doing back to back Uploads {Same? or Diff? sketch??} , but an intervening TyComm Reset? May be a variation on that ...
 
I did Beta 1 'Ten' of a few things after I saw it - and could not prompt it to re-appear ... link to Beta 1 was reposted in p#9 : Teensyduino-1-55-Beta-2

Wondering if it relates to the Post #32, #34 'State Memory' that Teensy loader is expressing? Though none of those tests triggered it - I wasn't doing back to back Uploads {Same? or Diff? sketch??} , but an intervening TyComm Reset? May be a variation on that ...

As I said I am only using the Arduino IDE for uploads and only Tycommander for capturing serial data or multiple Teensies. Using the IDE I have uploaded sketches (mostly testing MTP and LittleFS and Temp) can't tell you the number - at least 30 times with out issues with Beta2. Only time I have seen the Flashing issues is with Beta1 doing a 15s restore or trying to load your code4code sketch to a single T4.

What's causes the issue I can't tell because its not repeatable to be honest.
 
As I said I am only using the Arduino IDE for uploads and only Tycommander for capturing serial data or multiple Teensies. Using the IDE I have uploaded sketches (mostly testing MTP and LittleFS and Temp) can't tell you the number - at least 30 times with out issues with Beta2. Only time I have seen the Flashing issues is with Beta1 doing a 15s restore or trying to load your code4code sketch to a single T4.

What's causes the issue I can't tell because its not repeatable to be honest.

Interesting - recall your note about Code4Code trouble ... but didn't understand you saw the Dual LEDS { Both Orange and Red } flash?

>> I just pressed 15s Restore on the LOCKED Beta and get Red Led { "Blink, Blink, Pause" ... repeat }

>> Same 15s Restore press on the Beta I cannot Lock - but has 'some scrambled HASH' and it did the expected Factory Blink load.

Then Both Beta T4's took upload of "TimeTeensy3.ino" to work!
 
@Paul - below is updated isEncrypt() WIP for Code4Code edits - notify if anything else 'out of line'.

It is called with Teensy Serial# in szTeensy[] - but need not be.

For Locked Secure T4_Beta it shows:
Code:
Verify secure code is running properly

Pass: Bus Encryption Engine is active
Pass: Encryption region starts at proper address
Pass: Program data is entirely within encrypted region
Pass: isEncrypt() is within encrypted region
Pass: title_text[] is within encrypted region
Pass: csf is HAB 4.0
NOTE: hab_version == 0x40307
NOTE: hab_status == 0xF0
Secure mode IS set :: Fuses == 0x4C8B01A

All Tests Passed.  :-)
10379970
10379970 ENC SM @600

For Unlocked Secure Mode T4_Beta - with 'Bug Bit' unusable HASH - .hex only:
Code:
Verify secure code is running properly

Fail: Bus Encryption Engine is not active
Fail: Encryption region starts at wrong address
Fail: Program data is not within encrypted region
Fail: isEncrypt() is not in encrypted region
Fail: title_text[] is not in encrypted region
Fail: csf not HAB 4.0
NOTE: hab_version == 0x40307
NOTE: hab_status == 0xF0
Secure mode NOT SET :: Fuses == 0x8B018

10379960
10379960 nor ns @600

For PRODUCTION T4 {No PCB Hash marks}:
Code:
Verify secure code is running properly

Fail: Bus Encryption Engine is not active
Fail: Encryption region starts at wrong address
Fail: Program data is not within encrypted region
Fail: isEncrypt() is not in encrypted region
Fail: title_text[] is not in encrypted region
Fail: csf not HAB 4.0
NOTE: hab_version == 0x40307
NOTE: hab_status == 0xF0
Secure mode NOT SET :: Fuses == 0x80018

6052840
6052840 nor ns: @600

And the isEncrypt():
Code:
extern "C" uint32_t  _sdataload; /* special linker symbols */
extern const uint32_t hab_csf[]; // placeholder for HAB signature
PROGMEM char title_text[] = "Verify secure code is running properly";
FLASHMEM int isEncrypt() {
  int ok = 0;
  Serial.println( title_text );
  Serial.println();
  char buf[11];
  uint32_t i, num;

  num = HW_OCOTP_MAC0 & 0xFFFFFF;
  // add extra zero to work around OS-X CDC-ACM driver bug
  if (num < 10000000) num = num * 10;
  ultoa(num, buf, 10);
  for (i = 0; i < 10; i++) {
    char c = buf[i];
    if (!c) break;
    szTeensy[i] = c;
  }
  szTeensy[i] = 0;

  if ((IOMUXC_GPR_GPR11 & 0x100) == 0x100) {
    Serial.println("Pass: Bus Encryption Engine is active");
  } else {
    Serial.println("Fail: Bus Encryption Engine is not active");
    ok--;
  }

  uint32_t begin_address = IOMUXC_GPR_GPR18 & ~0x3FF;
  if (begin_address == 0x60001400) {
    Serial.println("Pass: Encryption region starts at proper address");
  } else {
    Serial.println("Fail: Encryption region starts at wrong address");
    ok--;
  }

  uint32_t end_address = IOMUXC_GPR_GPR19 & ~0x3FF;
  uint32_t data_end = (uint32_t)&_sdataload + (uint32_t)&_edata - (uint32_t)&_sdata;
  if (data_end <= end_address) {
    Serial.println("Pass: Program data is entirely within encrypted region");
  } else {
    Serial.println("Fail: Program data is not within encrypted region");
    ok--;
  }

  uint32_t title_address = ((uint32_t)&isEncrypt) & ~1;
  if (title_address >= begin_address && title_address < end_address) {
    Serial.println("Pass: isEncrypt() is within encrypted region");
  } else {
    Serial.println("Fail: isEncrypt() is not in encrypted region");
    ok--;
  }

  if ((uint32_t)title_text >= begin_address && (uint32_t)title_text < end_address) {
    Serial.println("Pass: title_text[] is within encrypted region");
  } else {
    Serial.println("Fail: title_text[] is not in encrypted region");
    ok--;
  }
  // deprecitated :: uint32_t hab_PJRC = 0x403000D4; // https://forum.pjrc.com/threads/67989-Teensyduino-1-55-Beta-1?p=286356&viewfull=1#post286356
  // https://forum.pjrc.com/threads/68121-Teensyduino-1-55-Beta-2?p=288055&viewfull=1#post288055
  if ((hab_csf[0] & 0xF80000FF) == 0x400000D4) {
    uint16_t hab_size = (hab_csf[0] >> 16) & 0xFF;
    hab_size |= ((hab_csf[0] >> 8) & 0xFF) << 8;
    uint8_t hab_minor = (hab_csf[0] >> 24) & 7;
    Serial.printf("Pass: CSF is %u bytes with HAB version 4.%u", hab_size, hab_minor);
  } else {
    Serial.println("Fail: csf not HAB 4.0");
    strcat( szTeensy, " nor" );
    ok--;
  }
  const uint32_t hab_version = (*(uint32_t (**)())0x00200330)();
  const uint32_t hab_status = (*(int (**)(int *, int *))0x00200324)(NULL, NULL);
  if (hab_version == 0x40307) {
    Serial.println("NOTE: hab_version == 0x40307");
  } else {
    Serial.println("NOTE: hab_version NOT == 0x40307");
    ok--;
  }
  if (hab_status == 0xF0) {
    Serial.println("NOTE: hab_status == 0xF0");
  } else {
    Serial.println("NOTE: hab_status NOT == 0xF0");
    ok--;
  }
  if ((HW_OCOTP_CFG5 & 0x04C00002) == 0x04C00002) {
    Serial.print("Secure mode IS set :: Fuses == 0x");
    strcat( szTeensy, " SM:" );
  } else {
    Serial.print("Secure mode NOT SET :: Fuses == 0x");
    strcat( szTeensy, " ns:" );
    ok--;
  }
  i = F_CPU_ACTUAL / 1000000;
  sprintf( &szTeensy[15], " @%lu", i );
  Serial.println( HW_OCOTP_CFG5, HEX );

  Serial.println();
  if (0 == ok) Serial.println("All Tests Passed.  :-)");
  else printf(" %d Tests failed.  :-(", -ok);
  return ok;
}
 
@Paul: are the 0xB000 bits the one that indicate and HASH has been Fuse Burned?
>> This " Fuses == 0x8B018" versus "Fuses == 0x80018" from above ?

Note: Code4Code build takes some LONG time to Build - 4,000 funcs in 'CodeMade.ino'

Then after showing Teensy_Size output in IDE it again sits some LONG time before pushing the Upload

I suppose this is the .hex >> .eHex encrypt process.

It seems like NOTHING is happening - but the IDE 'Green Progress' bar still shown - near 100% and the '->' Upload Arrow is still 'Yellow'.

It may be that interrupting this 'Involved and long running process' - perhaps with a button push is where the Dual Leds comes from? Will give it a try. But would require perhaps hitting the right/Wrong time where the .eHex exists, but is not complete?

It seems the prior .eHex exists WHILE the new .eHex is being constructed?
> I did 2.5 Button Uploads (these are NOT fast with Code4Code) after 'Teensy_size' before the IDE completed and tried to do Auto Upload, that failed as the Teensy Loader was 'currently busy'

Then did another Button and in those 4 completed uploads ... Nothing ODD happened ... this time ...
 
A couple pull requests are open regarding startup hooks. I'm looking at it today and realizing the startups sequence is not consistent between Teensy 3 and 4. Hoping to fix that for 1.55.

I'm considering edits to both, so we have a consistent startup sequence. Here's my thoughts on the matter at this moment:

1: minimal hardware init
2: call startup_early_hook() - intended for watchdog setup
3: initialize variables, configure clocks, initialize non-USB hardware
4: call startup_middle_hook() - useful to run "normal" code early
5: delay 25ms
6: turn on USB
7: delay 275ms
8: call startup_late_hook() - useful for initialization before constructors
9: run C++ constructors
10: run setup()
11: run loop()

These are the pull requests. Probably best to comment here on the forum for any feedback about the startup sequence.

https://github.com/PaulStoffregen/cores/pull/605

https://github.com/PaulStoffregen/cores/pull/602
 
A couple pull requests are open regarding startup hooks. I'm looking at it today and realizing the startups sequence is not consistent between Teensy 3 and 4. Hoping to fix that for 1.55.

I'm considering edits to both, so we have a consistent startup sequence. Here's my thoughts on the matter at this moment:

...

Not sure of the PR's - but good you are giving a look.

The other day/week attempting some use I was getting a failure of them to run code and have 'global var' data persist in sketch - expected in early_ but not helpful in late_ ???

Played a bit before some 'distraction' took me away and never got back to it. Assumed it was the #9: constructors? But moving late_ after that failed too - unless I was editing the wrong cores folder.

Will look for changes and see what is going on when I get back ... gotta run.
 
are the ... bits the one that indicate...


I know this is silly, but the "reserved" fuses are covered by NXP's NDA which PJRC signed, so I can't answer about the specific fuse bit functions if they are "reserved" in the reference manual.

NXP did give me a green light to publish the code security software, which does reference some fuses numerically out of necessity. Just getting to that point took a lot of back and forth. I'm not eager to push the envelope.

I put a lot of work into writing the most complete documentation possible without disclosing anything confidential, even with page number references to the reference manual for all the info about encryption features used.
 
I know this is silly, but the "reserved" fuses are covered by NXP's NDA which PJRC signed, so I can't answer about the specific fuse bit functions if they are "reserved" in the reference manual.

NXP did give me a green light to publish the code security software, which does reference some fuses numerically out of necessity. Just getting to that point took a lot of back and forth. I'm not eager to push the envelope.

I put a lot of work into writing the most complete documentation possible without disclosing anything confidential, even with page number references to the reference manual for all the info about encryption features used.

Silly indeed :) - especially thinking I'd look at the Manual :confused: Then again - if I bothered to read/head all the instructions ... I wouldn't have made my second Beta board a Secure Mode failure doing the second write of the Hash bits :cool:

- I wasn't going to ask as I figured it would show when you did it, but seeing just those three "0xB== 1011" bits made me wonder if it was that 'simple'.

as always ... Good work making it through the Battle of the manuals, especially compounded by the NDA parts.

One Note from prior post: If you could add a Console Out after the Teensy_size in the IDE saying ... 'Please wait ... doing security stuff' it might save some trouble.
Just timed ReBuild of LARGE Code4Code:
Code:
[B]1 min 8 secs for IDE to show teensy_size
  [/B] -- no console feedback on what the wait is ...[B]
1 min 30 secs after teensy_size until Teeny Loader is pointed to the .eHex for Upload[/B]
>> Win 11 machine with Gen 10 i7-10700 w/ 8 cores (16 threads ) - and 32GB RAM building on SSD drive.
Code:
Memory Usage on Teensy 4.0:
  FLASH: code:994536, data:325912, headers:8700   free for files:702468
   RAM1: variables:86752, code:37112, padding:28424   free for local variables:372000
   RAM2: variables:12384  free for malloc/new:511904

<edit> Same applies to 'Verify' build, where Nothing prints after 'teensy_size', but build of .eHex is not ready for that (extended when large) time.

Note Upload times of Large Code4Code:
Code:
10379960 nor ns: @600 :: ~12 secs << This is Beta unit that cannot take .eHex
10379970 ENC SM: @600 :: ~25 secs << Locked Beta taking .ehex
6052840 nor ns: @600 :: ~5 secs << Production T4
 
Last edited:
Then again - if I bothered to read/head all the instructions ... I wouldn't have made my second Beta board a Secure Mode failure doing the second write of the Hash bits :cool:

Really glad you did. It's now on my list to fix for 1.55-beta3.

I will send you another 4.0 lockable beta board, and a lockable 4.1 early next week. :)
 
Status
Not open for further replies.
Back
Top