Pinephone Pro port just nsh

Pinephone Pro port just nsh

Status:
booting till GICD / IRQ issue

style cleanups

start to fix style checks

revert offset

whitespaces

revert a64 bringup file

prob last cleanup

more cleanups

remove dts

move changes from a64 hardware specific folders to rk3399

undo common changes (except head.s)

revert gitignore

missing irq.h and rk3399_serial.c need to finish cleaning them up

WIP

add source for load address

make debug print hex again add board include

Pinephone Pro port just nsh

Status:
booting till GICD / IRQ issue

style cleanups

start to fix style checks

revert offset

whitespaces

revert a64 bringup file

prob last cleanup

more cleanups

remove dts

move changes from a64 hardware specific folders to rk3399

undo common changes (except head.s)

revert gitignore

missing irq.h and rk3399_serial.c need to finish cleaning them up

WIP

add source for load address

remove ccache, add board memory map

remove board reset
This commit is contained in:
Anner J. Bonilla 2023-08-11 09:12:26 -04:00 committed by Xiang Xiao
parent c91cd510fc
commit 24e45d071e
25 changed files with 2964 additions and 1 deletions

View File

@ -36,6 +36,16 @@ config ARCH_CHIP_A64
---help---
Allwinner A64 SoC
config ARCH_CHIP_RK3399
bool "Rockchip RK3399"
select ARCH_CORTEX_A53
select ARCH_HAVE_ADDRENV
select ARCH_HAVE_RESET
select ARCH_HAVE_PSCI
select ARCH_NEED_ADDRENV_MAPPING
---help---
Rockchip RK3399 SoC
config ARCH_CHIP_QEMU
bool "QEMU virt platform (ARMv8a)"
select ARCH_HAVE_ADDRENV
@ -190,6 +200,7 @@ config ARCH_FAMILY
config ARCH_CHIP
string
default "a64" if ARCH_CHIP_A64
default "rk3399" if ARCH_CHIP_RK3399
default "qemu" if ARCH_CHIP_QEMU
default "fvp-v8r" if ARCH_CHIP_FVP_ARMV8R
default "imx8" if ARCH_CHIP_IMX8
@ -251,6 +262,10 @@ if ARCH_CHIP_A64
source "arch/arm64/src/a64/Kconfig"
endif
if ARCH_CHIP_RK3399
source "arch/arm64/src/rk3399/Kconfig"
endif
if ARCH_CHIP_QEMU
source "arch/arm64/src/qemu/Kconfig"
endif

View File

@ -0,0 +1,71 @@
/****************************************************************************
* arch/arm64/include/rk3399/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_RK3399_CHIP_H
#define __ARCH_ARM64_INCLUDE_RK3399_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)
/* Rockchip A64 Generic Interrupt Controller v2: Distributor and Redist */
#define CONFIG_GICD_BASE 0xfee00000
#define CONFIG_GICR_BASE 0xfef00000
#define CONFIG_GICR_OFFSET 0x20000
/* Rockchip RK3399 Memory Map: RAM and Device I/O */
#define CONFIG_RAMBANK1_ADDR 0x02000000
#define CONFIG_RAMBANK1_SIZE MB(512)
#define CONFIG_DEVICEIO_BASEADDR 0xF8000000
#define CONFIG_DEVICEIO_SIZE MB(128)
/* U-Boot loads NuttX at this address (kernel_addr_r) */
#define CONFIG_LOAD_BASE 0x02080000
#define MPID_TO_CLUSTER_ID(mpid) ((mpid) & ~0xff)
/****************************************************************************
* Assembly Macros
****************************************************************************/
#ifdef __ASSEMBLY__
.macro get_cpu_id xreg0
mrs \xreg0, mpidr_el1
ubfx \xreg0, \xreg0, #0, #8
.endm
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_ARM64_INCLUDE_RK3399_CHIP_H */

View File

@ -0,0 +1,168 @@
/****************************************************************************
* arch/arm64/include/rk3399/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_RK3399_IRQ_H
#define __ARCH_ARM64_INCLUDE_RK3399_IRQ_H
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Rockchip RK3399 Interrupts */
#define NR_IRQS 181 /* Total number of interrupts */
#define A64_IRQ_SGI0 (0) /* 0x0000 SGI 0 interrupt */
#define A64_IRQ_SGI1 (1) /* 0x0004 SGI 1 interrupt */
#define A64_IRQ_SGI2 (2) /* 0x0008 SGI 2 interrupt */
#define A64_IRQ_SGI3 (3) /* 0x000C SGI 3 interrupt */
#define A64_IRQ_SGI4 (4) /* 0x0010 SGI 4 interrupt */
#define A64_IRQ_SGI5 (5) /* 0x0014 SGI 5 interrupt */
#define A64_IRQ_SGI6 (6) /* 0x0018 SGI 6 interrupt */
#define A64_IRQ_SGI7 (7) /* 0x001C SGI 7 interrupt */
#define A64_IRQ_SGI8 (8) /* 0x0020 SGI 8 interrupt */
#define A64_IRQ_SGI9 (9) /* 0x0024 SGI 9 interrupt */
#define A64_IRQ_SGI10 (10) /* 0x0028 SGI 10 interrupt */
#define A64_IRQ_SGI11 (11) /* 0x002C SGI 11 interrupt */
#define A64_IRQ_SGI12 (12) /* 0x0030 SGI 12 interrupt */
#define A64_IRQ_SGI13 (13) /* 0x0034 SGI 13 interrupt */
#define A64_IRQ_SGI14 (14) /* 0x0038 SGI 14 interrupt */
#define A64_IRQ_SGI15 (15) /* 0x003C SGI 15 interrupt */
#define A64_IRQ_PPI0 (16) /* 0x0040 PPI 0 interrupt */
#define A64_IRQ_PPI1 (17) /* 0x0044 PPI 1 interrupt */
#define A64_IRQ_PPI2 (18) /* 0x0048 PPI 2 interrupt */
#define A64_IRQ_PPI3 (19) /* 0x004C PPI 3 interrupt */
#define A64_IRQ_PPI4 (20) /* 0x0050 PPI 4 interrupt */
#define A64_IRQ_PPI5 (21) /* 0x0054 PPI 5 interrupt */
#define A64_IRQ_PPI6 (22) /* 0x0058 PPI 6 interrupt from ncommirq */
#define A64_IRQ_PPI7 (23) /* 0x005C PPI 7 interrupt from npmuirq*/
#define A64_IRQ_PPI8 (24) /* 0x0060 PPI 8 interrupt from nctiirqack*/
#define A64_IRQ_PPI9 (25) /* 0x0064 PPI 9 interrupt from nvcpumntirq*/
#define A64_IRQ_PPI10 (26) /* 0x0068 PPI 10 interrupt from ncnthpirq*/
#define A64_IRQ_PPI11 (27) /* 0x006C PPI 11 interrupt from ncntvirq*/
#define A64_IRQ_PPI12 (28) /* 0x0070 PPI 12 interrupt */
#define A64_IRQ_PPI13 (29) /* 0x0074 PPI 13 interrupt from ncntpsirq*/
#define A64_IRQ_PPI14 (30) /* 0x0078 PPI 14 interrupt from ncntpnsirq */
#define A64_IRQ_PPI15 (31) /* 0x007C PPI 15 interrupt */
#define A64_IRQ_TWI0 (38) /* 0x0098 TWI 0 interrupt */
#define A64_IRQ_TWI1 (39) /* 0x009C TWI 1 interrupt */
#define A64_IRQ_TWI2 (40) /* 0x00A0 TWI 2 interrupt */
#define A64_IRQ_PB_EINT (43) /* 0x00AC PB_EINT interrupt */
#define A64_IRQ_OWA (44) /* 0x00B0 OWA interrupt */
#define A64_IRQ_I2S_PCM0 (45) /* 0x00B4 I2S/PCM-0 interrupt */
#define A64_IRQ_I2S_PCM1 (46) /* 0x00B8 I2S/PCM-1 interrupt */
#define A64_IRQ_I2S_PCM2 (47) /* 0x00BC I2S/PCM-2 interrupt */
#define A64_IRQ_PG_EINT (49) /* 0x00C4 PG_EINT interrupt */
#define A64_IRQ_TIMER0 (50) /* 0x00C8 Timer 0 interrupt */
#define A64_IRQ_TIMER1 (51) /* 0x00CC Timer 1 interrupt */
#define A64_IRQ_PH_EINT (53) /* 0x00C4 PH_EINT interrupt */
#define A64_IRQ_AC_DET (60) /* 0x00F0 Audio Codec earphone detect interrupt */
#define A64_IRQ_AUDIO_CODEC (61) /* 0x00F4 Audio Codec interrupt */
#define A64_IRQ_KEYADC (62) /* 0x00F8 KEYADC interrupt */
#define A64_IRQ_THERMAL_SENSOR (63) /* 0x00FC Thermal Sensor interrupt */
#define A64_IRQ_EXTERNAL_NMI (64) /* 0x100 External Non-Mask Interrupt */
#define A64_IRQ_R_TIMER0 (65) /* 0x104 R_timer 0 interrupt */
#define A64_IRQ_R_TIMER1 (66) /* 0x108 R_timer 1 interrupt */
#define A64_IRQ_R_WATCHDOG (68) /* 0x0110 R_watchdog interrupt */
#define A64_IRQ_R_CIR_RX (69) /* 0x00E8 R_CIR_RX interrupt */
#define A64_IRQ_R_UART (70) /* 0x0118 R_UART interrupt */
#define A64_IRQ_R_RSB (71) /* 0x011C R_RSB interrupt */
#define A64_IRQ_R_ALARM0 (72) /* 0x0120 R_Alarm 0 interrupt */
#define A64_IRQ_R_ALARM1 (73) /* 0x0124 R_Alarm 1 interrupt */
#define A64_IRQ_R_TIMER2 (74) /* 0x0128 R_timer 2 interrupt */
#define A64_IRQ_R_TIMER3 (75) /* 0x012C R_timer 3 interrupt */
#define A64_IRQ_R_TWI (76) /* 0x0130 R_TWI interrupt */
#define A64_IRQ_R_PL_EINT (77) /* 0x0134 R_PL_EINT interrupt */
#define A64_IRQ_R_TWD (78) /* 0x0138 R_TWD interrupt */
#define A64_IRQ_MSGBOX (81) /* 0x0144 MSGBOX interrupt */
#define A64_IRQ_DMA (82) /* 0x0148 DMA channel interrupt */
#define A64_IRQ_HS_TIMER (83) /* 0x014C HS Timer interrupt */
#define A64_IRQ_SD_MMC0 (92) /* 0x0170 SD/MMC Host Controller 0 interrupt */
#define A64_IRQ_SD_MMC1 (93) /* 0x0174 SD/MMC Host Controller 1 interrupt */
#define A64_IRQ_SD_MMC2 (94) /* 0x0178 SD/MMC Host Controller 2 interrupt */
#define A64_IRQ_SPI0 (97) /* 0x0184 SPI 0 interrupt */
#define A64_IRQ_SPI1 (98) /* 0x0188 SPI 1 interrupt */
#define A64_IRQ_DRAM_MDFS (101) /* 0x0194 DRAM MDFS interrupt */
#define A64_IRQ_NAND (102) /* 0x0198 NAND Flash Controller interrupt */
#define A64_IRQ_USB_OTG (103) /* 0x019C USB-OTG interrupt */
#define A64_IRQ_USB_OTG_EHCI (104) /* 0x01A0 USB-OTG-EHCI interrupt */
#define A64_IRQ_USB_OTG_OHCI (105) /* 0x01A4 USB-OTG-OHCI interrupt */
#define A64_IRQ_USB_EHCI0 (106) /* 0x01A8 USB-EHCI0 interrupt */
#define A64_IRQ_USB_OHCI0 (107) /* 0x01AC USB-OHCI0 interrupt */
#define A64_IRQ_CE0 (112) /* 0x01C0 CE interrupt */
#define A64_IRQ_TS (113) /* 0x01C4 TS interrupt */
#define A64_IRQ_EMAC (114) /* 0x01C8 EMAC interrupt */
#define A64_IRQ_SCR (115) /* 0x01CC SCR interrupt */
#define A64_IRQ_CSI (116) /* 0x01D0 CSI interrupt */
#define A64_IRQ_CSI_CCI (117) /* 0x01D4 CSI_CCI interrupt */
#define A64_IRQ_TCON0 (118) /* 0x01D8 TCON0 interrupt */
#define A64_IRQ_TCON1 (119) /* 0x01DC TCON1 interrupt */
#define A64_IRQ_HDMI (120) /* 0x01E0 HDMI interrupt */
#define A64_IRQ_MIPI_DSI (121) /* 0x01E4 MIPI DSI interrupt */
#define A64_IRQ_DIT (125) /* 0x01F4 De-interlace interrupt */
#define A64_IRQ_CE1 (126) /* 0x01F8 CE1 interrupt */
#define A64_IRQ_DE (127) /* 0x01FC DE interrupt */
#define A64_IRQ_ROT (128) /* 0x0200 DE_RORATE interrupt */
#define A64_IRQ_GPU_GP (129) /* 0x0204 GPU-GP interrupt */
#define A64_IRQ_UART1 (130) /* 0x0084 UART 1 interrupt */
#define A64_IRQ_UART0 (131) /* 0x0080 UART 0 interrupt */
#define A64_IRQ_UART2 (132) /* 0x0088 UART 2 interrupt */
#define A64_IRQ_UART3 (133) /* 0x008C UART 3 interrupt */
#define A64_IRQ_UART4 (134) /* 0x0090 UART 4 interrupt */
#define A64_IRQ_GPU_PPMMU1 (135) /* 0x021C GPU-PPMMU1 interrupt */
#define A64_IRQ_CTI0 (140) /* 0x0230 CTI0 interrupt */
#define A64_IRQ_CTI1 (141) /* 0x0234 CTI1 interrupt */
#define A64_IRQ_CTI2 (142) /* 0x0238 CTI2 interrupt */
#define A64_IRQ_CTI3 (143) /* 0x023C CTI3 interrupt */
#define A64_IRQ_COMMTX0 (144) /* 0x0240 COMMTX0 interrupt */
#define A64_IRQ_COMMTX1 (145) /* 0x0244 COMMTX1 interrupt */
#define A64_IRQ_COMMTX2 (146) /* 0x0248 COMMTX2 interrupt */
#define A64_IRQ_COMMTX3 (147) /* 0x024C COMMTX3 interrupt */
#define A64_IRQ_COMMRX0 (148) /* 0x0250 COMMRX0 interrupt */
#define A64_IRQ_COMMRX1 (149) /* 0x0254 COMMRX1 interrupt */
#define A64_IRQ_COMMRX2 (150) /* 0x0258 COMMRX2 interrupt */
#define A64_IRQ_COMMRX3 (151) /* 0x025C COMMRX3 interrupt */
#define A64_IRQ_PMU0 (152) /* 0x0260 PMU0 interrupt */
#define A64_IRQ_PMU1 (153) /* 0x0264 PMU1 interrupt */
#define A64_IRQ_PMU2 (154) /* 0x0268 PMU2 interrupt */
#define A64_IRQ_PMU3 (155) /* 0x026C PMU3 interrupt */
#define A64_IRQ_AXI_ERROR (156) /* 0x0270 AXI_ERROR interrupt */
#endif /* __ARCH_ARM64_INCLUDE_RK3399_IRQ_H */

View File

@ -426,7 +426,7 @@ static void init_xlat_tables(const struct arm_mmu_region *region)
uint64_t level_size;
#ifdef CONFIG_MMU_DEBUG
sinfo("mmap: virt %llx phys %llx size %llx\n", virt, phys, size);
sinfo("mmap: virt %lux phys %lux size %lux\n", virt, phys, size);
#endif
/* check minimum alignment requirement for given mmap region */

View File

@ -0,0 +1,52 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#
if ARCH_CHIP_RK3399
menu "Rockchip RK3399 Peripheral Selection"
config RK3399_UART
bool "UART 0"
default n
select UART0_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
---help---
Select to enable support for UART0.
config RK3399_UART1
bool "UART 1"
default n
select UART1_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
---help---
Select to enable support for UART1.
config RK3399_UART2
bool "UART 2"
default y
select UART2_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
---help---
Select to enable support for UART2.
config RK3399_UART3
bool "UART 3"
default n
select UART3_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
---help---
Select to enable support for UART3.
config RK3399_UART4
bool "UART 4"
default n
select UART4_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
---help---
Select to enable support for UART4.
endmenu # Rockchip RK3399 Peripheral Selection
endif # ARCH_CHIP_RK3399

View File

@ -0,0 +1,28 @@
############################################################################
# arch/arm64/src/rk3399/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
# Rockchip RK3399 specific C source files
CHIP_CSRCS = rk3399_boot.c rk3399_serial.c
ifeq ($(CONFIG_ARCH_EARLY_PRINT),y)
CHIP_ASRCS = rk3399_lowputc.S
endif

View File

@ -0,0 +1,42 @@
/****************************************************************************
* arch/arm64/src/rk3399/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_RK3399_CHIP_H
#define __ARCH_ARM64_SRC_RK3399_CHIP_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__
# include <nuttx/arch.h>
#endif
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Macro Definitions
****************************************************************************/
#endif /* __ARCH_ARM64_SRC_RK3399_CHIP_H */

View File

@ -0,0 +1,61 @@
/****************************************************************************
* arch/arm64/src/rk3399/hardware/rk3399_memorymap.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_ARM64_SRC_RK3399_HARDWARE_RK3399_MEMORYMAP_H
#define __ARCH_ARM64_SRC_RK3399_HARDWARE_RK3399_MEMORYMAP_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Peripheral Base Addresses */
#define RK3399_GPIO0_ADDR 0xff720000
#define RK3399_GPIO1_ADDR 0xff730000
#define RK3399_GPIO2_ADDR 0xff780000
#define RK3399_GPIO3_ADDR 0xff788000
#define RK3399_GPIO4_ADDR 0xff790000
#define RK3399_PIO_ADDR RK3399_GPIO0_ADDR
#define RK3399_PWM_ADDR 0xff430000
#define RK3399_UART0_ADDR 0xff180000
#define RK3399_UART1_ADDR 0xff190000
#define RK3399_UART2_ADDR 0xff1a0000
#define RK3399_UART3_ADDR 0xff1b0000
#define RK3399_UART4_ADDR 0xff370000
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Public Functions Prototypes
****************************************************************************/
#endif /* __ARCH_ARM64_SRC_RK3399_HARDWARE_RK3399_MEMORYMAP_H */

View File

@ -0,0 +1,130 @@
/****************************************************************************
* arch/arm64/src/rk3399/rk3399_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 "rk3399_boot.h"
#include "rk3399_serial.h"
/****************************************************************************
* Private Data
****************************************************************************/
static const struct arm_mmu_region g_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 g_mmu_config =
{
.num_regions = nitems(g_mmu_regions),
.mmu_regions = g_mmu_regions,
};
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: arm64_el_init
*
* Description:
* The function called from arm64_head.S at very early stage for these
* platform, it's use to:
* - Handling special hardware initialize routine which is need to
* run at high ELs
* - Initialize system software such as hypervisor or security firmware
* which is need to run at high ELs
*
****************************************************************************/
void arm64_el_init(void)
{
/* TODO: RK3399 set init sys clock */
}
/****************************************************************************
* 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);
#if defined(CONFIG_SMP) || defined(CONFIG_ARCH_HAVE_PSCI)
arm64_psci_init("smc");
#endif
/* Perform board-specific device initialization. This would include
* configuration of board specific resources such as GPIOs, LEDs, etc.
*/
rk3399_board_initialize();
#ifdef USE_EARLYSERIALINIT
/* Perform early serial initialization if we are going to use the serial
* driver.
*/
arm64_earlyserialinit();
#endif
}
#if defined(CONFIG_NET) && !defined(CONFIG_NETDEV_LATEINIT)
void arm64_netinitialize(void)
{
/* TODO: Support net initialize */
}
#endif

View File

@ -0,0 +1,77 @@
/****************************************************************************
* arch/arm64/src/rk3399/rk3399_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_RK3399_RK3399_BOOT_H
#define __ARCH_ARM64_SRC_RK3399_RK3399_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: rk3399_board_initialize
*
* Description:
* All rk3399 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 rk3399_board_initialize(void);
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_ARM64_SRC_RK3399_RK3399_BOOT_H */

View File

@ -0,0 +1,90 @@
/****************************************************************************
* arch/arm64/src/rk3399/rk3399_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 Rockchip RK3399
*
***************************************************************************/
#include <nuttx/config.h>
#include "arm64_macro.inc"
/****************************************************************************
* Public Symbols
****************************************************************************/
.file "rk3399_lowputc.S"
/****************************************************************************
* Assembly Macros
****************************************************************************/
/* Rockchip RK3399 UART0 Base Address */
#define UART2_BASE_ADDRESS 0xFF1A0000
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
/* Initialize A64 UART
* xb: Register that contains the UART Base Address
* c: Scratch register number
*/
GTEXT(arm64_earlyprintinit)
SECTION_FUNC(text, arm64_earlyprintinit)
ret /* Do nothing because U-Boot has already initialized UART */
/* Wait for RK3399 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 RK3399 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(arm64_lowputc)
SECTION_FUNC(text, arm64_lowputc)
ldr x15, =UART2_BASE_ADDRESS
early_uart_ready x15, w2
early_uart_transmit x15, w0
ret

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,69 @@
/****************************************************************************
* arch/arm64/src/rk3399/rk3399_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_RK3399_RK3399_SERIAL_H
#define __ARCH_ARM64_SRC_RK3399_RK3399_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_RK3399
/* IRQ for RK3399 UART Rockchip_RK3399TRM_V1.4_Part1-20170408 page 17 */
#define RK3399_UART2_ADDR 0xff1a0000
#define RK3399_UART0_IRQ 131 /* RK3399 UART0 IRQ */
#define RK3399_UART1_IRQ 130 /* RK3399 UART1 IRQ */
#define RK3399_UART2_IRQ 132 /* RK3399 UART2 IRQ */
#define RK3399_UART3_IRQ 133 /* RK3399 UART3 IRQ */
#define RK3399_UART4_IRQ 134 /* RK3399 UART4 IRQ */
#endif /* CONFIG_ARCH_CHIP_RK3399 */
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#endif /* __ASSEMBLY__ */
#endif /* __ARCH_ARM64_SRC_RK3399_RK3399_SERIAL_H */

View File

@ -1943,6 +1943,14 @@ config ARCH_BOARD_PINEPHONE
This options selects support for NuttX on PINE64 PinePhone based
on Allwinner A64 SoC with ARM Cortex-A53.
config ARCH_BOARD_PINEPHONE_PRO
bool "PINE64 PinePhonePro"
depends on ARCH_CHIP_RK3399
select ARCH_HAVE_LEDS
select ARCH_HAVE_IRQBUTTONS
---help---
This options selects support for NuttX on PINE64 PinePhone based
on Rockchip RK3399 SoC with ARM Cortex-A53
config ARCH_BOARD_FVP_ARMV8R
bool "FVP ARM-v8r CPUs board"
depends on ARCH_CHIP_FVP_ARMV8R
@ -3100,6 +3108,7 @@ config ARCH_BOARD
default "qemu-armv7a" if ARCH_BOARD_QEMU_ARMV7A
default "qemu-armv8a" if ARCH_BOARD_QEMU_ARMV8A
default "pinephone" if ARCH_BOARD_PINEPHONE
default "pinephonepro" if ARCH_BOARD_PINEPHONE_PRO
default "fvp-armv8r" if ARCH_BOARD_FVP_ARMV8R
default "fvp-armv8r-aarch32" if ARCH_BOARD_FVP_ARMV8R_AARCH32
default "imx8qm-mek" if ARCH_BOARD_IMX8QM_MEK
@ -3302,6 +3311,9 @@ endif
if ARCH_BOARD_PINEPHONE
source "boards/arm64/a64/pinephone/Kconfig"
endif
if ARCH_BOARD_PINEPHONE_PRO
source "boards/arm64/rk3399/pinephonepro/Kconfig"
endif
if ARCH_BOARD_FVP_ARMV8R
source "boards/arm64/fvp-v8r/fvp-armv8r/Kconfig"
endif

View File

@ -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_PRO
endif # ARCH_BOARD_PINEPHONE_PRO

View File

@ -0,0 +1,69 @@
#
# 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_ARCH="arm64"
CONFIG_ARCH_ARM64=y
CONFIG_ARCH_BOARD="pinephonepro"
CONFIG_ARCH_BOARD_PINEPHONE_PRO=y
CONFIG_ARCH_CHIP="rk3399"
CONFIG_ARCH_CHIP_RK3399=y
CONFIG_ARCH_EARLY_PRINT=y
CONFIG_ARCH_INTERRUPTSTACK=4096
CONFIG_BOARD_LOOPSPERMSEC=116524
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_IRQ=y
CONFIG_DEBUG_IRQ_INFO=y
CONFIG_DEBUG_SCHED=y
CONFIG_DEBUG_SCHED_ERROR=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_EXAMPLES_LEDS=y
CONFIG_EXPERIMENTAL=y
CONFIG_FRAME_POINTER=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_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=0x02080000
CONFIG_RAW_BINARY=y
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_BACKTRACE=y
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_SYSTEM_TIME64=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_USEC_PER_TICK=1000
CONFIG_USERLED=y

View File

@ -0,0 +1,71 @@
/****************************************************************************
* boards/arm64/rk3399/pinephonepro/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_ARM64_RK3399_PINEPHONE_PRO_INCLUDE_BOARD_H
#define __BOARDS_ARM64_RK3399_PINEPHONE_PRO_INCLUDE_BOARD_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* LED definitions **********************************************************/
/* LED index values for use with board_userled() */
typedef enum
{
BOARD_LED1 = 0, /* Green LED */
BOARD_LED2 = 1, /* Red LED */
BOARD_LED3 = 2, /* Blue LED */
BOARD_LEDS /* Number of LEDs */
} led_typedef_enum;
/* LED bits for use with board_userled_all() */
#define BOARD_LED1_BIT (1 << BOARD_LED1)
#define BOARD_LED2_BIT (1 << BOARD_LED2)
#define BOARD_LED3_BIT (1 << BOARD_LED3)
/* If CONFIG_ARCH_LEDS is defined, the usage by the board port is defined in
* include/board.h and src/pinephone_autoleds.c. The LEDs are used to encode
* OS-related events as follows:
*
* SYMBOL Meaning LED state
* LED1 LED2 LED3
* ---------------------- -------------------------- ------ ------ ---
*/
#define LED_STARTED 0 /* NuttX has been started OFF OFF OFF */
#define LED_HEAPALLOCATE 1 /* Heap has been allocated ON OFF OFF */
#define LED_IRQSENABLED 2 /* Interrupts enabled OFF ON OFF */
#define LED_STACKCREATED 3 /* Idle stack created OFF OFF ON */
#define LED_INIRQ 4 /* In an interrupt ON ON OFF */
#define LED_SIGNAL 5 /* In a signal handler ON OFF ON */
#define LED_ASSERTION 6 /* An assertion failed OFF ON ON */
#define LED_PANIC 7 /* The system has crashed FLASH ON ON */
#define LED_IDLE 8 /* MCU is is sleep mode OFF FLASH OFF */
#endif /* __BOARDS_ARM64_RK3399_PINEPHONE_PRO_INCLUDE_BOARD_H */

View File

@ -0,0 +1,59 @@
/****************************************************************************
* boards/arm64/rk3399/pinephonepro/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_RK3399_PINEPHONE_PRO_INCLUDE_BOARD_MEMORYMAP_H
#define __BOARDS_ARM64_RK3399_PINEPHONE_PRO_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_RK3399_PINEPHONE_PRO_INCLUDE_BOARD_MEMORYMAP_H */

View File

@ -0,0 +1,48 @@
############################################################################
# boards/arm64/rk3399/pinephonepro/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)

View File

@ -0,0 +1,128 @@
/****************************************************************************
* boards/arm64/rk3399/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
{
// this comes from u-boot https://github.com/u-boot/u-boot/blob/a5899cc69a99379f01e8e2f9f98e0e09b24f1656/include/configs/rk3399_common.h#L41
. = 0x02080000; /* 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(.);
KEEP(*(.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 */
. = ALIGN(8);
_sbss = .;
*(.bss)
. = ALIGN(8);
} :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) }
}

View File

@ -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 = pinephonepro_boardinit.c pinephonepro_bringup.c
ifeq ($(CONFIG_BOARDCTL),y)
CSRCS += pinephonepro_appinit.c
endif
include $(TOPDIR)/boards/Board.mk

View File

@ -0,0 +1,49 @@
/****************************************************************************
* boards/arm64/rk3399/pinephonepro/src/pinephonepro.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_RK3399_PINEPHONE_SRC_PINEPHONEPRO_H
#define __BOARDS_ARM64_RK3399_PINEPHONE_SRC_PINEPHONEPRO_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_RK3399_PINEPHONE_SRC_PINEPHONEPRO_H */

View File

@ -0,0 +1,73 @@
/****************************************************************************
* boards/arm64/rk3399/pinephonepro/src/pinephonepro_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 "pinephonepro.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 */

View File

@ -0,0 +1,106 @@
/****************************************************************************
* boards/arm64/rk3399/pinephonepro/src/pinephonepro_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 "pinephonepro.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: rk3399_memory_initialize
*
* Description:
* All RK3399 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 rk3399_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 rk3399_memory_initialize(void)
{
/* SDRAM was already init by bootloader in supported configuration */
}
/****************************************************************************
* Name: rk3399_board_initialize
*
* Description:
* All RK3399 architectures must provide the following entry point. This
* entry point is called in the initialization phase -- after
* rk3399_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 rk3399_board_initialize(void)
{
#ifdef CONFIG_ARCH_LEDS
/* Configure on-board LEDs if LED support has been selected. */
/* board_autoled_initialize(); */
#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_initialize() 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 */

View File

@ -0,0 +1,63 @@
/****************************************************************************
* boards/arm64/rk3399/pinephonepro/src/pinephonepro_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 <nuttx/kmalloc.h>
#include <sys/types.h>
#include <syslog.h>
#include "pinephonepro.h"
#ifdef CONFIG_FS_PROCFS
# include <nuttx/fs/fs.h>
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: pinephone_bringup
*
* Description:
* Bring up board features
*
****************************************************************************/
int pinephone_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)
{
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
}
#endif
UNUSED(ret);
return OK;
}