Skip to content

Commit 81d7389

Browse files
authored
Merge pull request #722 from sparkfun/ambiq-apollo3-experimental
Ambiq Apollo3 and Sparkfun Artemis DK Board
2 parents 39504bd + a849d17 commit 81d7389

File tree

9 files changed

+450
-0
lines changed

9 files changed

+450
-0
lines changed

projects.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,10 @@ projects:
158158
- *module_if
159159
- *module_hic_kl26z
160160
- records/board/nina_b1.yaml
161+
kl26z_artemis_dk_if:
162+
- *module_if
163+
- *module_hic_kl26z
164+
- records/board/artemis_dk.yaml
161165
k20dx_frdmk20dx_if:
162166
- *module_if
163167
- *module_hic_k20dx

records/board/artemis_dk.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
common:
2+
macros:
3+
- IO_CONFIG_OVERRIDE
4+
- HID_LED_DEF=GPIO_LED_ON
5+
- CDC_LED_DEF=GPIO_LED_ON
6+
- MSC_LED_DEF=GPIO_LED_ON
7+
- USB_PROD_STR="SparkFun Artemis Dev Kit CMSIS-DAP"
8+
includes:
9+
- source/board/override_mkl26z_reset
10+
sources:
11+
board:
12+
- source/board/artemis_dk.c
13+
family:
14+
- source/family/ambiq/ama3b1kk/target.c
15+
- source/family/ambiq/ama3b1kk/target_reset.c

source/board/artemis_dk.c

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/**
2+
* @file microbit.c
3+
* @brief board ID for the BBC Microbit 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+
#include "fsl_device_registers.h"
22+
#include "IO_Config.h"
23+
#include "DAP.h"
24+
#include "target_family.h"
25+
#include "target_board.h"
26+
27+
const char *const board_id_artemis_dk_v10 = "A127";
28+
29+
typedef enum
30+
{
31+
BOARD_VERSION_v10 = 0,
32+
} artemis_dk_version_t;
33+
34+
static void set_board_id(artemis_dk_version_t board_version)
35+
{
36+
switch (board_version)
37+
{
38+
case BOARD_VERSION_v10:
39+
target_device.rt_board_id = board_id_artemis_dk_v10;
40+
break;
41+
default:
42+
target_device.rt_board_id = board_id_artemis_dk_v10;
43+
break;
44+
}
45+
}
46+
47+
// Called in main_task() to init before USB and files are configured
48+
static void prerun_board_config(void)
49+
{
50+
// in the future you could auto-detect board version here
51+
artemis_dk_version_t board_version = (artemis_dk_version_t)BOARD_VERSION_v10;
52+
set_board_id(board_version);
53+
}
54+
55+
// USB HID override function return 1 if the activity is trivial or response is null
56+
uint8_t usbd_hid_no_activity(uint8_t *buf)
57+
{
58+
if (buf[0] == ID_DAP_Vendor3 && buf[1] == 0)
59+
return 1;
60+
else
61+
return 0;
62+
}
63+
64+
const board_info_t g_board_info = {
65+
.info_version = 0x1,
66+
.family_id = kAmbiq_ama3b1kk_FamilyID,
67+
.daplink_url_name = "ARTEMIS_HTM",
68+
.daplink_drive_name = "ARTEMIS ",
69+
.daplink_target_url = "https://www.sparkfun.com/artemis",
70+
.prerun_board_config = prerun_board_config,
71+
.target_cfg = &target_device,
72+
};
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
/* Flash OS Routines (Automagically Generated)
2+
* Copyright (c) 2009-2015 ARM Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
8+
*/
9+
10+
static const uint32_t ama3b1kk_flash_prog_blob[] = {
11+
0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
12+
0x2040f04f, 0x61812147, 0x61412100, 0x46086181, 0x20004770, 0xe92d4770, 0x4e3341f0, 0x4f332500,
13+
0x444e2406, 0x68734622, 0x46382100, 0x43054798, 0x2c401c64, 0x6832dbf6, 0x46382101, 0x43284790,
14+
0x81f0e8bd, 0x0cc1b510, 0x2101d000, 0x444a4a26, 0xf3c06853, 0x48253245, 0x28004798, 0x2001d000,
15+
0xe92dbd10, 0x460747f0, 0x07884616, 0x2001d000, 0x0491eb00, 0x8070f8df, 0x0006ea47, 0xa06cf8df,
16+
0x44c80780, 0x2000d025, 0xf5b4e01f, 0xd2017f00, 0xe00100a5, 0x6500f44f, 0x20004915, 0xe0044449,
17+
0x2b01f816, 0x2b01f801, 0x42a81c40, 0x4910d3f8, 0xc008f8d8, 0xf02708ab, 0x44490203, 0x47e04650,
18+
0xd1042800, 0x0495eba4, 0x2c00442f, 0xe8bdd1dd, 0xf8d887f0, 0x46235008, 0x4631463a, 0x46ac4650,
19+
0x47f0e8bd, 0x00004760, 0x00000004, 0x12344321, 0x00000024, 0x00000000, 0x0800004d, 0x08000051,
20+
0x08000055, 0x08000059, 0x0800005d, 0x08000061, 0x08000065, 0x08000069, 0x00000000, 0x00000000,
21+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
22+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
23+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
24+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
25+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
26+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
27+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
28+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
29+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
30+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
31+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
32+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
33+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
34+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
35+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
36+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
37+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
38+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
39+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
40+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
41+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
42+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
43+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
44+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
45+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
46+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
47+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
48+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
49+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
50+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
51+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
52+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
53+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
54+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
55+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
56+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
57+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
58+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
59+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
60+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
61+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
62+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
63+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
64+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
65+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
66+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
67+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
68+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
69+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
70+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
71+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
72+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
73+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
74+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
75+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
76+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
77+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
78+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
79+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
80+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
81+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
82+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
83+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
84+
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000};
85+
86+
// Start address of flash
87+
static const uint32_t flash_start = 0x0000C000;
88+
// Size of flash
89+
static const uint32_t flash_size = 0x000f4000;
90+
91+
/**
92+
* List of start and size for each size of flash sector - even indexes are start, odd are size
93+
* The size will apply to all sectors between the listed address and the next address
94+
* in the list.
95+
* The last pair in the list will have sectors starting at that address and ending
96+
* at address flash_start + flash_size.
97+
*/
98+
static const uint32_t sectors_info[] = {
99+
0x0000C000,
100+
0x00002000,
101+
};
102+
103+
static const program_target_t flash = {
104+
0x10000021, // Init
105+
0x10000033, // UnInit
106+
0x10000037, // EraseChip
107+
0x10000065, // EraseSector
108+
0x10000083, // ProgramPage
109+
0x0, // Verify
110+
111+
// BKPT : start of blob + 1
112+
// RSB : blob start + header + rw data offset
113+
// RSP : stack pointer
114+
{
115+
0x10000001,
116+
0x10000114,
117+
0x10000400},
118+
119+
0x10000000 + 0x00000A00, // mem buffer location
120+
0x10000000, // location to write prog_blob in target RAM
121+
sizeof(ama3b1kk_flash_prog_blob), // prog_blob size
122+
ama3b1kk_flash_prog_blob, // address of prog_blob
123+
0x00002000 // ram_to_flash_bytes_to_be_written
124+
};
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 kl26z
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 = (const sector_info_t *)sectors_info,
30+
.sector_info_length = (sizeof(sectors_info)) / (sizeof(sector_info_t)),
31+
.flash_regions[0].start = 0x0C000,
32+
.flash_regions[0].end = MB(1),
33+
.flash_regions[0].flags = kRegionIsDefault,
34+
.flash_regions[0].flash_algo = (program_target_t *)&flash,
35+
.ram_regions[0].start = 0x10000000,
36+
.ram_regions[0].end = 0x10060000,
37+
};

0 commit comments

Comments
 (0)