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:
fangxinyong
2023-10-12 11:05:20 +08:00
committed by Xiang Xiao
parent 323ee075be
commit 55d7708fa0
7 changed files with 267 additions and 0 deletions
+1
View File
@@ -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
+2
View File
@@ -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 */
+2
View File
@@ -25,6 +25,8 @@
#include <sys/param.h>
#include "mmu.h"
#include "hardware/qemu_memorymap.h"
#include "qemu_memorymap.h"
/****************************************************************************
+76
View File
@@ -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 */