Teensy 4.0 - NOR Flash Partitioning Problem

Status
Not open for further replies.

TA7

New member
Hi all,

Just before I begin, I want to say a big thanks to Paul and any contributors to Teensy!
Teensy 4.0 has been a real life saver for a project I've been working on for a while now, however it is due to be finished before the HalfKay bootloader chip is released for purchase, and unfortunately I cannot wait.

Therefore, I have had to start writing my own bootloader and uploader software to be compatible with Teensyduino generated hex files (all of which will never ever be released just to make that clear). However there are a few questions I have, and I totally understand if Paul doesn't want to answer these.

I understand that the W25Q16JVUXIM NOR Flash chip used is 16MBit - 2048Kb, and that Halfkay Bootloader (uploaded to RAM via JTAG during Boot Mode 01b) is likely responsible for partitioning the flash during firmware upload via FlexSPI.

I also understand that the maximum sketch size is 2031616 bytes. That leaves room on the Flash Chip for the reserved top 4Kb to store the backup Blink Sketch and ~17Kb unused space.

However, this does not leave room for 60Kb of reserved flash for EEPROM emulation.
Is this actually stored in the 128Kb of ROM that is integrated in the IMXRT1062?
 
The linker file says:

FLASH (rwx): ORIGIN = 0x60000000, LENGTH = 1984K

2048 - 1984 = 64KB.

What is your reason not to use a Teensy? And why should your product be "Teensy-Hex" compatible?
It would be easier to write your own software from scratch instead. No need to be Teensy-compatible?!?
 
Ah, thank you! I definitely should have checked the linker file...

The only reason is that I developed all the software using Teensyduino, and I don't want to have to port everything to MCUXpresso once I completely transition to custom PCBs. It's also imperative to still retain the ability to upgrade firmware on multiple IMXRT1062s as I require a distributed system in my project.
 
Remember, 1K is 1024 bytes, not 1000 bytes, and a 2M chip is 2048K.

2031616 bytes is 1984K.

Bootloader ... is likely responsible for partitioning the flash during firmware upload via FlexSPI.

The bootloader simply does not erase or write to the top 64K. No special partitioning is done by the bootloader.

However, special programming of the flash chip is done by our test fixture, as we test each Teensy 4.0. The restore program is written into the top 4K. The flash chip's write protect setting is configured to permanently make that top 4K read-only. The top 4K can never be erased or altered.

When you hold the pushbutton for 15 seconds (release shortly after the quick red LED blink) the bootloader does a full erase of the entire flash chip, except for that top 4K with can't be erased. Then it copies that 4K program to the beginning of the flash. This feature is meant to give you a way to recover to a known-good state, even from the toughest problems.
 
Thank you Paul, I'm very grateful for your reply.

Well, this is the last time I blindly use Google's inbuilt converter, instead of just using a calculator or my brain for such a simple conversion. I certainly feel a bit foolish now! Perhaps I should get some sleep.
 
Status
Not open for further replies.
Back
Top