Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not all data in DMAMEM/RAM2 survives a warm reset/restart #14

Open
Defragster opened this issue Jun 29, 2023 · 2 comments
Open

Not all data in DMAMEM/RAM2 survives a warm reset/restart #14

Defragster opened this issue Jun 29, 2023 · 2 comments

Comments

@Defragster
Copy link
Contributor

In : https://github.com/TeensyUser/doc/wiki/The-Watchdog-timer

This is not entirely true. Some portion of lower (?) DMAMEM is used by the security HAB (?) code before startup and data stored there will be wiped and overwritten. There is a forum post somewhere - or it could be tested - some 32KB (???) area is disturbed as the processor wakes up and verifies chip security. Any area above that - that was flushed from cache - will be retained. The area used may be different between Locked and UnLocked as well???

// DMAMEM causes allocation in 'static' RAM2 on Teensy using 1062 processor
// It is not initialized and will retain value while powered
// BUT - it writes through a cache that must be flushed to assure it is current
// This works for any DMAMEM allocation of any variable type or structure

@Defragster
Copy link
Contributor Author

Wrote test sketch to MALLOC DMAMEM and test in 1KB blocks.
'X' are blocks before Malloc (USB Alloc and any other)
'+' blocks retained the expected values on warm restart
'-' blocks are those that did not have the pre-written and flushed values

Locked T_4.1 pollutes first 39-40KB, and also 1KB more at start +~64KB?
Start Address 0x20203088 End at 0x2027fc88
XXXXXXXXXXXXX13+1-------------------------25+++++++++++50
++++++++++++++25-1+++++++++++++++++++++++++++++++++++100

Unlocked 1062 startup pollutes the first ~34KB
Start Address 0x20203088 End at 0x2027fc88
XXXXXXXXXXXXX13+1-------------------19+++++++++++++++++50
++++++++++++++++++++++++++++++++++++++++++++++++++100

Cold start - no block matches of course
Warm Start after Program Load or TyComm Reset {with loader not triggering programming} show above results.

Will update if the sketch cleans up nicely for posting and perhaps improve results display.

@Defragster
Copy link
Contributor Author

shared this https://github.com/Defragster/TeensySketches/tree/main/RamPersistTest

DRAM Persist test
............._ Bytes 510976 is 499 KB

Start Address 0x20203088 End at 0x2027fc88
XXXXXXXXXXXXXAlready Allocated
20200000 - 16 03 55 00 53 00 42 00 20 00 53 00 65 00 72 00 : ..U.S.B. .S.e.r.
20200010 - 69 00 61 00 6C 00 6F 00 00 00 00 00 00 00 00 00 : i.a.l.o. ........
13+
Overwritten
20203488 - 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 : ABCDEFGH IJKLMNOP
... 53 duplicate line(s) removed.
202037E8 - 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 : ABCDEFGH IJKLMNOP
202037F8 - 41 42 43 44 45 46 47 48 49 4A 40 48 4D 4E 4F 50 : ABCDEFGH IJ@HMNOP
20203808 - 01 00 00 00 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 : ....EFGH IJKLMNOP
20203818 - 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 : ABCDEFGH IJKLMNOP
*** Max Count of Output Lines Reached ***
1-------------------19+++++++++++++++++50
++++++++++++++++++++++++++++++++++++++++++++++++++100
++++++++++++++++++++++++++++++++++++++++++++++++++150
++++++++++++++++++++++++++++++++++++++++++++++++++200
++++++++++++++++++++++++++++++++++++++++++++++++++250
++++++++++++++++++++++++++++++++++++++++++++++++++300
++++++++++++++++++++++++++++++++++++++++++++++++++350
++++++++++++++++++++++++++++++++++++++++++++++++++400
++++++++++++++++++++++++++++++++++++++++++++++++++450
++++++++++++++++++++++++++++++++++++++++++++++++++500
++++++++++++479
Start=20200000 Len KB=13 TYPE=Pre allocated X
Start=20203088 Len KB=1 TYPE=Static maintained +
Start=20203488 Len KB=19 TYPE=Overwritten/LOST -
Start=20208088 Len KB=479 TYPE=Static maintained +

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant