mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 04:52:02 +08:00
boards/arm/qemu: enable kernel build for armv7a
See Documentation/platforms/arm/qemu/boards/qemu-armv7a/README.txt for details Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
This commit is contained in:
@@ -32,6 +32,35 @@ Getting Started
|
||||
-net none -chardev stdio,id=con,mux=on -serial chardev:con \
|
||||
-mon chardev=con,mode=readline -kernel ./nuttx
|
||||
|
||||
2. knsh
|
||||
------
|
||||
This is a configuration of testing the BUILD_KERNEL configuration
|
||||
$ cd nuttx
|
||||
$ ./tools/configure.sh qemu-armv7a:knsh
|
||||
$ make V=1 -j7
|
||||
$ make export V=1
|
||||
$ cd ../apps
|
||||
$ ./tools/mkimport.sh -z -x ../nuttx/nuttx-export-*.tar.gz
|
||||
$ make import V=1
|
||||
$ cd ../nuttx
|
||||
$ qemu-system-arm -semihosting -M virt -m 1024 -nographic -kernel ./nuttx
|
||||
|
||||
NuttShell (NSH) NuttX-12.3.0-RC0
|
||||
nsh> uname -a
|
||||
NuttX 12.3.0-RC0 28dee592a3-dirty Oct 12 2023 03:03:07 arm qemu-armv7a
|
||||
nsh> ps
|
||||
PID GROUP PRI POLICY TYPE NPX STATE EVENT SIGMASK STACK USED FILLED COMMAND
|
||||
0 0 0 FIFO Kthread N-- Ready 0000000000000000 004088 000896 21.9% Idle_Task
|
||||
1 1 100 RR Kthread --- Waiting Semaphore 0000000000000000 004040 000304 7.5% lpwork 0x40119398 0x401193ac
|
||||
2 2 100 RR Task --- Running 0000000000000000 003032 001032 34.0% /system/bin/init
|
||||
nsh> free
|
||||
total used free largest nused nfree
|
||||
Kmem: 133058556 16644 133041912 133041152 41 3
|
||||
Page: 134217728 1105920 133111808 133111808
|
||||
nsh> /system/bin/hello
|
||||
Hello, World!!
|
||||
nsh>
|
||||
|
||||
Debugging with QEMU
|
||||
===================
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ include armv7-a/Make.defs
|
||||
|
||||
# qemu-specific C source files
|
||||
CHIP_CSRCS = qemu_boot.c qemu_serial.c qemu_irq.c qemu_timer.c qemu_memorymap.c
|
||||
CHIP_CSRCS += qemu_pgalloc.c
|
||||
|
||||
ifeq ($(CONFIG_SMP),y)
|
||||
CHIP_CSRCS += qemu_cpuboot.c
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "hardware/qemu_memorymap.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/qemu/hardware/qemu_memorymap.h
|
||||
*
|
||||
* 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 __ARCH_ARM_SRC_QEMU_HARDWARE_QEMU_MEMORYMAP_H
|
||||
#define __ARCH_ARM_SRC_QEMU_HARDWARE_QEMU_MEMORYMAP_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#undef ARMV7A_PGTABLE_MAPPING /* We do not remap the page table */
|
||||
|
||||
/* Check if the user has configured the page table address */
|
||||
|
||||
#if !defined(PGTABLE_BASE_PADDR) || !defined(PGTABLE_BASE_VADDR)
|
||||
|
||||
/* Sanity check.. if one is undefined, both should be undefined */
|
||||
|
||||
# if defined(PGTABLE_BASE_PADDR) || defined(PGTABLE_BASE_VADDR)
|
||||
# error "Only one of PGTABLE_BASE_PADDR or PGTABLE_BASE_VADDR is defined"
|
||||
# endif
|
||||
|
||||
/* A sanity check, if the configuration says that the page table is read-only
|
||||
* and pre-initialized (maybe ROM), then it should have also defined both of
|
||||
* the page table base addresses.
|
||||
*/
|
||||
|
||||
# ifdef CONFIG_ARCH_ROMPGTABLE
|
||||
# error "CONFIG_ARCH_ROMPGTABLE defined; PGTABLE_BASE_P/VADDR not defined"
|
||||
# endif
|
||||
|
||||
#define ARMV7A_PGTABLE_MAPPING 1
|
||||
|
||||
#else /* !PGTABLE_BASE_PADDR || !PGTABLE_BASE_VADDR */
|
||||
|
||||
/* Sanity check.. if one is defined, both should be defined */
|
||||
|
||||
# if !defined(PGTABLE_BASE_PADDR) || !defined(PGTABLE_BASE_VADDR)
|
||||
# error "One of PGTABLE_BASE_PADDR or PGTABLE_BASE_VADDR is undefined"
|
||||
# endif
|
||||
|
||||
#endif /* !PGTABLE_BASE_PADDR || !PGTABLE_BASE_VADDR */
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_QEMU_HARDWARE_QEMU_MEMORYMAP_H */
|
||||
@@ -25,6 +25,8 @@
|
||||
#include <sys/param.h>
|
||||
|
||||
#include "mmu.h"
|
||||
|
||||
#include "hardware/qemu_memorymap.h"
|
||||
#include "qemu_memorymap.h"
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/qemu/qemu_pgalloc.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#ifdef CONFIG_MM_PGALLOC
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Currently, page cache memory must be allocated in DRAM. There are other
|
||||
* possibilities, but the logic in this file will have to extended in order
|
||||
* handle any other possibility.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_ARCH_PGPOOL_MAPPING
|
||||
# error CONFIG_ARCH_PGPOOL_MAPPING must be selected
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_allocate_pgheap
|
||||
*
|
||||
* Description:
|
||||
* If there is a page allocator in the configuration, then this function
|
||||
* must be provided by the platform-specific code. The OS initialization
|
||||
* logic will call this function early in the initialization sequence to
|
||||
* get the page heap information needed to configure the page allocator.
|
||||
*
|
||||
* Input parameters:
|
||||
* heap_start - A double pointer to the start address of the pgheap
|
||||
* heap_size - A pointer to the size of the pgheap
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_allocate_pgheap(void **heap_start, size_t *heap_size)
|
||||
{
|
||||
DEBUGASSERT(heap_start && heap_size);
|
||||
|
||||
*heap_start = (void *)CONFIG_ARCH_PGPOOL_PBASE;
|
||||
*heap_size = (size_t)CONFIG_ARCH_PGPOOL_SIZE;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_MM_PGALLOC */
|
||||
@@ -0,0 +1,92 @@
|
||||
#
|
||||
# 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_TLS_ALIGNED is not set
|
||||
CONFIG_ALARM_ARCH=y
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_ADDRENV=y
|
||||
CONFIG_ARCH_BOARD="qemu-armv7a"
|
||||
CONFIG_ARCH_BOARD_QEMU_ARMV7A=y
|
||||
CONFIG_ARCH_CHIP="qemu"
|
||||
CONFIG_ARCH_CHIP_QEMU_ARM=y
|
||||
CONFIG_ARCH_CHIP_QEMU_CORTEXA7=y
|
||||
CONFIG_ARCH_DATA_NPAGES=256
|
||||
CONFIG_ARCH_DATA_VBASE=0x80100000
|
||||
CONFIG_ARCH_HEAP_NPAGES=256
|
||||
CONFIG_ARCH_HEAP_VBASE=0x80200000
|
||||
CONFIG_ARCH_INTERRUPTSTACK=2048
|
||||
CONFIG_ARCH_KERNEL_STACKSIZE=3072
|
||||
CONFIG_ARCH_LOWVECTORS=y
|
||||
CONFIG_ARCH_PGPOOL_MAPPING=y
|
||||
CONFIG_ARCH_PGPOOL_PBASE=0x48000000
|
||||
CONFIG_ARCH_PGPOOL_SIZE=134217728
|
||||
CONFIG_ARCH_PGPOOL_VBASE=0x48000000
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_ARCH_TEXT_NPAGES=256
|
||||
CONFIG_ARCH_TEXT_VBASE=0x80000000
|
||||
CONFIG_ARM_SEMIHOSTING_HOSTFS=y
|
||||
CONFIG_ARM_THUMB=y
|
||||
CONFIG_BUILD_KERNEL=y
|
||||
CONFIG_DEBUG_ASSERTIONS=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_DEBUG_FULLOPT=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DEFAULT_TASK_STACKSIZE=4096
|
||||
CONFIG_DEV_ZERO=y
|
||||
CONFIG_ELF=y
|
||||
CONFIG_EXAMPLES_HELLO=m
|
||||
CONFIG_EXPERIMENTAL=y
|
||||
CONFIG_FLASH_SIZE=134217728
|
||||
CONFIG_FLASH_START=0
|
||||
CONFIG_FLASH_VSTART=0
|
||||
CONFIG_FS_HOSTFS=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=4096
|
||||
CONFIG_INIT_FILEPATH="/system/bin/init"
|
||||
CONFIG_INIT_MOUNT=y
|
||||
CONFIG_INIT_MOUNT_DATA="fs=../apps"
|
||||
CONFIG_INIT_MOUNT_FLAGS=0x1
|
||||
CONFIG_INIT_MOUNT_FSTYPE="hostfs"
|
||||
CONFIG_INIT_MOUNT_SOURCE=""
|
||||
CONFIG_INIT_MOUNT_TARGET="/system"
|
||||
CONFIG_INIT_STACKSIZE=3072
|
||||
CONFIG_INTELHEX_BINARY=y
|
||||
CONFIG_LIBC_ENVPATH=y
|
||||
CONFIG_LIBC_EXECFUNCS=y
|
||||
CONFIG_MM_PGALLOC=y
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
CONFIG_NSH_FILE_APPS=y
|
||||
CONFIG_NSH_READLINE=y
|
||||
CONFIG_ONESHOT=y
|
||||
CONFIG_PATH_INITIAL="/system/bin"
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_RAM_SIZE=536870912
|
||||
CONFIG_RAM_START=0x40000000
|
||||
CONFIG_RAM_VSTART=0x40000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_READLINE_CMD_HISTORY=y
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_LPWORK=y
|
||||
CONFIG_STACK_COLORATION=y
|
||||
CONFIG_START_DAY=25
|
||||
CONFIG_START_MONTH=4
|
||||
CONFIG_START_YEAR=2023
|
||||
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||
CONFIG_SYSLOG_TIMESTAMP=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_NSH_PROGNAME="init"
|
||||
CONFIG_TESTING_GETPRIME=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
|
||||
Reference in New Issue
Block a user