Skip to content

Commit 1ff2e84

Browse files
ozersamathias-arm
authored andcommitted
Update MAX32666 flash algo to support second flash block
Signed-off-by: Sadik.Ozer <[email protected]>
1 parent 1c60ddb commit 1ff2e84

File tree

1 file changed

+54
-35
lines changed

1 file changed

+54
-35
lines changed

source/family/maxim/max32666/flash_blob.c

Lines changed: 54 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,46 @@
2121

2222
#include "flash_blob.h"
2323

24-
#define FLC_BASE 0x40029000
2524
#define CLOCK_DIV 0x00000060
2625
#define BURST_SIZE 0x00000080
27-
#define FLASH_BASE 0x10000000
26+
27+
#define FLC0_BASE 0x40029000
28+
#define FLASH0_BASE 0x10000000 //
29+
#define FLASH0_SIZE 0x00080000 //
30+
31+
#define FLC1_BASE 0x40029400 // second flash controller
32+
#define FLASH1_BASE 0x10080000 // second block of flash
33+
#define FLASH1_SIZE 0x00080000 //
34+
2835
#define FLASH_SIZE MB(1)
2936
#define FLASH_SECTOR KB(8)
3037

31-
static const uint32_t flash_algo_blob[] = {
32-
0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
33-
0x44494975, 0x68826808, 0x0f07f012, 0x2001bf1c, 0x68494770, 0x20006041, 0x486f4770, 0x68004448,
34-
0xf0216881, 0x60814170, 0x47702000, 0xb510486a, 0x68044448, 0xf8b4f000, 0x68a0b9b0, 0x407ff420,
35-
0x402af440, 0x68a060a0, 0x0002f040, 0x68a060a0, 0x0f02f010, 0x68a0d1fb, 0x4070f020, 0x6a6060a0,
36-
0x0002f010, 0xbd10bf08, 0xbd102001, 0x4605b570, 0x44484859, 0xf0006804, 0xb9b8f893, 0xf42068a0,
37-
0xf440407f, 0x60a040aa, 0x68a06025, 0x0004f040, 0x68a060a0, 0x0f04f010, 0x68a0d1fb, 0x4070f020,
38-
0x6a6060a0, 0x0002f010, 0xbd70bf08, 0xbd702001, 0x41f0e92d, 0x8120f8df, 0x44c8460d, 0xf8d84606,
39-
0x46174000, 0x0f03f012, 0xf000d167, 0x2800f869, 0xe00dd163, 0xf8576026, 0x63200b04, 0xf04068a0,
40-
0x60a00001, 0xf01068a0, 0xd1fb0f01, 0x1d361f2d, 0xd3022d04, 0x0f1ff016, 0xf8d8d1ec, 0x28800008,
41-
0x2d10d11a, 0x6026d318, 0x0b04f857, 0xf8576320, 0x63600b04, 0x0b04f857, 0xf85763a0, 0x63e00b04,
42-
0xf04068a0, 0x60a00001, 0xf01068a0, 0xd1fb0f01, 0x36103d10, 0xd2e62d10, 0xd30f2d04, 0xf8576026,
43-
0x63200b04, 0xf04068a0, 0x60a00001, 0xf01068a0, 0xd1fb0f01, 0x1d361f2d, 0xd2ef2d04, 0x683ab19d,
44-
0x31fff04f, 0xea6220ff, 0x40190300, 0x1e6d0200, 0x6026d1f9, 0x68a06321, 0x0001f040, 0x68a060a0,
45-
0x0f01f010, 0x68a0d1fb, 0x4070f020, 0x6a6060a0, 0x0002f010, 0xe8bdbf08, 0x200181f0, 0x81f0e8bd,
46-
0x4448480d, 0x68816800, 0x0f07f011, 0x6a41d109, 0x2100b149, 0x6a416241, 0x2102b129, 0x6a416241,
47-
0x2001b109, 0x68814770, 0x4170f021, 0x5100f041, 0x20006081, 0x00004770, 0x00000004, 0x00000000,
48-
FLC_BASE, CLOCK_DIV, BURST_SIZE,
38+
#define FLASH_BASE FLASH0_BASE
39+
40+
static const uint32_t maxim_flash_prog_blob[] = {
41+
0xE00ABE00,
42+
0x444949a4, 0x68826808, 0x0f07f012, 0x68cad10b, 0x69486042, 0x6948b148, 0xf0126882, 0xbf040f07,
43+
0x604168c9, 0x2001d001, 0x20004770, 0x49994770, 0x68084449, 0xf0226882, 0x60824270, 0xb1206948,
44+
0x68816948, 0x4170f021, 0x20006081, 0xb5104770, 0x444c4c90, 0xf0006820, 0xb928f8ef, 0xb1286960,
45+
0xf0006960, 0xb108f8e9, 0xbd102001, 0xbd102000, 0x44494988, 0x4282698a, 0x6809bf88, 0x688ad802,
46+
0x1a806949, 0xf012688a, 0xd1270f07, 0xb13a6a4a, 0x624a2200, 0xb11a6a4a, 0x624a2202, 0xb9ea6a4a,
47+
0xf022688a, 0xf0424270, 0x608a5200, 0xf422688a, 0xf442427f, 0x608a42aa, 0x68886008, 0x0004f040,
48+
0x68886088, 0x0f04f010, 0x6888d1fb, 0x4070f020, 0x6a486088, 0x0002f010, 0x4770bf08, 0x47702001,
49+
0x4c6cb430, 0x69a3444c, 0xbf9d4283, 0x1ac068a3, 0x68236963, 0x0f03f012, 0xf8d3bf04, 0xf01cc008,
50+
0xd17d0f07, 0xc024f8d3, 0x0f00f1bc, 0xf04fd011, 0xf8c30c00, 0xf8d3c024, 0xf1bcc024, 0xd0080f00,
51+
0x0c02f04f, 0xc024f8c3, 0xc024f8d3, 0x0f00f1bc, 0xf8d3d17f, 0xf02cc008, 0xf04c4c70, 0xf8c35c00,
52+
0xe011c008, 0xf8526018, 0xf8c3cb04, 0xf8d3c030, 0xf04cc008, 0xf8c30c01, 0xf8d3c008, 0xf01cc008,
53+
0xd1fa0f01, 0x1f091d00, 0xd3022904, 0x0f1ff010, 0xf8d4d1e8, 0xf1bcc010, 0xd1210f80, 0xd31f2910,
54+
0xf8526018, 0xf8c3cb04, 0xf852c030, 0xf8c3cb04, 0xf852c034, 0xf8c3cb04, 0xf852c038, 0xf8c3cb04,
55+
0xf8d3c03c, 0xf04cc008, 0xf8c30c01, 0xf8d3c008, 0xf01cc008, 0xd1fa0f01, 0x39103010, 0xd2df2910,
56+
0xd3132904, 0xf8526018, 0xf8c3cb04, 0xf8d3c030, 0xf04cc008, 0xf8c30c01, 0xf8d3c008, 0xf01cc008,
57+
0xd1fa0f01, 0x1f091d00, 0xd2eb2904, 0x6812b1b9, 0x34fff04f, 0x0cfff04f, 0x050cea62, 0xe000402c,
58+
0xea4fe017, 0x1e492c0c, 0x6018d1f6, 0x6898631c, 0x0001f040, 0x68986098, 0x0f01f010, 0x6898d1fb,
59+
0x4070f020, 0x6a586098, 0x0002f010, 0xbc30bf04, 0x20014770, 0x4770bc30, 0xf0116881, 0xd1260f07,
60+
0xb1396a41, 0x62412100, 0xb1196a41, 0x62412102, 0xb9e16a41, 0xf0216881, 0xf0414170, 0x60815100,
61+
0xf4216881, 0xf441417f, 0x6081412a, 0xf0416881, 0x60810102, 0xf0116881, 0xd1fb0f02, 0xf0216881,
62+
0x60814170, 0xf0106a40, 0xbf080002, 0x20014770, 0x00004770, 0x00000004, 0x00000000,
63+
FLC0_BASE, FLASH0_BASE,FLASH0_SIZE,CLOCK_DIV, BURST_SIZE, FLC1_BASE, FLASH1_BASE,FLASH1_SIZE,
4964
};
5065

5166
/**
@@ -56,25 +71,29 @@ static const uint32_t flash_algo_blob[] = {
5671
* at address flash_start + flash_size.
5772
*/
5873
static const sector_info_t sectors_info[] = {
59-
FLASH_BASE, FLASH_SECTOR,
74+
FLASH0_BASE, FLASH_SECTOR,
6075
};
6176

6277
static const program_target_t flash = {
63-
0x20000021, // Init
64-
0x2000003b, // UnInit
65-
0x2000004d, // EraseChip
66-
0x2000008d, // EraseSector
67-
0x200000d1, // ProgramPage
68-
0x00000000, // Verify
78+
0x20000005, // Init
79+
0x20000033, // UnInit
80+
0x20000053, // EraseChip
81+
0x20000075, // EraseSector
82+
0x200000e5, // ProgramPage
83+
0x0, // Verify
84+
85+
// BKPT : start of blob + 1
86+
// RSB : blob start + header + rw data offset
87+
// RSP : stack pointer
6988
{
70-
0x20000001, // BKPT : start of blob + 1
71-
0x200001fc, // RSB : blob start + header + rw data offset
72-
0x20000500 // RSP : stack pointer
89+
0x20000001,
90+
0x2000029c,
91+
0x20000500
7392
},
7493

75-
0x20000000 + 0x00000A00, // mem buffer location
76-
0x20000000, // location to write prog_blob in target RAM
77-
sizeof(flash_algo_blob), // prog_blob size
78-
flash_algo_blob, // address of prog_blob
79-
0x00000400 // ram_to_flash_bytes_to_be_written
94+
0x20000000 + 0x00000A00, // mem buffer location
95+
0x20000000, // location to write prog_blob in target RAM
96+
sizeof(maxim_flash_prog_blob), // prog_blob size
97+
maxim_flash_prog_blob, // address of prog_blob
98+
0x00002000 // ram_to_flash_bytes_to_be_written
8099
};

0 commit comments

Comments
 (0)