Inconsistent Flash Buffer Sizes for Teensy 4.1 Using FlasherX Library

sudharsan

Member
Hello everyone,

I've been using the FlasherX library to program my Teensy 4.1 boards. I have two Teensy 4.1 boards, one used (Set A) and one newly purchased (Set B). I encountered an issue with inconsistent flash buffer sizes between the two boards when uploading the same FlasherX code.
When I upload the code to Set A, I receive the following message:

WARNING: this can ruin your device!
target = fw_teensy41 (8192K flash in 4K sectors)
FlasherX v2.3 - Jun 17 2024 12:48:59
WARNING: this can ruin your device!
Board Model: Teensy 4.1
created buffer = 128K FLASH (607DC000 - 607FC000)

However, when I upload the same code to the newly purchased Teensy 4.1 (Set B), the message is different:

WARNING: this can ruin your device!
target = fw_teensy41 (8192K flash in 4K sectors)
FlasherX v2.3 - Jun 17 2024 12:48:59
WARNING: this can ruin your device!
Board Model: Teensy 4.1
created buffer = 8040K FLASH (60022000 - 607FC000)

Questions:
  1. Why is there a discrepancy between the flash buffer sizes on the two boards?
  2. How can this issue be resolved to ensure consistent flash buffer sizes?
Any advice or insights would be greatly appreciated. Thank you!
 
Sorry, I have never used it, although think about it from time to time:

Try programming both of them with the same sketch and then try to upload both again: from the library documentation,
the size you have depends on the program that is currently uploaded on the board.

From the Readme:
FlasherX buffers the new code in flash by default, and automatically defines the largest possible flash buffer, from the top of existing code to the bottom of FLASH_RESERVE (settable in FlashTxx.h). After moving the new code from the buffer to the program flash, the flash buffer is erased. This leaves the flash in the same state as if the code was uploaded via TeensyDuino. If the new code to be sent via FlasherX is smaller than the available buffer, the update can be done in one step. If the new code is larger than the available flash, a two-step process can be used.
 
Sorry, I have never used it, although think about it from time to time:

Try programming both of them with the same sketch and then try to upload both again: from the library documentation,
the size you have depends on the program that is currently uploaded on the board.

From the Readme:
Thanks for insights . I got the same results when uploading the same sketch. I do get the same result. Thanks from sharing the info in readme, I will check in (settable in FlashTxx.h).
 
This issue is caused by using EEPROM. When the EEPROM is used somehow the buffer is reduced to 128K FLASH. So I cleared all the EEPROM , But the buffer size becomes 0K FLASH. Is there any way to revert the buffer size to default 8MB size?
 
This issue is caused by using EEPROM. When the EEPROM is used somehow the buffer is reduced to 128K FLASH. So I cleared all the EEPROM , But the buffer size becomes 0K FLASH. Is there any way to revert the buffer size to default 8MB size?
If you are using EEPROM, you must set the value of FLASH_RESERVE_HI in FlashTxx.h to 256KB (64 sectors) as shown below. This tells FlasherX that the buffer must be below EEPROM.

Code:
#elif defined(__IMXRT1062__) && defined(ARDUINO_TEENSY41)
  #define FLASH_ID        "fw_teensy41"        // target ID (in code)
  #define FLASH_SIZE        (0x800000)        // 8MB
  #define FLASH_SECTOR_SIZE    (0x1000)        // 4KB sector size
  #define FLASH_WRITE_SIZE    (4)            // 4-byte/32-bit writes  
  #define FLASH_RESERVE_HI    (64*FLASH_SECTOR_SIZE)    // reserve top of flash
  #define FLASH_BASE_ADDR    (0x60000000)        // code starts here
 
Back
Top