Teensyduino 1.55 Beta #1

Status
Not open for further replies.
objdump, symbols

Hi Paul,

I know you don't want to update the toolchain now.
But could you update these things? They are really useful.


Quote from the wiki:
List and symbol files:

Teensyduino produces additional files, which are useful if you want to dig more in to the internals or for optimizing. In principle this should be possible with any of the build systems.Teensyduino creates an .LST and a .SYM file in the build directory.
But, there is nothing that can't be improved - the generated .SYM file is a bit confusing because the tool nm is not used. We can easily change that:
Arduino IDE
Example for Teensy 4:

  1. Add a line to boards.txt:
    teensy40.build.command.nm=arm-none-eabi-gcc-nm
  2. Add the following line to platform.txt:
recipe.hooks.postbuild.4.pattern="{compiler.path}stdout_redirect" "{build.path}/{build.project_name}.symnm" "compiler.path}{build.toolchain}{build.command.nm}" -n -S --defined-only -C "{build.path}/{build.project_name}.elf"

Now, when we do a new build, an additional .symnm file is created, which is clearer and sorted -- and therefore easier to read.

>>Perhaps use the sym extension and remove the old sym generation
Fix broken objdump for Teensy 4
The objdump for the current GCC is broken and emits more or less unreadable lst files. Copying an objdump from a newer (GCC 9) toolchain to the GCC folder fixes this. Here the output of a working objdump
You can use objdump from GCC10.
 
Indeed ... stone dead. Once I saw similar current that seemed to show indeed the horse being beaten was dead.

But your graphs are very nice! Where do they come from?

Went the simple route and used Exel. Have other graphing tools but for this excel was easier.
 
I've added the other 3 Linux builds. If anyone was waiting to try on a Linux SBC or old 32 bit x86 machine, the files are now available.

MacOS support is going to take me a couple more weeks.
 
And now for a completely different test of the chips...

So I tried to build again the windows version of the teensy_loader_cli app project... failed to setup. So booted up old machine with recently updated Windows10/Ubuntu 20.04 dual boot... Booted Ubuntu

And built it...

Was able to program the unlocked one with the CLI. As expected was not able to program the locked one.

I copied the security over between the two machines (I assume that is valid)...

Then tried to program the locked one with blink over on Ubuntu and it failed... Then tried the 15-20 second reset operation. The board did the quick blink and then I released and then it reasonably came back quickly with double blinks...
It did not look like Arduino over there wanted to program correctly as well led was not blinking...

Brought back over to Windows 10 machine and it blinked again... (After I programmed it)
Not sure yet what happened, but will now bring that chip back over to Ubuntu and see if it will update the program

Update: Brought back over to Ubuntu and changed blink to half second and it updated the locked program correctly
 
LittlFS

The ESP has nice tools for using littlfs. It is very easy to upload files from the PC to littlfs.

Example:
https://github.com/lorol/arduino-esp32fs-plugin#arduino-esp32-filesystem-uploader
tool.png


This works anytime, I think the bootloader helps. At least I know you don't need to run a special sketch on the ESP etc.

You can just create a sketch subdirectory "data" in the sketch folder, and it gets uploaded to the filesystem. Quite easy and reliable.

To the littlFS experts: Could you write a "howto" how this works on the Teensy? (really, I don't know it. And I don't even know where to search)
Is there an *simple* example (or just a "howto") how I can copy my files from PC to littleFS? (I have the feeling I need the still "experimental "MTP Disk"?)
Or, from SD?

- Then: My Arduino does not show the littlFS examples. I know they are there, and I know how to open them, but they are not visible in the "examples" menu.


Code:
LittleFS_QPINAND myfs;
- Is there a "S" missing?

- The littlfs_teensy_test lacks any comment... there is no indication what is does (without digging into the sourcecode) and it is complicated.
- what does BB_ECC do?
- ... same for other examples. There is no description what they do (not to speak about how they do it) . Also, there are examples with two ino files and no idication which to open.

We really should make this better. It is just not beginner friendly.

I have full understanding when a user who tries to use it *somehow* throws everything away and gives up at this point. It's so much easier with ESP to find information, and the www is full of tutorials and (simple!) commented examples. Even in German language.

Please take this as a contructive criticism.
 
Last edited:
that datalogger example looks better. But it lacks the not unimportant information how to transfer the logged data to the PC? What happens if there is no filesystem? will it be created automatically? if not, how to?

PSRAM: Does littlFS still use 4096 bytes blocksize?

Encryption: I guess not, but let me ask: Are the files encrypted? I'd not be surprised if not, but it needs to be documented... only Arduino seems to encrypt, any later writes (from teensy itself) not.
So that means, only the program and its const data are encrypted. Other data in the flash, not. Correct? (<- no critic - just to make it clear! ) its not as obvious as it may seem.
 
Last edited:
Morning Frank - see you been busy :)

he ESP has nice tools for using littlfs. It is very easy to upload files from the PC to littlfs.

Example:
https://github.com/lorol/arduino-esp...ystem-uploader
Not a java expert here but remembering how the ESP32 works and looking at the java source don;t think it can be used without a bunch of modifications. For instance I believe it assumes that the LittleFS/SPIFFS/FatFS start from some address and fixed size. Yes I see there is a tool to make LittleFS etc and you can create a partition.csv but not sure what goes into that file (no instructions). Basically not sure you can use it without mods to work with the Teensy.

Would be nice though but don't really know Java well enough to fix it.

Arduino does not show the littlFS examples. I know they are there, and I know how to open them, but they are not visible in the "examples" menu.
Thats strange I can see them when I select the LittleFS library from the dropdown:
Capture.PNG

- The littlfs_teensy_test lacks any comment... there is no indication what is does (without digging into the sourcecode) and it is complicated.
- what does BB_ECC do?
- ... same for other examples. There is no description what they do (not to speak about how they do it) . Also, there are examples with two ino files and no idication which to open.

We really should make this better. It is just not beginner friendly.
BB_ECC should really be deleted - that was a test sketch for Bad Block Management which we are not using as LittleFS pretty much does that for you if it sees a bad block.

Yep - I agree with you all the examples need work - its on my to-do list including the logger examples but that needs some work as well. That test sketch was there to test different commands in LittleFS and really needs cleaning up if we want to use something like it.

PSRAM: Does littlFS still use 4096 bytes blocksize?
Believe it does.

Encryption: I guess not, but let me ask: Are the files encrypted? I'd not be surprised if not, but it needs to be documented... only Arduino seems to encrypt, any later writes (from teensy itself) not.
So that means, only the program and its const data are encrypted. Other data in the flash, not. Correct? (<- no critic - just to make it clear! ) its not as obvious as it may seem.
Yes that is correct. LittleFS is not encrypted yet. Was mentioned in post #53 that eventually support encryption but probably not until end of year or early next year.
 
Encryption: I guess not, but let me ask: Are the files encrypted? I'd not be surprised if not, but it needs to be documented... only Arduino seems to encrypt, any later writes (from teensy itself) not. So that means, only the program and its const data are encrypted. Other data in the flash, not. Correct? (<- no critic - just to make it clear! ) its not as obvious as it may seem.

I am working on documentation now. Please be patient. I know the lack of clear documentation is frustrating. This situation will improve. Please try to keep in mind this beta test started on Tuesday. Teensyduino 1.55-beta1 has existed for not even 70 hours yet.

Regarding what is encrypted, indeed it only encrypts code. I believe you asked this same question on Tuesday and I answered in msg #52, including thoughts on future encryption support in LittleFS and some explanation of the 2 different hardware encryption engines inside this IMXRT chip.

Likewise, LittleFS and new SD / SdFat pages are needed. Realistically, I probably will not get to those for a few more weeks. But they are on my high priority list.


PSRAM: Does littlFS still use 4096 bytes blocksize?

Looking at the code in LittleFS.h, seems we are using 2K block size if the filesystem is more than 1Mbyte size, otherwise small 256 byte blocks.

Code:
                if ( size > 1024*1024 ) {
                        config.read_size = 256; // Must set cache_size. If read_buffer or prog_buffer are provided manually, these must be cache_size.
                        config.prog_size = 256;
                        [B]config.block_size = 2048;[/B]
                        config.block_count = size / config.block_size;
                        config.block_cycles = 900;
                        config.cache_size = 256;
                        config.lookahead_size = 512; // (config.block_count / 8 + 7) & 0xFFFFFFF8;
                }
                else {
                        config.read_size = 64;
                        config.prog_size = 64;
                        [B]config.block_size = 256;[/B]
                        config.block_count = size / 256;
                        config.block_cycles = 50;
                        config.cache_size = 64;
                        config.lookahead_size = 64;
                }
 
that datalogger example looks better. But it lacks the not unimportant information how to transfer the logged data to the PC? What happens if there is no filesystem? will it be created automatically? if not, how to?
My guess if I were doing this I would probably integrate in MTP... Which hopefully we will get more integration...

PSRAM: Does littlFS still use 4096 bytes blocksize?
I am no expert here, but my guess from the library for Ram shows, it depends on size:
From LittleFS_Fran:
Code:
        if ( size > 1024*1024 ) {
            config.read_size = 256; // Must set cache_size. If read_buffer or prog_buffer are provided manually, these must be cache_size.
            config.prog_size = 256;
            config.block_size = 2048;
            config.block_count = size / config.block_size;
            config.block_cycles = 900;
            config.cache_size = 256;
            config.lookahead_size = 512; // (config.block_count / 8 + 7) & 0xFFFFFFF8;
        }
        else {
            config.read_size = 64;
            config.prog_size = 64;
            config.block_size = 256;
            config.block_count = size / 256;
            config.block_cycles = 50;
            config.cache_size = 64;
            config.lookahead_size = 64;
        }

As for Encryption... Beyond my pay grade ;)

Edit: Looks like Paul answered with same
 
Excryption - Yup, I asked that for the extra, optional QSPI - but I realized later that it is the same for the "main" Flash :) Somehow I had the wrong assumption that the HAB works on whole chip - which is of course, not right.

Thank you all very much for answering my questions! I read somewhere, some time ago, that littlfs uses 4k blocks, that's why iI asked about that as this would be indeed a little inefficient if used for RAM.
But as it is, it looks good :)

I can help with the examples. (If wanted)
(But I really don't know what the easiest way is to transfer from PC->Teensy)

Could we have a "trigger" like for bkpt (set baudrate 250 or similar) that starts a short piece of code or callback?
 
Sorry my fault I was looking at LittleFS Program in CPP and forgot about the RAM is in the .h. Have to remember that.
 
Was beginning to play with the LittleFS logger example. But think may have to break that out to 3 or 4 separate examples to keep it clean:
Code:
#include <LittleFS.h>

// LittleFS supports creating file systems (FS) in multiple memory types.  Depending on the 
// memory type you want to use you would uncomment one of the following constructors

//LittleFS_QSPIFlash myfs;	// Used to create FS on QSPI NOR flash chips located on the bottom of the T4.1 such as the W25Q16JV*IQ/W25Q16FV,  for the full list of supported NOR flash see https://github.com/PaulStoffregen/LittleFS#nor-flash
LittleFS_SPIFlash myfs;	// Used to create FS on SPI NOR flash chips on a SPI port such as SPI, SPI1, SPI2 etc

//LittleFS_SPINAND myfs;	// Used to create FS on SPI NAND flash chips on a SPI port such as SPI, SPI1, SPI2 etc.  For the full list of supported NAND Flash chips see https://github.com/PaulStoffregen/LittleFS#nand-flash
//LittleFS_QPINAND myfs;	// Used to create FS on QSPI NAND flash chips located on the bottom of the T4.1 such as the W25N01G. 

//LittleFS_SPIFram myfs;	// Used to create FS on FRAM memory chips such as the FM25V10-G.  For the full list of supported chips see https://github.com/PaulStoffregen/LittleFS#fram

//LittleFS_Program myfs;	// Used to create a FS in program memory (FLASH).  This option is only available on the Teensy 4.0, Teensy 4.1 and Teensy Micromod boards

//LittleFS_RAM myfs;	//  Used to create a RAM disk on a PSRAM chip (T4.1 Only) or in DMA memory.
Maybe an example for QSPI, SPI, and Memory?


EDIT: Modified example (havent tried it yet though)
Code:
/*
 /*
  LittleFS  datalogger
 
 This example shows how to log data from three analog sensors
 to an storage device such as a FLASH.
 
 This example code is in the public domain.
 */

// LittleFS supports creating file systems (FS) in multiple memory types.  Depending on the 
// memory type you want to use you would uncomment one of the following constructors

LittleFS_SPIFlash myfs;	// Used to create FS on QSPI NOR flash chips located on the bottom of the T4.1 such as the W25Q16JV*IQ/W25Q16FV,  for the full list of supported NOR flash see https://github.com/PaulStoffregen/LittleFS#nor-flash

//LittleFS_SPINAND myfs;	// Used to create FS on SPI NAND flash chips on a SPI port such as SPI, SPI1, SPI2 etc.  For the full list of supported NAND Flash chips see https://github.com/PaulStoffregen/LittleFS#nand-flash

//LittleFS_SPIFram myfs;	// Used to create FS on FRAM memory chips such as the FM25V10-G.  For the full list of supported chips see https://github.com/PaulStoffregen/LittleFS#fram

const int chipSelect = 4;  // digital pin for Flash or Fram chip CS pin
int record_count = 0;

void setup()
{

  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    // wait for serial port to connect.
  }

  Serial.print("Initializing LittleFS ...");

  // see if the Flash is present and can be initialized:
  // Note:  SPI is default so if you are using SPI and not SPI for instance
  //        you can just specify myfs.begin(chipSelect). 
  if (!myfs.begin(chipSelect, SPI)) {
    Serial.printf("Error starting %s\n", "SPI FLASH");
    while (1) {
      // Error, so don't do anything more - stay stuck here
    }
  }
  Serial.println("LittleFS initialized.");
  
  menu();
  
}

void loop()
{
	
	
  if ( Serial.available() ) {
    char rr;
    rr = Serial.read();
    if (rr == 's') {
		// opens a file or creates a file if not present,  FILE_WRITE will append data to 
		// to the file created.
		File dataFile = myfs.open("datalog.txt", FILE_WRITE);
		startLogging();
	}
    if (rr == 'x') stopLogging();
    if (rr == 'q') dumpLog();
    if (rr == 'h') menu();
  }
  
}

void startLogging()
{
  // make a string for assembling the data to log:
  String dataString = "";

  // read three sensors and append to the string:
  for (int analogPin = 0; analogPin < 3; analogPin++) {
    int sensor = analogRead(analogPin);
    dataString += String(sensor);
    if (analogPin < 2) {
      dataString += ",";
    }
  }

  // if the file is available, write to it:
  if (dataFile) {
    dataFile.println(dataString);
    // print to the serial port too:
    Serial.println(dataString);
	record_count += 1;
  } else {
    // if the file isn't open, pop up an error:
    Serial.println("error opening datalog.txt");
  }
  delay(100); // run at a reasonable not-too-fast speed
}

void stopLogging()
{
  // Closes the data file.
  dataFile.close();
  Serial.printf("Records written = %d\n", record_count);
}


void dumpLog()
{
  // open the file.
  File dataFile = myfs.open("datalog.txt");

  // if the file is available, write to it:
  if (dataFile) {
    while (dataFile.available()) {
      Serial.write(dataFile.read());
    }
    dataFile.close();
  }  
  // if the file isn't open, pop up an error:
  else {
    Serial.println("error opening datalog.txt");
  } 
}

void menu()
{
  Serial.println();
  Serial.println("Menu Options:");
  Serial.println("\ts - Start Logging data (Restarting logger will append records to existing log)");
  Serial.println("\tx - Stop Logging data");
  Serial.println("\td - Dump Log");
  Serial.println("\th - Menu");
  Serial.println();
}
 
Last edited:
Some more Random lockable T4 experiments...

As I (and many others) often use TyCommander - I went in and Integrated it with Arduino...
So now it tries to use TyCommander to program the chips instead of Teensy loader.


So for the one that I ran the T4 security enable stuff, TyCommander does program the chip, but as expected it uploaded the .hex file and the encryption stuff is not enabled. That is I used @defragsters kitchen sink and:
Code:
C:\Users\kurte\Documents\Arduino\Github\T4LockBeta\T4MemInfoKitchen\T4MemInfoKitchen.ino Aug 20 2021 06:16:46

	deg  C=35.769230	 F_CPU=600000000
_stext        00000000
_etext        00006628 +26152b
_sdata        20000000
_edata        20001bc8 +7112b
_sbss         20001bc8
_ebss         200042c0 +9976b
curr stack    20077fb0 +474352b
_estack       20078000 +80b
_heap_start   20203060
__brkval      20204000 +4000b
_heap_end     20280000 +507904b

<ITCM>  00000000 .. 00007fff
<DTCM>  20000000 .. 20077fff
<RAM>   20200000 .. 2027ffff
<FLASH> 60000000 .. 601fffff

avail STACK   474352 b   463 kb	<<RAM1
avail HEAP    507904 b   496 kb	<<RAM2


++++++++++++++++++++++
Size of Free ITCM in Bytes = 6612
Start of Free ITCM = 26156 [ 662C] 
End of Free ITCM = 32768 [ 8000] 
ITCM DWORD cnt = 1653 [#bytes=6612] 

---	hab_csf
6000A800 - 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  : ........ ........
...	 6 duplicate line(s) removed.
6000A870 - 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  : ........ ........
---	ITCM used
0000562C - BF F6 4B AE 54 EA 05 03  7F F4 4D AE 38 AE 30 34  : ..K.T... ..M.8.04
0000563C - 06 F8 41 4D 28 AB 9B 1B  08 93 08 9B 43 45 B8 BF  : ..AM(... ....CE..
0000564C - 43 46 04 93 00 23 0E 93  8A E6 0C 93 A8 46 00 2A  : CF...#.. .....F.*
0000565C - 40 F0 28 87 1B F0 20 0F  C2 48 00 F0 86 80 09 9F  : @.(... . .H......
0000566C - 07 37 27 F0 07 03 D3 E9  00 45 03 F1 08 02 09 92  : .7'..... .E......
0000567C - 1B F0 01 07 00 F0 47 82  54 EA 05 03 00 F0 A3 84  : ......G. T.......
0000568C - 00 27 30 23 9D F8 30 20  8D F8 50 30 B8 45 8D F8  : .'0#..0  ..P0.E..
0000569C - 51 20 8D F8 4F 70 4B F0  02 03 C0 F2 17 86 2B F0  : Q ..OpK. ......+.
---	ITCM filler to DTCM	 test 3 
0000662C - 01 00 00 00 01 00 00 00  01 00 00 00 01 00 00 00  : ........ ........
...	 411 duplicate line(s) removed.
00007FEC - 01 00 00 00 01 00 00 00  01 00 00 00 01 00 00 00  : ........ ........
00007FFC - 01 00 00 00                                       : ....
 ITCM Start: 
 Given addr of 0  *Skipping Addresses < 32 to avoid access violation
00000020 - 10 B5 05 4C 23 78 33 B9  04 4B 13 B1 04 48 AF F3  : ...L#x3. .K...H..
00000030 - 00 80 01 23 23 70 10 BD  C8 1B 00 20 00 00 00 00  : ...##p.. ... ....
00000040 - 24 66 00 00 08 4B 10 B5  1B B1 08 49 08 48 AF F3  : $f...K.. ...I.H..
00000050 - 00 80 08 48 03 68 03 B9  10 BD 07 4B 00 2B FB D0  : ...H.h.. ...K.+..
00000060 - BD E8 10 40 18 47 00 BF  00 00 00 00 CC 1B 00 20  : ...@.G.. ....... 
00000070 - 24 66 00 00 C8 1B 00 20  00 00 00 00 00 00 00 00  : $f.....  ........
00000080 - 15 4B 04 21 15 4A 1B 68  12 68 9B 1A 00 EE 10 3A  : .K.!.J.h .h.....:
00000090 - 9F ED 0F 7B B8 EE 40 0B  10 B5 11 4C 20 EE 07 0B  : ...{..@. ...L ...
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: title_function() is not in encrypted region
Fail: title_text[] is not in encrypted region
Fail: csf is Zero

 6 Tests failed.  :-(0.0000, 35.77
0.0083, 35.77
I then reprogrammed with using Teensy loader and:
Code:
C:\Users\kurte\Documents\Arduino\Github\T4LockBeta\T4MemInfoKitchen\T4MemInfoKitchen.ino Aug 20 2021 06:42:02

	deg  C=45.865383	 F_CPU=600000000
_stext        00000000
_etext        00006628 +26152b
_sdata        20000000
_edata        20001bc8 +7112b
_sbss         20001bc8
_ebss         200042c0 +9976b
curr stack    20077fb0 +474352b
_estack       20078000 +80b
_heap_start   20203060
__brkval      20204000 +4000b
_heap_end     20280000 +507904b

<ITCM>  00000000 .. 00007fff
<DTCM>  20000000 .. 20077fff
<RAM>   20200000 .. 2027ffff
<FLASH> 60000000 .. 601fffff

avail STACK   474352 b   463 kb	<<RAM1
avail HEAP    507904 b   496 kb	<<RAM2


++++++++++++++++++++++
Size of Free ITCM in Bytes = 6612
Start of Free ITCM = 26156 [ 662C] 
End of Free ITCM = 32768 [ 8000] 
ITCM DWORD cnt = 1653 [#bytes=6612] 

---	hab_csf
6000A800 - D4 00 30 40 BE 00 0C 00  03 17 00 00 00 00 00 30  : ..0@.... .......0
6000A810 - CA 00 0C 00 01 C5 00 00  00 00 04 44 CA 00 14 00  : ........ ...D....
6000A820 - 00 C5 00 00 00 00 06 28  60 00 10 00 00 00 98 00  : .......( `.......
6000A830 - D7 01 13 40 E1 01 0F 21  00 00 00 00 01 00 00 03  : ...@...! ........
6000A840 - C1 F8 EC 22 94 4B A3 B8  A1 91 18 51 1A BD DF 08  : ...".K.. ...Q....
6000A850 - 4B FC FF 2F 60 0D 9F 5F  1F 1D A5 26 FF 8C EF C7  : K../`.._ ...&....
6000A860 - 8F D2 10 BD B5 D6 08 65  9E 3B 2E 62 B1 D9 AF 60  : .......e .;.b...`
6000A870 - D6 F3 B6 38 E7 8D 99 1B  13 AE A1 A3 8F 61 C4 63  : ...8.... .....a.c
---	ITCM used
0000562C - BF F6 4B AE 54 EA 05 03  7F F4 4D AE 38 AE 30 34  : ..K.T... ..M.8.04
0000563C - 06 F8 41 4D 28 AB 9B 1B  08 93 08 9B 43 45 B8 BF  : ..AM(... ....CE..
0000564C - 43 46 04 93 00 23 0E 93  8A E6 0C 93 A8 46 00 2A  : CF...#.. .....F.*
0000565C - 40 F0 28 87 1B F0 20 0F  C2 48 00 F0 86 80 09 9F  : @.(... . .H......
0000566C - 07 37 27 F0 07 03 D3 E9  00 45 03 F1 08 02 09 92  : .7'..... .E......
0000567C - 1B F0 01 07 00 F0 47 82  54 EA 05 03 00 F0 A3 84  : ......G. T.......
0000568C - 00 27 30 23 9D F8 30 20  8D F8 50 30 B8 45 8D F8  : .'0#..0  ..P0.E..
0000569C - 51 20 8D F8 4F 70 4B F0  02 03 C0 F2 17 86 2B F0  : Q ..OpK. ......+.
---	ITCM filler to DTCM	 test 3 
0000662C - 01 00 00 00 01 00 00 00  01 00 00 00 01 00 00 00  : ........ ........
...	 411 duplicate line(s) removed.
00007FEC - 01 00 00 00 01 00 00 00  01 00 00 00 01 00 00 00  : ........ ........
00007FFC - 01 00 00 00                                       : ....
 ITCM Start: 
 Given addr of 0  *Skipping Addresses < 32 to avoid access violation
00000020 - 10 B5 05 4C 23 78 33 B9  04 4B 13 B1 04 48 AF F3  : ...L#x3. .K...H..
00000030 - 00 80 01 23 23 70 10 BD  C8 1B 00 20 00 00 00 00  : ...##p.. ... ....
00000040 - 24 66 00 00 08 4B 10 B5  1B B1 08 49 08 48 AF F3  : $f...K.. ...I.H..
00000050 - 00 80 08 48 03 68 03 B9  10 BD 07 4B 00 2B FB D0  : ...H.h.. ...K.+..
00000060 - BD E8 10 40 18 47 00 BF  00 00 00 00 CC 1B 00 20  : ...@.G.. ....... 
00000070 - 24 66 00 00 C8 1B 00 20  00 00 00 00 00 00 00 00  : $f.....  ........
00000080 - 15 4B 04 21 15 4A 1B 68  12 68 9B 1A 00 EE 10 3A  : .K.!.J.h .h.....:
00000090 - 9F ED 0F 7B B8 EE 40 0B  10 B5 11 4C 20 EE 07 0B  : ...{..@. ...L ...
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
Pass: title_text[] is within encrypted region
Pass: csf not Zero

All Tests Passed.  :-)



On the one that I locked, TyCommander fails to upload... Does not give very descriptive error, but then T4 disappears. I then again try the 20-30 push on the program button, and release after the led blinks... And then starts a double blink on the program led.. I then un-integrated tycommander and then Arduino using Teensy sketch was able to program the locked chip...

I then tried the restore process again and again it went into double blink mode. And the current program continued to run.


So so far I have busted anything :D

I am assuming someone has already tried programing one of these chips with the wrong security key?
 
@KurtE reminded me of something I wanted to try: 15s restore on Locked T4.

Did the restore process - got a single blink of the RED LED - heard the beep but the the RED LED blinks twice pauses then blinks twice again and the previously loaded sketch continues to run. So 15s restore seems to fail on a Locked T4.

Think @KurtE did the same test but can't find if his worked or not.

EDIT: Turning on and off stopped the double blinking of the RED LED.

EDIT:
@KurtE - can't remember if I tried writing sketch with a different key but I think I did on a fused but not locked and it failed to load???
 
Worked on rewickering the logger example. Added a few things to help with just basic LittleFS commands and dumping the file without having to load a new sketch by developing a simple menu:
Code:
Menu Options:
	l - List files on disk
	e - Erase files on disk
	s - Start Logging data (Restarting logger will append records to existing log)
	x - Stop Logging data
	d - Dump Log
	h - Menu

Here is the whole sketch that can be used as the base. Note the following probably could use some more comments on the print directory functions.

Code:
/*
  LittleFS  datalogger
 
 This example shows how to log data from three analog sensors
 to an storage device such as a FLASH.
 
 This example code is in the public domain.
 */
#include <LittleFS.h>

// LittleFS supports creating file systems (FS) in multiple memory types.  Depending on the 
// memory type you want to use you would uncomment one of the following constructors

//LittleFS_QSPIFlash myfs;  // Used to create FS on QSPI NOR flash chips located on the bottom of the T4.1 such as the W25Q16JV*IQ/W25Q16FV,  for the full list of supported NOR flash see https://github.com/PaulStoffregen/LittleFS#nor-flash
LittleFS_QPINAND myfs;  // Used to create FS on QSPI NAND flash chips located on the bottom of the T4.1 such as the W25N01G. for the full list of supported NAND flash see  https://github.com/PaulStoffregen/LittleFS#nand-flash

File dataFile;  // Specifes that dataFile is of File type

int record_count = 0;
bool write_data = false;

void setup()
{

  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    // wait for serial port to connect.
  }

  Serial.print("Initializing LittleFS ...");

  // see if the Flash is present and can be initialized:
  if (!myfs.begin()) {
    Serial.printf("Error starting %s\n", "QSPI FLASH");
    while (1) {
      // Error, so don't do anything more - stay stuck here
    }
  }
  Serial.println("LittleFS initialized.");
  
  menu();
  
}

void loop()
{ 
  if ( Serial.available() ) {
    char rr;
    rr = Serial.read();
    if (rr == 'l') listFiles();
    if (rr == 'e') eraseFiles();
    if (rr == 's') {
      Serial.println("\nLogging Data!!!");
      write_data = true;   // sets flag to continue to write data until new command is received
      // opens a file or creates a file if not present,  FILE_WRITE will append data to 
      // to the file created.
      dataFile = myfs.open("datalog.txt", FILE_WRITE);
      logData();
    }
    if (rr == 'x') stopLogging();
    if (rr == 'd') dumpLog();
    if (rr == 'h') menu();
  } 

  if(write_data) logData();
}

void logData()
{
    // make a string for assembling the data to log:
    String dataString = "";
  
    // read three sensors and append to the string:
    for (int analogPin = 0; analogPin < 3; analogPin++) {
      int sensor = analogRead(analogPin);
      dataString += String(sensor);
      if (analogPin < 2) {
        dataString += ",";
      }
    }
  
    // if the file is available, write to it:
    if (dataFile) {
      dataFile.println(dataString);
      // print to the serial port too:
      Serial.println(dataString);
      record_count += 1;
    } else {
      // if the file isn't open, pop up an error:
      Serial.println("error opening datalog.txt");
    }
    delay(100); // run at a reasonable not-too-fast speed for testing
}

void stopLogging()
{
  Serial.println("\nStopped Logging Data!!!");
  write_data = false;
  // Closes the data file.
  dataFile.close();
  Serial.printf("Records written = %d\n", record_count);
}


void dumpLog()
{
  Serial.println("\nDumping Log!!!");
  // open the file.
  dataFile = myfs.open("datalog.txt");

  // if the file is available, write to it:
  if (dataFile) {
    while (dataFile.available()) {
      Serial.write(dataFile.read());
    }
    dataFile.close();
  }  
  // if the file isn't open, pop up an error:
  else {
    Serial.println("error opening datalog.txt");
  } 
}

void menu()
{
  Serial.println();
  Serial.println("Menu Options:");
  Serial.println("\tl - List files on disk");
  Serial.println("\te - Erase files on disk");
  Serial.println("\ts - Start Logging data (Restarting logger will append records to existing log)");
  Serial.println("\tx - Stop Logging data");
  Serial.println("\td - Dump Log");
  Serial.println("\th - Menu");
  Serial.println();
}

void listFiles()
{
  Serial.print("\n Space Used = ");
  Serial.println(myfs.usedSize());
  Serial.print("Filesystem Size = ");
  Serial.println(myfs.totalSize());

  printDirectory(myfs);
}

void eraseFiles()
{
  myfs.quickFormat();  // performs a quick format of the created di
  Serial.println("\nFiles erased !");
}

void printDirectory(FS &fs) {
  Serial.println("Directory\n---------");
  printDirectory(fs.open("/"), 0);
  Serial.println();
}

void printDirectory(File dir, int numSpaces) {
   while(true) {
     File entry = dir.openNextFile();
     if (! entry) {
       //Serial.println("** no more files **");
       break;
     }
     printSpaces(numSpaces);
     Serial.print(entry.name());
     if (entry.isDirectory()) {
       Serial.println("/");
       printDirectory(entry, numSpaces+2);
     } else {
       // files have sizes, directories do not
       printSpaces(36 - numSpaces - strlen(entry.name()));
       Serial.print("  ");
       Serial.println(entry.size(), DEC);
     }
     entry.close();
   }
}

void printSpaces(int num) {
  for (int i=0; i < num; i++) {
    Serial.print(" ");
  }
}
 
Created second key:
Tried to program the locked teensy and saw:

The teensy Windows:
screenshot.jpg
But I am not sure I noticed anything in the Arduino window... It just showed: Done Uploading


Tried on one that is not locked and tried loading blink with simple quick tests to see if encryption is running...

The program compiled and uploaded just fine... However it was not using the .ehex file...
Wonder if there should be some warning back to the build process?

Code:
Fail: Bus Encryption Engine is not active
Fail: Encryption region starts at wrong address

Code:
08:11:33.639 (loader): remote connection 2032 closed
08:11:58.741 (post_compile 38): Begin, version=1.55-beta1, high-res time
08:11:58.742 (loader): remote connection 1820 opened
08:11:58.743 (loader): remote cmd from 1820: "comment: Teensyduino 1.55-beta1 - WINDOWS (teensy_post_compile)"
08:11:58.744 (post_compile 38): Sending command: comment: Teensyduino 1.55-beta1 - WINDOWS (teensy_post_compile)
08:11:58.744 (loader): remote cmd from 1820: "status"
08:11:58.747 (loader): remote cmd from 1820: "dir:C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\"
08:11:58.747 (post_compile 38): Status: 1, 1, 0, 8, 0, 0, C:\Users\kurte\AppData\Local\Temp\arduino_build_301445\, T4MemInfoKitchen.ino.hex
08:11:58.747 (post_compile 38): Sending command: dir:C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\
08:11:58.748 (loader): remote cmd from 1820: "file:Blink.pde.hex"
08:11:58.749 (post_compile 38): Sending command: file:Blink.pde.hex
08:11:58.760 (loader): File "C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\Blink.pde.hex", 18432 bytes
08:11:58.768 (loader): File "C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\Blink.pde.ehex", 18432 bytes, 4960 extra
08:11:58.769 (loader): ehex is valid, key hash: 780F523E 230AF722 9012E6EE F46FD7CD 4DD51787 3FBD9C56 5662764C 76EEC228
08:11:58.776 (loader): remote cmd from 1820: "status"
08:11:58.779 (post_compile 38): Status: 1, 1, 0, 8, 0, 0, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:11:58.779 (post_compile 38): Disconnect
08:11:58.805 (loader): remote connection 1820 closed
08:11:58.999 (post_compile 39): Begin, version=1.55-beta1, high-res time
08:11:59.000 (loader): remote connection 1900 opened
08:11:59.002 (loader): remote cmd from 1900: "comment: Teensyduino 1.55-beta1 - WINDOWS (teensy_post_compile)"
08:11:59.003 (post_compile 39): Sending command: comment: Teensyduino 1.55-beta1 - WINDOWS (teensy_post_compile)
08:11:59.004 (loader): remote cmd from 1900: "status"
08:11:59.008 (loader): remote cmd from 1900: "dir:C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\"
08:11:59.009 (post_compile 39): Status: 1, 1, 0, 8, 0, 0, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:11:59.009 (post_compile 39): Sending command: dir:C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\
08:11:59.010 (loader): remote cmd from 1900: "file:Blink.pde.hex"
08:11:59.011 (post_compile 39): Sending command: file:Blink.pde.hex
08:11:59.018 (loader): File "C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\Blink.pde.hex", 18432 bytes
08:11:59.023 (loader): File "C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\Blink.pde.ehex", 18432 bytes, 4960 extra
08:11:59.025 (loader): ehex is valid, key hash: 780F523E 230AF722 9012E6EE F46FD7CD 4DD51787 3FBD9C56 5662764C 76EEC228
08:11:59.034 (loader): remote cmd from 1900: "status"
08:11:59.039 (post_compile 39): Status: 1, 1, 0, 8, 0, 0, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:11:59.039 (post_compile 39): Disconnect
08:11:59.054 (loader): remote connection 1900 closed
08:11:59.054 (post_compile 40): Running teensy_reboot: "C:\arduino-1.8.15\hardware\teensy\..\tools\teensy_reboot.exe" teensy_reboot.exe "-board=TEENSY40" "-port=usb:0/140000/0/1/3" "-portlabel=hid#vid_16c0&pid_0478 Bootloader" "-portprotocol=Teensy"
08:11:59.061 (loader): remote connection 1900 opened
08:11:59.087 (reboot 41): Begin, version=1.55-beta1, high-res time
08:11:59.087 (reboot 41): location = usb:0/140000/0/1/3
08:11:59.087 (reboot 41): portprotocol = Teensy
08:11:59.087 (reboot 41): portlabel = hid#vid_16c0&pid_0478 Bootloader
08:11:59.087 (reboot 41): Only location usb:0/140000/0/1/3 will be tried
08:11:59.087 (reboot 41): LoadLibrary cfgmgr32 ok
08:11:59.087 (reboot 41): LoadLibrary ntdll ok
08:11:59.088 (reboot 41): found_usb_device, id=\\?\usb#vid_16c0&pid_0483#10379940#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:11:59.088 (reboot 41): found_usb_device, loc=usb:0/140000/0/1/3    Port_#0003.Hub_#0005
08:11:59.088 (reboot 41): found_usb_device, hwid=USB\VID_16C0&PID_0483&REV_0279
08:11:59.088 (reboot 41): found_usb_device, devinst=00000005
08:11:59.088 (reboot 41): add: loc=usb:0/140000/0/1/3, class=USB, vid=16C0, pid=0483, ver=0279, serial=10379940, dev=\\?\usb#vid_16c0&pid_0483#10379940#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:11:59.088 (reboot 41):   comport_from_devinst_list attempt
08:11:59.088 (reboot 41):   found Ports in classguid_list at index=1
08:11:59.088 (reboot 41):   port COM81 found from devnode
08:11:59.088 (reboot 41): found_usb_device complete
08:11:59.093 (loader): remote connection 1616 opened
08:11:59.096 (loader): remote cmd from 1616: "show:arduino_attempt_reboot"
08:11:59.096 (reboot 41): found Teensy Loader, version 1.55
08:11:59.096 (reboot 41): Sending command: show:arduino_attempt_reboot
08:11:59.099 (loader): got request to show arduino rebooting message
08:11:59.106 (loader): remote cmd from 1616: "comment: Teensyduino 1.55-beta1 - WINDOWS (teensy_reboot)"
08:11:59.106 (reboot 41): Sending command: comment: Teensyduino 1.55-beta1 - WINDOWS (teensy_reboot)
08:11:59.111 (loader): remote cmd from 1616: "status"
08:11:59.117 (reboot 41): Status: 1, 1, 0, 8, 0, 0, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:11:59.117 (reboot 41): do_reset (serial) COM81
08:11:59.119 (loader): remote cmd from 1616: "status"
08:11:59.128 (reboot 41): Status: 1, 1, 0, 8, 0, 0, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:11:59.128 (reboot 41): status read, retry 0
08:11:59.142 (ports 19): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
08:11:59.144 (ports 19): remove: loc=usb:0/140000/0/1/3
08:11:59.144 (ports 19): usb_remove: usb:0/140000/0/1/3
08:11:59.144 (ports 19): nothing new, skipping HID & Ports enum
08:11:59.171 (ports 19): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:11:59.172 (ports 19): nothing new, skipping HID & Ports enum
08:11:59.173 (ports 19): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
08:11:59.175 (ports 19): nothing new, skipping HID & Ports enum
08:11:59.240 (loader): remote cmd from 1616: "status"
08:11:59.246 (reboot 41): Status: 1, 1, 0, 8, 0, 0, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:11:59.246 (reboot 41): status read, retry 1
08:11:59.348 (loader): remote cmd from 1616: "status"
08:11:59.355 (ports 19): WM_DEVICECHANGE DBT_DEVICEARRIVAL
08:11:59.355 (reboot 41): Status: 1, 1, 0, 8, 0, 0, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:11:59.355 (reboot 41): status read, retry 2
08:11:59.356 (ports 19): found_usb_device, id=\\?\usb#vid_16c0&pid_0478#000fd6aa#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:11:59.356 (ports 19): found_usb_device, loc=usb:0/140000/0/1/3    Port_#0003.Hub_#0005
08:11:59.356 (ports 19): found_usb_device, hwid=USB\VID_16C0&PID_0478&REV_0107
08:11:59.356 (ports 19): found_usb_device, devinst=00000015
08:11:59.356 (ports 19): add: loc=usb:0/140000/0/1/3, class=HID, vid=16C0, pid=0478, ver=0107, serial=000fd6aa, dev=\\?\usb#vid_16c0&pid_0478#000fd6aa#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:11:59.357 (ports 19): hiddev_from_devinst_list: iface=0
08:11:59.358 (ports 19): found_usb_device complete
08:11:59.358 (ports 19): hid, found devinst=00000016
08:11:59.358 (ports 19): hid, path=\\?\hid#vid_16c0&pid_0478#7&2e03e660&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
08:11:59.358 (ports 19): hid,  opened handle
08:11:59.359 (ports 19):  devinst=00000016, location=usb:0/140000/0/1/3
08:11:59.359 (ports 19):  vid=16C0, pid=0478, ver=0107, usepage=FF9C, use=0024
08:11:59.359 (ports 19):  devpath=\\?\hid#vid_16c0&pid_0478#7&2e03e660&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
08:11:59.359 (ports 19): usb_add: usb:0/140000/0/1/3  hid#vid_16c0&pid_0478 (Teensy 4.0) Bootloader
08:11:59.434 (loader): encryption is optional, public key hash: FB63C934 9683889D 3A20DB52 811A0593 83BEA33F 0F810CDF D6AD3C83 5DF1DA1A
08:11:59.437 (loader): Device came online, code_size = 2031616
08:11:59.441 (loader): Board is: Teensy 4.0 (IMXRT1062), version 1.07
08:11:59.452 (loader): File "C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\Blink.pde.hex", 18432 bytes
08:11:59.461 (loader): File "C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\Blink.pde.ehex", 18432 bytes, 4960 extra
08:11:59.466 (loader): ehex is valid, key hash: 780F523E 230AF722 9012E6EE F46FD7CD 4DD51787 3FBD9C56 5662764C 76EEC228
08:11:59.475 (loader): set background IMG_ONLINE
08:11:59.488 (loader): File "C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\Blink.pde.hex", 18432 bytes
08:11:59.496 (loader): File "C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\Blink.pde.ehex", 18432 bytes, 4960 extra
08:11:59.499 (loader): ehex is valid, key hash: 780F523E 230AF722 9012E6EE F46FD7CD 4DD51787 3FBD9C56 5662764C 76EEC228
08:11:59.505 (loader): elf appears to be for Teensy 4.0 (IMXRT1062) (2031616 bytes)
08:11:59.510 (loader): elf binary data matches hex file
08:11:59.514 (loader): elf file is for Teensy 4.0 (IMXRT1062)
08:11:59.517 (loader): ehex encrypted with wrong key, use hex
08:11:59.570 (loader): begin operation
08:11:59.586 (loader): remote cmd from 1616: "status"
08:11:59.593 (reboot 41): Status: 1, 1, 1, 9, 0, 1, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:11:59.596 (ports 19): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:11:59.597 (ports 19): nothing new, skipping HID & Ports enum
08:11:59.621 (loader): flash, block=0, bs=1024, auto=1
08:11:59.626 (loader): flash, block=1, bs=1024, auto=1
08:11:59.627 (ports 19): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:11:59.629 (ports 19): nothing new, skipping HID & Ports enum
08:11:59.630 (loader): flash, block=2, bs=1024, auto=1
08:11:59.801 (loader): remote cmd from 1616: "status"
08:11:59.802 (reboot 41): Status: 1, 1, 1, 9, 0, 1, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:11:59.816 (loader): flash, block=3, bs=1024, auto=1
08:11:59.820 (loader): flash, block=4, bs=1024, auto=1
08:11:59.825 (loader): flash, block=5, bs=1024, auto=1
08:11:59.829 (loader): flash, block=6, bs=1024, auto=1
08:11:59.834 (loader): flash, block=7, bs=1024, auto=1
08:11:59.839 (loader): flash, block=8, bs=1024, auto=1
08:11:59.844 (loader): flash, block=9, bs=1024, auto=1
08:11:59.849 (loader): flash, block=10, bs=1024, auto=1
08:11:59.853 (loader): flash, block=11, bs=1024, auto=1
08:11:59.857 (loader): flash, block=12, bs=1024, auto=1
08:11:59.862 (loader): flash, block=13, bs=1024, auto=1
08:11:59.868 (loader): remote cmd from 1616: "status"
08:11:59.878 (loader): flash, block=14, bs=1024, auto=1
08:11:59.878 (reboot 41): Status: 1, 1, 1, 9, 0, 1, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:11:59.883 (loader): flash, block=15, bs=1024, auto=1
08:11:59.888 (loader): flash, block=16, bs=1024, auto=1
08:11:59.898 (loader): flash, block=17, bs=1024, auto=1
08:11:59.917 (loader): sending reboot
08:11:59.926 (loader): begin wait_until_offline
08:11:59.929 (ports 19): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
08:11:59.931 (ports 19): remove: loc=usb:0/140000/0/1/3
08:11:59.931 (ports 19): usb_remove: usb:0/140000/0/1/3
08:11:59.931 (ports 19): nothing new, skipping HID & Ports enum
08:11:59.933 (loader): offline, waited 0
08:11:59.937 (loader): end operation, total time = 0.364 seconds
08:11:59.943 (loader): set background IMG_REBOOT_OK
08:11:59.951 (loader): redraw timer set, image 14 to show for 1200 ms
08:11:59.958 (loader): remote cmd from 1616: "status"
08:11:59.960 (loader): HID/win32:  vid:058F pid:9410 ver:0122
08:11:59.960 (loader): HID/win32:  vid:058F pid:9410 ver:0122
08:11:59.960 (loader): HID/win32:  vid:045E pid:07A5 ver:0797
08:11:59.960 (loader): HID/win32:  vid:045E pid:07A5 ver:0797
08:11:59.960 (loader): HID/win32:  vid:045E pid:07A5 ver:0797
08:11:59.960 (loader): HID/win32:  vid:045E pid:07A5 ver:0797
08:11:59.961 (reboot 41): Status: 1, 1, 0, 9, 0, 0, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:11:59.961 (reboot 41): status read, retry 3
08:11:59.961 (reboot 41): Success
08:11:59.961 (reboot 41): Disconnect
08:11:59.994 (loader): remote connection 1616 closed
08:12:00.007 (loader): remote connection 1900 closed
08:12:00.098 (ports 19): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:12:00.099 (ports 19): nothing new, skipping HID & Ports enum
08:12:00.190 (serialmon 42): Begin, version=1.55-beta1, high-res time
08:12:00.190 (serialmon 42): listening for location: usb:0/140000/0/1/3
08:12:00.190 (serialmon 42): LoadLibrary cfgmgr32 ok
08:12:00.190 (serialmon 42): LoadLibrary ntdll ok
08:12:00.208 (serialmon 42): callback 0024
08:12:00.208 (serialmon 42): callback 0081
08:12:00.214 (serialmon 42): callback 0083
08:12:00.214 (serialmon 42): hWnd = 1968846
08:12:00.220 (serialmon 42): nothing new, skipping HID & Ports enum
08:12:00.224 (loader): remote connection 1900 opened
08:12:00.229 (serialmon 42): loop stdin, ready=262143
08:12:00.269 (ports 19): WM_DEVICECHANGE DBT_DEVICEARRIVAL
08:12:00.271 (ports 19): found_usb_device, id=\\?\usb#vid_16c0&pid_0483#10379940#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:12:00.271 (ports 19): found_usb_device, loc=usb:0/140000/0/1/3    Port_#0003.Hub_#0005
08:12:00.271 (ports 19): found_usb_device, hwid=USB\VID_16C0&PID_0483&REV_0279
08:12:00.271 (ports 19): found_usb_device, devinst=00000005
08:12:00.271 (ports 19): add: loc=usb:0/140000/0/1/3, class=USB, vid=16C0, pid=0483, ver=0279, serial=10379940, dev=\\?\usb#vid_16c0&pid_0483#10379940#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:12:00.271 (ports 19):   comport_from_devinst_list attempt
08:12:00.271 (ports 19):   found Ports in classguid_list at index=1
08:12:00.271 (ports 19):   port COM81 found from devnode
08:12:00.271 (ports 19): found_usb_device complete
08:12:00.272 (ports 19): usb_add: usb:0/140000/0/1/3  COM81 (Teensy 4.0) Serial
08:12:00.285 (serialmon 42): WM_DEVICECHANGE DBT_DEVICEARRIVAL
08:12:00.285 (serialmon 42): found_usb_device, id=\\?\usb#vid_16c0&pid_0483#10379940#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:12:00.285 (serialmon 42): found_usb_device, loc=usb:0/140000/0/1/3    Port_#0003.Hub_#0005
08:12:00.285 (serialmon 42): found_usb_device, hwid=USB\VID_16C0&PID_0483&REV_0279
08:12:00.285 (serialmon 42): found_usb_device, devinst=00000005
08:12:00.285 (serialmon 42): add: loc=usb:0/140000/0/1/3, class=USB, vid=16C0, pid=0483, ver=0279, serial=10379940, dev=\\?\usb#vid_16c0&pid_0483#10379940#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:12:00.285 (serialmon 42):   comport_from_devinst_list attempt
08:12:00.285 (serialmon 42):   found Ports in classguid_list at index=1
08:12:00.286 (serialmon 42):   port COM81 found from devnode
08:12:00.286 (serialmon 42): found_usb_device complete
08:12:00.287 (serialmon 42): usb_add: usb:0/140000/0/1/3
08:12:00.287 (serialmon 42): translate "COM81" -> "\\.\COM81"
08:12:00.464 (serialmon 42): GetDefaultCommConfig success
08:12:00.561 (serialmon 42): SetDefaultCommConfig success
08:12:00.561 (serialmon 42): Opened \\.\COM81 Serial
08:12:00.563 (ports 19): callback 001A
08:12:00.568 (serialmon 42): WM_DEVICECHANGE DBT_DEVICEARRIVAL
08:12:00.569 (serialmon 42): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:12:00.572 (serialmon 42): callback 001A
08:12:00.574 (serialmon 42): nothing new, skipping HID & Ports enum
08:12:00.841 (ports 19): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:12:00.841 (ports 19): WM_DEVICECHANGE DBT_DEVICEARRIVAL
08:12:00.844 (ports 19): nothing new, skipping HID & Ports enum
08:12:01.167 (loader): redraw, image 9
08:15:51.412 (loader): remote connection 1900 closed
08:16:15.897 (serialmon 43): Begin, version=1.55-beta1, high-res time
08:16:15.897 (serialmon 43): listening for location: usb:0/140000/0/1/3
08:16:15.897 (serialmon 43): LoadLibrary cfgmgr32 ok
08:16:15.897 (serialmon 43): LoadLibrary ntdll ok
08:16:15.901 (serialmon 43): callback 0024
08:16:15.901 (serialmon 43): callback 0081
08:16:15.902 (serialmon 43): callback 0083
08:16:15.903 (serialmon 43): hWnd = 986148
08:16:15.903 (serialmon 43): loop stdin, ready=262143
08:16:15.904 (serialmon 43): found_usb_device, id=\\?\usb#vid_16c0&pid_0483#10379940#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:16:15.904 (serialmon 43): found_usb_device, loc=usb:0/140000/0/1/3    Port_#0003.Hub_#0005
08:16:15.904 (serialmon 43): found_usb_device, devinst=00000005
08:16:15.904 (serialmon 43): found_usb_device, hwid=USB\VID_16C0&PID_0483&REV_0279
08:16:15.904 (serialmon 43): add: loc=usb:0/140000/0/1/3, class=USB, vid=16C0, pid=0483, ver=0279, serial=10379940, dev=\\?\usb#vid_16c0&pid_0483#10379940#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:16:15.904 (serialmon 43):   comport_from_devinst_list attempt
08:16:15.904 (serialmon 43):   found Ports in classguid_list at index=1
08:16:15.904 (serialmon 43):   port COM81 found from devnode
08:16:15.904 (serialmon 43): found_usb_device complete
08:16:15.907 (serialmon 43): usb_add: usb:0/140000/0/1/3
08:16:15.907 (serialmon 43): translate "COM81" -> "\\.\COM81"
08:16:15.986 (serialmon 43): GetDefaultCommConfig success
08:16:16.062 (serialmon 43): SetDefaultCommConfig success
08:16:16.062 (serialmon 43): Opened \\.\COM81 Serial
08:16:16.071 (ports 19): callback 001A
08:16:16.083 (loader): remote connection 1900 opened
08:16:52.041 (loader): remote connection 1900 closed
08:17:16.921 (serialmon 44): Begin, version=1.55-beta1, high-res time
08:17:16.921 (serialmon 44): listening for location: usb:0/140000/0/1/3
08:17:16.921 (serialmon 44): LoadLibrary cfgmgr32 ok
08:17:16.921 (serialmon 44): LoadLibrary ntdll ok
08:17:16.925 (serialmon 44): callback 0024
08:17:16.925 (serialmon 44): callback 0081
08:17:16.927 (serialmon 44): callback 0083
08:17:16.927 (serialmon 44): hWnd = 23398886
08:17:16.927 (serialmon 44): loop stdin, ready=262143
08:17:16.929 (serialmon 44): found_usb_device, id=\\?\usb#vid_16c0&pid_0483#10379940#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:17:16.929 (serialmon 44): found_usb_device, loc=usb:0/140000/0/1/3    Port_#0003.Hub_#0005
08:17:16.929 (serialmon 44): found_usb_device, devinst=00000005
08:17:16.929 (serialmon 44): found_usb_device, hwid=USB\VID_16C0&PID_0483&REV_0279
08:17:16.929 (serialmon 44): add: loc=usb:0/140000/0/1/3, class=USB, vid=16C0, pid=0483, ver=0279, serial=10379940, dev=\\?\usb#vid_16c0&pid_0483#10379940#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:17:16.929 (serialmon 44):   comport_from_devinst_list attempt
08:17:16.929 (serialmon 44):   found Ports in classguid_list at index=1
08:17:16.929 (serialmon 44):   port COM81 found from devnode
08:17:16.929 (serialmon 44): found_usb_device complete
08:17:16.931 (serialmon 44): usb_add: usb:0/140000/0/1/3
08:17:16.931 (serialmon 44): translate "COM81" -> "\\.\COM81"
08:17:17.002 (serialmon 44): GetDefaultCommConfig success
08:17:17.080 (serialmon 44): SetDefaultCommConfig success
08:17:17.080 (serialmon 44): Opened \\.\COM81 Serial
08:17:17.088 (ports 19): callback 001A
08:17:17.105 (loader): remote connection 1828 opened
08:18:12.308 (loader): remote connection 1828 closed
08:18:36.797 (serialmon 45): Begin, version=1.55-beta1, high-res time
08:18:36.797 (serialmon 45): listening for location: usb:0/140000/0/1/3
08:18:36.797 (serialmon 45): LoadLibrary cfgmgr32 ok
08:18:36.797 (serialmon 45): LoadLibrary ntdll ok
08:18:36.801 (serialmon 45): callback 0024
08:18:36.801 (serialmon 45): callback 0081
08:18:36.803 (serialmon 45): callback 0083
08:18:36.803 (serialmon 45): hWnd = 2099808
08:18:36.804 (serialmon 45): loop stdin, ready=262143
08:18:36.805 (serialmon 45): found_usb_device, id=\\?\usb#vid_16c0&pid_0483#10379940#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:18:36.805 (serialmon 45): found_usb_device, loc=usb:0/140000/0/1/3    Port_#0003.Hub_#0005
08:18:36.805 (serialmon 45): found_usb_device, devinst=00000005
08:18:36.805 (serialmon 45): found_usb_device, hwid=USB\VID_16C0&PID_0483&REV_0279
08:18:36.805 (serialmon 45): add: loc=usb:0/140000/0/1/3, class=USB, vid=16C0, pid=0483, ver=0279, serial=10379940, dev=\\?\usb#vid_16c0&pid_0483#10379940#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:18:36.805 (serialmon 45):   comport_from_devinst_list attempt
08:18:36.805 (serialmon 45):   found Ports in classguid_list at index=1
08:18:36.805 (serialmon 45):   port COM81 found from devnode
08:18:36.805 (serialmon 45): found_usb_device complete
08:18:36.808 (serialmon 45): usb_add: usb:0/140000/0/1/3
08:18:36.808 (serialmon 45): translate "COM81" -> "\\.\COM81"
08:18:36.882 (serialmon 45): GetDefaultCommConfig success
08:18:36.959 (serialmon 45): SetDefaultCommConfig success
08:18:36.959 (serialmon 45): Opened \\.\COM81 Serial
08:18:36.965 (ports 19): callback 001A
08:18:36.981 (loader): remote connection 1504 opened
08:20:18.839 (loader): remote connection 1504 closed
08:20:44.230 (loader): file changed
08:20:44.248 (loader): File "C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\Blink.pde.hex", 41984 bytes
08:20:44.265 (loader): File "C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\Blink.pde.ehex", 41984 bytes, 4960 extra
08:20:44.269 (loader): ehex is valid, key hash: 780F523E 230AF722 9012E6EE F46FD7CD 4DD51787 3FBD9C56 5662764C 76EEC228
08:20:44.335 (post_compile 46): Begin, version=1.55-beta1, high-res time
08:20:44.337 (loader): remote connection 1572 opened
08:20:44.341 (loader): remote cmd from 1572: "comment: Teensyduino 1.55-beta1 - WINDOWS (teensy_post_compile)"
08:20:44.341 (post_compile 46): Sending command: comment: Teensyduino 1.55-beta1 - WINDOWS (teensy_post_compile)
08:20:44.344 (loader): remote cmd from 1572: "status"
08:20:44.349 (loader): remote cmd from 1572: "dir:C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\"
08:20:44.349 (post_compile 46): Status: 1, 1, 0, 9, 0, 0, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:20:44.349 (post_compile 46): Sending command: dir:C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\
08:20:44.352 (loader): remote cmd from 1572: "file:Blink.pde.hex"
08:20:44.353 (post_compile 46): Sending command: file:Blink.pde.hex
08:20:44.366 (loader): File "C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\Blink.pde.hex", 41984 bytes
08:20:44.375 (loader): File "C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\Blink.pde.ehex", 41984 bytes, 4960 extra
08:20:44.378 (loader): ehex is valid, key hash: 780F523E 230AF722 9012E6EE F46FD7CD 4DD51787 3FBD9C56 5662764C 76EEC228
08:20:44.387 (loader): remote cmd from 1572: "status"
08:20:44.394 (post_compile 46): Status: 1, 1, 0, 9, 0, 0, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:20:44.394 (post_compile 46): Disconnect
08:20:44.417 (loader): remote connection 1572 closed
08:20:44.601 (post_compile 47): Begin, version=1.55-beta1, high-res time
08:20:44.603 (loader): remote connection 1732 opened
08:20:44.608 (post_compile 47): Sending command: comment: Teensyduino 1.55-beta1 - WINDOWS (teensy_post_compile)
08:20:44.608 (loader): remote cmd from 1732: "comment: Teensyduino 1.55-beta1 - WINDOWS (teensy_post_compile)"
08:20:44.612 (loader): remote cmd from 1732: "status"
08:20:44.618 (loader): remote cmd from 1732: "dir:C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\"
08:20:44.619 (post_compile 47): Status: 1, 1, 0, 9, 0, 0, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:20:44.619 (post_compile 47): Sending command: dir:C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\
08:20:44.622 (post_compile 47): Sending command: file:Blink.pde.hex
08:20:44.623 (loader): remote cmd from 1732: "file:Blink.pde.hex"
08:20:44.634 (loader): File "C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\Blink.pde.hex", 41984 bytes
08:20:44.643 (loader): File "C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\Blink.pde.ehex", 41984 bytes, 4960 extra
08:20:44.646 (loader): ehex is valid, key hash: 780F523E 230AF722 9012E6EE F46FD7CD 4DD51787 3FBD9C56 5662764C 76EEC228
08:20:44.655 (loader): remote cmd from 1732: "status"
08:20:44.660 (post_compile 47): Status: 1, 1, 0, 9, 0, 0, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:20:44.660 (post_compile 47): Disconnect
08:20:44.681 (loader): remote connection 1732 closed
08:20:44.681 (post_compile 48): Running teensy_reboot: "C:\arduino-1.8.15\hardware\teensy\..\tools\teensy_reboot.exe" teensy_reboot.exe "-board=TEENSY40" "-port=usb:0/140000/0/1/3" "-portlabel=hid#vid_16c0&pid_0478 Bootloader" "-portprotocol=Teensy"
08:20:44.684 (loader): remote connection 1732 opened
08:20:44.709 (reboot 49): Begin, version=1.55-beta1, high-res time
08:20:44.709 (reboot 49): location = usb:0/140000/0/1/3
08:20:44.709 (reboot 49): portprotocol = Teensy
08:20:44.709 (reboot 49): portlabel = hid#vid_16c0&pid_0478 Bootloader
08:20:44.709 (reboot 49): Only location usb:0/140000/0/1/3 will be tried
08:20:44.709 (reboot 49): LoadLibrary cfgmgr32 ok
08:20:44.709 (reboot 49): LoadLibrary ntdll ok
08:20:44.711 (reboot 49): found_usb_device, id=\\?\usb#vid_16c0&pid_0483#10379940#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:20:44.711 (reboot 49): found_usb_device, loc=usb:0/140000/0/1/3    Port_#0003.Hub_#0005
08:20:44.711 (reboot 49): found_usb_device, hwid=USB\VID_16C0&PID_0483&REV_0279
08:20:44.711 (reboot 49): found_usb_device, devinst=00000005
08:20:44.711 (reboot 49): add: loc=usb:0/140000/0/1/3, class=USB, vid=16C0, pid=0483, ver=0279, serial=10379940, dev=\\?\usb#vid_16c0&pid_0483#10379940#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:20:44.711 (reboot 49):   comport_from_devinst_list attempt
08:20:44.711 (reboot 49):   found Ports in classguid_list at index=1
08:20:44.711 (reboot 49):   port COM81 found from devnode
08:20:44.711 (reboot 49): found_usb_device complete
08:20:44.715 (loader): remote connection 1572 opened
08:20:44.718 (loader): remote cmd from 1572: "show:arduino_attempt_reboot"
08:20:44.719 (reboot 49): found Teensy Loader, version 1.55
08:20:44.719 (reboot 49): Sending command: show:arduino_attempt_reboot
08:20:44.721 (loader): got request to show arduino rebooting message
08:20:44.727 (reboot 49): Sending command: comment: Teensyduino 1.55-beta1 - WINDOWS (teensy_reboot)
08:20:44.727 (loader): remote cmd from 1572: "comment: Teensyduino 1.55-beta1 - WINDOWS (teensy_reboot)"
08:20:44.730 (loader): remote cmd from 1572: "status"
08:20:44.736 (reboot 49): Status: 1, 1, 0, 9, 0, 0, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:20:44.736 (reboot 49): do_reset (serial) COM81
08:20:44.738 (loader): remote cmd from 1572: "status"
08:20:44.746 (reboot 49): Status: 1, 1, 0, 9, 0, 0, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:20:44.746 (reboot 49): status read, retry 0
08:20:44.766 (ports 19): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
08:20:44.771 (ports 19): remove: loc=usb:0/140000/0/1/3
08:20:44.771 (ports 19): usb_remove: usb:0/140000/0/1/3
08:20:44.771 (ports 19): nothing new, skipping HID & Ports enum
08:20:44.805 (ports 19): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
08:20:44.806 (ports 19): nothing new, skipping HID & Ports enum
08:20:44.806 (ports 19): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:20:44.808 (ports 19): nothing new, skipping HID & Ports enum
08:20:44.849 (loader): remote cmd from 1572: "status"
08:20:44.858 (reboot 49): Status: 1, 1, 0, 9, 0, 0, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:20:44.858 (reboot 49): status read, retry 1
08:20:44.973 (ports 19): WM_DEVICECHANGE DBT_DEVICEARRIVAL
08:20:44.975 (ports 19): found_usb_device, id=\\?\usb#vid_16c0&pid_0478#000fd6aa#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:20:44.975 (ports 19): found_usb_device, loc=usb:0/140000/0/1/3    Port_#0003.Hub_#0005
08:20:44.975 (ports 19): found_usb_device, hwid=USB\VID_16C0&PID_0478&REV_0107
08:20:44.975 (ports 19): found_usb_device, devinst=00000015
08:20:44.975 (ports 19): add: loc=usb:0/140000/0/1/3, class=HID, vid=16C0, pid=0478, ver=0107, serial=000fd6aa, dev=\\?\usb#vid_16c0&pid_0478#000fd6aa#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:20:44.975 (ports 19): hiddev_from_devinst_list: iface=0
08:20:44.977 (ports 19): found_usb_device complete
08:20:44.978 (ports 19): hid, found devinst=00000016
08:20:44.978 (ports 19): hid, path=\\?\hid#vid_16c0&pid_0478#7&2e03e660&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
08:20:44.978 (ports 19): hid,  opened handle
08:20:44.978 (ports 19):  devinst=00000016, location=usb:0/140000/0/1/3
08:20:44.978 (ports 19):  vid=16C0, pid=0478, ver=0107, usepage=FF9C, use=0024
08:20:44.978 (ports 19):  devpath=\\?\hid#vid_16c0&pid_0478#7&2e03e660&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
08:20:44.979 (ports 19): usb_add: usb:0/140000/0/1/3  hid#vid_16c0&pid_0478 (Teensy 4.0) Bootloader
08:20:44.983 (loader): remote cmd from 1572: "status"
08:20:44.997 (loader): encryption is optional, public key hash: FB63C934 9683889D 3A20DB52 811A0593 83BEA33F 0F810CDF D6AD3C83 5DF1DA1A
08:20:45.002 (loader): Device came online, code_size = 2031616
08:20:45.006 (loader): Board is: Teensy 4.0 (IMXRT1062), version 1.07
08:20:45.023 (loader): File "C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\Blink.pde.hex", 41984 bytes
08:20:45.038 (loader): File "C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\Blink.pde.ehex", 41984 bytes, 4960 extra
08:20:45.042 (loader): ehex is valid, key hash: 780F523E 230AF722 9012E6EE F46FD7CD 4DD51787 3FBD9C56 5662764C 76EEC228
08:20:45.047 (loader): set background IMG_ONLINE
08:20:45.062 (loader): File "C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\Blink.pde.hex", 41984 bytes
08:20:45.071 (loader): File "C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\Blink.pde.ehex", 41984 bytes, 4960 extra
08:20:45.076 (loader): ehex is valid, key hash: 780F523E 230AF722 9012E6EE F46FD7CD 4DD51787 3FBD9C56 5662764C 76EEC228
08:20:45.082 (loader): elf appears to be for Teensy 4.0 (IMXRT1062) (2031616 bytes)
08:20:45.086 (loader): elf binary data matches hex file
08:20:45.089 (loader): elf file is for Teensy 4.0 (IMXRT1062)
08:20:45.093 (loader): ehex encrypted with wrong key, use hex
08:20:45.144 (loader): begin operation
08:20:45.164 (reboot 49): Status: 1, 1, 1, 10, 0, 1, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:20:45.185 (ports 19): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:20:45.186 (ports 19): nothing new, skipping HID & Ports enum
08:20:45.205 (loader): flash, block=0, bs=1024, auto=1
08:20:45.211 (loader): flash, block=1, bs=1024, auto=1
08:20:45.214 (loader): flash, block=2, bs=1024, auto=1
08:20:45.406 (loader): remote cmd from 1572: "status"
08:20:45.411 (loader): flash, block=3, bs=1024, auto=1
08:20:45.411 (reboot 49): Status: 1, 1, 1, 10, 0, 1, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:20:45.415 (loader): flash, block=4, bs=1024, auto=1
08:20:45.423 (loader): flash, block=5, bs=1024, auto=1
08:20:45.426 (ports 19): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:20:45.427 (ports 19): nothing new, skipping HID & Ports enum
08:20:45.445 (loader): flash, block=6, bs=1024, auto=1
08:20:45.451 (loader): flash, block=7, bs=1024, auto=1
08:20:45.455 (loader): flash, block=8, bs=1024, auto=1
08:20:45.460 (loader): flash, block=9, bs=1024, auto=1
08:20:45.465 (loader): flash, block=10, bs=1024, auto=1
08:20:45.470 (loader): remote cmd from 1572: "status"
08:20:45.473 (loader): flash, block=11, bs=1024, auto=1
08:20:45.473 (reboot 49): Status: 1, 1, 1, 10, 0, 1, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:20:45.485 (loader): flash, block=12, bs=1024, auto=1
08:20:45.491 (loader): flash, block=13, bs=1024, auto=1
08:20:45.498 (loader): flash, block=14, bs=1024, auto=1
08:20:45.502 (loader): flash, block=15, bs=1024, auto=1
08:20:45.507 (loader): flash, block=16, bs=1024, auto=1
08:20:45.517 (loader): flash, block=17, bs=1024, auto=1
08:20:45.526 (loader): flash, block=18, bs=1024, auto=1
08:20:45.534 (loader): remote cmd from 1572: "status"
08:20:45.545 (loader): flash, block=19, bs=1024, auto=1
08:20:45.545 (reboot 49): Status: 1, 1, 1, 10, 0, 1, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:20:45.551 (loader): flash, block=20, bs=1024, auto=1
08:20:45.557 (loader): flash, block=21, bs=1024, auto=1
08:20:45.564 (loader): flash, block=22, bs=1024, auto=1
08:20:45.571 (loader): flash, block=23, bs=1024, auto=1
08:20:45.578 (loader): flash, block=24, bs=1024, auto=1
08:20:45.584 (loader): flash, block=25, bs=1024, auto=1
08:20:45.592 (loader): flash, block=26, bs=1024, auto=1
08:20:45.599 (loader): flash, block=27, bs=1024, auto=1
08:20:45.606 (loader): flash, block=28, bs=1024, auto=1
08:20:45.614 (loader): remote cmd from 1572: "status"
08:20:45.620 (reboot 49): Status: 1, 1, 1, 10, 0, 1, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:20:45.620 (loader): flash, block=29, bs=1024, auto=1
08:20:45.645 (loader): flash, block=30, bs=1024, auto=1
08:20:45.657 (loader): flash, block=31, bs=1024, auto=1
08:20:45.674 (loader): remote cmd from 1572: "status"
08:20:45.681 (reboot 49): Status: 1, 1, 1, 10, 0, 1, C:\Users\kurte\AppData\Local\Temp\arduino_build_300167\, Blink.pde.hex
08:20:45.682 (loader): flash, block=32, bs=1024, auto=1
08:20:45.688 (loader): flash, block=33, bs=1024, auto=1
08:20:45.701 (loader): flash, block=34, bs=1024, auto=1
08:20:45.708 (loader): flash, block=35, bs=1024, auto=1
08:20:45.716 (loader): flash, block=36, bs=1024, auto=1
08:20:45.728 (loader): flash, block=37, bs=1024, auto=1
08:20:45.732 (reboot 49): status read, retry 2
08:20:45.732 (reboot 49): Success
08:20:45.732 (reboot 49): Disconnect
08:20:45.777 (loader): remote connection 1572 closed
08:20:45.796 (loader): remote connection 1732 closed
08:20:45.801 (loader): flash, block=38, bs=1024, auto=1
08:20:45.808 (loader): flash, block=39, bs=1024, auto=1
08:20:45.821 (loader): flash, block=40, bs=1024, auto=1
08:20:45.840 (loader): sending reboot
08:20:45.846 (loader): begin wait_until_offline
08:20:45.851 (loader): offline, waited 0
08:20:45.856 (loader): end operation, total time = 0.708 seconds
08:20:45.867 (loader): set background IMG_REBOOT_OK
08:20:45.869 (ports 19): WM_DEVICECHANGE DBT_DEVICEREMOVECOMPLETE
08:20:45.870 (ports 19): remove: loc=usb:0/140000/0/1/3
08:20:45.870 (ports 19): usb_remove: usb:0/140000/0/1/3
08:20:45.870 (ports 19): nothing new, skipping HID & Ports enum
08:20:45.880 (loader): redraw timer set, image 14 to show for 1200 ms
08:20:45.913 (serialmon 50): Begin, version=1.55-beta1, high-res time
08:20:45.913 (serialmon 50): listening for location: usb:0/140000/0/1/3
08:20:45.913 (serialmon 50): LoadLibrary cfgmgr32 ok
08:20:45.913 (serialmon 50): LoadLibrary ntdll ok
08:20:45.919 (serialmon 50): callback 0024
08:20:45.919 (serialmon 50): callback 0081
08:20:45.921 (serialmon 50): callback 0083
08:20:45.921 (serialmon 50): hWnd = 1051592
08:20:45.922 (serialmon 50): loop stdin, ready=262143
08:20:45.926 (serialmon 50): nothing new, skipping HID & Ports enum
08:20:45.929 (ports 19): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:20:45.930 (ports 19): nothing new, skipping HID & Ports enum
08:20:45.934 (loader): remote connection 1828 opened
08:20:45.998 (loader): HID/win32:  vid:058F pid:9410 ver:0122
08:20:46.001 (loader): HID/win32:  vid:058F pid:9410 ver:0122
08:20:46.005 (loader): HID/win32:  vid:045E pid:07A5 ver:0797
08:20:46.008 (loader): HID/win32:  vid:045E pid:07A5 ver:0797
08:20:46.012 (loader): HID/win32:  vid:045E pid:07A5 ver:0797
08:20:46.016 (loader): HID/win32:  vid:045E pid:07A5 ver:0797
08:20:46.196 (ports 19): WM_DEVICECHANGE DBT_DEVICEARRIVAL
08:20:46.198 (ports 19): found_usb_device, id=\\?\usb#vid_16c0&pid_0483#10379940#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:20:46.198 (ports 19): found_usb_device, loc=usb:0/140000/0/1/3    Port_#0003.Hub_#0005
08:20:46.198 (ports 19): found_usb_device, hwid=USB\VID_16C0&PID_0483&REV_0279
08:20:46.198 (ports 19): found_usb_device, devinst=00000005
08:20:46.198 (ports 19): add: loc=usb:0/140000/0/1/3, class=USB, vid=16C0, pid=0483, ver=0279, serial=10379940, dev=\\?\usb#vid_16c0&pid_0483#10379940#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:20:46.198 (serialmon 50): WM_DEVICECHANGE DBT_DEVICEARRIVAL
08:20:46.199 (ports 19):   comport_from_devinst_list attempt
08:20:46.199 (ports 19):   found Ports in classguid_list at index=1
08:20:46.199 (ports 19):   port COM81 found from devnode
08:20:46.199 (ports 19): found_usb_device complete
08:20:46.200 (serialmon 50): found_usb_device, id=\\?\usb#vid_16c0&pid_0483#10379940#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:20:46.200 (serialmon 50): found_usb_device, loc=usb:0/140000/0/1/3    Port_#0003.Hub_#0005
08:20:46.200 (serialmon 50): found_usb_device, hwid=USB\VID_16C0&PID_0483&REV_0279
08:20:46.200 (serialmon 50): found_usb_device, devinst=00000005
08:20:46.200 (serialmon 50): add: loc=usb:0/140000/0/1/3, class=USB, vid=16C0, pid=0483, ver=0279, serial=10379940, dev=\\?\usb#vid_16c0&pid_0483#10379940#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
08:20:46.200 (serialmon 50):   comport_from_devinst_list attempt
08:20:46.200 (serialmon 50):   found Ports in classguid_list at index=1
08:20:46.200 (serialmon 50):   port COM81 found from devnode
08:20:46.200 (serialmon 50): found_usb_device complete
08:20:46.201 (ports 19): usb_add: usb:0/140000/0/1/3  COM81 (Teensy 4.0) Serial
08:20:46.201 (serialmon 50): usb_add: usb:0/140000/0/1/3
08:20:46.201 (serialmon 50): translate "COM81" -> "\\.\COM81"
08:20:46.303 (serialmon 50): GetDefaultCommConfig success
08:20:46.396 (serialmon 50): SetDefaultCommConfig success
08:20:46.396 (serialmon 50): Opened \\.\COM81 Serial
08:20:46.398 (ports 19): callback 001A
08:20:46.404 (serialmon 50): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:20:46.405 (serialmon 50): WM_DEVICECHANGE DBT_DEVICEARRIVAL
08:20:46.406 (serialmon 50): callback 001A
08:20:46.408 (serialmon 50): nothing new, skipping HID & Ports enum
08:20:46.553 (ports 19): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:20:46.553 (ports 19): WM_DEVICECHANGE DBT_DEVICEARRIVAL
08:20:46.555 (ports 19): nothing new, skipping HID & Ports enum
08:20:46.595 (serialmon 50): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:20:46.596 (serialmon 50): nothing new, skipping HID & Ports enum
08:20:46.674 (ports 19): WM_DEVICECHANGE DBT_DEVNODES_CHANGED
08:20:46.676 (ports 19): nothing new, skipping HID & Ports enum
08:20:47.079 (loader): redraw, image 9

Restored the first key file... And again no visual difference I know of but now running encrypted:
Code:
Pass: Bus Encryption Engine is active
Pass: Encryption region starts at proper address

All Tests Passed.  :-)
 
Some more Random lockable T4 experiments...

As I (and many others) often use TyCommander - I went in and Integrated it with Arduino...
So now it tries to use TyCommander to program the chips instead of Teensy loader.

...
I then reprogrammed with using Teensy loader and:
...


On the one that I locked, TyCommander fails to upload... Does not give very descriptive error, but then T4 disappears. I then again try the 20-30 push on the program button, and release after the led blinks... And then starts a double blink on the program led.. I then un-integrated tycommander and then Arduino using Teensy sketch was able to program the locked chip...

I then tried the restore process again and again it went into double blink mode. And the current program continued to run.


So so far I have busted anything :D

I am assuming someone has already tried programing one of these chips with the wrong security key?

Have not tried it yet - but IIRC ... Integrate TyCommander ... But leave TLoader OPEN

Tloader takes first crack at the Upload and it will see TyComm trigger bootloader and ... BAM - TLoader will do the job.

... Correct?


Re #p164
Also not tested 15sec Restore - but it has to FAIL the code upload part as the factory stored 'short' code is not encrypted. I had that wonder the other day but held back - ... Don't suppose the Locked bootloader could leave that Flash Unlocked and when made LOCKED push up a properly Encrypted 'Factory 'short' code and then lock it?
 
Just tried the data logger using the encrypted T4 with a SPI Flash chip on SPI and CS = 6 (had to give it a try). And worked as it should:
Code:
Logging Data!!!
10,10,9
10,10,10
10,11,9
10,10,10
10,11,10
10,10,10
9,10,10
10,10,9
10,10,10
10,11,9
10,11,10
10,10,10
9,11,10
10,10,10
10,9,10
10,10,10
10,10,10
10,11,10
10,11,9
9,11,10
10,11,10
10,11,9
10,10,10
10,11,9
10,10,9
10,11,10
10,11,10
10,10,10
9,11,10
10,11,10
10,11,10
10,10,10
10,10,10
9,11,10
10,11,10
10,11,10
9,10,10
10,12,9
10,10,9
10,10,10
9,11,9
10,11,10
10,11,10
10,10,9
10,11,10
10,10,10
10,10,10
10,10,10
9,10,10
10,10,10
10,11,10
10,10,10
10,11,10
10,11,10
9,11,10
10,10,9
10,11,9
10,10,9
10,10,10

Stopped Logging Data!!!
Records written = 59

Dumping Log!!!
10,10,9
10,10,10
10,11,9
10,10,10
10,11,10
10,10,10
9,10,10
10,10,9
10,10,10
10,11,9
10,11,10
10,10,10
9,11,10
10,10,10
10,9,10
10,10,10
10,10,10
10,11,10
10,11,9
9,11,10
10,11,10
10,11,9
10,10,10
10,11,9
10,10,9
10,11,10
10,11,10
10,10,10
9,11,10
10,11,10
10,11,10
10,10,10
10,10,10
9,11,10
10,11,10
10,11,10
9,10,10
10,12,9
10,10,9
10,10,10
9,11,9
10,11,10
10,11,10
10,10,9
10,11,10
10,10,10
10,10,10
10,10,10
9,10,10
10,10,10
10,11,10
10,10,10
10,11,10
10,11,10
9,11,10
10,10,9
10,11,9
10,10,9
10,10,10

 Space Used = 12288
Filesystem Size = 16777216
Directory
---------
datalog.txt                           565
 
Re #p164
Also not tested 15sec Restore - but it has to FAIL the code upload part as the factory stored 'short' code is not encrypted. I had that wonder the other day but held back - ... Don't suppose the Locked bootloader could leave that Flash Unlocked and when made LOCKED push up a properly Encrypted 'Factory 'short' code and then lock it?
Had to test just to see what the behavior was going to be.
 
Worked on rewickering the logger example. Added a few things to help with just basic LittleFS commands and dumping the file without having to load a new sketch by developing a simple menu:
Code:
Menu Options:
    l - List files on disk
    e - Erase files on disk
    s - Start Logging data (Restarting logger will append records to existing log)
    x - Stop Logging data
    d - Dump Log
    h - Menu
Not sure.. i'm not a friend of these menus. Too much code that obscures the important part that interests the user. Or distracts.
Why not a fixed order? - list files, erase, start logging, stop logging, dump.
No menu needed...

The examples are not there to show what can be done or, what is possible.. they should just show how to do the basic operations - not what Arduino is capable of. Its no Arduino example, its a littlefs example...
 
As far as LFS and Uploading an Image - that works well for ESP because the PC does the Upload directly - filling the Flash with 'hex' and then writing the LFS (SPIFFS when I did it) image to Flash.

I did write a sketch that does xFer to/from SD card the other week ... but that takes some code on the Teensy.

The mediaTransfer() code is here : p#929 : forum.pjrc.com/threads/58033-LittleFS-port-to-Teensy-SPIFlash

That code here is an 'extra INO' file "xfersdlfs.ino" and then called in setup where the Integrity example was hacked to use it.

Just put that code to github.com/Defragster/T4LockBeta/tree/main/PROG

I started doing that with a copy to/from RAM<>SD - with the couple of lines calling from any of the Integrity examples - or other it will work. It could be extended beyond SD to any other similar FS { USB? - could even copy RAM to FLASH ? where log to RAM would be faster and then push to FLASH would make it secure - or allow offloading after RAM fills to larger FLASH/SD/USB }
 
No it can just upload the files - without uploading the program. Have used that on my esp internet radio , for the web interface. had to edit the html pages several times - they did just upload, without touching everything else.
esp resetted.. uploaded my files.. that was all.

I even had a "key=value" flash "partition" that was untouched.

Some code on the teensy would be ok - great, if it would be a "library" that needs an #include only...
Could'nt that be done with a hook or callback before setup()?

It would have to check for a "magic packet" over usb.. that way the bootloader can stay unchanged.
For the PC side, the cli loader should show enough example code that can be copied.. :)
 
Last edited:
Yes, ESP can do anything - with the PC in charge of programming - can write to Flash independent of programming for sure.

Before setup() - means USB isn't online yet - unless waited for ...

There are other USB Technologies underway that give FS access to USB - and that USB access includes OS access to FS media - including LFS ... but that takes USB Stack support for those ...

Some custom TeensyTransfer type interface could be evolved as well perhaps that used std USB_Serial without adding the other overhead. Maybe a binary transfer using DUAL serial port - where PC code could own that port for transfers?
 
Worked on rewickering the logger example. Added a few things to help with just basic LittleFS commands and dumping the file without having to load a new sketch by developing a simple menu:
Code:
Menu Options:
	l - List files on disk
	e - Erase files on disk
	s - Start Logging data (Restarting logger will append records to existing log)
	x - Stop Logging data
	d - Dump Log
	h - Menu

Hi @mjs513 - Looks reasonable to me. I agree with Frank that too big of a menu could obscure stuff but this one seams nice and short and too the point. Another alternative, which I personally don't like, is have 5 different programs, one to list, one to erase, One to Init, one to dump, and one to chew gum :D And yes probably can not count :D

Now back to playing... Will try it out on Locked one
 
Hi @mjs513 - Looks reasonable to me. I agree with Frank that too big of a menu could obscure stuff but this one seams nice and short and too the point. Another alternative, which I personally don't like, is have 5 different programs, one to list, one to erase, One to Init, one to dump, and one to chew gum :D And yes probably can not count :D

Now back to playing... Will try it out on Locked one

Kurt - I agree with you. As long as the menu's are short sweet and to the point and don't do complex actions I don't mind using them. I am planning on doing another sketch that kind of does what you and Frank suggested about doing things sequentially to illustrate. It would be a modifed version of the test sketch.
 
Status
Not open for further replies.
Back
Top