modify nuttx bug of lack of files
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
@@ -0,0 +1,186 @@
|
||||
README
|
||||
======
|
||||
|
||||
This README file describes the contents of the build configurations available
|
||||
for the NuttX QEMU x86_64 port.
|
||||
|
||||
Contents
|
||||
========
|
||||
|
||||
* Creating a bootable disk
|
||||
* QEMU/KVM
|
||||
- Running QEMU/KVM
|
||||
* Bochs
|
||||
- Building Bochs
|
||||
- Running Bochs
|
||||
* Real machine
|
||||
* Toolchain
|
||||
* FAQ
|
||||
* Configurations
|
||||
- ostest
|
||||
|
||||
Creating a bootable disk
|
||||
========================
|
||||
|
||||
This build supports multiboot2, which means that usual multiboot2 bootlaoders, e.g. grub can be used.
|
||||
To create a bootable disk with grub2, create a directory named `iso` with grub configuration file and the compiled nuttx.elf.
|
||||
|
||||
##### Directory and file hierarchy
|
||||
```
|
||||
- iso/
|
||||
- boot/
|
||||
- grub/
|
||||
- grub.cfg
|
||||
- nuttx.elf
|
||||
```
|
||||
|
||||
##### grub.cfg
|
||||
|
||||
The grub.cfg should contain the boot entry of NuttX.
|
||||
```
|
||||
set timeout=0
|
||||
set default=0
|
||||
menuentry "kernel" {
|
||||
multiboot2 /boot/nuttx.elf
|
||||
}
|
||||
```
|
||||
|
||||
##### Making the disk
|
||||
|
||||
Use the following command to create the disk.
|
||||
P.S. In some distros, `grub-mkrescue` is called `grub2-mkrescue`
|
||||
```
|
||||
grub-mkrescue -o boot.iso iso
|
||||
```
|
||||
|
||||
|
||||
QEMU/KVM
|
||||
====
|
||||
|
||||
QEMU is a generic and open source machine emulator and virtual machine. Here are
|
||||
some links (which will probably be mostly outdated by the time your read this):
|
||||
|
||||
Home Page: http://wiki.qemu.org/Main_Page
|
||||
Downloads: http://wiki.qemu.org/Download
|
||||
Documentation: http://wiki.qemu.org/Manual
|
||||
|
||||
KVM is the Linux kernel hypervisor.
|
||||
It supports creations of virtual machines in Linux systems.
|
||||
It is usually coupled with Qemu as its I/O supporting layer.
|
||||
|
||||
The qemu can be build from source or downloaded from distro repositories.
|
||||
However, a modern CPU and KVM support are mandatory because the X2APIC is not available
|
||||
in pure emulator mode.
|
||||
This mean using this build with qemu in windows or old x86 machine can be frustrating.
|
||||
In such case, looks the next section and use bochs emulator instead.
|
||||
|
||||
Running QEMU
|
||||
------------
|
||||
|
||||
In the top-level NuttX directory:
|
||||
|
||||
qemu-system-x86_64 -cpu host -enable-kvm -m 2G -cdrom boot.iso -nographic -serial mon:stdio
|
||||
|
||||
This multiplex the qemu console and COM1 to your console.
|
||||
Use control-a 1 and 2 to switch between.
|
||||
Use control-a x to terminate the emulation.
|
||||
|
||||
P.S. Make sure that you CPU supports the mandatory features. Look at Real machine
|
||||
section for more information.
|
||||
|
||||
Bochs
|
||||
=====
|
||||
|
||||
Bochs is also a generic and open source machine emulator and virtualizer.
|
||||
It does very comprehensive emulation of x86 platform, even the state-of-art processors.
|
||||
Here are some links (which will probably be mostly outdated by the time your read this):
|
||||
|
||||
Home Page: http://bochs.sourceforge.net
|
||||
|
||||
The bochs can be build from source.
|
||||
Unlike qemu, it do not rely on KVM to support modern hardware features, therefor it can
|
||||
also be used under windows.
|
||||
When building bochs, remember to enable x86-64 support with "--enable-x86-64".
|
||||
If you also want the support of SIMD instruction, enable them with "--enable-avx --enable-evex".
|
||||
|
||||
Running Bochs
|
||||
------------
|
||||
|
||||
First edit/check the .bochsrc
|
||||
You can create one in the top-level NuttX directory or bochs will use the one in your $HOME.
|
||||
Remember to change the CPU model to one with mandatory features and enable the COM port.
|
||||
|
||||
* Find and edit (You might adjust the IPS as you machine perform):
|
||||
```
|
||||
cpu: model=broadwell_ult, count=1, ips=50000000, reset_on_triple_fault=0, ignore_bad_msrs=0, msrs="msrs.def" a
|
||||
ata0-master: type=cdrom, path="<PATH TO boot.iso>", status=inserted
|
||||
|
||||
```
|
||||
|
||||
* Add:
|
||||
```
|
||||
com1: enabled=1, mode=file, dev=com1.out
|
||||
```
|
||||
|
||||
In the top-level NuttX directory:
|
||||
|
||||
```
|
||||
bochs
|
||||
```
|
||||
|
||||
The emulator will drop into debugger mode.
|
||||
Enter 'c' to start the emulation.
|
||||
COM port output will be in the com1.out file.
|
||||
|
||||
|
||||
Real machine
|
||||
============
|
||||
|
||||
This port should work on real x86-64 machine with a proper CPU.
|
||||
The mandatory CPU features are:
|
||||
* TSC DEADLINE or APIC timer
|
||||
* PCID
|
||||
* X2APIC
|
||||
|
||||
WARNING: IF you use TSC DEADLINE, make sure that your CPU's TSC DEADLINE timer is not buggy!
|
||||
|
||||
Toolchains
|
||||
==========
|
||||
|
||||
Currently, only the Linux GCC toolchain is tested.
|
||||
While building on a modern x86_64 PC, the default system GCC can be used.
|
||||
|
||||
Configurations
|
||||
==============
|
||||
|
||||
Common Configuration Notes
|
||||
--------------------------
|
||||
|
||||
1. Each Qemu-intel64 configuration is maintained in a sub-directory
|
||||
and can be selected as follow:
|
||||
|
||||
tools/configure.sh qemu-intel64:<subdir>
|
||||
|
||||
Where <subdir> is one of the configuration sub-directories described in
|
||||
the following paragraph.
|
||||
|
||||
2. These configurations use the mconf-based configuration tool. To
|
||||
change a configurations using that tool, you should:
|
||||
|
||||
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
|
||||
see additional README.txt files in the NuttX tools repository.
|
||||
|
||||
b. Execute 'make menuconfig' in nuttx/ in order to start the
|
||||
reconfiguration process.
|
||||
|
||||
3. By default, all configurations assume the Linux. This is easily
|
||||
reconfigured:
|
||||
|
||||
CONFIG_HOST_LINUX=y
|
||||
|
||||
Configuration Sub-Directories
|
||||
-----------------------------
|
||||
|
||||
ostest
|
||||
|
||||
The "standard" NuttX examples/ostest configuration.
|
||||
@@ -0,0 +1,60 @@
|
||||
#
|
||||
# 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_16550_ADDRWIDTH=16
|
||||
CONFIG_16550_UART0=y
|
||||
CONFIG_16550_UART0_BASE=0x3f8
|
||||
CONFIG_16550_UART0_CLOCK=1843200
|
||||
CONFIG_16550_UART0_IRQ=36
|
||||
CONFIG_16550_UART0_RXBUFSIZE=16
|
||||
CONFIG_16550_UART0_SERIAL_CONSOLE=y
|
||||
CONFIG_16550_UART0_TXBUFSIZE=16
|
||||
CONFIG_16550_UART=y
|
||||
CONFIG_ARCH="x86_64"
|
||||
CONFIG_ARCH_BOARD="qemu-intel64"
|
||||
CONFIG_ARCH_BOARD_INTEL64_QEMU=y
|
||||
CONFIG_ARCH_CHIP="intel64"
|
||||
CONFIG_ARCH_INTEL64_CORE_FREQ_KHZ=2600000
|
||||
CONFIG_ARCH_SIZET_LONG=y
|
||||
CONFIG_ARCH_X86_64=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=999
|
||||
CONFIG_BOOT_RUNFROMEXTSRAM=y
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_CLOCK_MONOTONIC=y
|
||||
CONFIG_CONSOLE_SYSLOG=y
|
||||
CONFIG_EXAMPLES_HELLO=y
|
||||
CONFIG_EXAMPLES_HELLO_STACKSIZE=4194304
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=4194304
|
||||
CONFIG_LIBM=y
|
||||
CONFIG_MAX_TASKS=64
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
CONFIG_NSH_BUILTIN_APPS=y
|
||||
CONFIG_NSH_DISABLE_IFCONFIG=y
|
||||
CONFIG_NSH_DISABLE_IFUPDOWN=y
|
||||
CONFIG_PREALLOC_CHILDSTATUS=16
|
||||
CONFIG_PRIORITY_INHERITANCE=y
|
||||
CONFIG_PTHREAD_MUTEX_TYPES=y
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=4194304
|
||||
CONFIG_PTHREAD_STACK_MIN=4194304
|
||||
CONFIG_RAM_SIZE=268435456
|
||||
CONFIG_SCHED_CHILD_STATUS=y
|
||||
CONFIG_SCHED_HAVE_PARENT=y
|
||||
CONFIG_SCHED_TICKLESS=y
|
||||
CONFIG_SCHED_TICKLESS_ALARM=y
|
||||
CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_SIG_DEFAULT=y
|
||||
CONFIG_START_DAY=3
|
||||
CONFIG_START_MONTH=3
|
||||
CONFIG_START_YEAR=2011
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_TIME64=y
|
||||
CONFIG_USEC_PER_TICK=1
|
||||
CONFIG_USERMAIN_STACKSIZE=4194304
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
@@ -0,0 +1,53 @@
|
||||
#
|
||||
# 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_16550_ADDRWIDTH=16
|
||||
CONFIG_16550_UART0=y
|
||||
CONFIG_16550_UART0_BASE=0x3f8
|
||||
CONFIG_16550_UART0_CLOCK=1843200
|
||||
CONFIG_16550_UART0_IRQ=36
|
||||
CONFIG_16550_UART0_RXBUFSIZE=16
|
||||
CONFIG_16550_UART0_SERIAL_CONSOLE=y
|
||||
CONFIG_16550_UART0_TXBUFSIZE=16
|
||||
CONFIG_16550_UART=y
|
||||
CONFIG_ARCH="x86_64"
|
||||
CONFIG_ARCH_BOARD="qemu-intel64"
|
||||
CONFIG_ARCH_BOARD_INTEL64_QEMU=y
|
||||
CONFIG_ARCH_CHIP="intel64"
|
||||
CONFIG_ARCH_INTEL64_CORE_FREQ_KHZ=2600000
|
||||
CONFIG_ARCH_SIZET_LONG=y
|
||||
CONFIG_ARCH_X86_64=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=999
|
||||
CONFIG_BOOT_RUNFROMEXTSRAM=y
|
||||
CONFIG_CLOCK_MONOTONIC=y
|
||||
CONFIG_CONSOLE_SYSLOG=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=4194304
|
||||
CONFIG_LIBM=y
|
||||
CONFIG_MAX_TASKS=64
|
||||
CONFIG_PREALLOC_CHILDSTATUS=16
|
||||
CONFIG_PRIORITY_INHERITANCE=y
|
||||
CONFIG_PTHREAD_MUTEX_TYPES=y
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=4194304
|
||||
CONFIG_PTHREAD_STACK_MIN=4194304
|
||||
CONFIG_RAM_SIZE=268435456
|
||||
CONFIG_SCHED_CHILD_STATUS=y
|
||||
CONFIG_SCHED_HAVE_PARENT=y
|
||||
CONFIG_SCHED_TICKLESS=y
|
||||
CONFIG_SCHED_TICKLESS_ALARM=y
|
||||
CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_SIG_DEFAULT=y
|
||||
CONFIG_START_DAY=3
|
||||
CONFIG_START_MONTH=3
|
||||
CONFIG_START_YEAR=2011
|
||||
CONFIG_SYSTEM_TIME64=y
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_TESTING_OSTEST_STACKSIZE=4149304
|
||||
CONFIG_USEC_PER_TICK=1
|
||||
CONFIG_USERMAIN_STACKSIZE=4194304
|
||||
CONFIG_USER_ENTRYPOINT="ostest_main"
|
||||
@@ -0,0 +1,75 @@
|
||||
/****************************************************************************
|
||||
* boards/x86_64/intel64/qemu-intel64/include/board.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 __BOARDS_X86_64_INTEL64_QEMU_INCLUDE_BOARD_H
|
||||
#define __BOARDS_X86_64_INTEL64_QEMU_INCLUDE_BOARD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Clocking *****************************************************************/
|
||||
|
||||
/* Programmable interval timer (PIT) */
|
||||
|
||||
#define PIT_CLOCK 1041816 /* PIT input clock */
|
||||
|
||||
/* LED definitions **********************************************************/
|
||||
|
||||
/* Button definitions *******************************************************/
|
||||
|
||||
/* Alternate pin selections *************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#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_X86_64_INTEL64_QEMU_INCLUDE_BOARD_H */
|
||||
@@ -0,0 +1,76 @@
|
||||
############################################################################
|
||||
# boards/x86_64/intel64/qemu-intel64/scripts/Make.defs
|
||||
#
|
||||
# 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
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||
ARCHOPTIMIZATION += -O2 -fno-optimize-sibling-calls -fno-omit-frame-pointer -fno-crossjumping -fno-delete-null-pointer-checks
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_CYGWIN_WINTOOL),y)
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(BOARD_DIR)$(DELIM)scripts$(DELIM)qemu.ld}"
|
||||
MAXOPTIMIZATION = -O2
|
||||
else
|
||||
ARCHSCRIPT = -T$(BOARD_DIR)$(DELIM)scripts$(DELIM)qemu.ld
|
||||
endif
|
||||
|
||||
ARCHCPUFLAGS = -fPIC -fno-builtin -fno-stack-protector -mno-red-zone -mrdrnd
|
||||
ARCHPICFLAGS = -fPIC
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||
|
||||
# We have to use a cross-development toolchain under Cygwin because the native
|
||||
# Cygwin toolchains don't generate ELF binaries.
|
||||
|
||||
ifeq ($(CONFIG_WINDOWS_CYGWIN),y)
|
||||
CROSSDEV = i486-nuttx-elf-
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_HOST_MACOS),y)
|
||||
CROSSDEV = x86_64-elf-
|
||||
endif
|
||||
|
||||
CC = $(CROSSDEV)gcc
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
STRIP = $(CROSSDEV)strip --strip-unneeded
|
||||
AR = $(CROSSDEV)ar rcs
|
||||
NM = $(CROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
CFLAGS := $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
|
||||
AFLAGS := $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
ifeq ($(CONFIG_HOST_MACOS),y)
|
||||
AFLAGS += -Wa,--divide
|
||||
endif
|
||||
|
||||
EXEEXT = .elf
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
@@ -0,0 +1,122 @@
|
||||
/****************************************************************************
|
||||
* boards/x86_64/intel64/qemu-intel64/scripts/qemu.ld
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
OUTPUT_ARCH(i386:x86-64)
|
||||
ENTRY(__pmode_entry)
|
||||
SECTIONS
|
||||
{
|
||||
|
||||
. = 0x0;
|
||||
|
||||
.realmode : {
|
||||
. = ALIGN(8);
|
||||
KEEP(*(.multiboot))
|
||||
*(.realmode)
|
||||
}
|
||||
|
||||
. = 0x1M;
|
||||
_kernel_physical_start = .;
|
||||
|
||||
.loader.text : {
|
||||
. = ALIGN(8);
|
||||
*(.loader.text)
|
||||
}
|
||||
|
||||
.loader.rodata : {
|
||||
*(.loader.rodata)
|
||||
}
|
||||
|
||||
.loader.data : {
|
||||
*(.loader.data)
|
||||
}
|
||||
|
||||
.loader.bss : {
|
||||
*(.loader.bss)
|
||||
}
|
||||
|
||||
. = ALIGN(0x1000);
|
||||
_boot_end = .;
|
||||
|
||||
. += 0x100000000;
|
||||
_kernel_virtual_start = .;
|
||||
|
||||
.text : AT(_boot_end)
|
||||
{
|
||||
_stext = ABSOLUTE(.);
|
||||
. = ALIGN(8);
|
||||
KEEP(*(.multiboot))
|
||||
*(.text .text.*)
|
||||
*(.gnu.linkonce.t.*)
|
||||
_etext = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
.rodata ALIGN(0x1000) : AT ( (LOADADDR (.text) + SIZEOF (.text) + 0xFFF) & 0xFFFFFFFFFFFFF000 )
|
||||
{
|
||||
_srodata = ABSOLUTE(.);
|
||||
*(.rodata .rodata.*)
|
||||
*(.fixup)
|
||||
*(.gnu.warning)
|
||||
*(.glue_7)
|
||||
*(.glue_7t)
|
||||
*(.got)
|
||||
*(.gcc_except_table)
|
||||
*(.gnu.linkonce.r.*)
|
||||
*(.eh_frame)
|
||||
_erodata = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
.data ALIGN(0x1000) : AT ( (LOADADDR (.rodata) + SIZEOF (.rodata) + 0xFFF) & 0xFFFFFFFFFFFFF000 )
|
||||
{
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data .data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
CONSTRUCTORS
|
||||
. = ALIGN(4);
|
||||
_edata = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
.bss ALIGN(0x1000) : AT ( (LOADADDR (.data) + SIZEOF (.data) + 0xFFF) & 0xFFFFFFFFFFFFF000 )
|
||||
{
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss .bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
_ebss = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
_kernel_virtual_end = .;
|
||||
|
||||
_kernel_physical_end = (LOADADDR (.bss) + SIZEOF (.bss) + 0xFFF) & 0xFFFFFFFFFFFFF000;
|
||||
|
||||
/* 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) }
|
||||
.debug_abbrev 0 : { *(.debug_abbrev) }
|
||||
.debug_info 0 : { *(.debug_info) }
|
||||
.debug_line 0 : { *(.debug_line) }
|
||||
.debug_pubnames 0 : { *(.debug_pubnames) }
|
||||
.debug_aranges 0 : { *(.debug_aranges) }
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
############################################################################
|
||||
# boards/x86_64/intel64/qemu-intel64/src/Makefile
|
||||
#
|
||||
# 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)/Make.defs
|
||||
|
||||
CSRCS = qemu_boot.c qemu_bringup.c qemu_freq.c qemu_net.c
|
||||
|
||||
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
||||
CSRCS += qemu_appinit.c
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
||||
@@ -0,0 +1,71 @@
|
||||
/****************************************************************************
|
||||
* boards/x86_64/intel64/qemu-intel64/src/qemu_appinit.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/config.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "qemu_intel64.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_app_initialize
|
||||
*
|
||||
* Description:
|
||||
* Perform application specific initialization. This function is never
|
||||
* called directly from application code, but only indirectly via the
|
||||
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
|
||||
*
|
||||
* Input Parameters:
|
||||
* arg - The boardctl() argument is passed to the board_app_initialize()
|
||||
* implementation without modification. The argument has no
|
||||
* meaning to NuttX; the meaning of the argument is a contract
|
||||
* between the board-specific initialization logic and the
|
||||
* matching application logic. The value could be such things as a
|
||||
* mode enumeration value, a set of DIP switch switch settings, a
|
||||
* pointer to configuration data read from a file or serial FLASH,
|
||||
* or whatever you would like to do with it. Every implementation
|
||||
* should accept zero/NULL as a default configuration.
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned on
|
||||
* any failure to indicate the nature of the failure.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int board_app_initialize(uintptr_t arg)
|
||||
{
|
||||
#ifdef CONFIG_BOARD_LATE_INITIALIZE
|
||||
/* Board initialization already performed by board_late_initialize() */
|
||||
|
||||
return OK;
|
||||
#else
|
||||
/* Perform board-specific initialization */
|
||||
|
||||
return qemu_bringup();
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/****************************************************************************
|
||||
* boards/x86_64/intel64/qemu-intel64/src/qemu_boot.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/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/serial/uart_16550.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "qemu_intel64.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: x86_64_boardinitialize
|
||||
*
|
||||
* Description:
|
||||
* All x86_64 architectures must provide the following entry point.
|
||||
* This entry point is called early in the initialization -- after all
|
||||
* memory has been configured and mapped but before any devices have been
|
||||
* initialized.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void x86_64_boardinitialize(void)
|
||||
{
|
||||
#if defined(CONFIG_16550_UART0) && (CONFIG_16550_UART0_BASE == 0x3f8)
|
||||
uart_putreg(CONFIG_16550_UART0_BASE, UART_MCR_OFFSET, UART_MCR_OUT2);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_16550_UART1) && (CONFIG_16550_UART1_BASE == 0x3f8)
|
||||
uart_putreg(CONFIG_16550_UART1_BASE, UART_MCR_OFFSET, UART_MCR_OUT2);
|
||||
#endif
|
||||
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
board_autoled_initialize();
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/****************************************************************************
|
||||
* boards/x86_64/intel64/qemu-intel64/src/qemu_bringup.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/config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/input/buttons.h>
|
||||
|
||||
#include "qemu_intel64.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: qemu_bringup
|
||||
****************************************************************************/
|
||||
|
||||
int qemu_bringup(void)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
/* Mount the procfs file system */
|
||||
|
||||
ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
serr("ERROR: Failed to mount procfs at %s: %d\n", "/proc", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/****************************************************************************
|
||||
* boards/x86_64/intel64/qemu-intel64/src/qemu_freq.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/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/clock.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
extern unsigned long x86_64_timer_freq;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: x86_64_timer_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initializes all platform-specific timer facilities. This function is
|
||||
* called early in the initialization sequence by up_initialize().
|
||||
* On return, the current up-time should be available from
|
||||
* up_timer_gettime() and the interval timer is ready for use (but not
|
||||
* actively timing.
|
||||
*
|
||||
* Provided by platform-specific code and called from the architecture-
|
||||
* specific logic.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
* Called early in the initialization sequence before any special
|
||||
* concurrency protections are required.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void x86_64_timer_calibrate_freq(void)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_INTEL64_HAVE_TSC_DEADLINE
|
||||
|
||||
unsigned long crystal_freq;
|
||||
unsigned long numerator;
|
||||
unsigned long denominator;
|
||||
|
||||
asm volatile("cpuid"
|
||||
: "=c" (crystal_freq), "=b" (numerator), "=a" (denominator)
|
||||
: "a" (X86_64_CPUID_TSC)
|
||||
: "rdx", "memory");
|
||||
|
||||
if (numerator == 0 || denominator == 0 || crystal_freq == 0)
|
||||
{
|
||||
x86_64_timer_freq = CONFIG_ARCH_INTEL64_CORE_FREQ_KHZ * 1000L;
|
||||
}
|
||||
else
|
||||
{
|
||||
x86_64_timer_freq = crystal_freq / denominator * numerator;
|
||||
}
|
||||
|
||||
#else
|
||||
x86_64_timer_freq = CONFIG_ARCH_INTEL64_APIC_FREQ_KHZ * 1000L;
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/****************************************************************************
|
||||
* boards/x86_64/intel64/qemu-intel64/src/qemu_intel64.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 __BOARDS_X86_64_INTEL64_QEMU_SRC_QEMU_INTEL64_H
|
||||
#define __BOARDS_X86_64_INTEL64_QEMU_SRC_QEMU_INTEL64_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* GPIO Pin Definitions *****************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
int qemu_bringup(void);
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_X86_64_INTEL64_QEMU_SRC_QEMU_INTEL64_H */
|
||||
@@ -0,0 +1,59 @@
|
||||
/****************************************************************************
|
||||
* boards/x86_64/intel64/qemu-intel64/src/qemu_net.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/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/arch.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_netinitialize
|
||||
*
|
||||
* Description:
|
||||
* All x86 architectures must provide the following function to setup the
|
||||
* on board Ethernet device. This function is called in the initialization.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET
|
||||
void up_netinitialize(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user