Skip to content

Commit 288550e

Browse files
cbrown38350mbrossard
authored andcommitted
NXP: Add TWR-KV58F
1 parent 58e9117 commit 288550e

File tree

10 files changed

+82
-76
lines changed

10 files changed

+82
-76
lines changed

projects.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,10 @@ projects:
318318
- *module_if
319319
- *module_hic_k20dx
320320
- records/board/twrkl28z72m.yaml
321+
k20dx_twrkv58f220m_if:
322+
- *module_if
323+
- *module_hic_k20dx
324+
- records/board/twrkv58f220m.yaml
321325
k20dx_xdot_l151_if:
322326
- *module_if
323327
- *module_hic_k20dx

records/board/twrkv58f220m.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
common:
2+
sources:
3+
board:
4+
- source/board/twrkv58f.c
5+
family:
6+
- source/family/freescale/kv58f/target.c
7+
- source/family/freescale/target_reset_Vseries.c
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
common:
2+
sources:
3+
target:
4+
- source/target/freescale/target_reset_Vseries.c

source/board/twrkv58f.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#include "target_family.h"
2424

2525
const board_info_t g_board_info = {
26-
.infoVersion = 0x0,
27-
.board_id = "0240",
26+
.info_version = 0x0,
27+
.board_id = "0330",
2828
.family_id = kNXP_KinetisV_FamilyID,
2929
.flags = kEnablePageErase,
3030
.target_cfg = &target_device,

source/daplink/cmsis-dap/debug_cm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
#define CSW_MSTRCORE 0x00000000 // Master Type: Core
9595
#define CSW_MSTRDBG 0x20000000 // Master Type: Debug
9696
#define CSW_RESERVED 0x01000000 // Reserved Value
97+
#define CSW_SPROT 0x40000000 // SProt
9798

9899
// Core Debug Register Address Offsets
99100
#define DBG_OFS 0x0DF0 // Debug Register Offset inside NVIC

source/family/freescale/kv58f/flash_blob.c

Lines changed: 52 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -16,86 +16,75 @@
1616

1717
static const uint32_t mkv58f_flash_prog_blob[] = {
1818
0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
19-
0xb510483e, 0x5120f24c, 0xf64d81c1, 0x81c11128, 0xf0218801, 0x80010101, 0x78414839, 0x0160f001,
20-
0xbf0c2940, 0x21002101, 0x444a4a36, 0xb1397011, 0xf0217841, 0x70410160, 0xf0117841, 0xd1fb0f60,
21-
0x44484831, 0xf864f000, 0xbf182800, 0xbd102001, 0x4448482c, 0xb1587800, 0x78414829, 0x0160f021,
22-
0x0140f041, 0x78417041, 0x0160f001, 0xd1fa2940, 0x47702000, 0xb5104824, 0x44484924, 0xf891f000,
23-
0xbf182800, 0x2100bd10, 0xe8bd481f, 0x44484010, 0xb958f000, 0x4c1cb570, 0x444c4605, 0x4b1b4601,
24-
0x68e24620, 0xf8b6f000, 0xbf182800, 0x2300bd70, 0x68e24629, 0x4070e8bd, 0x44484813, 0xb94cf000,
25-
0x460cb570, 0x4606460b, 0x480f4601, 0x4615b084, 0xf0004448, 0x2800f8eb, 0xb004bf1c, 0x2000bd70,
26-
0xe9cd2101, 0x90021000, 0x462b4807, 0x46314622, 0xf0004448, 0xb004f97f, 0x0000bd70, 0x40052000,
27-
0x4007e000, 0x00000004, 0x00000008, 0x6b65666b, 0xbf042800, 0x47702004, 0x6cc949ea, 0x6103f3c1,
28-
0xbf08290f, 0x1180f44f, 0x4ae7bf1f, 0xf832447a, 0x02891011, 0xe9c02200, 0x21022100, 0x61426081,
29-
0x618202c9, 0x1203e9c0, 0x52a0f04f, 0x2108e9c0, 0x47702000, 0xbf0e2800, 0x61012004, 0x47702000,
30-
0x48da4602, 0x49d96840, 0x0070f440, 0x47706048, 0x217048d7, 0x21807001, 0x78017001, 0x0f80f011,
31-
0x7800d0fb, 0x0f20f010, 0x2067bf1c, 0xf0104770, 0xbf1c0f10, 0x47702068, 0x0001f010, 0x2069bf18,
32-
0x28004770, 0x2004bf04, 0xb5104770, 0x4ac84604, 0x403bf06f, 0x48c76050, 0xbf144281, 0x2000206b,
33-
0xbf182800, 0x4620bd10, 0xffd2f7ff, 0x46204603, 0xffc6f7ff, 0xbd104618, 0xbf042800, 0x47702004,
34-
0x60532300, 0x60d36093, 0x61536113, 0x61d36193, 0x68c16011, 0xe9d06051, 0xfbb11001, 0x6090f0f0,
35-
0x21102008, 0x0103e9c2, 0x1005e9c2, 0x61d02004, 0x47702000, 0x4df0e92d, 0x4615b088, 0x460c4698,
36-
0x466a4682, 0xffd8f7ff, 0x4621462a, 0x9b044650, 0xf931f000, 0xbf1c0007, 0xe8bdb008, 0xe9dd8df0,
37-
0x19604600, 0xfbb51e45, 0xfb06f0f6, 0xb1205010, 0xf0f6fbb5, 0x43701c40, 0x42ac1e45, 0xf8dfbf98,
38-
0xd81cb270, 0x407ff024, 0x6010f040, 0x0004f8cb, 0x45804898, 0x206bbf14, 0x28002000, 0xb008bf1c,
39-
0x8df0e8bd, 0xf7ff4650, 0x4607ff73, 0x0010f8da, 0xbf182800, 0xb9174780, 0x42ac4434, 0x4650d9e2,
40-
0xff5ef7ff, 0x4638b008, 0x8df0e8bd, 0xbf042a00, 0x47702004, 0x45f0e92d, 0x4614b089, 0x460d461e,
41-
0x466a4680, 0xff88f7ff, 0x46294632, 0x9b034640, 0xf8e1f000, 0xbf1c0007, 0xe8bdb009, 0x9d0085f0,
42-
0xbf182e00, 0xa1e8f8df, 0xf854d025, 0xf8ca0b04, 0x98030008, 0xbf042804, 0x407ff025, 0x60c0f040,
43-
0x2808d009, 0xf854d109, 0xf8ca0b04, 0xf025000c, 0xf040407f, 0xf8ca60e0, 0x46400004, 0xff28f7ff,
44-
0x1010f8d8, 0x29004607, 0x4788bf18, 0x9803b91f, 0x1a364405, 0x4640d1d9, 0xff12f7ff, 0x4638b009,
45-
0x85f0e8bd, 0xbf042800, 0x47702004, 0xea424a62, 0x4a5f4101, 0xe70b6051, 0x4dffe92d, 0x4614b088,
46-
0x460d469a, 0x9808466a, 0xff36f7ff, 0x46294622, 0x98089b05, 0xf88ff000, 0xbf1c2800, 0xe8bdb00c,
47-
0x466a8df0, 0x98084629, 0xff26f7ff, 0xf8dd9e00, 0x42708008, 0x0100f1c8, 0x42474008, 0xbf0842b7,
48-
0x2c004447, 0xf8dfbf18, 0xd01fb128, 0x42a51bbd, 0x4625bf88, 0xf0269805, 0xfbb5417f, 0xf041f0f0,
49-
0xf8cb7180, 0x04001004, 0x200aea40, 0x00fff040, 0x0008f8cb, 0xf7ff9808, 0x2800fecb, 0xb00cbf1c,
50-
0x8df0e8bd, 0x442e1b64, 0xd1df4447, 0x2000b00c, 0x8df0e8bd, 0xbf042b00, 0x47702004, 0x4dffe92d,
51-
0x4616b088, 0x7a14e9dd, 0x460c461d, 0xf8dd466a, 0x98088058, 0xfee0f7ff, 0x3007e9dd, 0x46214632,
52-
0xf839f000, 0xbf1c2800, 0xe8bdb00c, 0x9c008df0, 0xbf042e00, 0xe8bdb00c, 0xf8df8df0, 0xf06fb094,
53-
0xea40407f, 0xf0246707, 0xf040407f, 0xf8cb7000, 0xf8cb0004, 0x68287008, 0x000cf8cb, 0xf7ff9808,
54-
0xb168fe87, 0x0f00f1ba, 0xf8cabf18, 0xf1b84000, 0xbf1c0f00, 0xf8c82100, 0xb00c1000, 0x8df0e8bd,
55-
0x1a769907, 0x0103f021, 0x9907440d, 0xd1da440c, 0xe8bdb00c, 0x28008df0, 0x2004bf04, 0xf1a34770,
56-
0x42190301, 0x421abf0e, 0x47702065, 0x428b6803, 0x6840d806, 0x44184411, 0xbf244288, 0x47702000,
57-
0x47702066, 0x40048000, 0x000003b4, 0x4001f000, 0x40020000, 0x6b65666b, 0x4000ffff, 0x40020004,
58-
0x40020010, 0x00100008, 0x00200018, 0x00400030, 0x00800060, 0x010000c0, 0x02000180, 0x04000300,
59-
0x00000600, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
60-
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000
19+
0xb510494a, 0x60084449, 0x5120f24c, 0x81c14848, 0x1128f64d, 0x880181c1, 0x0101f021, 0x48468001,
20+
0x49442200, 0x60014448, 0x604102c9, 0x60811209, 0x31fff04f, 0x1205e9c0, 0x2020f880, 0xf0006241,
21+
0x2800f96d, 0x2001d000, 0x2000bd10, 0x4a3b4770, 0x447ab508, 0x92002300, 0x02cff3c1, 0x48364601,
22+
0xf0004448, 0x2800f960, 0x2001d000, 0x4933bd08, 0x44794831, 0x44483920, 0xf000b508, 0x2800f8d3,
23+
0x482ed10e, 0x4b2e4478, 0x447b3832, 0x482a9000, 0x492c2208, 0xf0004448, 0x2800f98f, 0x2001d000,
24+
0x4b26bd08, 0x4601447b, 0x3b524823, 0x5200f44f, 0xf0004448, 0xb508b8eb, 0x46131dc9, 0x0207f021,
25+
0x4479491e, 0x91003970, 0x481b4601, 0xf0004448, 0x2800f973, 0x2001d000, 0x481bbd08, 0xf4216801,
26+
0x60013100, 0x20004919, 0x47706008, 0x20004916, 0x3170b570, 0x48146008, 0xf4216801, 0x60013180,
27+
0x306c4811, 0xf6436800, 0x4d1074ff, 0xf3c03524, 0xf3c0314e, 0xea0403c9, 0x46181241, 0x7680ea42,
28+
0x1e40602e, 0x1e49d2fa, 0xbd70d2f5, 0x00000004, 0x40052000, 0x40020000, 0x00000008, 0x000000fb,
29+
0x000003e2, 0x10000408, 0xe000ed14, 0xe000ef50, 0x4604b570, 0x25006800, 0x061b7803, 0x2370d5fc,
30+
0x20007003, 0x280ce03a, 0xe8dfd236, 0x0a06f000, 0x1a16120e, 0x2a26221e, 0x6826322e, 0x71f37813,
31+
0x6826e02a, 0x71b37853, 0x6826e026, 0x71737893, 0x6826e022, 0x713378d3, 0x6826e01e, 0x72f37913,
32+
0x6826e01a, 0x72b37953, 0x6826e016, 0x72737993, 0x6826e012, 0x723379d3, 0x6826e00e, 0x73f37a13,
33+
0x6826e00a, 0x73b37a53, 0x6826e006, 0x73737a93, 0x6826e002, 0x73337ad3, 0xb2c01c40, 0xd9c24288,
34+
0x20806821, 0xe0037008, 0x1c416a60, 0x4780d000, 0x78006820, 0xd5f70600, 0x68484909, 0x2000f440,
35+
0x68206048, 0x06817800, 0x2504d501, 0x06c1e006, 0x2508d501, 0x07c0e002, 0x2510d000, 0xbd704628,
36+
0x4001f000, 0x2244b508, 0x2100460b, 0x2000f88d, 0x4798466a, 0xb538bd08, 0x078a4614, 0xf44fd002,
37+
0xbd387080, 0x428b6843, 0x6882d803, 0x428a441a, 0x68c3d80c, 0xd803428b, 0x441a6902, 0xd801428a,
38+
0xbd382002, 0xf5011ac9, 0xe0000100, 0x22081ac9, 0x2000f88d, 0xf88d0c0a, 0x0a0a2001, 0x2002f88d,
39+
0x1003f88d, 0x466a2103, 0xbd3847a0, 0x45f8e92d, 0x46984607, 0x20004616, 0x198a687b, 0xd803428b,
40+
0x441c68bc, 0xd20e4294, 0x428b68fb, 0x693cd803, 0x4294441c, 0x2002d202, 0x85f8e8bd, 0x25001acc,
41+
0x0400f504, 0x1acce002, 0x5500f44f, 0xf1f5fbb4, 0x4111fb05, 0xf44fb111, 0xe7ed7080, 0xf1f5fbb6,
42+
0x6111fb05, 0x2001b1a9, 0xf88de7e6, 0x0c20a000, 0x0001f88d, 0xf88d0a20, 0x21030002, 0x466a4643,
43+
0xf88d4638, 0x47984003, 0xd1d52800, 0x442c1b76, 0xf04fe001, 0x2e000a09, 0xe7cdd1e7, 0x20004601,
44+
0x61c86108, 0xe92d4770, 0x684641fc, 0x0482eb01, 0x428e9d08, 0x6887d803, 0x428f4437, 0x68c7d80a,
45+
0xd804428f, 0xc010f8d0, 0x428f4467, 0x2002d802, 0x81fce8bd, 0xd80642a6, 0x44376887, 0xd30242a7,
46+
0x24041b89, 0x68c6e00a, 0xd90342a6, 0x44376907, 0xd3ec42a7, 0x24041b89, 0x0100f501, 0xf6f4fbb1,
47+
0x1416fb04, 0xf44fb114, 0xe7e17080, 0xf88d2401, 0x0c0c4000, 0x4001f88d, 0xf88d0a0c, 0xf88d4002,
48+
0x0a111003, 0x1004f88d, 0xf88d2106, 0x466a2005, 0x3006f88d, 0xe7cb47a8, 0x43fee92d, 0x46074616,
49+
0x461c2000, 0x8028f8dd, 0x074b198a, 0xf44fd003, 0xe8bd7080, 0x077383fe, 0x2001d001, 0x687be7f9,
50+
0xd803428b, 0x441d68bd, 0xd20c4295, 0x428b68fb, 0x693dd803, 0x4295441d, 0x2002d201, 0x1acde7e9,
51+
0x0500f505, 0x1acde02e, 0x2007e02c, 0x0000f88d, 0xf88d0c28, 0x0a280001, 0x0002f88d, 0x5003f88d,
52+
0xf88d78e0, 0x78a00004, 0x0005f88d, 0xf88d7860, 0x78200006, 0x0007f88d, 0xf88d79e0, 0x79a00008,
53+
0x0009f88d, 0xf88d7960, 0x7920000a, 0x4643210b, 0x000bf88d, 0x4638466a, 0x28004798, 0x3408d1b9,
54+
0x3e083508, 0xd1d02e00, 0x0000e7b3, 0xfffffffe, 0xffffffff, 0xfffffffe, 0x00000000, 0x00000000,
55+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
56+
0x00000000, 0x00000000
6157
};
6258

6359
// Start address of flash
6460
static const uint32_t flash_start = 0x10000000;
6561
// Size of flash
6662
static const uint32_t flash_size = 0x00100000;
6763

68-
/**
69-
* List of start and size for each size of flash sector
70-
* The size will apply to all sectors between the listed address and the next address
71-
* in the list.
72-
* The last pair in the list will have sectors starting at that address and ending
73-
* at address start + size.
74-
*/
7564
static const sector_info_t sectors_info[] = {
76-
{ 0x10000000, 0x00001000 },
65+
{ 0x10000000, 0x00002000 },
7766
};
7867

7968
static const program_target_t flash = {
80-
0x00000021, // Init
81-
0x00000071, // UnInit
82-
0x00000095, // EraseChip
83-
0x000000b5, // EraseSector
84-
0x000000e1, // ProgramPage
69+
0x20000021, // Init
70+
0x2000006b, // UnInit
71+
0x2000008f, // EraseChip
72+
0x200000c3, // EraseSector
73+
0x200000d7, // ProgramPage
8574
0x0, // Verify
8675

8776
// BKPT : start of blob + 1
8877
// RSB : blob start + header + rw data offset
8978
// RSP : stack pointer
9079
{
91-
0x00000001,
92-
0x00000524,
93-
0x00000800
80+
0x20000001,
81+
0x20000498,
82+
0x20000700
9483
},
9584

96-
0x00000000 + 0x00000A00, // mem buffer location
97-
0x00000000, // location to write prog_blob in target RAM
98-
sizeof(mkv58f_flash_prog_blob), // prog_blob size
99-
mkv58f_flash_prog_blob, // address of prog_blob
100-
0x00000400 // ram_to_flash_bytes_to_be_written
85+
0x20000000 + 0x00000A00, // mem buffer location
86+
0x20000000, // location to write prog_blob in target RAM
87+
sizeof(mkv58f_flash_prog_blob), // prog_blob size
88+
mkv58f_flash_prog_blob, // address of prog_blob
89+
0x00000200 // ram_to_flash_bytes_to_be_written
10190
};

source/family/freescale/kv58f/target.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
target_cfg_t target_device = {
2929
.sectors_info = sectors_info,
3030
.sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)),
31-
.flash_regions[0].start = 0x00000000,
32-
.flash_regions[0].end = 0x00100000,
31+
.flash_regions[0].start = 0x10000000,
32+
.flash_regions[0].end = 0x10100000,
3333
.flash_regions[0].flags = kRegionIsDefault,
3434
.flash_regions[0].flash_algo = (program_target_t *) &flash,
35-
.ram_regions[0].start = 0x1fff0000,
36-
.ram_regions[0].end = 0x20030000,
35+
.ram_regions[0].start = 0x20000000,
36+
.ram_regions[0].end = 0x2000,
3737
};

source/family/freescale/target_reset_Vseries.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
2-
* @file target_reset_Kseries.c
3-
* @brief Target reset for the Kinetis K series
2+
* @file target_reset_Vseries.c
3+
* @brief Target reset for the Kinetis V series
44
*
55
* DAPLink Interface Firmware
66
* Copyright (c) 2009-2019, ARM Limited, All Rights Reserved
@@ -19,15 +19,14 @@
1919
* limitations under the License.
2020
*/
2121

22-
#include "target_reset.h"
2322
#include "swd_host.h"
2423
#include "info.h"
2524
#include "target_family.h"
2625

2726
#define MDM_STATUS 0x01000000
2827
#define MDM_CTRL 0x01000004
2928
#define MDM_IDR 0x010000fc
30-
#define MDM_ID 0x001c0000 // K64, K22 (K series)
29+
#define MDM_ID 0x001c0030 // (V series)
3130

3231
static void target_before_init_debug(void)
3332
{
@@ -109,7 +108,7 @@ static uint8_t target_unlock_sequence(void)
109108
//
110109
static uint8_t security_bits_set(uint32_t addr, uint8_t *data, uint32_t size)
111110
{
112-
const uint32_t fsec_addr = 0x40C;
111+
const uint32_t fsec_addr = 0x1000040C;
113112

114113
if ((addr <= fsec_addr) && (addr + size) > fsec_addr) {
115114
uint8_t fsec = data[fsec_addr - addr];
@@ -129,7 +128,7 @@ static uint8_t security_bits_set(uint32_t addr, uint8_t *data, uint32_t size)
129128
return 0;
130129
}
131130

132-
const target_family_descriptor_t g_nxp_kinetis_kseries = {
131+
const target_family_descriptor_t g_nxp_kinetis_vseries = {
133132
.family_id = kNXP_KinetisV_FamilyID,
134133
.default_reset_type = kHardwareReset,
135134
.target_before_init_debug = target_before_init_debug,

source/target/target_family.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const target_family_descriptor_t g_sw_sysresetreq_family = {
4646
// Weak references to family definitions.
4747
__WEAK const target_family_descriptor_t g_nxp_kinetis_kseries = {0};
4848
__WEAK const target_family_descriptor_t g_nxp_kinetis_lseries = {0};
49+
__WEAK const target_family_descriptor_t g_nxp_kinetis_vseries = {0};
4950
__WEAK const target_family_descriptor_t g_nxp_kinetis_k32_series = {0};
5051
__WEAK const target_family_descriptor_t g_nxp_mimxrt = {0};
5152
__WEAK const target_family_descriptor_t g_nxp_rapid_iot = {0};
@@ -78,6 +79,7 @@ const target_family_descriptor_t *g_families[] = {
7879
&g_sw_sysresetreq_family,
7980
&g_nxp_kinetis_kseries,
8081
&g_nxp_kinetis_lseries,
82+
&g_nxp_kinetis_vseries,
8183
&g_nxp_kinetis_k32_series,
8284
&g_nxp_lpc55xx_series,
8385
&g_nxp_mimxrt,

source/target/target_family.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ typedef enum _family_id {
9797
kNXP_RapidIot_FamilyID = CREATE_FAMILY_ID(kNXP_VendorID, 4),
9898
kNXP_KinetisK32_FamilyID = CREATE_FAMILY_ID(kNXP_VendorID, 5),
9999
kNXP_LPC55xx_FamilyID = CREATE_FAMILY_ID(kNXP_VendorID, 6),
100-
kNXP_KinetisV_FamilyID = VENDOR_TO_FAMILY(kNXP_VendorID, 7),
100+
kNXP_KinetisV_FamilyID = CREATE_FAMILY_ID(kNXP_VendorID, 7),
101101
kNordic_Nrf51_FamilyID = CREATE_FAMILY_ID(kNordic_VendorID, 1),
102102
kNordic_Nrf52_FamilyID = CREATE_FAMILY_ID(kNordic_VendorID, 2),
103103
kRealtek_Rtl8195am_FamilyID = CREATE_FAMILY_ID(kRealtek_VendorID, 1),

0 commit comments

Comments
 (0)