bsilver8192
Member
The existing information is confusing (to say the least), but I think the Teensy 3.5 actually has 256K of RAM, not 192K as is listed most places. Has anybody else looked at this? This seems really weird that nobody's noticed for this long, so I've done a fair amount of searching, and am listing what I turned up here. If it actually has 256K, only using 192K seems like a bug.
First, documentation saying 256K: A thread on the Freescale forums titled MK64FX512VLQ12 : Does it have 256KB of SRAM or 192KB of SRAM has what looks like an official Freescale response saying the version with 1M of flash has 256K. The datasheet (I'm looking at "Rev. 7, 10/2016") says it has 256K in many places, and doesn't mention 192 anywhere ctrl+F finds. The reference manual (I'm looking at "Rev. 3, July 2017") also says there's 256K in "3.5.3.1 SRAM sizes" and "2.3 Orderable part numbers". SIM_SOPT1.RAMSIZE does not have an option for 192K. "A.4 Chip Configuration chapter changes" mentions "Updated SRAM to 256 KB and SRAM_U to 192 in SRAM sizes".
Some documentation pointing to 192K: "3.5.3.1 SRAM sizes" lists a 192K-sized address range for some of the K64 chips, but not others. The previously-linked Freescale forum post implies there used to be a lot more places saying 192K (I don't see much point in trying to verify by digging up old revisions of the documentation). Also, every single piece of Teensy-related documentation I've found says the 3.5 has 192K of SRAM, and many of them contrast that with 256K in the 3.6. The mk64fx512.ld that comes with Teensyduino also uses LENGTH=192K for the RAM region.
Empirically, all 256K seem to work. I tested with this (after moving the stack out of the way in the linker script):
Even after all of that evidence for having 256K, I still have doubts about this. It just seems like too big of a thing for everybody else to have missed for this long. Did I miss something obvious here?
First, documentation saying 256K: A thread on the Freescale forums titled MK64FX512VLQ12 : Does it have 256KB of SRAM or 192KB of SRAM has what looks like an official Freescale response saying the version with 1M of flash has 256K. The datasheet (I'm looking at "Rev. 7, 10/2016") says it has 256K in many places, and doesn't mention 192 anywhere ctrl+F finds. The reference manual (I'm looking at "Rev. 3, July 2017") also says there's 256K in "3.5.3.1 SRAM sizes" and "2.3 Orderable part numbers". SIM_SOPT1.RAMSIZE does not have an option for 192K. "A.4 Chip Configuration chapter changes" mentions "Updated SRAM to 256 KB and SRAM_U to 192 in SRAM sizes".
Some documentation pointing to 192K: "3.5.3.1 SRAM sizes" lists a 192K-sized address range for some of the K64 chips, but not others. The previously-linked Freescale forum post implies there used to be a lot more places saying 192K (I don't see much point in trying to verify by digging up old revisions of the documentation). Also, every single piece of Teensy-related documentation I've found says the 3.5 has 192K of SRAM, and many of them contrast that with 256K in the 3.6. The mk64fx512.ld that comes with Teensyduino also uses LENGTH=192K for the RAM region.
Empirically, all 256K seem to work. I tested with this (after moving the stack out of the way in the linker script):
Code:
printf("starting\n");
volatile uint32_t *const test_pointer = (volatile uint32_t *)0x20000000;
static constexpr size_t kRestOfSize = 0x30000 / sizeof(uint32_t);
for (size_t i = 0; i < kRestOfSize; ++i) {
test_pointer[i] = i % 293;
}
for (size_t i = 0; i < kRestOfSize; ++i) {
if (test_pointer[i] != i % 293) {
printf("compare fail\n");
while (true) {}
}
}
if (test_pointer[0] == test_pointer[kRestOfSize / 3]) {
printf("prime didn't work\n");
while (true) {}
}
if (test_pointer[kRestOfSize / 3] == test_pointer[kRestOfSize / 3 * 2]) {
printf("prime didn't work\n");
while (true) {}
}
if (test_pointer[0] == test_pointer[kRestOfSize / 3 * 2]) {
printf("prime didn't work\n");
while (true) {}
}
if (test_pointer[0] == test_pointer[kRestOfSize / 2]) {
printf("prime didn't work\n");
while (true) {}
}
printf("finished\n");
Even after all of that evidence for having 256K, I still have doubts about this. It just seems like too big of a thing for everybody else to have missed for this long. Did I miss something obvious here?