Skip to content

Commit

Permalink
boards/arm: add qemu-armv7r board
Browse files Browse the repository at this point in the history
This adds support for qemu-armv7r board with flat mode sample
config for using with QEMU emulated Cortex-R5 processor.

Signed-off-by: Yanfeng Liu <[email protected]>
  • Loading branch information
yf13 committed Jan 17, 2025
1 parent 42d3e0e commit 748c5d6
Show file tree
Hide file tree
Showing 13 changed files with 809 additions and 0 deletions.
9 changes: 9 additions & 0 deletions boards/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2222,6 +2222,14 @@ config ARCH_BOARD_QEMU_ARMV8A
This options selects support for NuttX on the QEMU ARMv8a + virt
board featuring the qemu ARMv8a CPUs.

config ARCH_BOARD_QEMU_ARMV7R
bool "Qemu ARMv7r CPUs board"
depends on ARCH_CHIP_QEMU_ARM
select ARCH_HAVE_IRQBUTTONS
---help---
This selects support for NuttX on the QEMU ARMv7r + virt
board featuring the qemu ARMv7r CPUs.

config ARCH_BOARD_PINEPHONE
bool "PINE64 PinePhone"
depends on ARCH_CHIP_A64
Expand Down Expand Up @@ -3515,6 +3523,7 @@ config ARCH_BOARD
default "sabre-6quad" if ARCH_BOARD_SABRE_6QUAD
default "tc397" if ARCH_BOARD_TC397
default "qemu-armv7a" if ARCH_BOARD_QEMU_ARMV7A
default "qemu-armv7r" if ARCH_BOARD_QEMU_ARMV7R
default "qemu-armv8a" if ARCH_BOARD_QEMU_ARMV8A
default "pinephone" if ARCH_BOARD_PINEPHONE
default "pinephonepro" if ARCH_BOARD_PINEPHONE_PRO
Expand Down
25 changes: 25 additions & 0 deletions boards/arm/qemu/qemu-armv7r/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# ##############################################################################
# boards/arm/qemu/qemu-armv7r/CMakeLists.txt
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you 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.
#
# ##############################################################################

set_property(GLOBAL PROPERTY LD_SCRIPT "${NUTTX_BOARD_DIR}/scripts/dramboot.ld")

add_subdirectory(src)
7 changes: 7 additions & 0 deletions boards/arm/qemu/qemu-armv7r/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

if ARCH_BOARD_QEMU_ARMV7R
endif
61 changes: 61 additions & 0 deletions boards/arm/qemu/qemu-armv7r/configs/nsh/defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
CONFIG_ALARM_ARCH=y
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="qemu-armv7r"
CONFIG_ARCH_BOARD_QEMU_ARMV7R=y
CONFIG_ARCH_CHIP="qemu"
CONFIG_ARCH_CHIP_QEMU_ARM=y
CONFIG_ARCH_CHIP_QEMU_CORTEXR5=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_LOWVECTORS=y
CONFIG_BOARDCTL_POWEROFF=y
CONFIG_BUILTIN=y
CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEFAULT_TASK_STACKSIZE=4096
CONFIG_EXAMPLES_HELLO=y
CONFIG_FLASH_SIZE=1048576
CONFIG_FS_PROCFS=y
CONFIG_FS_ROMFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_IDLETHREAD_STACKSIZE=4096
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_ONESHOT=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=16777216
CONFIG_RAM_START=0x40000000
CONFIG_RAW_BINARY=y
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_HPWORKPRIORITY=192
CONFIG_STACK_COLORATION=y
CONFIG_START_DAY=25
CONFIG_START_YEAR=2025
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_SYSTEM=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_LEAKS=y
CONFIG_TESTING_OSTEST=y
CONFIG_UART1_BASE=0x9000000
CONFIG_UART1_IRQ=33
CONFIG_UART1_PL011=y
CONFIG_UART1_SERIAL_CONSOLE=y
CONFIG_UART_PL011=y
CONFIG_USEC_PER_TICK=1000
61 changes: 61 additions & 0 deletions boards/arm/qemu/qemu-armv7r/include/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/****************************************************************************
* boards/arm/qemu/qemu-armv7r/include/board.h
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you 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.
*
****************************************************************************/

#ifndef __BOARDS_ARM_QEMU_QEMU_ARMV7R_INCLUDE_BOARD_H
#define __BOARDS_ARM_QEMU_QEMU_ARMV7R_INCLUDE_BOARD_H

/****************************************************************************
* Included Files
****************************************************************************/

#include <nuttx/config.h>

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

/****************************************************************************
* Public Data
****************************************************************************/

#ifndef __ASSEMBLY__

#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif

/****************************************************************************
* Public Function Prototypes
****************************************************************************/

#undef EXTERN
#if defined(__cplusplus)
}
#endif

#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_QEMU_QEMU_ARMV7R_INCLUDE_BOARD_H */
42 changes: 42 additions & 0 deletions boards/arm/qemu/qemu-armv7r/scripts/Make.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
############################################################################
# boards/arm/qemu/qemu-armv7r/scripts/Make.defs
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you 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 $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/arch/arm/src/armv7-r/Toolchain.defs

LDSCRIPT = dramboot.ld

ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)

CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__

# NXFLAT module definitions

NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)$(DELIM)binfmt$(DELIM)libnxflat$(DELIM)gnu-nxflat-pcrel.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
138 changes: 138 additions & 0 deletions boards/arm/qemu/qemu-armv7r/scripts/dramboot.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/****************************************************************************
* boards/arm/qemu/qemu-armv7a/scripts/dramboot.ld
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you 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 <nuttx/config.h>

OUTPUT_ARCH(arm)
ENTRY(__start)

MEMORY
{
ROM (rx) : ORIGIN = CONFIG_FLASH_START, LENGTH = CONFIG_FLASH_SIZE
RAM (rwx): ORIGIN = CONFIG_RAM_START, LENGTH = CONFIG_RAM_SIZE
}

SECTIONS
{

/* where the global variable out-of-bounds detection information located */

#ifdef CONFIG_MM_KASAN_GLOBAL
.kasan.unused : {
*(.data..LASANLOC*)
}
.kasan.global : {
KEEP (*(.data..LASAN0))
KEEP (*(.data.rel.local..LASAN0))
}
.kasan.shadows : {
*(.kasan.shadows)
}
#endif

.text : {
_stext = .; /* Text section */
__text_start = .;
*(.vectors)
*(.text*)
*(.fixup)
*(.gnu.warning)
} > ROM

. = ALIGN(4096);

.init_section : {
_sinit = ABSOLUTE(.);
KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
KEEP(*(.init_array EXCLUDE_FILE(*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o) .ctors))
_einit = ABSOLUTE(.);
. = ALIGN(4096);
_etext = .; /* End_1 of .text */
_sztext = _etext - _stext;
} > ROM

.ARM.extab :
{
*(.ARM.extab*)
} > ROM

/* .ARM.exidx is sorted, so has to go in its own output section. */

PROVIDE_HIDDEN (__exidx_start = .);
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > ROM
PROVIDE_HIDDEN (__exidx_end = .);

.rodata : {
_srodata = .; /* Read-only data */
*(.rodata*)
*(.data.rel.ro*)
KEEP(*(SORT(.scattered_array*)));
. = ALIGN(4096);
_erodata = .;
} > ROM

_eronly = LOADADDR(.data);
.data : { /* Data */
_sdata = .;
*(.data*)
. = ALIGN(8);
__start_impls = .;
*(.impls)
KEEP(*(.impls))
. = ALIGN(4);
__stop_impls = .;
_edata = .;
} > RAM AT > ROM

.noinit : {
_snoinit = ABSOLUTE(.);
*(.noinit*)
_enoinit = ABSOLUTE(.);
} > RAM

.bss : { /* BSS */
_sbss = .;
*(.bss*)
. = ALIGN(4096);
_ebss = .;
} > RAM

/* Sections to be discarded */
/DISCARD/ : {
*(.exit.text)
*(.exit.data)
*(.exitcall.exit)
}

/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
}

33 changes: 33 additions & 0 deletions boards/arm/qemu/qemu-armv7r/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# ##############################################################################
# boards/arm/qemu/qemu-armv7r/src/CMakeLists.txt
#
# SPDX-License-Identifier: Apache-2.0
#
# Licensed to the Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with this work for
# additional information regarding copyright ownership. The ASF licenses this
# file to you 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.
#
# ##############################################################################
set(SRCS qemu_boardinit.c qemu_bringup.c)

if(CONFIG_BOARDCTL)
list(APPEND SRCS qemu_appinit.c)
endif()

if(CONFIG_LIBC_FDT)
target_include_directories(board
PRIVATE ${NUTTX_DIR}/libs/libc/fdt/dtc/libfdt)
endif()

target_sources(board PRIVATE ${SRCS})
Loading

0 comments on commit 748c5d6

Please sign in to comment.