mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 20:44:39 +08:00
arch/arm64: Add support for PINE64 PinePhone
This PR adds support for PINE64 PinePhone and the Allwinner A64 SoC (based on Arm Cortex-A53). With this PR, PinePhone boots successfully to nsh (via microSD Card) and runs console apps. - `arch/arm64/Kconfig`: Added Allwinner A64 SoC - `boards/Kconfig`: Added PINE64 PinePhone - `arch/arm64/src/a64/Kconfig`: New Kconfig for Allwinner A64 SoC - `boards/arm64/a64/pinephone/Kconfig`: New Kconfig for PINE64 PinePhone - `src/a64/a64_boot.c`, `a64_boot.h`: Boot functions for Allwinner A64 - `src/a64/a64_lowputc.S`: Low-level console output - `src/a64/a64_serial.c`, `a64_serial.h`: A64 Serial Driver - `src/a64/chip.h`: A64 SoC Definitions - `include/a64/chip.h`: A64 Memory Map, Generic Interrupt Controller - `include/a64/irq.h`: A64 Interrupts - `src/a64/Make.defs`: Source files for A64 - `configs/nsh/defconfig`: Board Configuration for `pinephone:nsh` - `src/pinephone_appinit.c`: Init PinePhone - `src/pinephone_boardinit.c`: Init PinePhone - `src/pinephone_bringup.c`: Start PinePhone Drivers - `src/pinephone.h`: PinePhone Declarations - `include/board_memorymap.h`: PinePhone Memory Map - `scripts/dramboot.ld`: PinePhone Linker Script - `scripts/Make.defs`: Source files for PinePhone - `src/Makefile`: PinePhone Makefile - `platforms/arm/a64/boards/pinephone/index.rst`: Building and booting NuttX on PinePhone - `platforms/arm/a64/index.rst`: Overview of Allwinner A64 - `introduction/supported_platforms.rst`: Added Allwinner A64 - `introduction/detailed_support.rst`: Added Allwinner A64
This commit is contained in:
@@ -335,6 +335,16 @@ AM335x are supported by NuttX:
|
||||
`README <https://github.com/apache/incubator-nuttx/blob/master/boards/arm/am335x/beaglebone-black/README.txt>`__
|
||||
file for further, up-to-date information.
|
||||
|
||||
ARM Cortex-A53
|
||||
==============
|
||||
|
||||
Allwinner A64
|
||||
-------------
|
||||
|
||||
The basic port has been completed for the following Allwinner A64 board:
|
||||
|
||||
- **PINE64 PinePhone**: Refer to :doc:`PINE64 PinePhone </platforms/arm/a64/boards/pinephone/index>` for further information.
|
||||
|
||||
ARM Cortex-A9
|
||||
=============
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ from board-to-board. Follow the links for the details:
|
||||
- :ref:`introduction/detailed_support:ARM Cortex-A5` (3)
|
||||
- :ref:`introduction/detailed_support:ARM Cortex-A8` (2)
|
||||
- :ref:`introduction/detailed_support:ARM Cortex-A9` (1)
|
||||
- :ref:`introduction/detailed_support:ARM Cortex-A53` (1)
|
||||
- :ref:`introduction/detailed_support:ARM Cortex-R4` (2)
|
||||
- :ref:`introduction/detailed_support:ARM Cortex-M0/M0+` (13)
|
||||
- :ref:`introduction/detailed_support:ARM Cortex-M3` (39)
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
================
|
||||
PINE64 PinePhone
|
||||
================
|
||||
|
||||
`PinePhone <https://wiki.pine64.org/index.php/PinePhone>`_ is an ARM64 smartphone created by PINE64.
|
||||
|
||||
Features
|
||||
========
|
||||
|
||||
- **System on Chip:** Allwinner A64
|
||||
- **CPU:** Quad-Core ARM Cortex-A53
|
||||
- **GPU:** ARM Mali400 MP2
|
||||
- **Interrupt Controller:** ARM GIC PL400 (Generic Interrupt Controller v2)
|
||||
- **Display Engine:** Allwinner Display Engine 2.0 (MIPI DSI with DMA)
|
||||
- **Display:** Xingbangda XBD599 HD IPS Capacitive Touchscreen (5.95 inches, 1440x720 resolution, 16M colors)
|
||||
- **LCD Controller:** Sitronix ST7703 (MIPI DSI)
|
||||
- **RAM:** 2GB or 3GB LPDDR3 SDRAM
|
||||
- **Internal Storage:** 16GB or 32GB eMMC, extendable up to 2TB via microSD
|
||||
- **Back Camera:** Single 5MP, 1/4", LED Flash
|
||||
- **Front Camera:** Single 2MP, f/2.8, 1/5"
|
||||
- **Sound:** Loudspeaker, 3.5mm jack & mic (jack doubles as Hardware UART if Privacy Switch 6 is Off)
|
||||
- Modem: Quectel EG25-G
|
||||
- **LTE-FDD, LTE-TDD, WCDMA, GSM**
|
||||
- **GNSS:** GPS / GLONASS / BeiDou / Galileo / QZSS, with A-GPS
|
||||
- 2.4 GHz Wireless: Realtek RTL8723CS
|
||||
- **WLAN:** WiFi 802.11 b/g/n, single-band, hotspot
|
||||
- **Bluetooth:** 4.0, A2DP
|
||||
- **Sensors:** Accelerometer, Gyroscope, Proximity, Ambient Light, Compass
|
||||
- **Privacy Switches:** Modem, WiFi & Bluetooth, Microphone, Cameras, Headphone
|
||||
- **Battery:** Lithium-ion, rated capacity 2800mAh (10.64Wh), typical capacity 3000mAh (11.40Wh)
|
||||
- **I/O:** USB Type-C, USB Host, DisplayPort Alternate Mode output, 15W 5V 3A Quick Charge, follows USB PD specification
|
||||
|
||||
Serial Console
|
||||
==============
|
||||
|
||||
A `PinePhone Serial Debug Cable <https://wiki.pine64.org/index.php/PinePhone#Serial_console>`_
|
||||
is required to run NuttX on PinePhone.
|
||||
|
||||
On PinePhone, set the `Privacy Switch 6 (Headphone) <https://wiki.pine64.org/index.php/PinePhone#Privacy_switch_configuration>`_
|
||||
to **Off**.
|
||||
|
||||
Connect PinePhone to our computer with the Serial Debug Cable.
|
||||
On our computer, start a Serial Terminal and connect to the USB Serial Port
|
||||
at **115.2 kbps**.
|
||||
|
||||
NuttX will appear in the Serial Console when it boots on PinePhone.
|
||||
|
||||
ARM64 Toolchain
|
||||
===============
|
||||
|
||||
Before building NuttX for PinePhone, download the ARM64 Toolchain for
|
||||
**AArch64 Bare-Metal Target** ``aarch64-none-elf`` from
|
||||
`Arm GNU Toolchain Downloads <https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads>`_.
|
||||
(Skip the section for Beta Releases)
|
||||
|
||||
Add the downloaded toolchain ``gcc-arm-...-aarch64-none-elf/bin``
|
||||
to the ``PATH`` Environment Variable.
|
||||
|
||||
Check the ARM64 Toolchain:
|
||||
|
||||
.. code:: console
|
||||
|
||||
$ aarch64-none-elf-gcc -v
|
||||
|
||||
Building
|
||||
========
|
||||
|
||||
To build NuttX for PinePhone, :doc:`install the prerequisites </quickstart/install>` and
|
||||
:doc:`clone the git repositories </quickstart/install>` for ``nuttx`` and ``apps``.
|
||||
|
||||
Configure the NuttX project and build the project:
|
||||
|
||||
.. code:: console
|
||||
|
||||
$ cd nuttx
|
||||
$ tools/configure.sh pinephone:nsh
|
||||
$ make
|
||||
$ cp nuttx.bin Image
|
||||
$ rm -f Image.gz
|
||||
$ gzip Image
|
||||
|
||||
This produces the file ``Image.gz``, which will be copied to PinePhone in the next step.
|
||||
|
||||
If the build fails with the error ``token "@" is not valid in preprocessor``,
|
||||
`apply this patch <https://github.com/apache/incubator-nuttx/pull/7284/commits/518b0eb31cb66f25b590ae9a79ab16c319b96b94#diff-12291efd8a0ded1bc38bad733d99e4840ae5112b465c04287f91ba5169612c73>`_
|
||||
to ``gcc-arm-none-eabi/arm-none-eabi/include/_newlib_version.h``
|
||||
in the ARM64 Toolchain.
|
||||
|
||||
Booting
|
||||
=======
|
||||
|
||||
NuttX boots on PinePhone via a microSD Card. To prepare the microSD Card, download the
|
||||
**PinePhone Jumpdrive Image** ``pine64-pinephone.img.xz`` from
|
||||
`dreemurrs-embedded/Jumpdrive <https://github.com/dreemurrs-embedded/Jumpdrive/releases>`_.
|
||||
|
||||
Write the downloaded image to a microSD Card with
|
||||
`Balena Etcher <https://www.balena.io/etcher/>`_.
|
||||
|
||||
Copy the file ``Image.gz`` from the previous section
|
||||
and overwrite the file on the microSD Card.
|
||||
|
||||
Check that PinePhone is connected to our computer via a
|
||||
`Serial Debug Cable <https://wiki.pine64.org/index.php/PinePhone#Serial_console>`_ at 115.2 kbps.
|
||||
`Privacy Switch 6 (Headphone) <https://wiki.pine64.org/index.php/PinePhone#Privacy_switch_configuration>`_
|
||||
should be set to **Off**.
|
||||
|
||||
Insert the microSD Card into PinePhone and power up PinePhone.
|
||||
NuttX boots on PinePhone and NuttShell (nsh) appears in the Serial Console.
|
||||
|
||||
To see the available commands in NuttShell:
|
||||
|
||||
.. code:: console
|
||||
|
||||
$ help
|
||||
|
||||
Configurations
|
||||
==============
|
||||
|
||||
nsh
|
||||
---
|
||||
|
||||
Basic configuration that runs NuttShell (nsh).
|
||||
This configuration is focused on low level, command-line driver testing.
|
||||
Built-in applications are supported, but none are enabled.
|
||||
Serial Console is enabled on UART0 at 115.2 kbps.
|
||||
|
||||
Peripheral Support
|
||||
==================
|
||||
|
||||
NuttX for PinePhone supports these peripherals:
|
||||
|
||||
=========== ======= =====
|
||||
Peripheral Support NOTES
|
||||
=========== ======= =====
|
||||
UART Yes Only UART0 is supported
|
||||
=========== ======= =====
|
||||
@@ -0,0 +1,19 @@
|
||||
=============
|
||||
Allwinner A64
|
||||
=============
|
||||
|
||||
`Allwinner A64 <https://linux-sunxi.org/A64>`_ is an ARM64 SoC that features:
|
||||
|
||||
- **CPU:** Quad-Core ARM Cortex-A53
|
||||
- **GPU:** ARM Mali400 MP2
|
||||
- **Interrupt Controller:** ARM GIC PL400 (Generic Interrupt Controller v2)
|
||||
- **Display Engine:** Allwinner Display Engine 2.0 (MIPI DSI with DMA)
|
||||
|
||||
Supported Boards
|
||||
================
|
||||
|
||||
.. toctree::
|
||||
:glob:
|
||||
:maxdepth: 1
|
||||
|
||||
boards/*/*
|
||||
@@ -10,6 +10,14 @@ choice
|
||||
prompt "ARM64 chip selection"
|
||||
default ARCH_CHIP_QEMU
|
||||
|
||||
config ARCH_CHIP_A64
|
||||
bool "Allwinner A64"
|
||||
select ARCH_CORTEX_A53
|
||||
select ARCH_HAVE_ADDRENV
|
||||
select ARCH_NEED_ADDRENV_MAPPING
|
||||
---help---
|
||||
Allwinner A64 SoC
|
||||
|
||||
config ARCH_CHIP_QEMU
|
||||
bool "QEMU virt platform (ARMv8a)"
|
||||
select ARCH_CORTEX_A53
|
||||
@@ -80,6 +88,7 @@ config ARCH_FAMILY
|
||||
|
||||
config ARCH_CHIP
|
||||
string
|
||||
default "a64" if ARCH_CHIP_A64
|
||||
default "qemu" if ARCH_CHIP_QEMU
|
||||
|
||||
config ARCH_HAVE_TRUSTZONE
|
||||
@@ -97,12 +106,17 @@ config ARM_HAVE_NEON
|
||||
|
||||
config ARM_GIC_VERSION
|
||||
int "GIC version"
|
||||
default 2 if ARCH_CHIP_A64
|
||||
default 3
|
||||
range 2 4
|
||||
---help---
|
||||
Version of Generic Interrupt Controller (GIC) supported by the
|
||||
architecture
|
||||
|
||||
if ARCH_CHIP_A64
|
||||
source "arch/arm64/src/a64/Kconfig"
|
||||
endif
|
||||
|
||||
if ARCH_CHIP_QEMU
|
||||
source "arch/arm64/src/qemu/Kconfig"
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/****************************************************************************
|
||||
* arch/arm64/include/a64/chip.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_ARM64_INCLUDE_A64_CHIP_H
|
||||
#define __ARCH_ARM64_INCLUDE_A64_CHIP_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Number of bytes in @p x kibibytes/mebibytes/gibibytes */
|
||||
|
||||
#define KB(x) ((x) << 10)
|
||||
#define MB(x) (KB(x) << 10)
|
||||
#define GB(x) (MB(UINT64_C(x)) << 10)
|
||||
|
||||
/* Allwinner A64 Generic Interrupt Controller v2: Distributor and Redist */
|
||||
|
||||
#define CONFIG_GICD_BASE 0x1C81000
|
||||
#define CONFIG_GICR_BASE 0x1C82000
|
||||
|
||||
/* Allwinner A64 Memory Map: RAM and Device I/O */
|
||||
|
||||
#define CONFIG_RAMBANK1_ADDR 0x40000000
|
||||
#define CONFIG_RAMBANK1_SIZE MB(128)
|
||||
|
||||
#define CONFIG_DEVICEIO_BASEADDR 0x00000000
|
||||
#define CONFIG_DEVICEIO_SIZE MB(512)
|
||||
|
||||
/* U-Boot loads NuttX at this address (kernel_addr_r) */
|
||||
|
||||
#define CONFIG_LOAD_BASE 0x40080000
|
||||
|
||||
#endif /* __ARCH_ARM64_INCLUDE_A64_CHIP_H */
|
||||
@@ -0,0 +1,36 @@
|
||||
/****************************************************************************
|
||||
* arch/arm64/include/a64/irq.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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* This file should never be included directly but, rather,
|
||||
* only indirectly through nuttx/irq.h
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_ARM64_INCLUDE_A64_IRQ_H
|
||||
#define __ARCH_ARM64_INCLUDE_A64_IRQ_H
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Allwinner A64 Interrupts */
|
||||
|
||||
#define NR_IRQS 220 /* Total number of interrupts */
|
||||
|
||||
#endif /* __ARCH_ARM64_INCLUDE_QEMU_IRQ_H */
|
||||
@@ -0,0 +1,15 @@
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
if ARCH_CHIP_A64
|
||||
|
||||
menu "Allwinner A64 Peripheral Selection"
|
||||
config A64_UART
|
||||
bool "UART"
|
||||
default n
|
||||
select UART1_SERIALDRIVER
|
||||
endmenu # Allwinner A64 Peripheral Selection
|
||||
|
||||
endif # ARCH_CHIP_A64
|
||||
@@ -0,0 +1,26 @@
|
||||
############################################################################
|
||||
# arch/arm64/src/a64/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 common/Make.defs
|
||||
|
||||
# Allwinner A64 specific C source files
|
||||
CHIP_CSRCS = a64_boot.c a64_serial.c
|
||||
|
||||
CHIP_ASRCS = a64_lowputc.S
|
||||
@@ -0,0 +1,112 @@
|
||||
/****************************************************************************
|
||||
* arch/arm64/src/a64/a64_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 <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/cache.h>
|
||||
#ifdef CONFIG_PAGING
|
||||
# include <nuttx/page.h>
|
||||
#endif
|
||||
|
||||
#include <arch/chip/chip.h>
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
#include "arm64_smp.h"
|
||||
#endif
|
||||
|
||||
#include "arm64_arch.h"
|
||||
#include "arm64_internal.h"
|
||||
#include "arm64_mmu.h"
|
||||
#include "a64_boot.h"
|
||||
#include "a64_serial.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static const struct arm_mmu_region mmu_regions[] =
|
||||
{
|
||||
MMU_REGION_FLAT_ENTRY("DEVICE_REGION",
|
||||
CONFIG_DEVICEIO_BASEADDR, CONFIG_DEVICEIO_SIZE,
|
||||
MT_DEVICE_NGNRNE | MT_RW | MT_SECURE),
|
||||
|
||||
MMU_REGION_FLAT_ENTRY("DRAM0_S0",
|
||||
CONFIG_RAMBANK1_ADDR, CONFIG_RAMBANK1_SIZE,
|
||||
MT_NORMAL | MT_RW | MT_SECURE),
|
||||
};
|
||||
|
||||
const struct arm_mmu_config mmu_config =
|
||||
{
|
||||
.num_regions = ARRAY_SIZE(mmu_regions),
|
||||
.mmu_regions = mmu_regions,
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arm64_chip_boot
|
||||
*
|
||||
* Description:
|
||||
* Complete boot operations started in arm64_head.S
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void arm64_chip_boot(void)
|
||||
{
|
||||
/* MAP IO and DRAM, enable MMU. */
|
||||
|
||||
arm64_mmu_init(true);
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
arm64_psci_init("smc");
|
||||
|
||||
#endif
|
||||
|
||||
/* Perform board-specific device initialization. This would include
|
||||
* configuration of board specific resources such as GPIOs, LEDs, etc.
|
||||
*/
|
||||
|
||||
a64_board_initialize();
|
||||
|
||||
#ifdef USE_EARLYSERIALINIT
|
||||
/* Perform early serial initialization if we are going to use the serial
|
||||
* driver.
|
||||
*/
|
||||
|
||||
a64_earlyserialinit();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT)
|
||||
void arm64_netinitialize(void)
|
||||
{
|
||||
/* TODO: Support net initialize */
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,80 @@
|
||||
/****************************************************************************
|
||||
* arch/arm64/src/a64/a64_boot.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_ARM64_SRC_A64_A64_BOOT_H
|
||||
#define __ARCH_ARM64_SRC_A64_A64_BOOT_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <arch/chip/chip.h>
|
||||
#include "arm64_internal.h"
|
||||
#include "arm64_arch.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: a64_board_initialize
|
||||
*
|
||||
* Description:
|
||||
* All A64 architectures must provide the following entry point. This
|
||||
* entry point is called in the initialization phase -- after
|
||||
* a64_memory_initialize and after all memory has been configured and
|
||||
* mapped but before any devices have been initialized.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void a64_board_initialize(void);
|
||||
|
||||
void up_lowputc(char c);
|
||||
void up_low_flush(void);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_ARM64_SRC_A64_A64_BOOT_H */
|
||||
@@ -0,0 +1,91 @@
|
||||
/****************************************************************************
|
||||
* arch/arm64/src/a64/a64_lowputc.S
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************
|
||||
*
|
||||
* DESCRIPTION
|
||||
* Low-level console output for Allwinner A64
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "arm64_macro.inc"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Symbols
|
||||
****************************************************************************/
|
||||
|
||||
.file "a64_lowputc.S"
|
||||
|
||||
/****************************************************************************
|
||||
* Assembly Macros
|
||||
****************************************************************************/
|
||||
|
||||
/* Allwinner A64 UART0 Base Address */
|
||||
|
||||
#define UART0_BASE_ADDRESS 0x1C28000
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/* Initialize A64 UART
|
||||
* xb: Register that contains the UART Base Address
|
||||
* c: Scratch register number
|
||||
*/
|
||||
|
||||
GTEXT(up_earlyserialinit)
|
||||
SECTION_FUNC(text, up_earlyserialinit)
|
||||
ret /* Do nothing because U-Boot has already initialized UART */
|
||||
|
||||
/* Wait for A64 UART to be ready to transmit
|
||||
* xb: Register that contains the UART Base Address
|
||||
* wt: Scratch register number
|
||||
*/
|
||||
|
||||
.macro early_uart_ready xb, wt
|
||||
1:
|
||||
ldrh \wt, [\xb, #0x14] /* UART_LSR (Line Status Register) */
|
||||
tst \wt, #0x20 /* Check THRE (TX Holding Register Empty) */
|
||||
b.eq 1b /* Wait for the UART to be ready (THRE=1) */
|
||||
.endm
|
||||
|
||||
/* Transmit character to A64 UART
|
||||
* xb: Register that contains the UART base address
|
||||
* wt: Register that contains the character to transmit
|
||||
*/
|
||||
|
||||
.macro early_uart_transmit xb, wt
|
||||
strb \wt, [\xb] /* UART_THR (Transmit Holding Register) */
|
||||
.endm
|
||||
|
||||
/* Print a character on the UART - this function is called by C
|
||||
* x0: Character to print
|
||||
*/
|
||||
|
||||
GTEXT(up_lowputc)
|
||||
SECTION_FUNC(text, up_lowputc)
|
||||
ldr x15, =UART0_BASE_ADDRESS
|
||||
early_uart_ready x15, w2
|
||||
early_uart_transmit x15, w0
|
||||
ret
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,75 @@
|
||||
/****************************************************************************
|
||||
* arch/arm64/src/a64/a64_serial.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_ARM64_SRC_A64_A64_SERIAL_H
|
||||
#define __ARCH_ARM64_SRC_A64_A64_SERIAL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "arm64_internal.h"
|
||||
#include "arm64_gic.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Inline Functions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_CHIP_A64
|
||||
#define CONFIG_A64_UART_BASE 0x1C28000 /* A64 UART0 Base Address */
|
||||
#define CONFIG_A64_UART_IRQ 32 /* A64 UART0 IRQ */
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: a64_earlyserialinit
|
||||
*
|
||||
* Description:
|
||||
* Performs the low level UART initialization early in debug so that the
|
||||
* serial console will be available during bootup. This must be called
|
||||
* before arm64_serialinit.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef USE_EARLYSERIALINIT
|
||||
void a64_earlyserialinit(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __ARCH_ARM64_SRC_A64_A64_SERIAL_H */
|
||||
@@ -0,0 +1,42 @@
|
||||
/****************************************************************************
|
||||
* arch/arm64/src/a64/chip.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_ARM64_SRC_A64_CHIP_H
|
||||
#define __ARCH_ARM64_SRC_A64_CHIP_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <nuttx/arch.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Macro Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#endif /* __ARCH_ARM64_SRC_A64_CHIP_H */
|
||||
@@ -1760,6 +1760,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_PINEPHONE
|
||||
bool "PINE64 PinePhone"
|
||||
depends on ARCH_CHIP_A64
|
||||
select ARCH_HAVE_IRQBUTTONS
|
||||
---help---
|
||||
This options selects support for NuttX on PINE64 PinePhone based
|
||||
on Allwinner A64 SoC with ARM Cortex-A53.
|
||||
|
||||
config ARCH_BOARD_SAMA5D2_XULT
|
||||
bool "Atmel SAMA5D2 Xplained Ultra development board"
|
||||
depends on ARCH_CHIP_ATSAMA5D27
|
||||
@@ -2833,6 +2841,7 @@ config ARCH_BOARD
|
||||
default "rv-virt" if ARCH_BOARD_QEMU_RV_VIRT
|
||||
default "sabre-6quad" if ARCH_BOARD_SABRE_6QUAD
|
||||
default "qemu-armv8a" if ARCH_BOARD_QEMU_ARMV8A
|
||||
default "pinephone" if ARCH_BOARD_PINEPHONE
|
||||
default "sama5d2-xult" if ARCH_BOARD_SAMA5D2_XULT
|
||||
default "giant-board" if ARCH_BOARD_GIANT_BOARD
|
||||
default "sama5d3x-ek" if ARCH_BOARD_SAMA5D3X_EK
|
||||
@@ -3021,6 +3030,9 @@ endif
|
||||
if ARCH_BOARD_QEMU_ARMV8A
|
||||
source "boards/arm64/qemu/qemu-armv8a/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_PINEPHONE
|
||||
source "boards/arm64/a64/pinephone/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_IMXRT1020_EVK
|
||||
source "boards/arm/imxrt/imxrt1020-evk/Kconfig"
|
||||
endif
|
||||
|
||||
@@ -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_PINEPHONE
|
||||
endif
|
||||
@@ -0,0 +1,64 @@
|
||||
#
|
||||
# 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_A64_UART=y
|
||||
CONFIG_ARCH="arm64"
|
||||
CONFIG_ARCH_ARM64=y
|
||||
CONFIG_ARCH_BOARD="pinephone"
|
||||
CONFIG_ARCH_BOARD_PINEPHONE=y
|
||||
CONFIG_ARCH_CHIP="a64"
|
||||
CONFIG_ARCH_CHIP_A64=y
|
||||
CONFIG_ARCH_INTERRUPTSTACK=4096
|
||||
CONFIG_BUILTIN=y
|
||||
CONFIG_DEBUG_ASSERTIONS=y
|
||||
CONFIG_DEBUG_ERROR=y
|
||||
CONFIG_DEBUG_FEATURES=y
|
||||
CONFIG_DEBUG_FULLOPT=y
|
||||
CONFIG_DEBUG_INFO=y
|
||||
CONFIG_DEBUG_SCHED=y
|
||||
CONFIG_DEBUG_SCHED_ERROR=y
|
||||
CONFIG_DEBUG_SCHED_INFO=y
|
||||
CONFIG_DEBUG_SCHED_WARN=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_DEBUG_WARN=y
|
||||
CONFIG_DEFAULT_TASK_STACKSIZE=8192
|
||||
CONFIG_DEV_ZERO=y
|
||||
CONFIG_EXAMPLES_HELLO=y
|
||||
CONFIG_EXPERIMENTAL=y
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_ROMFS=y
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
CONFIG_IDLETHREAD_STACKSIZE=8192
|
||||
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_NSH_ROMFSETC=y
|
||||
CONFIG_PREALLOC_TIMERS=4
|
||||
CONFIG_PTHREAD_STACK_MIN=8192
|
||||
CONFIG_RAMLOG=y
|
||||
CONFIG_RAM_SIZE=134217728
|
||||
CONFIG_RAM_START=0x40000000
|
||||
CONFIG_RAW_BINARY=y
|
||||
CONFIG_READLINE_CMD_HISTORY=y
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_SCHED_HPWORK=y
|
||||
CONFIG_SCHED_HPWORKPRIORITY=192
|
||||
CONFIG_SPINLOCK=y
|
||||
CONFIG_STACK_COLORATION=y
|
||||
CONFIG_START_MONTH=11
|
||||
CONFIG_START_YEAR=2022
|
||||
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_SYSTEM_SYSTEM=y
|
||||
CONFIG_TESTING_GETPRIME=y
|
||||
CONFIG_TESTING_OSTEST=y
|
||||
CONFIG_UART1_SERIAL_CONSOLE=y
|
||||
CONFIG_USEC_PER_TICK=1000
|
||||
@@ -0,0 +1,59 @@
|
||||
/****************************************************************************
|
||||
* boards/arm64/a64/pinephone/include/board_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 __BOARDS_ARM64_A64_PINEPHONE_INCLUDE_BOARD_MEMORYMAP_H
|
||||
#define __BOARDS_ARM64_A64_PINEPHONE_INCLUDE_BOARD_MEMORYMAP_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_ARM64_A64_PINEPHONE_INCLUDE_BOARD_MEMORYMAP_H */
|
||||
@@ -0,0 +1,48 @@
|
||||
############################################################################
|
||||
# boards/arm64/a64/pinephone/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
|
||||
include $(TOPDIR)/arch/arm64/src/Toolchain.defs
|
||||
|
||||
LDSCRIPT = dramboot.ld
|
||||
|
||||
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)
|
||||
|
||||
CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
|
||||
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
|
||||
|
||||
# ELF module definitions
|
||||
|
||||
CELFFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
|
||||
CXXELFFLAGS = $(CXXFLAGS) -mlong-calls # --target1-abs
|
||||
|
||||
LDELFFLAGS = -r -e main
|
||||
LDELFFLAGS += -T $(call CONVERT_PATH,$(TOPDIR)/binfmt/libelf/gnu-elf.ld)
|
||||
@@ -0,0 +1,126 @@
|
||||
/****************************************************************************
|
||||
* boards/arm64/a64/pinephone/scripts/dramboot.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(aarch64)
|
||||
|
||||
ENTRY(__start)
|
||||
|
||||
PHDRS
|
||||
{
|
||||
text PT_LOAD ;
|
||||
}
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x40080000; /* U-Boot loads NuttX at this address (kernel_addr_r) */
|
||||
_start = .;
|
||||
.text : {
|
||||
_stext = .; /* Text section */
|
||||
*(.text)
|
||||
*(.text.cold)
|
||||
*(.text.unlikely)
|
||||
*(.fixup)
|
||||
*(.gnu.warning)
|
||||
} :text = 0x9090
|
||||
|
||||
. = ALIGN(4096);
|
||||
|
||||
.init_section : {
|
||||
_sinit = ABSOLUTE(.);
|
||||
*(.init_array .init_array.*)
|
||||
_einit = ABSOLUTE(.);
|
||||
}
|
||||
|
||||
. = ALIGN(4096);
|
||||
|
||||
.vector : {
|
||||
_vector_start = .;
|
||||
KEEP(*(.exc_vector_table))
|
||||
KEEP(*(".exc_vector_table.*"))
|
||||
KEEP(*(.vectors))
|
||||
_vector_end = .;
|
||||
} :text
|
||||
. = ALIGN(4096);
|
||||
_etext = .; /* End_1 of .text */
|
||||
_sztext = _etext - _stext;
|
||||
|
||||
. = ALIGN(4096);
|
||||
.rodata : {
|
||||
_srodata = .; /* Read-only data */
|
||||
*(.rodata)
|
||||
*(.rodata.*)
|
||||
*(.data.rel.ro)
|
||||
*(.data.rel.ro.*)
|
||||
} :text
|
||||
. = ALIGN(4096);
|
||||
_erodata = .; /* End of read-only data */
|
||||
_szrodata = _erodata - _srodata;
|
||||
_eronly = .; /* End of read-only data */
|
||||
|
||||
. = ALIGN(4096);
|
||||
.data : { /* Data */
|
||||
_sdata = .;
|
||||
*(.data.page_aligned)
|
||||
*(.data)
|
||||
. = ALIGN(8);
|
||||
*(.data.rel)
|
||||
*(.data.rel.*)
|
||||
CONSTRUCTORS
|
||||
} :text
|
||||
_edata = .; /* End+1 of .data */
|
||||
|
||||
.bss : { /* BSS */
|
||||
_sbss = .;
|
||||
*(.bss)
|
||||
. = ALIGN(1 << 3);
|
||||
} :text
|
||||
. = ALIGN(4096);
|
||||
_ebss = .;
|
||||
_szbss = _ebss - _sbss;
|
||||
|
||||
.initstack : { /* INIT STACK */
|
||||
_s_initstack = .;
|
||||
*(.initstack)
|
||||
. = ALIGN(16);
|
||||
} :text
|
||||
. = ALIGN(4096);
|
||||
_e_initstack = . ;
|
||||
g_idle_topstack = . ;
|
||||
|
||||
_szdata = _e_initstack - _sdata;
|
||||
|
||||
/* Sections to be discarded */
|
||||
/DISCARD/ : {
|
||||
*(.exit.text)
|
||||
*(.exit.data)
|
||||
*(.exitcall.exit)
|
||||
*(.eh_frame)
|
||||
}
|
||||
|
||||
/* 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) }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
############################################################################
|
||||
# boards/arm64/a64/pinephone/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 = pinephone_boardinit.c pinephone_bringup.c
|
||||
|
||||
ifeq ($(CONFIG_BOARDCTL),y)
|
||||
CSRCS += pinephone_appinit.c
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
||||
@@ -0,0 +1,50 @@
|
||||
/****************************************************************************
|
||||
* boards/arm64/a64/pinephone/src/pinephone.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_ARM64_A64_PINEPHONE_SRC_PINEPHONE_H
|
||||
#define __BOARDS_ARM64_A64_PINEPHONE_SRC_PINEPHONE_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: pinephone_bringup
|
||||
*
|
||||
* Description:
|
||||
* Bring up board features
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_BOARDCTL) || defined(CONFIG_BOARD_LATE_INITIALIZE)
|
||||
int pinephone_bringup(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_ARM64_A64_PINEPHONE_SRC_PINEPHONE_H */
|
||||
@@ -0,0 +1,73 @@
|
||||
/****************************************************************************
|
||||
* boards/arm64/a64/pinephone/src/pinephone_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 <sys/types.h>
|
||||
#include <nuttx/board.h>
|
||||
#include "pinephone.h"
|
||||
|
||||
#ifdef CONFIG_BOARDCTL
|
||||
|
||||
/****************************************************************************
|
||||
* 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)
|
||||
{
|
||||
UNUSED(arg);
|
||||
#ifndef CONFIG_BOARD_LATE_INITIALIZE
|
||||
/* Perform board initialization */
|
||||
|
||||
return pinephone_bringup();
|
||||
#else
|
||||
return OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BOARDCTL */
|
||||
@@ -0,0 +1,105 @@
|
||||
/****************************************************************************
|
||||
* boards/arm64/a64/pinephone/src/pinephone_boardinit.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 <nuttx/board.h>
|
||||
#include "pinephone.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: a64_memory_initialize
|
||||
*
|
||||
* Description:
|
||||
* All A64 architectures must provide the following entry point. This
|
||||
* entry point is called early in the initialization before memory has
|
||||
* been configured. This board-specific function is responsible for
|
||||
* configuring any on-board memories.
|
||||
*
|
||||
* Logic in a64_memory_initialize must be careful to avoid using any
|
||||
* global variables because those will be uninitialized at the time this
|
||||
* function is called.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void a64_memory_initialize(void)
|
||||
{
|
||||
/* SDRAM was initialized by a bootloader in the supported configurations. */
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: a64_board_initialize
|
||||
*
|
||||
* Description:
|
||||
* All A64 architectures must provide the following entry point. This
|
||||
* entry point is called in the initialization phase -- after
|
||||
* a64_memory_initialize and after all memory has been configured and
|
||||
* mapped but before any devices have been initialized.
|
||||
*
|
||||
* Input Parameters:
|
||||
* None
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void a64_board_initialize(void)
|
||||
{
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
/* Configure on-board LEDs if LED support has been selected. */
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_late_initialize
|
||||
*
|
||||
* Description:
|
||||
* If CONFIG_BOARD_LATE_INITIALIZE is selected, then an additional
|
||||
* initialization call will be performed in the boot-up sequence to a
|
||||
* function called board_late_initialize(). board_late_initialize() will be
|
||||
* called immediately after up_intitialize() is called and just before the
|
||||
* initial application is started. This additional initialization phase
|
||||
* may be used, for example, to initialize board-specific device drivers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_BOARD_LATE_INITIALIZE
|
||||
void board_late_initialize(void)
|
||||
{
|
||||
/* Perform board initialization */
|
||||
|
||||
pinephone_bringup();
|
||||
}
|
||||
#endif /* CONFIG_BOARD_LATE_INITIALIZE */
|
||||
@@ -0,0 +1,59 @@
|
||||
/****************************************************************************
|
||||
* boards/arm64/a64/pinephone/src/pinephone_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 <sys/types.h>
|
||||
#include <syslog.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include "pinephone.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: pinephone_bringup
|
||||
*
|
||||
* Description:
|
||||
* Bring up board features
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int pinephone_bringup(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
/* Mount the procfs file system */
|
||||
|
||||
ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
Reference in New Issue
Block a user