Skip to content

Commit d1f365f

Browse files
Masmiseim36mathias-arm
authored andcommitted
Add support for NXP FRDM-KL03 board
1 parent 0feda6e commit d1f365f

File tree

6 files changed

+178
-0
lines changed

6 files changed

+178
-0
lines changed

projects.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ projects:
219219
- *module_if
220220
- *module_hic_k20dx
221221
- records/board/frdmkl02z.yaml
222+
k20dx_frdmkl03z_if:
223+
- *module_if
224+
- *module_hic_k20dx
225+
- records/board/frdmkl03z.yaml
222226
k20dx_frdmkl05z_if:
223227
- *module_if
224228
- *module_hic_k20dx

records/board/frdmkl03z.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/frdmkl03z.c
5+
family:
6+
- source/family/freescale/kl03z/target.c
7+
- source/family/freescale/target_reset_Lseries.c

source/board/frdmkl03z.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* @file frdmkl03z.c
3+
* @brief board ID for the NXP FRDM-KL03Z board
4+
*
5+
* DAPLink Interface Firmware
6+
* Copyright (c) 2009-2019, ARM Limited, All Rights Reserved
7+
* SPDX-License-Identifier: Apache-2.0
8+
*
9+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
10+
* not use this file except in compliance with the License.
11+
* You may obtain a copy of the License at
12+
*
13+
* http://www.apache.org/licenses/LICENSE-2.0
14+
*
15+
* Unless required by applicable law or agreed to in writing, software
16+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
* See the License for the specific language governing permissions and
19+
* limitations under the License.
20+
*/
21+
22+
#include "target_board.h"
23+
#include "target_family.h"
24+
25+
const board_info_t g_board_info = {
26+
.info_version = kBoardInfoVersion,
27+
.board_id = "0207",
28+
.family_id = kNXP_KinetisL_FamilyID,
29+
.target_cfg = &target_device,
30+
};
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/**
2+
* @file flash_blob.c
3+
* @brief Flash algorithm for the kl03z
4+
*
5+
* DAPLink Interface Firmware
6+
* Copyright (c) 2009-2019, ARM Limited, All Rights Reserved
7+
* SPDX-License-Identifier: Apache-2.0
8+
*
9+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
10+
* not use this file except in compliance with the License.
11+
* You may obtain a copy of the License at
12+
*
13+
* http://www.apache.org/licenses/LICENSE-2.0
14+
*
15+
* Unless required by applicable law or agreed to in writing, software
16+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
* See the License for the specific language governing permissions and
19+
* limitations under the License.
20+
*/
21+
22+
#include "flash_blob.h"
23+
24+
static const uint32_t KL03Z_FLM[] = {
25+
0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
26+
0x492bb510, 0x60082000, 0x4448482a, 0xf88af000, 0xd0002800, 0xbd102001, 0x47702000, 0xb5104825,
27+
0xf0004448, 0x0004f871, 0x4822d105, 0x44482100, 0xf908f000, 0xf0004604, 0x4620f834, 0xb570bd10,
28+
0x46014605, 0x2201481b, 0xf0004448, 0x0004f837, 0x4818d107, 0x22012300, 0x44484629, 0xf8baf000,
29+
0xf0004604, 0x4620f81e, 0xb5febd70, 0x460b460d, 0x46014607, 0x4616480f, 0xf0004448, 0x0004f887,
30+
0x9001d10b, 0x21019002, 0x9100480a, 0x462a4633, 0x44484639, 0xf8e4f000, 0xf0004604, 0x4620f802,
31+
0x4805bdfe, 0x220168c1, 0x43110292, 0x477060c1, 0x40048100, 0x00000004, 0xf0003000, 0x4614b5f8,
32+
0xf000460d, 0x2800f848, 0x192cd118, 0x05a11e64, 0x0aa1d003, 0x028c1c49, 0x4e091e64, 0x2709447e,
33+
0xd80b42a5, 0x60056830, 0x71c74806, 0xf8e8f000, 0xd1032800, 0x02892101, 0xe7f1186d, 0x0000bdf8,
34+
0x0000038c, 0x40020000, 0x2800b510, 0x4904d005, 0x71c82044, 0xf8d4f000, 0x2004bd10, 0x0000bd10,
35+
0x40020000, 0xd0122800, 0x68c94916, 0x01094a16, 0x00490f09, 0x5a51447a, 0xd00a0309, 0x60022200,
36+
0x21016041, 0x02896081, 0x461060c1, 0x20044770, 0x20644770, 0x28004770, 0x460bd005, 0x079b4313,
37+
0x2065d003, 0x20044770, 0x68034770, 0xd804428b, 0x18896840, 0x42881818, 0x2066d201, 0x20004770,
38+
0x00004770, 0x40048040, 0x00000312, 0x461db5f8, 0x460e0014, 0x461ad017, 0xffddf7ff, 0xd1132800,
39+
0x447f4f0a, 0xd00f2d00, 0x60066838, 0x6839cc01, 0x49076048, 0x71c82006, 0xf882f000, 0xd1032800,
40+
0x1f2d1d36, 0x2004e7ee, 0x0000bdf8, 0x000002c6, 0x40020000, 0xb081b5ff, 0x460e4614, 0xf7ff4605,
41+
0x2800ffba, 0x68a9d127, 0xf0006868, 0x9000f881, 0x42404271, 0x424d4001, 0xd10142b5, 0x182d9800,
42+
0xd0172c00, 0x42a71baf, 0x4627d900, 0x08b9480b, 0x68004478, 0x480a6006, 0x71c22201, 0x72c20a0a,
43+
0x99047281, 0xf0007241, 0x2800f84b, 0x1be4d103, 0xe7e319f6, 0xb0052000, 0x0000bdf0, 0x00000258,
44+
0x40020000, 0x2800b510, 0x4804d006, 0x71c22240, 0xf0007181, 0xbd10f835, 0xbd102004, 0x40020000,
45+
0x9f08b5f8, 0x4616001c, 0xd004460d, 0xff73f7ff, 0xd1012800, 0x2004e01d, 0x480fbdf8, 0x68014478,
46+
0x490e600d, 0x71ca2202, 0x72ca9a06, 0x68216800, 0xf0006081, 0x2800f815, 0x9907d008, 0xd0002900,
47+
0x2f00600d, 0x2100d0e8, 0xbdf86039, 0x1d241f36, 0x2e001d2d, 0xbdf8d1e1, 0x000001ec, 0x40020000,
48+
0x2170480a, 0x21807001, 0x78017001, 0xd0fc09c9, 0x06817800, 0x2067d501, 0x06c14770, 0x2068d501,
49+
0x07c04770, 0x2069d0fc, 0x00004770, 0x40020000, 0x09032200, 0xd32c428b, 0x428b0a03, 0x2300d311,
50+
0xe04e469c, 0x430b4603, 0x2200d43c, 0x428b0843, 0x0903d331, 0xd31c428b, 0x428b0a03, 0x4694d301,
51+
0x09c3e03f, 0xd301428b, 0x1ac001cb, 0x09834152, 0xd301428b, 0x1ac0018b, 0x09434152, 0xd301428b,
52+
0x1ac0014b, 0x09034152, 0xd301428b, 0x1ac0010b, 0x08c34152, 0xd301428b, 0x1ac000cb, 0x08834152,
53+
0xd301428b, 0x1ac0008b, 0x08434152, 0xd301428b, 0x1ac0004b, 0x1a414152, 0x4601d200, 0x46104152,
54+
0xe05d4770, 0xd0000fca, 0x10034249, 0x4240d300, 0x22004053, 0x0903469c, 0xd32d428b, 0x428b0a03,
55+
0x22fcd312, 0xba120189, 0x428b0a03, 0x0189d30c, 0x428b1192, 0x0189d308, 0x428b1192, 0x0189d304,
56+
0x1192d03a, 0x0989e000, 0x428b09c3, 0x01cbd301, 0x41521ac0, 0x428b0983, 0x018bd301, 0x41521ac0,
57+
0x428b0943, 0x014bd301, 0x41521ac0, 0x428b0903, 0x010bd301, 0x41521ac0, 0x428b08c3, 0x00cbd301,
58+
0x41521ac0, 0x428b0883, 0x008bd301, 0x41521ac0, 0x0843d2d9, 0xd301428b, 0x1ac0004b, 0x1a414152,
59+
0x4601d200, 0x41524663, 0x4610105b, 0x4240d301, 0xd5002b00, 0x47704249, 0x105b4663, 0x4240d300,
60+
0x2000b501, 0x46c046c0, 0x0002bd02, 0x00000004, 0x00000008, 0x00000010, 0x00000020, 0x00000040,
61+
0x00000000, 0x00000000, 0x00000020, 0x40020004, 0x00000000,
62+
};
63+
64+
/**
65+
* List of start and size for each size of flash sector
66+
* The size will apply to all sectors between the listed address and the next address
67+
* in the list.
68+
* The last pair in the list will have sectors starting at that address and ending
69+
* at address start + size.
70+
*/
71+
static const sector_info_t sectors_info[] = {
72+
{0, 1024},
73+
};
74+
75+
static const program_target_t flash = {
76+
0x20000021, // Init
77+
0x20000039, // UnInit
78+
0x2000003D, // EraseChip
79+
0x2000005F, // EraseSector
80+
0x2000008B, // ProgramPage
81+
0x0, // Verify
82+
83+
// breakpoint = RAM start + 1
84+
// RSB : base address is address of Execution Region PrgData in map file
85+
// to access global/static data
86+
// RSP : Initial stack pointer
87+
{
88+
0x20000001, // breakpoint instruction address
89+
0x20000000 + 0x20 + 0x470, // static base register value (image start + header + static base offset)
90+
0x20000800 // initial stack pointer
91+
},
92+
93+
0x20000a00, // program_buffer, any valid RAM location with +512 bytes of headroom
94+
0x20000000, // algo_start, start of RAM
95+
sizeof(KL03Z_FLM), // algo_size, size of array above
96+
KL03Z_FLM, // image, flash algo instruction array
97+
512 // ram_to_flash_bytes_to_be_written
98+
};
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* @file target.c
3+
* @brief Target information for the kl03z
4+
*
5+
* DAPLink Interface Firmware
6+
* Copyright (c) 2009-2019, ARM Limited, All Rights Reserved
7+
* SPDX-License-Identifier: Apache-2.0
8+
*
9+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
10+
* not use this file except in compliance with the License.
11+
* You may obtain a copy of the License at
12+
*
13+
* http://www.apache.org/licenses/LICENSE-2.0
14+
*
15+
* Unless required by applicable law or agreed to in writing, software
16+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
* See the License for the specific language governing permissions and
19+
* limitations under the License.
20+
*/
21+
22+
#include "target_config.h"
23+
24+
// The file flash_blob.c must only be included in target.c
25+
#include "flash_blob.c"
26+
27+
// target information
28+
target_cfg_t target_device = {
29+
.sectors_info = sectors_info,
30+
.sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)),
31+
.flash_regions[0].start = 0,
32+
.flash_regions[0].end = KB(32),
33+
.flash_regions[0].flags = kRegionIsDefault,
34+
.flash_regions[0].flash_algo = (program_target_t *) &flash,
35+
.ram_regions[0].start = 0x1FFFFC00,
36+
.ram_regions[0].end = 0x20000C00,
37+
};

test/info.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
("k20dx_frdmkw24d_if", True, 0x8000, "bin" ),
4444
("k20dx_frdmkw41z_if", True, 0x8000, "bin" ),
4545
("k20dx_frdmkl02z_if", True, 0x8000, "bin" ),
46+
("k20dx_frdmkl03z_if", True, 0x8000, "bin" ),
4647
("k20dx_frdmkl05z_if", True, 0x8000, "bin" ),
4748
("k20dx_frdmkl25z_if", True, 0x8000, "bin" ),
4849
("k20dx_frdmkl26z_if", True, 0x8000, "bin" ),
@@ -169,6 +170,7 @@ def VENDOR_TO_FAMILY(x, y) : return (VENDOR_ID[x] <<8) | y
169170
( 0x0204, VENDOR_TO_FAMILY('NXP', 2), 'k20dx_frdmkl02z_if', 'k20dx_bl', None ),
170171
( 0x0205, VENDOR_TO_FAMILY('NXP', 2), 'k20dx_frdmkl28z_if', 'k20dx_bl', None ),
171172
( 0x0206, VENDOR_TO_FAMILY('NXP', 1), 'k20dx_twrke18f_if', 'k20dx_bl', None ),
173+
( 0x0207, VENDOR_TO_FAMILY('NXP', 2), 'k20dx_frdmkl03z_if', 'k20dx_bl', 'FRDM-KL03Z' ),
172174
( 0x0210, VENDOR_TO_FAMILY('NXP', 2), 'k20dx_frdmkl05z_if', 'k20dx_bl', 'FRDM-KL05Z' ),
173175
( 0x0213, VENDOR_TO_FAMILY('NXP', 2), 'k20dx_frdmke15z_if', 'k20dx_bl', None ),
174176
( 0x0214, VENDOR_TO_FAMILY('NXP', 4), 'k20dx_hexiwear_if', 'k20dx_bl', 'HEXIWEAR' ),

0 commit comments

Comments
 (0)