Skip to content

Commit 1bd5317

Browse files
authored
Fix for i.MXRT10xx Flash Algorithms (#918)
2 parents d22d501 + a0ac2f1 commit 1bd5317

File tree

7 files changed

+1831
-1548
lines changed

7 files changed

+1831
-1548
lines changed

source/family/freescale/mimxrt1020_spi_flash/flash_blob.c

Lines changed: 490 additions & 588 deletions
Large diffs are not rendered by default.

source/family/freescale/mimxrt1050_hyper_flash/flash_blob.c

Lines changed: 508 additions & 447 deletions
Large diffs are not rendered by default.

source/family/freescale/mimxrt1050_spi_flash/flash_blob.c

Lines changed: 504 additions & 489 deletions
Large diffs are not rendered by default.

source/family/freescale/target_reset_mimxrt.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
#include "swd_host.h"
2323
#include "info.h"
24-
#include "target_config.h"
2524
#include "target_family.h"
2625
#include "cmsis_os2.h"
2726

@@ -49,14 +48,10 @@ static void prerun_target_config(void)
4948
#ifdef DAPLINK_MIMXRT_TARGET
5049
static uint8_t validate_bin_nvic(const uint8_t *buf)
5150
{
52-
if(buf[0] == 'F' && buf[1] == 'C' && buf[2] == 'F' && buf[3] == 'B')
53-
{
54-
target_device.flash_regions[0].start = 0x30000400;
55-
return 1;
56-
}
57-
else if(buf[0] == 0xFF && buf[1] == 0xFF && buf[2] == 0xFF && buf[3] == 0xFF)
58-
{
59-
target_device.flash_regions[0].start = 0x30000000;
51+
// Flash Configuration Block
52+
// https://www.nxp.com/docs/en/nxp/application-notes/AN12238.pdf
53+
if ((buf[0] == 'F' && buf[1] == 'C' && buf[2] == 'F' && buf[3] == 'B')) {
54+
// FlexSPI Configuration Block
6055
return 1;
6156
}
6257

source/family/nxp/mimxrt1060_spi_flash/flash_blob.c

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
/* Flash OS Routines (Automagically Generated)
2-
* Copyright (c) 2009-2021 Arm Limited
1+
/* Flash algorithm for MIMXRT106x 8mB QuadSPI NOR Flash
2+
*
3+
* DAPLink Interface Firmware
4+
* Copyright (c) 2009-2021 Arm Limited, All Rights Reserved
35
* SPDX-License-Identifier: Apache-2.0
46
*
57
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,8 +17,12 @@
1517
* limitations under the License.
1618
*/
1719

20+
// Generated from 'MIMXRT106x_QSPI_4KB_SEC.FLM' (MIMXRT106x 8mB QuadSPI NOR Flash)
21+
// Originating from 'NXP.MIMXRT1062_DFP.13.1.1.pack'
22+
// digest = 4b2722f4859e5a519ee072466d51eb02e131fbffbe5d8bdffdf025e5f71923ad, file size = 2847664
23+
// algo version = 0x101, algo size = 2880 (0xb40)
1824
static const uint32_t MIMXRT106x_QSPI_4KB_SEC_flash_prog_blob[] = {
19-
0xE00ABE00,
25+
0xe7fdbe00,
2026
0x4770ba40, 0x4770ba40, 0x4770ba40, 0x4770bac0, 0x4770bac0, 0x4770bac0, 0x4855b51c, 0x48559000,
2127
0x08498901, 0x81010049, 0x890a4953, 0x00520852, 0x8802810a, 0x07522304, 0xda022a00, 0x439a8802,
2228
0x88088002, 0xd5020740, 0x43988808, 0x484c8008, 0x6041494a, 0x6081494b, 0x22806801, 0x22204391,
@@ -122,7 +128,7 @@ static const uint32_t flash_size = 0x00800000;
122128
* at address flash_start + flash_size.
123129
*/
124130
static const sector_info_t sectors_info[] = {
125-
0x60000000, 0x00010000,
131+
{0x60000000, 0x00010000},
126132
};
127133

128134
static const program_target_t flash = {
@@ -131,20 +137,25 @@ static const program_target_t flash = {
131137
0x20000125, // EraseChip
132138
0x20000139, // EraseSector
133139
0x20000157, // ProgramPage
134-
0x0, // Verify
140+
0x00000000, // Verify
135141

136142
// BKPT : start of blob + 1
137143
// RSB : blob start + header + rw data offset
138144
// RSP : stack pointer
139145
{
140146
0x20000001,
141147
0x20000934,
142-
0x20000c00
148+
0x20001400
143149
},
144150

145-
0x20000000 + 0x00000A00, // mem buffer location
146-
0x20000000, // location to write prog_blob in target RAM
147-
sizeof(MIMXRT106x_QSPI_4KB_SEC_flash_prog_blob), // prog_blob size
148-
MIMXRT106x_QSPI_4KB_SEC_flash_prog_blob, // address of prog_blob
149-
0x00000100 // ram_to_flash_bytes_to_be_written
151+
// mem buffer location
152+
0x20001400,
153+
// location to write prog_blob in target RAM
154+
0x20000000,
155+
// prog_blob size
156+
sizeof(MIMXRT106x_QSPI_4KB_SEC_flash_prog_blob),
157+
// address of prog_blob
158+
MIMXRT106x_QSPI_4KB_SEC_flash_prog_blob,
159+
// ram_to_flash_bytes_to_be_written
160+
0x00000100
150161
};

test/info.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,16 @@ def VENDOR_TO_FAMILY(x, y) : return (VENDOR_ID[x] <<8) | y
142142
( 0x0220, VENDOR_TO_FAMILY('NXP', 2), 'k20dx_frdmkl46z_if', 'k20dx_bl', 'FRDM-KL46Z' ),
143143
( 0x0224, VENDOR_TO_FAMILY('NXP', 1), 'k20dx_frdmk28f_if', 'k20dx_bl', None ), # TODO - set target to 'FRDM-K28F' when mbed-os supports this
144144
( 0x0225, VENDOR_TO_FAMILY('NXP', 1), 'k26f_frdmk32w042_if', 'k26f_bl', None ), # TODO - set target to 'FRDM-K32W042' when mbed-os supports this
145-
( 0x0226, VENDOR_TO_FAMILY('NXP', 3), 'k20dx_mimxrt1020_evk_qspi_if', 'k20dx_bl', None ), # TODO - set target to 'MIMX6RT1050' when mbed-os supports this
146-
( 0x0227, VENDOR_TO_FAMILY('NXP', 3), 'k20dx_mimxrt1050_evk_hyper_if', 'k20dx_bl', None ), # TODO - set target to 'MIMX6RT1050' when mbed-os supports this
147-
( 0x0227, VENDOR_TO_FAMILY('NXP', 3), 'k20dx_mimxrt1050_evk_qspi_if', 'k20dx_bl', None ), # TODO - set target to 'MIMX6RT1050' when mbed-os supports this
145+
( 0x0226, VENDOR_TO_FAMILY('NXP', 3), 'k20dx_mimxrt1020_evk_qspi_if', 'k20dx_bl', 'MIMXRT1020' ),
146+
( 0x0227, VENDOR_TO_FAMILY('NXP', 3), 'k20dx_mimxrt1050_evk_hyper_if', 'k20dx_bl', 'MIMXRT1050-HYPER' ),
147+
( 0x0227, VENDOR_TO_FAMILY('NXP', 3), 'k20dx_mimxrt1050_evk_qspi_if', 'k20dx_bl', 'MIMXRT1050-QSPI' ),
148148
( 0x0228, VENDOR_TO_FAMILY('NXP', 4), 'k20dx_rapid_iot_if', 'k20dx_bl', None ), # TODO - set target to 'Rapid-IoT' when mbed-os supports this
149+
( 0x0229, VENDOR_TO_FAMILY('NXP', 3), 'lpc4322_mimxrt1060_evk_qspi_if', 'lpc4322_bl', 'MIMXRT1060' ),
149150
( 0x0230, VENDOR_TO_FAMILY('NXP', 1), 'k20dx_frdmk20dx_if', 'k20dx_bl', 'FRDM-K20D50M' ),
150151
( 0x0231, VENDOR_TO_FAMILY('NXP', 1), 'k20dx_frdmk22f_if', 'k20dx_bl', 'FRDM-K22F' ),
151152
( 0x0236, VENDOR_TO_FAMILY('NXP', 0), 'lpc4322_lpc55s69xpresso_if', 'lpc4322_bl', 'LPCXpresso55S69' ),
152153
( 0x0240, VENDOR_TO_FAMILY('NXP', 1), 'k20dx_frdmk64f_if', 'k20dx_bl', 'FRDM-K64F' ),
154+
( 0x0244, VENDOR_TO_FAMILY('NXP', 3), 'lpc4322_mimxrt1170_evk_qspi_if', 'lpc4322_bl', 'MIMXRT1170' ),
153155
( 0x0250, VENDOR_TO_FAMILY('NXP', 1), 'k20dx_frdmkw24d_if', 'k20dx_bl', 'FRDM-KW24D512' ),
154156
( 0x0260, VENDOR_TO_FAMILY('NXP', 2), 'k20dx_frdmkl26z_if', 'k20dx_bl', None ),
155157
( 0x0261, VENDOR_TO_FAMILY('NXP', 2), 'k20dx_frdmkl27z_if', 'k20dx_bl', 'FRDM-KL27Z' ),
@@ -176,7 +178,7 @@ def VENDOR_TO_FAMILY(x, y) : return (VENDOR_ID[x] <<8) | y
176178
( 0x1018, VENDOR_TO_FAMILY('Stub', 1), 'lpc11u35_ssci824_if', None, 'Switch-Science-mbed-LPC824' ),
177179
( 0x1019, VENDOR_TO_FAMILY('Nordic', 1), 'lpc11u35_sscity_if', None, 'Switch-Science-mbed-TY51822r3' ),
178180
( 0x1021, VENDOR_TO_FAMILY('Nordic', 1), 'lpc11u35_ssci_chibi_if', None, None ), # TODO - set target to 'SSCI-MBIT' when mbed-os supports this
179-
( 0x1028, VENDOR_TO_FAMILY('Nordic', 2), 'lpc11u35_pitaya_link_if', None, None ),
181+
( 0x1028, VENDOR_TO_FAMILY('Nordic', 2), 'lpc11u35_pitaya_link_if', None, None ),
180182
( 0x1050, VENDOR_TO_FAMILY('Stub', 1), 'lpc11u35_lpc812xpresso_if', None, 'NXP-LPC800-MAX' ),
181183
( 0x1054, VENDOR_TO_FAMILY('Stub', 1), 'lpc4322_lpc54114xpresso_if', 'lpc4322_bl', 'LPCXpresso54114' ),
182184
( 0x1056, VENDOR_TO_FAMILY('Stub', 1), 'lpc4322_lpc54608xpresso_if', 'lpc4322_bl', 'LPCXpresso54608' ),

0 commit comments

Comments
 (0)