diff --git a/boards/Kconfig b/boards/Kconfig index fc7d9900da3..6329c25fe79 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -1977,6 +1977,16 @@ config ARCH_BOARD_PINEPHONE_PRO ---help--- This options selects support for NuttX on PINE64 PinePhone based on Rockchip RK3399 SoC with ARM Cortex-A53 + +config ARCH_BOARD_NANOPI_M4 + bool "FriendlyElec NanoPi M4" + depends on ARCH_CHIP_RK3399 + select ARCH_HAVE_LEDS + select ARCH_HAVE_IRQBUTTONS + ---help--- + This options selects support for NuttX on FriendlyElec NanoPi M4 + 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 @@ -3146,6 +3156,7 @@ config ARCH_BOARD default "qemu-armv8a" if ARCH_BOARD_QEMU_ARMV8A default "pinephone" if ARCH_BOARD_PINEPHONE default "pinephonepro" if ARCH_BOARD_PINEPHONE_PRO + default "nanopi_m4" if ARCH_BOARD_NANOPI_M4 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 diff --git a/boards/arm64/rk3399/nanopi_m4/.gitignore b/boards/arm64/rk3399/nanopi_m4/.gitignore new file mode 100644 index 00000000000..ab90683ff46 --- /dev/null +++ b/boards/arm64/rk3399/nanopi_m4/.gitignore @@ -0,0 +1,3 @@ +etctmp.c +src/etctmp +tags diff --git a/boards/arm64/rk3399/nanopi_m4/Kconfig b/boards/arm64/rk3399/nanopi_m4/Kconfig new file mode 100644 index 00000000000..988f3adb02e --- /dev/null +++ b/boards/arm64/rk3399/nanopi_m4/Kconfig @@ -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_NANOPI_M4 +endif # ARCH_BOARD_NANOPI_M4 diff --git a/boards/arm64/rk3399/nanopi_m4/configs/nsh/defconfig b/boards/arm64/rk3399/nanopi_m4/configs/nsh/defconfig new file mode 100644 index 00000000000..777951dfc48 --- /dev/null +++ b/boards/arm64/rk3399/nanopi_m4/configs/nsh/defconfig @@ -0,0 +1,68 @@ +# +# 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="nanopi_m4" +CONFIG_ARCH_BOARD_NANOPI_M4=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_FEATURES=y +CONFIG_DEBUG_FULLOPT=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_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_ARCHROMFS=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=268435456 +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_UART2_BAUD=1500000 +CONFIG_USEC_PER_TICK=1000 +CONFIG_USERLED=y diff --git a/boards/arm64/rk3399/nanopi_m4/include/board.h b/boards/arm64/rk3399/nanopi_m4/include/board.h new file mode 100644 index 00000000000..3e843ce66fe --- /dev/null +++ b/boards/arm64/rk3399/nanopi_m4/include/board.h @@ -0,0 +1,34 @@ +/**************************************************************************** + * boards/arm64/rk3399/nanopi_m4/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_NANOPI_M4_INCLUDE_BOARD_H +#define __BOARDS_ARM64_RK3399_NANOPI_M4_INCLUDE_BOARD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#endif /* __BOARDS_ARM64_RK3399_NANOPI_M4_INCLUDE_BOARD_H */ diff --git a/boards/arm64/rk3399/nanopi_m4/include/nsh_romfsimg.h b/boards/arm64/rk3399/nanopi_m4/include/nsh_romfsimg.h new file mode 100644 index 00000000000..61cc98debb0 --- /dev/null +++ b/boards/arm64/rk3399/nanopi_m4/include/nsh_romfsimg.h @@ -0,0 +1,22 @@ +/*************************************************************************** + * boards/arm64/rk3399/nanopi_m4/include/nsh_romfsimg.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. + * + ***************************************************************************/ + +extern const unsigned char romfs_img[]; +extern unsigned int romfs_img_len; diff --git a/boards/arm64/rk3399/nanopi_m4/scripts/Make.defs b/boards/arm64/rk3399/nanopi_m4/scripts/Make.defs new file mode 100644 index 00000000000..e1d8e19f5fb --- /dev/null +++ b/boards/arm64/rk3399/nanopi_m4/scripts/Make.defs @@ -0,0 +1,48 @@ +############################################################################ +# boards/arm64/rk3399/nanopi_m4/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) diff --git a/boards/arm64/rk3399/nanopi_m4/scripts/dramboot.ld b/boards/arm64/rk3399/nanopi_m4/scripts/dramboot.ld new file mode 100644 index 00000000000..bebe73fff00 --- /dev/null +++ b/boards/arm64/rk3399/nanopi_m4/scripts/dramboot.ld @@ -0,0 +1,138 @@ +/**************************************************************************** + * boards/arm64/rk3399/nanopi_m4/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 +{ + /* Ref to https://github.com/apache/nuttx/pull/10193 + * + * This comes from (https://github.com/u-boot/u-boot/blob/v2022.04/ + * include/configs/rk3399_common.h) + * with patch from (https://github.com/armbian/build/tree/main/ + * patch/u-boot/u-boot-rockchip64-v2022.04) + * + * Using U-Boot(U-Boot 2020.10-armbian (Jan 05 2021 - 01:05:57 +0100)) + * from Armbian(https://www.armbian.com/), and replace `Image` with nuttx.bin + */ + . = 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(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) + KEEP(*(.init_array .ctors)) + _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) } +} + diff --git a/boards/arm64/rk3399/nanopi_m4/src/Makefile b/boards/arm64/rk3399/nanopi_m4/src/Makefile new file mode 100644 index 00000000000..2f6fedebb4f --- /dev/null +++ b/boards/arm64/rk3399/nanopi_m4/src/Makefile @@ -0,0 +1,32 @@ +############################################################################ +# boards/arm64/rk3399/nanopi_m4/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 = nanopi_m4_boardinit.c +CSRCS += nanopi_m4_appinit.c + +ifeq ($(CONFIG_NSH_ROMFSETC),y) +ifneq ($(CONFIG_NSH_CUSTOMROMFS),y) + RCSRCS = etc/init.d/rc.sysinit etc/init.d/rcS +endif +endif + +include $(TOPDIR)/boards/Board.mk diff --git a/boards/arm64/rk3399/nanopi_m4/src/etc/init.d/rc.sysinit b/boards/arm64/rk3399/nanopi_m4/src/etc/init.d/rc.sysinit new file mode 100644 index 00000000000..b7da80a42e6 --- /dev/null +++ b/boards/arm64/rk3399/nanopi_m4/src/etc/init.d/rc.sysinit @@ -0,0 +1,25 @@ +/**************************************************************************** + * boards/arm64/rk3399/nanopi_m4/src/etc/init.d/rc.sysinit + * + * 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 + +#ifdef CONFIG_FS_PROCFS +mount -t procfs CONFIG_NSH_PROC_MOUNTPOINT +#endif diff --git a/boards/arm64/rk3399/nanopi_m4/src/etc/init.d/rcS b/boards/arm64/rk3399/nanopi_m4/src/etc/init.d/rcS new file mode 100644 index 00000000000..7a11a837d21 --- /dev/null +++ b/boards/arm64/rk3399/nanopi_m4/src/etc/init.d/rcS @@ -0,0 +1,22 @@ +/**************************************************************************** + * boards/arm64/rk3399/nanopi_m4/src/etc/init.d/rcS + * + * 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 + diff --git a/boards/arm64/rk3399/nanopi_m4/src/nanopi_m4.h b/boards/arm64/rk3399/nanopi_m4/src/nanopi_m4.h new file mode 100644 index 00000000000..cb21bb154ba --- /dev/null +++ b/boards/arm64/rk3399/nanopi_m4/src/nanopi_m4.h @@ -0,0 +1,37 @@ +/**************************************************************************** + * boards/arm64/rk3399/nanopi_m4/src/nanopi_m4.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_NANOPI_M4_SRC_NANOPI_M4_H +#define __BOARDS_ARM64_RK3399_NANOPI_M4_SRC_NANOPI_M4_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#ifndef __ASSEMBLY__ + +/**************************************************************************** + * Public Functions Definitions + ****************************************************************************/ + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_ARM64_RK3399_NANOPI_M4_SRC_NANOPI_M4_H */ diff --git a/boards/arm64/rk3399/nanopi_m4/src/nanopi_m4_appinit.c b/boards/arm64/rk3399/nanopi_m4/src/nanopi_m4_appinit.c new file mode 100644 index 00000000000..81b035ab2d1 --- /dev/null +++ b/boards/arm64/rk3399/nanopi_m4/src/nanopi_m4_appinit.c @@ -0,0 +1,64 @@ +/**************************************************************************** + * boards/arm64/rk3399/nanopi_m4/src/nanopi_m4_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 +#include +#include +#include "nanopi_m4.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_app_initialize + * + * Description: + * Perform application specific initialization. This function is never + * called directly from application code, but only indirectly via the + * (non-standard) boardctl() interface using the command BOARDIOC_INIT. + * + * Input Parameters: + * arg - The boardctl() argument is passed to the board_app_initialize() + * implementation without modification. The argument has no + * meaning to NuttX; the meaning of the argument is a contract + * between the board-specific initialization logic and the + * matching application logic. The value could be such things as a + * mode enumeration value, a set of DIP switch switch settings, a + * pointer to configuration data read from a file or serial FLASH, + * or whatever you would like to do with it. Every implementation + * should accept zero/NULL as a default configuration. + * + * Returned Value: + * Zero (OK) is returned on success; a negated errno value is returned on + * any failure to indicate the nature of the failure. + * + ****************************************************************************/ + +int board_app_initialize(uintptr_t arg) +{ + /* Perform board initialization */ + + return OK; +} diff --git a/boards/arm64/rk3399/nanopi_m4/src/nanopi_m4_boardinit.c b/boards/arm64/rk3399/nanopi_m4/src/nanopi_m4_boardinit.c new file mode 100644 index 00000000000..c735c0d5fd5 --- /dev/null +++ b/boards/arm64/rk3399/nanopi_m4/src/nanopi_m4_boardinit.c @@ -0,0 +1,104 @@ +/**************************************************************************** + * boards/arm64/rk3399/nanopi_m4/src/nanopi_m4_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 +#include +#include +#include "nanopi_m4.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 */ +} +#endif /* CONFIG_BOARD_LATE_INITIALIZE */