Maybe this?Code:if (size & 0xffff) size += 0x10000; size = size & 0xFFFF0000;
Looks good, or probably could just be something like:Maybe this?Code:if (size & 0xffff) size += 0x10000; size = size & 0xFFFF0000;
size = (size + 0xFFFF) & 0xFFFF0000;
It's always 64k aligned..![]()
Looks good, or probably could just be something like:
Code:size = (size + 0xFFFF) & 0xFFFF0000;
The only way I can think of to take that into account is to check if the T4 encryption is active but that assumes you want it to persist across uploads.Now, the always erased area Paul mentioned needs to be taken into account?
if ( program_size <= 0xFFFFF) {program_size = 0x100000 ... }
But that would mean a probably smaller useable area. That's just a decision.
What kind of examples are you envisioning?LittleFS sorely needs documentation and better examples.
LittleFS_SPINAND myfs; //Specifies to use an SPI NOR Flash attached to SPI
A very minimal hello-world like example which works without additional chips. Open, read, write, erase, list directory - Commented. Or probably an example for each? As simple as possible.
I took a look at simple_dumpfile. Here it would be good to mention other options than SPI NOR (in a comment)
Code:LittleFS_SPINAND myfs; //Specifies to use an SPI NOR Flash attached to SPI
Speaking of LittleFS and examples and the like.
At some point would be great if we experimented as an option of adding creation and modification dates (probably also in FS.h) ... Obviously different feature than encryption, but...
DMM showing this for current idling running the posted SINK sketch:
#1 - Production T4_1.05 - bare board :: 98mA-99mA : 48 °C
#2 - Unfused T4_1.07 in T4 PJRC Beta breakout :: 109 mA (powering breakout LED and other on the board?) : 59 °C
#3 - Fused T4_1.07 with key.pem - bare board :: 99 mA-100 mA : 55 °C
Not sure why #'s 1 and 3 can be so close and the temp read so diff is 1 mA that much extra heat?
Next step would be external measure - but that is more arbitrary ...
Ok last thing with temperature. I took a brand new T4 (by new I mean right out of the package) with no pins and ran the temp test. I am now seeing temps getting up to 59-60degC on the bare board. Wonder if the pins are acting as a heat sink for the board keeping the temp lower.
View attachment 25606
28.0514, 56.32
28.0598, 55.70
Yep using the pre-LFS test sketch. Here is what I used for temp measurement on both boards
...
Could put it up on Github if you want.
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, 55.09
0.0083, 55.09
0.0167, 55.09
...
4.9927, 56.32
5.0010, 56.32
5.0094, 55.70
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. :-)
0.0000, 58.94
0.0083, 58.94
...
4.9927, 59.65
5.0010, 59.65
5.0094, 60.35
5.0177, 60.35
if ((HW_OCOTP_CFG5 & 0x04C00002) == 0x04C00002) {
Serial.println("Secure mode set");
} else {
Serial.println("Secure mode NOT SET");
ok--;
}
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
[B]Secure mode set[/B]
Tim
Ran one more temp profile on the second T4 Beta Secure that has not been been locked or fuses set. Added it to the chart. Same max temp as the T4 bare production. Looks like pins and whether its in or out of a breakout or breadboard can reduce temp:
View attachment 25610
Just added TMM and T41. Think we are beating a dead horse now.
...