Skip to content

Commit 30d84e1

Browse files
authored
Merge pull request #660 from OpenNuvoton/master
Add Nuvoton M48SSIDAE HIC and NuMaker-M252KG board
2 parents abed35e + 593ea28 commit 30d84e1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+22586
-0
lines changed

projects.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ module:
6969
hic_max32625: &module_hic_max32625
7070
- records/rtos/rtos-cm4.yaml
7171
- records/hic_hal/max32625.yaml
72+
hic_m48ssidae: &module_hic_m48ssidae
73+
- records/rtos/rtos-cm4.yaml
74+
- records/hic_hal/m48ssidae.yaml
7275

7376
projects:
7477
kl26z_bl:
@@ -623,3 +626,11 @@ projects:
623626
- *module_if
624627
- *module_hic_lpc11u35
625628
- records/board/wio_emw3166.yaml
629+
m48ssidae_bl:
630+
- *module_bl
631+
- records/hic_hal/m48ssidae.yaml
632+
- records/board/m48ssidae_bl.yaml
633+
m48ssidae_numaker_m252kg_if:
634+
- *module_if
635+
- *module_hic_m48ssidae
636+
- records/board/numaker_m252kg.yaml

records/board/m48ssidae_bl.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
common:
2+
sources:
3+
board:
4+
- source/board/m48ssidae_bl.c

records/board/numaker_m252kg.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
common:
2+
sources:
3+
board:
4+
- source/board/numaker_m252kg.c
5+
family:
6+
- source/family/nuvoton/m252kg6ae/target.c

records/hic_hal/m48ssidae.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
common:
2+
target:
3+
- m485sidae
4+
core:
5+
- Cortex-M4F
6+
macros:
7+
- INTERFACE_M48SSIDAE
8+
- DAPLINK_HIC_ID=0x97969921 # DAPLINK_HIC_ID_M48SSIDAE
9+
- OS_CLOCK=192000000
10+
- DAPLINK_IF
11+
includes:
12+
- source/hic_hal/nuvoton/m48ssidae
13+
- source/hic_hal/nuvoton/m48ssidae/CMSIS/Include
14+
- source/hic_hal/nuvoton/m48ssidae/Device/Nuvoton/M480/Include
15+
- source/hic_hal/nuvoton/m48ssidae/StdDriver/inc
16+
sources:
17+
hic_hal:
18+
- source/hic_hal/nuvoton/m48ssidae
19+
- source/hic_hal/nuvoton/m48ssidae/Device/Nuvoton/M480/Source
20+
- source/hic_hal/nuvoton/m48ssidae/Device/Nuvoton/M480/Source/ARM
21+
- source/hic_hal/nuvoton/m48ssidae/StdDriver/src
22+
23+
tool_specific:
24+
uvision:
25+
misc:
26+
ld_flags:
27+
- --predefine="-I..\..\..\source\hic_hal\nuvoton\m48ssidae"
28+
c_flags:
29+
- --no_unaligned_access
30+
cxx_flags:
31+
- --no_unaligned_access
32+
asm_flags:
33+
- --no_unaligned_access
34+
make_armcc:
35+
misc:
36+
ld_flags:
37+
- --predefine="-Isource\hic_hal\nuvoton\m48ssidae"
38+
c_flags:
39+
- --no_unaligned_access
40+
cxx_flags:
41+
- --no_unaligned_access
42+
asm_flags:
43+
- --no_unaligned_access

source/board/m48ssidae_bl.c

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/**
2+
* @file m48ssidae_bl.c
3+
* @brief board ID and meta-data for the hardware interface circuit (HIC) based on Nuvoton M48SSIDAE
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+
#include "daplink_addr.h"
24+
#include "compiler.h"
25+
#include "target_board.h"
26+
#include "target_family.h"
27+
28+
// Warning - changing the interface start will break backwards compatibility
29+
COMPILER_ASSERT(DAPLINK_ROM_IF_START == 0x0000C000);
30+
COMPILER_ASSERT(DAPLINK_ROM_IF_SIZE == KB(204));
31+
32+
/**
33+
* List of start and size for each size of flash sector
34+
* The size will apply to all sectors between the listed address and the next address
35+
* in the list.
36+
* The last pair in the list will have sectors starting at that address and ending
37+
* at address start + size.
38+
*/
39+
static const sector_info_t sectors_info[] = {
40+
{DAPLINK_ROM_IF_START, 0x1000},
41+
};
42+
43+
// m48ssidae target information
44+
target_cfg_t target_device = {
45+
.sectors_info = sectors_info,
46+
.sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)),
47+
.flash_regions[0].start = DAPLINK_ROM_IF_START,
48+
.flash_regions[0].end = DAPLINK_ROM_IF_START + DAPLINK_ROM_IF_SIZE,
49+
.flash_regions[0].flags = kRegionIsDefault,
50+
.ram_regions[0].start = DAPLINK_RAM_START,
51+
.ram_regions[0].end = DAPLINK_RAM_START + DAPLINK_RAM_SIZE,
52+
/* .flash_algo not needed for bootloader */
53+
};
54+
55+
// bootloader has no family
56+
const target_family_descriptor_t *g_target_family = NULL;
57+
58+
const board_info_t g_board_info = {
59+
.infoVersion = 0x0,
60+
.board_id = "0000",
61+
.daplink_url_name = "HELP_FAQHTM",
62+
.daplink_drive_name = "MAINTENANCE",
63+
.daplink_target_url = "https://mbed.com/daplink",
64+
.target_cfg = &target_device,
65+
};

source/board/numaker_m252kg.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* @file numaker_m252kg.c
3+
* @brief board ID for the NuMaker-M252KG board
4+
*
5+
* DAPLink Interface Firmware
6+
* Copyright (c) 2017-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_family.h"
23+
#include "target_board.h"
24+
25+
const board_info_t g_board_info = {
26+
.infoVersion = 0x0,
27+
.board_id = "1309",
28+
.family_id = kStub_SWSysReset_FamilyID,
29+
.flags = kEnablePageErase,
30+
.target_cfg = &target_device,
31+
};

source/daplink/daplink.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ COMPILER_ASSERT(DAPLINK_RAM_SHARED_START + DAPLINK_RAM_SHARED_SIZE == DAPLINK_RA
6767
#define DAPLINK_HIC_ID_LPC54606 0x9796990C // reserving for future use
6868
#define DAPLINK_HIC_ID_STM32F723IE 0x9796990D // reserving for future use
6969
#define DAPLINK_HIC_ID_LPC55S69 0x97969920 // reserving for future use
70+
#define DAPLINK_HIC_ID_M48SSIDAE 0x97969921
7071
#define DAPLINK_HIC_ID_PSOC5 0x2E127069
7172
//@}
7273

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/* Flash OS Routines (Automagically Generated)
2+
* Copyright (c) 2009-2019 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+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
static const uint32_t M251_AP_256_flash_prog_blob[] = {
18+
0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
19+
0xb088b5b0, 0x460c4613, 0x90064605, 0x92049105, 0x90032064, 0x1000f240, 0x0000f2c4, 0x60012159,
20+
0x60012116, 0x60012188, 0x21016800, 0x93024208, 0x95009401, 0xe7ffd103, 0x90072001, 0xf240e038,
21+
0xf2c42000, 0x68010000, 0x43112204, 0xf2406001, 0xf2c42004, 0x68010000, 0x60014311, 0x9803e7ff,
22+
0x91031e41, 0xd0012800, 0xe7f8e7ff, 0x0000f24c, 0x0000f2c4, 0x222d6801, 0x60014311, 0x011cf24c,
23+
0x0100f2c4, 0x2301680a, 0x600a431a, 0x42186800, 0xe7ffd103, 0x90072001, 0xf24ce00a, 0xf2c40000,
24+
0x68010000, 0x43112240, 0x20006001, 0xe7ff9007, 0xb0089807, 0xb082bdb0, 0x90014601, 0xe7ff9100,
25+
0x0010f24c, 0x0000f2c4, 0x21016800, 0xd0014208, 0xe7f5e7ff, 0x0000f24c, 0x0000f2c4, 0x222d6801,
26+
0x60014391, 0x001cf24c, 0x0000f2c4, 0x22016801, 0x60014391, 0xb0022000, 0xb0854770, 0x4603460a,
27+
0xa8029003, 0x92017001, 0xe7ff9300, 0x0010f24c, 0x0000f2c4, 0x21016800, 0xd0014208, 0xe7f5e7ff,
28+
0x0000f24c, 0x0000f2c4, 0x22406801, 0x60014311, 0x000cf24c, 0x0000f2c4, 0x60012122, 0xf24c9803,
29+
0xf2c40104, 0x60080100, 0x7800a802, 0xd1082800, 0x2000e7ff, 0xf24c43c0, 0xf2c40108, 0x60080100,
30+
0xf24ce009, 0xf2c40008, 0xf64a0000, 0xf2c02103, 0x60010155, 0xf24ce7ff, 0xf2c40010, 0x21010000,
31+
0xf3bf6001, 0xe7ff8f6f, 0x0010f24c, 0x0000f2c4, 0x21016800, 0xd0014208, 0xe7f5e7ff, 0x0000f24c,
32+
0x0000f2c4, 0x21406800, 0xd00b4208, 0xf24ce7ff, 0xf2c40000, 0x68010000, 0x43112240, 0x20016001,
33+
0xe0029004, 0x90042000, 0x9804e7ff, 0x4770b005, 0xb084b580, 0x90024601, 0x220f9802, 0x40100512,
34+
0x05522201, 0x91014290, 0xe7ffd10b, 0xf2409802, 0xf6cf0100, 0x184071e0, 0xf7ff2101, 0x9003ff7e,
35+
0x9802e005, 0xf7ff2100, 0x9003ff78, 0x9803e7ff, 0xbd80b004, 0xb088b580, 0x4603460a, 0x91059006,
36+
0x90042000, 0x93019202, 0x9804e7ff, 0x42889905, 0xe7ffd210, 0x99049806, 0x92041c4a, 0x58400089,
37+
0xffc6f7ff, 0x28009003, 0xe7ffd003, 0x90079803, 0xe7eae003, 0x90072000, 0x9807e7ff, 0xbd80b008,
38+
0xb08ab5b0, 0x460c4613, 0x90084605, 0x92069107, 0x90042000, 0x93029003, 0x95009401, 0xf24ce7ff,
39+
0xf2c40010, 0x68000000, 0x42082101, 0xe7ffd001, 0xf24ce7f5, 0xf2c40000, 0x68010000, 0x43112240,
40+
0x98076001, 0x21031cc0, 0x90074388, 0x9807e7ff, 0xd04c2800, 0xa808e7ff, 0x06407800, 0xd10f2800,
41+
0x9807e7ff, 0xd30b2880, 0x2080e7ff, 0x98089005, 0x9a069905, 0x18d29b04, 0xf83ff000, 0xe0229003,
42+
0x7800a808, 0x28000640, 0xe7ffd111, 0x28109807, 0xe7ffd30d, 0x210f9807, 0x90054388, 0x99059808,
43+
0x9b049a06, 0xf00018d2, 0x9003f828, 0x9807e00a, 0x98089005, 0x9a069905, 0x18d29b04, 0xf8e0f000,
44+
0xe7ff9003, 0x9805e7ff, 0x18089908, 0x98059008, 0x18089904, 0x98059004, 0x1a089907, 0x98039007,
45+
0xd0032800, 0x2001e7ff, 0xe0039009, 0x2000e7af, 0xe7ff9009, 0xb00a9809, 0xb5b0bdb0, 0x4613b088,
46+
0x4605460c, 0x91069007, 0x20009205, 0x98059003, 0x98069004, 0x210f300f, 0x90064388, 0x94019302,
47+
0xe7ff9500, 0x0010f24c, 0x0000f2c4, 0x21016800, 0xd0014208, 0xe7f5e7ff, 0x0000f24c, 0x0000f2c4,
48+
0x22406801, 0x60014311, 0x210f9807, 0xf24c4388, 0xf2c40104, 0x60080100, 0x000cf24c, 0x0000f2c4,
49+
0x60012127, 0x99039804, 0x92031c4a, 0x58400089, 0x0180f24c, 0x0100f2c4, 0x98046008, 0x1c4a9903,
50+
0x00899203, 0xf24c5840, 0xf2c40184, 0x60080100, 0x99039804, 0x92031c4a, 0x58400089, 0x0188f24c,
51+
0x0100f2c4, 0x98046008, 0x1c4a9903, 0x00899203, 0xf24c5840, 0xf2c4018c, 0x60080100, 0x0010f24c,
52+
0x0000f2c4, 0x60012101, 0x38109806, 0xe7ff9006, 0x28009806, 0xe7ffd046, 0xf24ce7ff, 0xf2c400c0,
53+
0x68000000, 0x42082130, 0xe7ffd001, 0x9804e7f5, 0x1c4a9903, 0x00899203, 0xf24c5840, 0xf2c40180,
54+
0x60080100, 0x99039804, 0x92031c4a, 0x58400089, 0x0184f24c, 0x0100f2c4, 0xe7ff6008, 0x00c0f24c,
55+
0x0000f2c4, 0x21c06800, 0xd0014208, 0xe7f5e7ff, 0x99039804, 0x92031c4a, 0x58400089, 0x0188f24c,
56+
0x0100f2c4, 0x98046008, 0x1c4a9903, 0x00899203, 0xf24c5840, 0xf2c4018c, 0x60080100, 0x38109806,
57+
0xe7b59006, 0xf24ce7ff, 0xf2c40010, 0x68000000, 0x42082101, 0xe7ffd001, 0x2000e7f5, 0xbdb0b008,
58+
0xb087b5b0, 0x460c4613, 0x90054605, 0x92039104, 0x1cc09804, 0x43882103, 0x93029004, 0x95009401,
59+
0xf24ce7ff, 0xf2c40010, 0x68000000, 0x42082101, 0xe7ffd001, 0xf24ce7f5, 0xf2c40000, 0x68010000,
60+
0x43112240, 0xf24c6001, 0xf2c4000c, 0x21210000, 0xe7ff6001, 0x28009804, 0xe7ffd040, 0x21039805,
61+
0xf24c4388, 0xf2c40104, 0x60080100, 0x68009803, 0x0108f24c, 0x0100f2c4, 0xf24c6008, 0xf2c40010,
62+
0x21010000, 0xf3bf6001, 0xe7ff8f6f, 0x0010f24c, 0x0000f2c4, 0x21016800, 0xd0014208, 0xe7f5e7ff,
63+
0x0000f24c, 0x0000f2c4, 0x21406800, 0xd00b4208, 0xf24ce7ff, 0xf2c40000, 0x68010000, 0x43112240,
64+
0x20016001, 0xe00c9006, 0x1d009805, 0x98039005, 0x90031d00, 0x1f009804, 0xe7bb9004, 0x90062000,
65+
0x9806e7ff, 0xbdb0b007, 0xb087b5b0, 0x460c4613, 0x90054605, 0x92039104, 0x1cc09804, 0x43882103,
66+
0x93029004, 0x95009401, 0xf24ce7ff, 0xf2c40010, 0x68000000, 0x42082101, 0xe7ffd001, 0xf24ce7f5,
67+
0xf2c40000, 0x68010000, 0x43112240, 0xf24c6001, 0xf2c4000c, 0x21000000, 0xe7ff6001, 0x28009804,
68+
0xe7ffd04c, 0x21039805, 0xf24c4388, 0xf2c40104, 0x60080100, 0x0008f24c, 0x0000f2c4, 0x60012100,
69+
0x0010f24c, 0x0000f2c4, 0x60012101, 0x8f6ff3bf, 0xf24ce7ff, 0xf2c40010, 0x68000000, 0x42082101,
70+
0xe7ffd001, 0xf24ce7f5, 0xf2c40000, 0x68000000, 0x42082140, 0xe7ffd00b, 0x0000f24c, 0x0000f2c4,
71+
0x22406801, 0x60014311, 0x90062001, 0xf24ce019, 0xf2c40008, 0x68000000, 0x68099903, 0xd0034288,
72+
0x2001e7ff, 0xe00c9006, 0x1d009805, 0x98039005, 0x90031d00, 0x1f009804, 0xe7af9004, 0x90062000,
73+
0x9806e7ff, 0xbdb0b007, 0x00000000
74+
};
75+
76+
/**
77+
* List of start and size for each size of flash sector - even indexes are start, odd are size
78+
* The size will apply to all sectors between the listed address and the next address
79+
* in the list.
80+
* The last pair in the list will have sectors starting at that address and ending
81+
* at address flash_start + flash_size.
82+
*/
83+
static const sector_info_t sectors_info[] = {
84+
{ 0x00000000, 0x00000200 },
85+
};
86+
87+
static const program_target_t flash = {
88+
0x20000021, // Init
89+
0x200000d7, // UnInit
90+
0x0, // EraseChip
91+
0x200001f1, // EraseSector
92+
0x20000281, // ProgramPage
93+
0x200005e9, // Verify
94+
95+
// BKPT : start of blob + 1
96+
// RSB : blob start + header + rw data offset
97+
// RSP : stack pointer
98+
{
99+
0x20000001,
100+
0x200006e8,
101+
0x20000900
102+
},
103+
104+
0x20000000 + 0x00000A00, // mem buffer location
105+
0x20000000, // location to write prog_blob in target RAM
106+
sizeof(M251_AP_256_flash_prog_blob), // prog_blob size
107+
M251_AP_256_flash_prog_blob, // address of prog_blob
108+
0x00000200 // ram_to_flash_bytes_to_be_written
109+
};
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 m252kg6ae
4+
*
5+
* DAPLink Interface Firmware
6+
* Copyright (c) 2017-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 = 0x00000000,
32+
.flash_regions[0].end = 0x00040000,
33+
.flash_regions[0].flags = kRegionIsDefault,
34+
.flash_regions[0].flash_algo = (program_target_t *)&flash,
35+
.ram_regions[0].start = 0x20000000,
36+
.ram_regions[0].end = 0x20008000,
37+
};

0 commit comments

Comments
 (0)