joepasquariello / FlasherX

Over-the-air firmware updates for Teensy LC/3.x/4.x/MicroMod
51 stars 13 forks source link

Inconsistent Flash Buffer Sizes for Teensy 4.1 #10

Closed SudharsanK58 closed 2 weeks ago

SudharsanK58 commented 4 weeks ago

I have two Teensy 4.1 boards, one used (Set A) and one newly purchased (Set B).

But Now when I upload your 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), I receive a different 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 = 8040K FLASH (60022000 - 607FC000)

Why does the used Teensy 4.1 board show created buffer = 128K FLASH while the new one shows created buffer = 8040K FLASH (60022000 - 607FC000)?

SudharsanK58 commented 2 weeks ago

Thanks @joepasquariello Found solutions

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.

`#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`