Skip to content

Commit 41c53e7

Browse files
FelipeMdeOxiaoxiang781216
authored andcommitted
boards/arm/ht32f491x3: add ESK32 board support
Add the ESK32 board with nsh configuration, linker script, board bring-up, flashing helper, and user LED support. Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
1 parent ba6ee9d commit 41c53e7

13 files changed

Lines changed: 893 additions & 0 deletions

File tree

boards/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3481,6 +3481,13 @@ config ARCH_BOARD_AT32F437_MINI
34813481
---help---
34823482
AT32F437-MINI board based on the Artery AT32F437VMT7 MCU.
34833483

3484+
config ARCH_BOARD_ESK32
3485+
bool "ESK32 board"
3486+
depends on ARCH_CHIP_HT32F49163
3487+
select ARCH_HAVE_LEDS
3488+
---help---
3489+
ESK32 board based on the Holtek HT32F49163 MCU.
3490+
34843491
config ARCH_BOARD_FRDM_MCXN236
34853492
bool "NXP MCXN236 CPU EVK board"
34863493
depends on ARCH_CHIP_N236
@@ -3927,6 +3934,7 @@ config ARCH_BOARD
39273934
default "hpm6360evk" if ARCH_BOARD_HPM6360EVK
39283935
default "hpm6750evk2" if ARCH_BOARD_HPM6750EVK2
39293936
default "at32f437-mini" if ARCH_BOARD_AT32F437_MINI
3937+
default "esk32" if ARCH_BOARD_ESK32
39303938
default "csk6011a-nano" if ARCH_BOARD_CSK6011A_NANO
39313939
default "frdm-mcxn236" if ARCH_BOARD_FRDM_MCXN236
39323940

@@ -5041,6 +5049,9 @@ endif
50415049
if ARCH_BOARD_AT32F437_MINI
50425050
source "boards/arm/at32/at32f437-mini/Kconfig"
50435051
endif
5052+
if ARCH_BOARD_ESK32
5053+
source "boards/arm/ht32f491x3/esk32/Kconfig"
5054+
endif
50445055
if ARCH_BOARD_CSK6011A_NANO
50455056
source "boards/arm/csk6/csk6011a-nano/Kconfig"
50465057
endif
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# ##############################################################################
2+
# boards/arm/ht32f491x3/esk32/CMakeLists.txt
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
7+
# license agreements. See the NOTICE file distributed with this work for
8+
# additional information regarding copyright ownership. The ASF licenses this
9+
# file to you under the Apache License, Version 2.0 (the "License"); you may not
10+
# use this file except in compliance with the License. You may obtain a copy of
11+
# 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. See the
18+
# License for the specific language governing permissions and limitations under
19+
# the License.
20+
#
21+
# ##############################################################################
22+
23+
add_subdirectory(src)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# For a description of the syntax of this configuration file,
3+
# see the file kconfig-language.txt in the NuttX tools repository.
4+
#
5+
6+
if ARCH_BOARD_ESK32
7+
8+
comment "ESK32 note: only USART1 pin routing is available in the current board port."
9+
10+
endif # ARCH_BOARD_ESK32
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#
2+
# This file is autogenerated: PLEASE DO NOT EDIT IT.
3+
#
4+
# You can use "make menuconfig" to make any modifications to the installed .config file.
5+
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
6+
# modifications.
7+
#
8+
# CONFIG_ARCH_FPU is not set
9+
# CONFIG_ARCH_LEDS is not set
10+
# CONFIG_NSH_ARGCAT is not set
11+
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
12+
CONFIG_ARCH="arm"
13+
CONFIG_ARCH_BOARD="esk32"
14+
CONFIG_ARCH_BOARD_ESK32=y
15+
CONFIG_ARCH_CHIP="ht32f491x3"
16+
CONFIG_ARCH_CHIP_HT32F49163=y
17+
CONFIG_ARCH_CHIP_HT32F491X3=y
18+
CONFIG_ARCH_INTERRUPTSTACK=2048
19+
CONFIG_ARCH_STACKDUMP=y
20+
CONFIG_BOARD_LOOPSPERMSEC=8499
21+
CONFIG_BUILTIN=y
22+
CONFIG_EXAMPLES_HELLO=y
23+
CONFIG_EXAMPLES_LEDS=y
24+
CONFIG_FS_BINFS=y
25+
CONFIG_FS_PROCFS=y
26+
CONFIG_HT32F491X3_PCLK1_FREQUENCY=75000000
27+
CONFIG_HT32F491X3_SYSCLK_FREQUENCY=150000000
28+
CONFIG_INIT_ENTRYPOINT="nsh_main"
29+
CONFIG_LINE_MAX=64
30+
CONFIG_NSH_ARCHINIT=y
31+
CONFIG_NSH_BUILTIN_APPS=y
32+
CONFIG_NSH_FILEIOSIZE=512
33+
CONFIG_NSH_READLINE=y
34+
CONFIG_PREALLOC_TIMERS=4
35+
CONFIG_RAM_SIZE=49152
36+
CONFIG_RAM_START=0x20000000
37+
CONFIG_RAW_BINARY=y
38+
CONFIG_RR_INTERVAL=200
39+
CONFIG_SCHED_BACKTRACE=y
40+
CONFIG_SCHED_WAITPID=y
41+
CONFIG_START_DAY=14
42+
CONFIG_START_MONTH=3
43+
CONFIG_START_YEAR=2026
44+
CONFIG_SYSTEM_DUMPSTACK=y
45+
CONFIG_SYSTEM_NSH=y
46+
CONFIG_TASK_NAME_SIZE=0
47+
CONFIG_TESTING_OSTEST=y
48+
CONFIG_TESTING_OSTEST_NBARRIER_THREADS=3
49+
CONFIG_TESTING_OSTEST_STACKSIZE=2048
50+
CONFIG_USART1_RXBUFSIZE=256
51+
CONFIG_USART1_SERIAL_CONSOLE=y
52+
CONFIG_USART1_TXBUFSIZE=256
53+
CONFIG_USERLED=y
54+
CONFIG_USERLED_LOWER=y
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
/****************************************************************************
2+
* boards/arm/ht32f491x3/esk32/include/board.h
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Licensed to the Apache Software Foundation (ASF) under one or more
7+
* contributor license agreements. See the NOTICE file distributed with
8+
* this work for additional information regarding copyright ownership. The
9+
* ASF licenses this file to you under the Apache License, Version 2.0 (the
10+
* "License"); you may not use this file except in compliance with the
11+
* License. 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. See the
18+
* License for the specific language governing permissions and limitations
19+
* under the License.
20+
*
21+
****************************************************************************/
22+
23+
#ifndef __BOARDS_ARM_HT32F491X3_ESK32_INCLUDE_BOARD_H
24+
#define __BOARDS_ARM_HT32F491X3_ESK32_INCLUDE_BOARD_H
25+
26+
/****************************************************************************
27+
* Included Files
28+
****************************************************************************/
29+
30+
#include <nuttx/config.h>
31+
32+
#include <stdbool.h>
33+
#include <stdint.h>
34+
35+
/****************************************************************************
36+
* Board USART Pin Mapping
37+
****************************************************************************/
38+
39+
/* Populate BOARD_USARTx_* for each routed USART on the board. The selected
40+
* console still comes from CONFIG_USARTx_SERIAL_CONSOLE in the defconfig.
41+
*/
42+
43+
#define BOARD_USART1_GPIO_CLKEN (1u << 0)
44+
#define BOARD_USART1_TX_GPIO_BASE 0x40020000u
45+
#define BOARD_USART1_RX_GPIO_BASE 0x40020000u
46+
#define BOARD_USART1_TX_PIN 9u
47+
#define BOARD_USART1_RX_PIN 10u
48+
#define BOARD_USART1_TX_AF 7u
49+
#define BOARD_USART1_RX_AF 7u
50+
51+
/****************************************************************************
52+
* Board LED Pin Mapping
53+
****************************************************************************/
54+
55+
#define BOARD_LED2_GPIO_CLKEN (1u << 3)
56+
#define BOARD_LED2_GPIO_BASE 0x40020c00u
57+
#define BOARD_LED2_GPIO_PIN 13u
58+
59+
#define BOARD_LED3_GPIO_CLKEN (1u << 3)
60+
#define BOARD_LED3_GPIO_BASE 0x40020c00u
61+
#define BOARD_LED3_GPIO_PIN 14u
62+
63+
#define BOARD_LED4_GPIO_CLKEN (1u << 3)
64+
#define BOARD_LED4_GPIO_BASE 0x40020c00u
65+
#define BOARD_LED4_GPIO_PIN 15u
66+
67+
#define BOARD_LED2 0
68+
#define BOARD_LED3 1
69+
#define BOARD_LED4 2
70+
#define BOARD_NLEDS 3
71+
72+
#define BOARD_LED2_BIT (1 << BOARD_LED2)
73+
#define BOARD_LED3_BIT (1 << BOARD_LED3)
74+
#define BOARD_LED4_BIT (1 << BOARD_LED4)
75+
76+
/****************************************************************************
77+
* Public Function Prototypes
78+
****************************************************************************/
79+
80+
void ht32f491x3_clockconfig(void);
81+
void ht32f491x3_boardinitialize(void);
82+
83+
int board_app_initialize(uintptr_t arg);
84+
85+
#if defined(CONFIG_USERLED) && !defined(CONFIG_ARCH_LEDS)
86+
uint32_t board_userled_initialize(void);
87+
void board_userled(int led, bool ledon);
88+
void board_userled_all(uint32_t ledset);
89+
#endif
90+
91+
#ifdef CONFIG_BOARD_LATE_INITIALIZE
92+
void board_late_initialize(void);
93+
#endif
94+
95+
#endif /* __BOARDS_ARM_HT32F491X3_ESK32_INCLUDE_BOARD_H */
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
############################################################################
2+
# boards/arm/ht32f491x3/esk32/scripts/Make.defs
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# Licensed to the Apache Software Foundation (ASF) under one or more
7+
# contributor license agreements. See the NOTICE file distributed with
8+
# this work for additional information regarding copyright ownership. The
9+
# ASF licenses this file to you under the Apache License, Version 2.0 (the
10+
# "License"); you may not use this file except in compliance with the
11+
# License. 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. See the
18+
# License for the specific language governing permissions and limitations
19+
# under the License.
20+
#
21+
############################################################################
22+
23+
include $(TOPDIR)/.config
24+
include $(TOPDIR)/tools/Config.mk
25+
include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs
26+
27+
LDSCRIPT = ld.script
28+
29+
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
30+
31+
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
32+
33+
CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
34+
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
35+
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
36+
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
37+
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
38+
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
39+
40+
NXFLATLDFLAGS1 = -r -d -warn-common
41+
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
42+
LDNXFLATFLAGS = -e main -s 2048
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
/****************************************************************************
2+
* boards/arm/ht32f491x3/esk32/scripts/ld.script
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Licensed to the Apache Software Foundation (ASF) under one or more
7+
* contributor license agreements. See the NOTICE file distributed with
8+
* this work for additional information regarding copyright ownership. The
9+
* ASF licenses this file to you under the Apache License, Version 2.0 (the
10+
* "License"); you may not use this file except in compliance with the
11+
* License. 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. See the
18+
* License for the specific language governing permissions and limitations
19+
* under the License.
20+
*
21+
****************************************************************************/
22+
23+
MEMORY
24+
{
25+
flash (rx) : ORIGIN = 0x08000000, LENGTH = 256K
26+
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K
27+
}
28+
29+
OUTPUT_ARCH(arm)
30+
ENTRY(__start)
31+
EXTERN(_vectors)
32+
33+
SECTIONS
34+
{
35+
.text :
36+
{
37+
_stext = ABSOLUTE(.);
38+
*(.vectors)
39+
*(.entry)
40+
*(.text .text.*)
41+
*(.fixup)
42+
*(.gnu.warning)
43+
*(.rodata .rodata.*)
44+
*(.gnu.linkonce.t.*)
45+
*(.glue_7)
46+
*(.glue_7t)
47+
*(.got)
48+
*(.gcc_except_table)
49+
*(.gnu.linkonce.r.*)
50+
_etext = ABSOLUTE(.);
51+
} > flash
52+
53+
.init_section :
54+
{
55+
_sinit = ABSOLUTE(.);
56+
KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
57+
KEEP(*(.init_array EXCLUDE_FILE(*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o) .ctors))
58+
_einit = ABSOLUTE(.);
59+
} > flash
60+
61+
.ARM.extab :
62+
{
63+
*(.ARM.extab*)
64+
} > flash
65+
66+
__exidx_start = ABSOLUTE(.);
67+
.ARM.exidx :
68+
{
69+
*(.ARM.exidx*)
70+
} > flash
71+
__exidx_end = ABSOLUTE(.);
72+
73+
_eronly = ABSOLUTE(.);
74+
75+
.data :
76+
{
77+
_sdata = ABSOLUTE(.);
78+
*(.data .data.*)
79+
*(.gnu.linkonce.d.*)
80+
CONSTRUCTORS
81+
. = ALIGN(4);
82+
_edata = ABSOLUTE(.);
83+
} > sram AT > flash
84+
85+
.ram_vectors :
86+
{
87+
*(.ram_vectors)
88+
} > sram
89+
90+
.noinit :
91+
{
92+
_snoinit = ABSOLUTE(.);
93+
*(.noinit*)
94+
_enoinit = ABSOLUTE(.);
95+
} > sram
96+
97+
.bss :
98+
{
99+
_sbss = ABSOLUTE(.);
100+
*(.bss .bss.*)
101+
*(.gnu.linkonce.b.*)
102+
*(COMMON)
103+
. = ALIGN(4);
104+
_ebss = ABSOLUTE(.);
105+
} > sram
106+
107+
.stab 0 : { *(.stab) }
108+
.stabstr 0 : { *(.stabstr) }
109+
.stab.excl 0 : { *(.stab.excl) }
110+
.stab.exclstr 0 : { *(.stab.exclstr) }
111+
.stab.index 0 : { *(.stab.index) }
112+
.stab.indexstr 0 : { *(.stab.indexstr) }
113+
.comment 0 : { *(.comment) }
114+
.debug_abbrev 0 : { *(.debug_abbrev) }
115+
.debug_info 0 : { *(.debug_info) }
116+
.debug_line 0 : { *(.debug_line) }
117+
.debug_pubnames 0 : { *(.debug_pubnames) }
118+
.debug_aranges 0 : { *(.debug_aranges) }
119+
}

0 commit comments

Comments
 (0)