Skip to content

Commit

Permalink
Add Nuvoton NuMaker-IoT-M467 board (ARMmbed#940)
Browse files Browse the repository at this point in the history
Also improve GCC support for m48ssidae
  • Loading branch information
ychsu-tf authored and gaborcsapo committed Jun 29, 2022
1 parent 222f1fe commit 0d0047c
Show file tree
Hide file tree
Showing 10 changed files with 557 additions and 390 deletions.
4 changes: 4 additions & 0 deletions projects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,10 @@ projects:
- *module_if
- *module_hic_m48ssidae
- records/board/numaker_iot_m263a.yaml
m48ssidae_numaker_iot_m467_if:
- *module_if
- *module_hic_m48ssidae
- records/board/numaker_iot_m467.yaml
m48ssidae_numaker_m2354_if:
- *module_if
- *module_hic_m48ssidae
Expand Down
6 changes: 6 additions & 0 deletions records/board/numaker_iot_m467.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
common:
sources:
board:
- source/board/numaker_iot_m467.c
family:
- source/family/nuvoton/m467hjhae/target.c
9 changes: 9 additions & 0 deletions records/hic_hal/m48ssidae.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ common:
tool_specific:
uvision:
misc:
asm_flags:
- -I../../../source/daplink
- -I../../../source/hic_hal/nuvoton/m48ssidae
ld_flags:
- --predefine="-I..\..\..\source\hic_hal\nuvoton\m48ssidae"
sources:
Expand All @@ -31,12 +34,18 @@ tool_specific:
misc:
asm_flags:
- --no_unaligned_access
- -I../../../source/daplink
- -I../../../source/hic_hal/nuvoton/m48ssidae
c_flags:
- --no_unaligned_access
sources:
hic_hal:
- source/hic_hal/nuvoton/m48ssidae/armcc
armclang:
misc:
asm_flags:
- -I../../../source/daplink
- -I../../../source/hic_hal/nuvoton/m48ssidae
sources:
hic_hal:
- source/hic_hal/nuvoton/m48ssidae/armcc
Expand Down
33 changes: 33 additions & 0 deletions source/board/numaker_iot_m467.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* @file numaker_iot_m467.c
* @brief board ID for the Nuvoton NuMaker-IoT-M467 board
*
* DAPLink Interface Firmware
* Copyright (c) 2022 Nuvoton Technology Corp. All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "target_family.h"
#include "target_board.h"

const board_info_t g_board_info = {
.info_version = kBoardInfoVersion,
.board_id = "1313",
.family_id = kStub_SWSysReset_FamilyID,
.flags = kEnablePageErase,
.target_cfg = &target_device,
.board_vendor = "Nuvoton",
.board_name = "NuMaker-IoT-M467",
};
2 changes: 1 addition & 1 deletion source/daplink/settings/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ typedef struct __attribute__((__packed__)) cfg_ram {
COMPILER_ASSERT((offsetof(cfg_ram_t, hexdump) % sizeof(uint32_t)) == 0);

// Configuration RAM
#if defined(__ARMCC)
#if defined(__CC_ARM)
static cfg_ram_t config_ram __attribute__((section("cfgram"), zero_init));
#else
static cfg_ram_t config_ram __attribute__((section("cfgram")));
Expand Down
106 changes: 106 additions & 0 deletions source/family/nuvoton/m467hjhae/flash_blob.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/* Flash OS Routines (Automagically Generated)
* Copyright (c) 2022 Nuvoton Technology Corp
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

static const uint32_t flash_prog_blob[] = {
0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2,
0x4770ba40, 0x4770bac0, 0x2000b5fe, 0x21009002, 0x680048fc, 0x0d000400, 0x26619002, 0x98020176,
0xd10a42b0, 0x6bc048f8, 0x42b04ef8, 0x0780d101, 0x2005e001, 0x46010700, 0x4ef5e00e, 0x42b09802,
0x0701d101, 0x2669e008, 0x98020176, 0xd10142b0, 0xe0010641, 0xbdfe2001, 0x2001460a, 0x180b0700,
0x34ff1dcc, 0x462034fa, 0x07362601, 0x20031985, 0x18080380, 0x20039001, 0x18080380, 0x90001980,
0x40304678, 0xd0012800, 0xe0004618, 0x30ff4610, 0x68003001, 0x0fc007c0, 0xd1372800, 0x26014678,
0x40300736, 0xd0012800, 0xe0004618, 0x26594610, 0x300130ff, 0x46786006, 0x07362601, 0x28004030,
0x4618d001, 0x4610e000, 0x30ff2616, 0x60063001, 0x26014678, 0x40300736, 0xd0012800, 0xe0004618,
0x26884610, 0x300130ff, 0x46786006, 0x40300676, 0xd0012800, 0xe0004618, 0x30ff4610, 0x68003001,
0x0fc007c0, 0xd1012800, 0xe7a42001, 0x2701467e, 0x403e073f, 0xd0012e00, 0xe000462e, 0x46304626,
0x27046836, 0x6006433e, 0x06bf467e, 0x2e00403e, 0x462ed001, 0x4626e000, 0x68761d30, 0x433e2704,
0xbf006006, 0x26014678, 0x40300736, 0xd0012800, 0xe0004628, 0x6d004620, 0x40302610, 0xd0f12800,
0x2701467e, 0x403e073f, 0xd0012e00, 0xe0009e00, 0x46309e01, 0x272d6836, 0x6006433e, 0x26014678,
0x40300736, 0xd0012800, 0xe0009800, 0x68009801, 0x0fc007c0, 0xd1012800, 0xe75c2001, 0xe75a2000,
0x4605b578, 0x90002000, 0x48962100, 0x04006800, 0x90000d00, 0x01642461, 0x42a09800, 0x4892d10a,
0x4c926bc0, 0xd10142a0, 0xe0010780, 0x07002005, 0xe00e4601, 0x98004c8e, 0xd10142a0, 0xe0080701,
0x01642469, 0x42a09800, 0x0641d101, 0x2001e001, 0x2003bd78, 0x180a0380, 0x24011808, 0x19030724,
0x2601467c, 0x40340736, 0xd0012c00, 0xe000461c, 0x46204614, 0x08646824, 0x60040064, 0xe7e72000,
0x4601b5f8, 0x20002300, 0x22009000, 0x68004875, 0x0d000400, 0x26619000, 0x98000176, 0xd10a42b0,
0x6bc04871, 0x42b04e71, 0x0780d101, 0x2005e001, 0x46020700, 0x4e6ee00e, 0x42b09800, 0x0702d101,
0x2669e008, 0x98000176, 0xd10142b0, 0xe0010642, 0xbdf82001, 0x03802003, 0x18101814, 0x07362601,
0x46081985, 0x460143b0, 0x0500200f, 0x11f64008, 0xd10042b0, 0x467e2301, 0x073f2701, 0x2e00403e,
0x462ed001, 0x4626e000, 0x68364630, 0x433e2740, 0x46786006, 0x403005be, 0xd0012800, 0xe0004628,
0x26224620, 0x467860c6, 0x403006f6, 0xd0012800, 0xe0004628, 0x60414620, 0xd10c2b00, 0x26014678,
0x40300736, 0xd0012800, 0xe0004628, 0x26004620, 0x608643f6, 0x4678e00a, 0x07362601, 0x28004030,
0x4628d001, 0x4620e000, 0x60864e42, 0x26014678, 0x40300736, 0xd0012800, 0xe0004628, 0x26014620,
0xf3bf6106, 0xbf008f6f, 0x26014678, 0x40300736, 0xd0012800, 0xe0004628, 0x69004620, 0x0fc007c0,
0xd1f12800, 0x26014678, 0x40300736, 0xd0012800, 0xe0004628, 0x68004620, 0x40302640, 0xd00f2800,
0x2701467e, 0x403e073f, 0xd0012e00, 0xe000462e, 0x46304626, 0x27406836, 0x6006433e, 0xe7782001,
0xe7762000, 0x4603b5fc, 0x90012000, 0x481d2400, 0x04006800, 0x90010d00, 0x01762661, 0x42b09801,
0x4819d10a, 0x4e196bc0, 0xd10142b0, 0xe0010780, 0x07002005, 0xe00e4604, 0x98014e15, 0xd10142b0,
0xe0080704, 0x01762669, 0x42b09801, 0x0644d101, 0x2001e001, 0x2003bdfc, 0x18250380, 0x26011820,
0x19800736, 0x1cc89000, 0x00890881, 0x43b04618, 0x467e4603, 0x073f2701, 0x2e00403e, 0x9e00d00c,
0x0000e00b, 0xe000ed00, 0x40003fc0, 0x20171011, 0x00000c24, 0x0055aa03, 0x4630462e, 0x27406836,
0x6006433e, 0x05be4678, 0x28004030, 0x9800d001, 0x4628e000, 0x60c62621, 0x4678e051, 0x07362601,
0x28004030, 0x9800d001, 0x4628e000, 0x46786043, 0x07362601, 0x28004030, 0x9800d001, 0x4628e000,
0x60866816, 0x26014678, 0x40300736, 0xd0012800, 0xe0009800, 0x26014628, 0xf3bf6106, 0xbf008f6f,
0x26014678, 0x40300736, 0xd0012800, 0xe0009800, 0x69004628, 0x0fc007c0, 0xd1f12800, 0x26014678,
0x40300736, 0xd0012800, 0xe0009800, 0x68004628, 0x40302640, 0xd00f2800, 0x2701467e, 0x403e073f,
0xd0012e00, 0xe0009e00, 0x4630462e, 0x27406836, 0x6006433e, 0xe77d2001, 0x1d121d1b, 0x29001f09,
0x2000d1ab, 0xb5fce776, 0x20004603, 0x24009001, 0x68004852, 0x0d000400, 0x26619001, 0x98010176,
0xd10a42b0, 0x6bc0484e, 0x42b04e4e, 0x0780d101, 0x2005e001, 0x46040700, 0x4e4be00e, 0x42b09801,
0x0704d101, 0x2669e008, 0x98010176, 0xd10142b0, 0xe0010644, 0xbdfc2001, 0x03802003, 0x18201825,
0x07362601, 0x90001980, 0x08811cc8, 0x46180089, 0x460343b0, 0x2701467e, 0x403e073f, 0xd0012e00,
0xe0009e00, 0x4630462e, 0x27406836, 0x6006433e, 0x05be4678, 0x28004030, 0x9800d001, 0x4628e000,
0x60c62600, 0x4678e055, 0x07362601, 0x28004030, 0x9800d001, 0x4628e000, 0x46786043, 0x07362601,
0x28004030, 0x9800d001, 0x4628e000, 0x61062601, 0x8f6ff3bf, 0x4678bf00, 0x07362601, 0x28004030,
0x9800d001, 0x4628e000, 0x07c06900, 0x28000fc0, 0x4678d1f1, 0x07362601, 0x28004030, 0x9800d001,
0x4628e000, 0x26406800, 0x28004030, 0x467ed00f, 0x073f2701, 0x2e00403e, 0x9e00d001, 0x462ee000,
0x68364630, 0x433e2740, 0x20016006, 0x4678e793, 0x07362601, 0x28004030, 0x9800d001, 0x4628e000,
0x68166880, 0xd00142b0, 0xe7842001, 0x1d121d1b, 0x29001f09, 0x2000d1a7, 0x0000e77d, 0xe000ed00,
0x40003fc0, 0x20171011, 0x00000c24, 0x00000000
};

/**
* List of start and size for each size of flash sector - even indexes are start, odd are size
* The size will apply to all sectors between the listed address and the next address
* in the list.
* The last pair in the list will have sectors starting at that address and ending
* at address flash_start + flash_size.
*/
static const sector_info_t sectors_info[] = {
{ 0x00000000, 0x00001000 },
{ 0x0F100000, 0x00001000 },
};

static const program_target_t flash = {
0x20000029, // Init
0x200001c1, // UnInit
0x0, // EraseChip
0x20000241, // EraseSector
0x200003a5, // ProgramPage
0x20000507, // Verify

// BKPT : start of blob + 1
// RSB : blob start + header + rw data offset
// RSP : stack pointer
{
0x20000001,
0x2000066c,
0x20000900
},

0x20000000 + 0x00000A00, // mem buffer location
0x20000000, // location to write prog_blob in target RAM
sizeof(flash_prog_blob), // prog_blob size
flash_prog_blob, // address of prog_blob
0x00001000 // ram_to_flash_bytes_to_be_written
};
43 changes: 43 additions & 0 deletions source/family/nuvoton/m467hjhae/target.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* @file target.c
* @brief Target information for the m467hjhae
*
* DAPLink Interface Firmware
* Copyright (c) 2022 Nuvoton Technology Corp. All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "target_config.h"

// The file flash_blob.c must only be included in target.c
#include "flash_blob.c"

// target information
target_cfg_t target_device = {
.version = kTargetConfigVersion,
.sectors_info = sectors_info,
.sector_info_length = (sizeof(sectors_info))/(sizeof(sector_info_t)),
.flash_regions[0].start = 0x00000000,
.flash_regions[0].end = 0x00100000,
.flash_regions[0].flags = kRegionIsDefault,
.flash_regions[0].flash_algo = (program_target_t *)&flash,
.flash_regions[1].start = 0x0F100000,
.flash_regions[1].end = 0x0F102000,
.flash_regions[1].flash_algo = (program_target_t *)&flash,
.ram_regions[0].start = 0x20000000,
.ram_regions[0].end = 0x20080000,
.target_vendor = "Nuvoton",
.target_part_number = "M467HJHAE",
};
6 changes: 4 additions & 2 deletions source/hic_hal/nuvoton/m48ssidae/armcc/startup_M480.s
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@
;//-------- <<< Use Configuration Wizard in Context Menu >>> ------------------
;*/

#include "daplink_addr.h"
#include "daplink_defaults.h"

; <h> Stack Configuration
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
; </h>

IF :LNOT: :DEF: Stack_Size
Stack_Size EQU 0x00006000
Stack_Size EQU DAPLINK_STACK_SIZE
ENDIF

AREA STACK, NOINIT, READWRITE, ALIGN=3
Expand All @@ -50,7 +52,7 @@ __initial_sp
; </h>

IF :LNOT: :DEF: Heap_Size
Heap_Size EQU 0x00000100
Heap_Size EQU DAPLINK_HEAP_SIZE
ENDIF

AREA HEAP, NOINIT, READWRITE, ALIGN=3
Expand Down
Loading

0 comments on commit 0d0047c

Please sign in to comment.