diff --git a/arch/sparc/src/s698pm/s698pm-lowinit.c b/arch/sparc/src/s698pm/s698pm-lowinit.c index d2b1684ac9..5f24841476 100644 --- a/arch/sparc/src/s698pm/s698pm-lowinit.c +++ b/arch/sparc/src/s698pm/s698pm-lowinit.c @@ -94,7 +94,7 @@ void up_lowinit(void) * certain that there are no issues with the state of global variables. */ - for (dest = &_bss_start; dest < &_end; ) + for (dest = (uint32_t *)_bss_start; dest < (uint32_t *)_end; ) { *dest++ = 0; } diff --git a/arch/sparc/src/s698pm/s698pm-serial.c b/arch/sparc/src/s698pm/s698pm-serial.c index e4cc899d96..6b9dbecd69 100644 --- a/arch/sparc/src/s698pm/s698pm-serial.c +++ b/arch/sparc/src/s698pm/s698pm-serial.c @@ -171,7 +171,7 @@ struct up_dev_s { uintptr_t uartbase; /* Base address of UART registers */ uint32_t baud; /* Configured baud */ - uint8_t irq; /* IRQ associated with this UART (for attachment) */ + uint16_t irq; /* IRQ associated with this UART (for attachment) */ uint8_t im; /* Interrupt mask state */ uint8_t parity; /* 0=none, 1=odd, 2=even */ uint8_t bits; /* Number of bits (5, 6, 7 or 8) */ diff --git a/arch/sparc/src/s698pm/s698pm_cpustart.c b/arch/sparc/src/s698pm/s698pm_cpustart.c index b8c1b2edf3..df58abff83 100644 --- a/arch/sparc/src/s698pm/s698pm_cpustart.c +++ b/arch/sparc/src/s698pm/s698pm_cpustart.c @@ -36,6 +36,7 @@ #include #include "sched/sched.h" +#include "init/init.h" #include "sparc_internal.h" #ifdef CONFIG_BUILD_KERNEL diff --git a/boards/Kconfig b/boards/Kconfig index 01584e3fc7..b3accc91e8 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -2588,6 +2588,13 @@ config ARCH_BOARD_XX3823 ---help--- none +config ARCH_BOARD_S698PM_DKIT + bool "Sparc S698pm Dkit Board" + depends on ARCH_CHIP_S698PM + select ARCH_HAVE_LEDS + ---help--- + none + config ARCH_BOARD_SIM bool "User mode simulation" select ARCH_HAVE_BUTTONS @@ -2932,6 +2939,7 @@ config ARCH_BOARD default "spresense" if ARCH_BOARD_SPRESENSE default "xx3803" if ARCH_BOARD_XX3803 default "xx3823" if ARCH_BOARD_XX3823 + default "s698pm-dkit" if ARCH_BOARD_S698PM_DKIT comment "Common Board Options" @@ -3756,6 +3764,9 @@ endif if ARCH_BOARD_XX3823 source "boards/sparc/bm3823/xx3823/Kconfig" endif +if ARCH_BOARD_S698PM_DKIT +source "boards/sparc/s698pm/s698pm-dkit/Kconfig" +endif if ARCH_BOARD_TLSR8278ADK80D source "boards/arm/tlsr82/tlsr8278adk80d/Kconfig" endif diff --git a/boards/sparc/s698pm/s698pm-dkit/Kconfig b/boards/sparc/s698pm/s698pm-dkit/Kconfig new file mode 100644 index 0000000000..042d28a89d --- /dev/null +++ b/boards/sparc/s698pm/s698pm-dkit/Kconfig @@ -0,0 +1,43 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +if ARCH_BOARD_CUSTOM +config S698PM_DKIT_WDG + bool "s698pm-dkit wdg kicker support" + depends on S698PM_WDG + depends on WATCHDOG + +config S698PM_DKIT_WDG_TIMEOUT + int "s698pm-dkit wdg Timeout (ms)" + default 1000 + depends on S698PM_DKIT_WDG + ---help--- + Watchdog timeout value in milliseconds. + +if S698PM_DKIT_WDG +config S698PM_DKIT_WDG_THREAD + bool "Watchdog Deamon Thread" + +if S698PM_DKIT_WDG_THREAD +config S698PM_DKIT_WDG_THREAD_NAME + string "Watchdog Thread Name" + default "wdog" + +config S698PM_DKIT_WDG_THREAD_INTERVAL + int "Watchdog Thread Interval (ms)" + default 500 + +config S698PM_DKIT_WDG_THREAD_PRIORITY + int "Watchdog Thread Priority" + default 200 + +config S698PM_DKIT_WDG_THREAD_STACKSIZE + int "Watchdog Thread Stacksize" + default 2048 + +endif # S698PM_DKIT_WDG_THREAD +endif # S698PM_DKIT_WDG + +endif diff --git a/boards/sparc/s698pm/s698pm-dkit/configs/nsh/defconfig b/boards/sparc/s698pm/s698pm-dkit/configs/nsh/defconfig new file mode 100644 index 0000000000..20a73a103b --- /dev/null +++ b/boards/sparc/s698pm/s698pm-dkit/configs/nsh/defconfig @@ -0,0 +1,118 @@ +# +# 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_LEDS is not set +# CONFIG_ARCH_RAMFUNCS is not set +# CONFIG_LIBC_LONG_LONG is not set +# CONFIG_NSH_ARGCAT is not set +# CONFIG_NSH_CMDOPT_HEXDUMP is not set +# CONFIG_NSH_CMDPARMS is not set +# CONFIG_NSH_DISABLE_DATE is not set +CONFIG_ARCH="sparc" +CONFIG_ARCH_BOARD="s698pm-dkit" +CONFIG_ARCH_BOARD_S698PM_DKIT=y +CONFIG_ARCH_CHIP="s698pm" +CONFIG_ARCH_CHIP_S698PM=y +CONFIG_ARCH_SPARC=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_BOARDCTL_ROMDISK=y +CONFIG_BOARD_LOOPSPERMSEC=800 +CONFIG_BOOT_RUNFROMEXTSRAM=y +CONFIG_BUILTIN=y +CONFIG_DEBUG_ASSERTIONS=y +CONFIG_DEBUG_ERROR=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEBUG_WARN=y +CONFIG_DEFAULT_TASK_STACKSIZE=8192 +CONFIG_DISABLE_MQUEUE=y +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_ELF=y +CONFIG_ELF_ALIGN_LOG2=3 +CONFIG_ELF_BUFFERINCR=64 +CONFIG_ELF_BUFFERSIZE=64 +CONFIG_ENDIAN_BIG=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_EXAMPLES_HELLO_STACKSIZE=4096 +CONFIG_EXAMPLES_NULL=y +CONFIG_FS_PROCFS=y +CONFIG_FS_ROMFS=y +CONFIG_IDLETHREAD_STACKSIZE=4096 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INIT_STACKSIZE=16384 +CONFIG_INTELHEX_BINARY=y +CONFIG_LIBM=y +CONFIG_MEMSET_64BIT=y +CONFIG_MEMSET_OPTSPEED=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_DISABLEBG=y +CONFIG_NSH_DISABLESCRIPT=y +CONFIG_NSH_DISABLE_CAT=y +CONFIG_NSH_DISABLE_CMP=y +CONFIG_NSH_DISABLE_CP=y +CONFIG_NSH_DISABLE_DF=y +CONFIG_NSH_DISABLE_ECHO=y +CONFIG_NSH_DISABLE_ENV=y +CONFIG_NSH_DISABLE_EXPORT=y +CONFIG_NSH_DISABLE_FREE=y +CONFIG_NSH_DISABLE_IFCONFIG=y +CONFIG_NSH_DISABLE_IFUPDOWN=y +CONFIG_NSH_DISABLE_KILL=y +CONFIG_NSH_DISABLE_LOSETUP=y +CONFIG_NSH_DISABLE_MKDIR=y +CONFIG_NSH_DISABLE_MOUNT=y +CONFIG_NSH_DISABLE_MV=y +CONFIG_NSH_DISABLE_PSSTACKUSAGE=y +CONFIG_NSH_DISABLE_PUT=y +CONFIG_NSH_DISABLE_PWD=y +CONFIG_NSH_DISABLE_RM=y +CONFIG_NSH_DISABLE_RMDIR=y +CONFIG_NSH_DISABLE_SEMICOLON=y +CONFIG_NSH_DISABLE_SET=y +CONFIG_NSH_DISABLE_SOURCE=y +CONFIG_NSH_DISABLE_TEST=y +CONFIG_NSH_DISABLE_TRUNCATE=y +CONFIG_NSH_DISABLE_UMOUNT=y +CONFIG_NSH_DISABLE_UNAME=y +CONFIG_NSH_DISABLE_UNSET=y +CONFIG_NSH_DISABLE_USLEEP=y +CONFIG_NSH_DISABLE_WGET=y +CONFIG_NSH_DISABLE_XD=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LINELEN=64 +CONFIG_NSH_READLINE=y +CONFIG_NUNGET_CHARS=0 +CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=32768 +CONFIG_PTHREAD_MUTEX_UNSAFE=y +CONFIG_PTHREAD_STACK_DEFAULT=4096 +CONFIG_PTHREAD_STACK_MIN=2048 +CONFIG_RAM_SIZE=4194304 +CONFIG_RAM_START=0x40000000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=100 +CONFIG_S698PM_TIM1=y +CONFIG_S698PM_TIM2=y +CONFIG_S698PM_UART1=y +CONFIG_S698PM_UART2=y +CONFIG_S698PM_UART3=y +CONFIG_SCHED_WAITPID=y +CONFIG_SIG_PREALLOC_IRQ_ACTIONS=4 +CONFIG_SPECIFIC_DRIVERS=y +CONFIG_STACK_COLORATION=y +CONFIG_START_DAY=16 +CONFIG_START_MONTH=6 +CONFIG_START_YEAR=2011 +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_NSH_STACKSIZE=4096 +CONFIG_SYSTEM_STACKMONITOR=y +CONFIG_SYSTEM_STACKMONITOR_INTERVAL=1 +CONFIG_SYSTEM_STACKMONITOR_STACKSIZE=4096 +CONFIG_UART1_BAUD=460800 +CONFIG_UART2_BAUD=460800 +CONFIG_UART2_SERIAL_CONSOLE=y diff --git a/boards/sparc/s698pm/s698pm-dkit/configs/smp/defconfig b/boards/sparc/s698pm/s698pm-dkit/configs/smp/defconfig new file mode 100644 index 0000000000..abe9fd08f7 --- /dev/null +++ b/boards/sparc/s698pm/s698pm-dkit/configs/smp/defconfig @@ -0,0 +1,121 @@ +# +# 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_LEDS is not set +# CONFIG_ARCH_RAMFUNCS is not set +# CONFIG_LIBC_LONG_LONG is not set +# CONFIG_NSH_ARGCAT is not set +# CONFIG_NSH_CMDOPT_HEXDUMP is not set +# CONFIG_NSH_CMDPARMS is not set +# CONFIG_NSH_DISABLE_DATE is not set +CONFIG_ARCH="sparc" +CONFIG_ARCH_BOARD="s698pm-dkit" +CONFIG_ARCH_BOARD_S698PM_DKIT=y +CONFIG_ARCH_CHIP="s698pm" +CONFIG_ARCH_CHIP_S698PM=y +CONFIG_ARCH_INTERRUPTSTACK=4096 +CONFIG_ARCH_SPARC=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_BOARDCTL_ROMDISK=y +CONFIG_BOARD_LOOPSPERMSEC=800 +CONFIG_BOOT_RUNFROMEXTSRAM=y +CONFIG_BUILTIN=y +CONFIG_DEBUG_ASSERTIONS=y +CONFIG_DEBUG_ERROR=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_INFO=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEBUG_WARN=y +CONFIG_DEFAULT_TASK_STACKSIZE=8192 +CONFIG_DISABLE_MQUEUE=y +CONFIG_DISABLE_POSIX_TIMERS=y +CONFIG_ELF=y +CONFIG_ELF_ALIGN_LOG2=3 +CONFIG_ELF_BUFFERINCR=64 +CONFIG_ELF_BUFFERSIZE=64 +CONFIG_ENDIAN_BIG=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_EXAMPLES_HELLO_STACKSIZE=4096 +CONFIG_EXAMPLES_NULL=y +CONFIG_FS_PROCFS=y +CONFIG_FS_ROMFS=y +CONFIG_IDLETHREAD_STACKSIZE=4096 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INIT_STACKSIZE=16384 +CONFIG_INTELHEX_BINARY=y +CONFIG_LIBM=y +CONFIG_MEMSET_64BIT=y +CONFIG_MEMSET_OPTSPEED=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_DISABLEBG=y +CONFIG_NSH_DISABLESCRIPT=y +CONFIG_NSH_DISABLE_CAT=y +CONFIG_NSH_DISABLE_CMP=y +CONFIG_NSH_DISABLE_CP=y +CONFIG_NSH_DISABLE_DF=y +CONFIG_NSH_DISABLE_ECHO=y +CONFIG_NSH_DISABLE_ENV=y +CONFIG_NSH_DISABLE_EXPORT=y +CONFIG_NSH_DISABLE_FREE=y +CONFIG_NSH_DISABLE_IFCONFIG=y +CONFIG_NSH_DISABLE_IFUPDOWN=y +CONFIG_NSH_DISABLE_KILL=y +CONFIG_NSH_DISABLE_LOSETUP=y +CONFIG_NSH_DISABLE_MKDIR=y +CONFIG_NSH_DISABLE_MOUNT=y +CONFIG_NSH_DISABLE_MV=y +CONFIG_NSH_DISABLE_PSSTACKUSAGE=y +CONFIG_NSH_DISABLE_PUT=y +CONFIG_NSH_DISABLE_PWD=y +CONFIG_NSH_DISABLE_RM=y +CONFIG_NSH_DISABLE_RMDIR=y +CONFIG_NSH_DISABLE_SEMICOLON=y +CONFIG_NSH_DISABLE_SET=y +CONFIG_NSH_DISABLE_SOURCE=y +CONFIG_NSH_DISABLE_TEST=y +CONFIG_NSH_DISABLE_TRUNCATE=y +CONFIG_NSH_DISABLE_UMOUNT=y +CONFIG_NSH_DISABLE_UNAME=y +CONFIG_NSH_DISABLE_UNSET=y +CONFIG_NSH_DISABLE_USLEEP=y +CONFIG_NSH_DISABLE_WGET=y +CONFIG_NSH_DISABLE_XD=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LINELEN=64 +CONFIG_NSH_READLINE=y +CONFIG_NUNGET_CHARS=0 +CONFIG_POSIX_SPAWN_PROXY_STACKSIZE=32768 +CONFIG_PTHREAD_MUTEX_UNSAFE=y +CONFIG_PTHREAD_STACK_DEFAULT=4096 +CONFIG_PTHREAD_STACK_MIN=2048 +CONFIG_RAM_SIZE=4194304 +CONFIG_RAM_START=0x40000000 +CONFIG_RAW_BINARY=y +CONFIG_RR_INTERVAL=100 +CONFIG_S698PM_TIM1=y +CONFIG_S698PM_TIM2=y +CONFIG_S698PM_UART1=y +CONFIG_S698PM_UART2=y +CONFIG_S698PM_UART3=y +CONFIG_SCHED_WAITPID=y +CONFIG_SIG_PREALLOC_IRQ_ACTIONS=4 +CONFIG_SMP=y +CONFIG_SPECIFIC_DRIVERS=y +CONFIG_STACK_COLORATION=y +CONFIG_START_DAY=16 +CONFIG_START_MONTH=6 +CONFIG_START_YEAR=2011 +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_NSH_STACKSIZE=4096 +CONFIG_SYSTEM_STACKMONITOR=y +CONFIG_SYSTEM_STACKMONITOR_INTERVAL=1 +CONFIG_SYSTEM_STACKMONITOR_STACKSIZE=4096 +CONFIG_TESTING_SMP=y +CONFIG_UART1_BAUD=460800 +CONFIG_UART2_BAUD=460800 +CONFIG_UART2_SERIAL_CONSOLE=y diff --git a/boards/sparc/s698pm/s698pm-dkit/include/board.h b/boards/sparc/s698pm/s698pm-dkit/include/board.h new file mode 100644 index 0000000000..310d18caef --- /dev/null +++ b/boards/sparc/s698pm/s698pm-dkit/include/board.h @@ -0,0 +1,75 @@ +/**************************************************************************** + * boards/sparc/s698pm/s698pm-dkit/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_SPARC_S698PM_S698PM_DKIT_INCLUDE_BOARD_H +#define __BOARDS_SPARC_S698PM_S698PM_DKIT_INCLUDE_BOARD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ + +/* Configuration ************************************************************/ + +/* Clocking *****************************************************************/ + +/* Assume default CLKDIV8 fuse setting is overridden to CLKDIV1 */ + +#define BOARD_XTAL_FREQ 200000000 /* 200MHz crystal */ +#define BOARD_CPU_CLOCK BOARD_XTAL_FREQ /* F_CPU = 60MHz */ +#define CHIP_NUARTS 4 + +#define BOARD_TIM1_FREQUENCY BOARD_CPU_CLOCK +#define BOARD_TIM2_FREQUENCY BOARD_CPU_CLOCK + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/**************************************************************************** + * Inline Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_SPARC_S698PM_S698PM_DKIT_INCLUDE_BOARD_H */ diff --git a/boards/sparc/s698pm/s698pm-dkit/scripts/Make.defs b/boards/sparc/s698pm/s698pm-dkit/scripts/Make.defs new file mode 100644 index 0000000000..45f2dc1244 --- /dev/null +++ b/boards/sparc/s698pm/s698pm-dkit/scripts/Make.defs @@ -0,0 +1,40 @@ +############################################################################ +# boards/sparc/s698pm/s698pm_dkit/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/sparc/src/sparc_v8/Toolchain.defs + +LDSCRIPT = linksparc.ld +ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT) + +CFLAGS = $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe +CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe +CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) +CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) +AFLAGS = $(CFLAGS) -D__ASSEMBLY__ + +# ELF module definitions + +CELFFLAGS = $(CFLAGS) +CXXELFFLAGS = $(CXXFLAGS) + +LDELFFLAGS = -r -e main +LDELFFLAGS += -T $(call CONVERT_PATH,$(BOARD_DIR)$(DELIM)scripts$(DELIM)gnu-elf.ld) diff --git a/boards/sparc/s698pm/s698pm-dkit/scripts/linksparc.ld b/boards/sparc/s698pm/s698pm-dkit/scripts/linksparc.ld new file mode 100644 index 0000000000..61953ef1b8 --- /dev/null +++ b/boards/sparc/s698pm/s698pm-dkit/scripts/linksparc.ld @@ -0,0 +1,202 @@ +/**************************************************************************** + * boards/sparc/s698pm/s698pm_dkit/scripts/linksparc.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. + * + ****************************************************************************/ + +/* + * The memory map looks like this: + * +--------------------+ <- low memory + * | .text | + * | etext | + * | ctor list | the ctor and dtor lists are for + * | dtor list | C++ support + * | _endtext | + * +--------------------+ + * | .data | initialized data goes here + * | _sdata | + * | _edata | + * +--------------------+ + * | .bss | + * | __bss_start | start of bss, cleared by crt0 + * | _end | start of heap, used by sbrk() + * +--------------------+ + * | heap space | + * | _ENDHEAP | + * | stack space | + * | __stack | top of stack + * +--------------------+ <- high memory + */ + +/* + * User modifiable values: + * + * _CLOCK_SPEED in Mhz (used to program the counter/timers) + * + * _PROM_SIZE size of PROM (permissible values are 128K, 256K, + * 512K, 1M, 2M, 4M, 8M and 16M) + * _RAM_SIZE size of RAM (permissible values are 256K, 512K, + * 1M, 2M, 4M, 8M, 16M, and 32M) + * + */ + +/* Default values, can be overridden */ + +_PROM_SIZE = 16M; +_RAM_SIZE = 4M; + +_RAM_START = 0x40000000; +_RAM_END = _RAM_START + _RAM_SIZE; + +_PROM_START = 0x00000000; +_PROM_END = _PROM_START + _PROM_SIZE; + +/* + * Alternate names without leading _. + */ + +PROM_START = _PROM_START; +PROM_SIZE = _PROM_SIZE; +PROM_END = _PROM_END; + +RAM_START = _RAM_START; +RAM_SIZE = _RAM_SIZE; +RAM_END = _RAM_END; + +/* + PROVIDE (__stack = _RAM_END); //move to the file of stack.ld +*/ +__stack = _RAM_END; + +/* these are the maximum values */ + +MEMORY +{ + rom (rx) : ORIGIN = 0x00000000, LENGTH = 16M + ram (rw!x) : ORIGIN = 0x40000000, LENGTH = 4M +} + +OUTPUT_FORMAT("elf32-sparc") +OUTPUT_ARCH(sparc) +__DYNAMIC = 0; +ENTRY(__start) +/* + * stick everything in ram (of course) + */ +SECTIONS +{ + .text : + { + CREATE_OBJECT_SYMBOLS + text_start = .; + _text_start = .; + *(.text) + . = ALIGN (16); + + *(.eh_frame) + . = ALIGN (16); + + /* *(.gnu.linkonce.t*) */ + + /* + * C++ constructors + */ + __CTOR_LIST__ = .; + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) + *(.ctors) + LONG(0) + __CTOR_END__ = .; + __DTOR_LIST__ = .; + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) + *(.dtors) + LONG(0) + __DTOR_END__ = .; + + _rodata_start = . ; + *(.rodata*) + /* *(.gnu.linkonce.r*) */ + _erodata = ALIGN( 0x10 ) ; + + etext = ALIGN(0x10); + _etext = .; + *(.init) + *(.fini) + *(.lit) + *(.shdata) + . = ALIGN (16); + _endtext = .; + } >ram + + /* + .dynamic : { *(.dynamic) } >ram + .got : { *(.got) } >ram + .plt : { *(.plt) } >ram + .hash : { *(.hash) } >ram + .dynrel : { *(.dynrel) } >ram + .dynsym : { *(.dynsym) } >ram + .dynstr : { *(.dynstr) } >ram + .hash : { *(.hash) } >ram + */ + + .data : + { + data_start = .; + _data_start = .; + _sdata = . ; + *(.data) + /* + *(.gnu.linkonce.d*) + *(.gcc_except_table) + */ + . = ALIGN(0x10); + edata = .; + _edata = .; + } > ram + .shbss : + { + *(.shbss) + } + .bss : + { + __bss_start = ALIGN(0x10); + _bss_start = .; + bss_start = .; + *(.bss) + *(COMMON) + end = .; + _end = ALIGN(0x10); + __end = ALIGN(0x10); + } > ram + .noinit : + { + _snoinit = ABSOLUTE(.); + *(.noinit*) + _enoinit = ABSOLUTE(.); + } > ram + + .jcr . (NOLOAD) : { *(.jcr) } + + .stab . (NOLOAD) : + { + [ .stab ] + } + .stabstr . (NOLOAD) : + { + [ .stabstr ] + } + +} diff --git a/boards/sparc/s698pm/s698pm-dkit/src/Makefile b/boards/sparc/s698pm/s698pm-dkit/src/Makefile new file mode 100644 index 0000000000..30f0896de2 --- /dev/null +++ b/boards/sparc/s698pm/s698pm-dkit/src/Makefile @@ -0,0 +1,34 @@ +############################################################################ +# boards/sparc/s698pm/s698pm-dkit/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 + +ASRCS = +CSRCS = s698pm_boot.c + +ifeq ($(CONFIG_BOARDCTL),y) +CSRCS += s698pm_appinit.c +endif + +ifeq ($(CONFIG_S698PM_WDG),y) +CSRCS += s698pm_wdt.c +endif + +include $(TOPDIR)/boards/Board.mk diff --git a/boards/sparc/s698pm/s698pm-dkit/src/s698pm-dkit.h b/boards/sparc/s698pm/s698pm-dkit/src/s698pm-dkit.h new file mode 100644 index 0000000000..6cba1bd2c0 --- /dev/null +++ b/boards/sparc/s698pm/s698pm-dkit/src/s698pm-dkit.h @@ -0,0 +1,85 @@ +/**************************************************************************** + * boards/sparc/s698pm/s698pm-dkit/src/s698pm-dkit.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_SPARC_S698PM_S698PM_DKIT_SRC_S698PM_DKIT_H +#define __BOARDS_SPARC_S698PM_S698PM_DKIT_SRC_S698PM_DKIT_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ + +/* procfs File System */ + +#ifdef CONFIG_FS_PROCFS +# ifdef CONFIG_NSH_PROC_MOUNTPOINT +# define S698PM_PROCFS_MOUNTPOINT CONFIG_NSH_PROC_MOUNTPOINT +# else +# define S698PM_PROCFS_MOUNTPOINT "/proc" +# endif +#endif + +/* Configuration ************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +/**************************************************************************** + * Inline Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: s698pm_ledinit + * + * Description: + * Configure on-board LEDs if LED support has been selected. + * + ****************************************************************************/ + +#ifdef CONFIG_ARCH_LEDS +void s698pm_led_initialize(void); +#endif + +/**************************************************************************** + * Name: s698pm_dkit_watchdog_initialize + * + * Description: + * Initialize the s698pm watchdog. + * + ****************************************************************************/ + +#ifdef CONFIG_S698PM_DKIT_WDG +int s698pm_dkit_watchdog_initialize(void); +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __BOARDS_SPARC_S698PM_S698PM_DKIT_SRC_S698PM_DKIT_H */ diff --git a/boards/sparc/s698pm/s698pm-dkit/src/s698pm_appinit.c b/boards/sparc/s698pm/s698pm-dkit/src/s698pm_appinit.c new file mode 100644 index 0000000000..f69ef8c0e4 --- /dev/null +++ b/boards/sparc/s698pm/s698pm-dkit/src/s698pm_appinit.c @@ -0,0 +1,108 @@ +/**************************************************************************** + * boards/sparc/s698pm/s698pm-dkit/src/s698pm_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 + +#include +#include "s698pm.h" +#include "s698pm-dkit.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * 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 cold 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) +{ + int ret; + +#ifdef CONFIG_S698PM_WDG + /* Initialize the watchdog timer */ + + s698pm_wdginitialize("/dev/watchdog0"); +#endif + +#ifdef CONFIG_S698PM_DKIT_WDG + /* Start WDG kicker thread */ + + ret = s698pm_dkit_watchdog_initialize(); + if (ret != OK) + { + syslog(LOG_ERR, "Failed to start watchdog thread: %d\n", ret); + return ret; + } +#endif + +#ifdef CONFIG_FS_PROCFS + /* Mount the procfs file system */ + + ret = mount(NULL, S698PM_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + if (ret < 0) + { + syslog(LOG_ERR, "Failed to mount procfs at %s: %d\n", + S698PM_PROCFS_MOUNTPOINT, ret); + } +#endif + + return ret; +} diff --git a/boards/sparc/s698pm/s698pm-dkit/src/s698pm_boot.c b/boards/sparc/s698pm/s698pm-dkit/src/s698pm_boot.c new file mode 100644 index 0000000000..3c16a2949b --- /dev/null +++ b/boards/sparc/s698pm/s698pm-dkit/src/s698pm_boot.c @@ -0,0 +1,65 @@ +/**************************************************************************** + * boards/sparc/s698pm/s698pm-dkit/src/s698pm_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 + +#include + +#include + +#include "sparc_internal.h" +#include "s698pm.h" +#include "s698pm-dkit.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_boardinitialize + * + * Description: + * All s698pm architectures must provide the following entry point. + * This entry point is called early in the initialization -- after all + * memory has been configured and mapped but before any devices have been + * initialized. + * + ****************************************************************************/ + +void s698pm_boardinitialize(void) +{ +#ifdef CONFIG_ARCH_LEDS + /* Configure on-board LEDs if LED support has been selected. */ + + board_autoled_initialize(); +#endif +} diff --git a/boards/sparc/s698pm/s698pm-dkit/src/s698pm_wdt.c b/boards/sparc/s698pm/s698pm-dkit/src/s698pm_wdt.c new file mode 100644 index 0000000000..b6f3536582 --- /dev/null +++ b/boards/sparc/s698pm/s698pm-dkit/src/s698pm_wdt.c @@ -0,0 +1,162 @@ +/**************************************************************************** + * boards/sparc/s698pm/s698pm-dkit/src/s698pm_wdt.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 +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/* Watchdog daemon thread */ + +#if defined(CONFIG_S698PM_DKIT_WDG_THREAD) + +static int wdog_daemon(int argc, char *argv[]) +{ + struct file filestruct; + int ret; + + /* Open watchdog device */ + + ret = file_open(&filestruct, CONFIG_WATCHDOG_DEVPATH, O_RDONLY); + if (ret < 0) + { + wderr("ERROR: open %s failed: %d\n", CONFIG_WATCHDOG_DEVPATH, ret); + return ret; + } + + /* Start watchdog timer */ + + ret = file_ioctl(&filestruct, WDIOC_START, 0); + if (ret < 0) + { + wderr("ERROR: ioctl(WDIOC_START) failed: %d\n", errno); + goto exit_close_dev; + } + + while (1) + { + nxsig_usleep((CONFIG_S698PM_DKIT_WDG_THREAD_INTERVAL)*1000); + + /* Send keep alive ioctl */ + + ret = file_ioctl(&filestruct, WDIOC_KEEPALIVE, 0); + if (ret < 0) + { + wderr("ERROR: ioctl(WDIOC_KEEPALIVE) failed: %d\n", errno); + break; + } + } + +exit_close_dev: + + /* Close watchdog device and exit. */ + + file_close(&filestruct); + return ret; +} + +#endif /* CONFIG_S698PM_DKIT_WDG_THREAD */ + +/**************************************************************************** + * Name: s698pm_dkit_watchdog_initialize() + * + * Description: + * Perform architecture-specific initialization of the Watchdog hardware. + * This interface must be provided by all configurations using + * apps/examples/watchdog + * + ****************************************************************************/ + +int s698pm_dkit_watchdog_initialize(void) +{ + struct file filestruct; + int ret = 0; + + /* Open the watchdog device */ + + ret = file_open(&filestruct, CONFIG_WATCHDOG_DEVPATH, O_RDONLY); + if (ret < 0) + { + wderr("ERROR: open %s failed: %d\n", CONFIG_WATCHDOG_DEVPATH, ret); + return ret; + } + + /* Set the watchdog timeout */ + +#ifdef CONFIG_S698PM_DKIT_WDG + wdinfo("Timeout = %d.\n", CONFIG_S698PM_DKIT_WDG_TIMEOUT); + ret = file_ioctl(&filestruct, WDIOC_SETTIMEOUT, + (unsigned long)CONFIG_S698PM_DKIT_WDG_TIMEOUT); +#else +# error "No watchdog configured" +#endif + + /* Close watchdog as it is not needed here anymore */ + + file_close(&filestruct); + + if (ret < 0) + { + wderr("ERROR: watchdog configuration failed: %d\n", errno); + return ret; + } + +#if defined(CONFIG_S698PM_DKIT_WDG_THREAD) + + sched_lock(); + + /* Spawn wdog daemon thread */ + + int taskid = kthread_create(CONFIG_S698PM_DKIT_WDG_THREAD_NAME, + CONFIG_S698PM_DKIT_WDG_THREAD_PRIORITY, + CONFIG_S698PM_DKIT_WDG_THREAD_STACKSIZE, + wdog_daemon, NULL); + + DEBUGASSERT(taskid > 0); + UNUSED(taskid); + + sched_unlock(); + +#endif /* CONFIG_S698PM_DKIT_WDG_THREAD */ + + return OK; +}