From cae713eeb18a46e82c7940af2d0874d18a610406 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 2 Mar 2016 13:14:02 -0600 Subject: [PATCH] Sabre-6Quad: Rename some files; add dummy LED files --- configs/sabre-6quad/scripts/dramboot.ld | 123 +++++++++++++++ configs/sabre-6quad/src/Makefile | 10 +- .../src/{imx6_appinit.c => imx_appinit.c} | 4 +- configs/sabre-6quad/src/imx_autoleds.c | 146 ++++++++++++++++++ .../src/{imx6_boardinit.c => imx_boardinit.c} | 48 +++--- .../src/{imx6_bringup.c => imx_bringup.c} | 6 +- configs/sabre-6quad/src/imx_userleds.c | 98 ++++++++++++ configs/sabre-6quad/src/sabre-6quad.h | 4 +- 8 files changed, 411 insertions(+), 28 deletions(-) create mode 100644 configs/sabre-6quad/scripts/dramboot.ld rename configs/sabre-6quad/src/{imx6_appinit.c => imx_appinit.c} (97%) create mode 100644 configs/sabre-6quad/src/imx_autoleds.c rename configs/sabre-6quad/src/{imx6_boardinit.c => imx_boardinit.c} (85%) rename configs/sabre-6quad/src/{imx6_bringup.c => imx_bringup.c} (97%) create mode 100644 configs/sabre-6quad/src/imx_userleds.c diff --git a/configs/sabre-6quad/scripts/dramboot.ld b/configs/sabre-6quad/scripts/dramboot.ld new file mode 100644 index 0000000000..915d8b251a --- /dev/null +++ b/configs/sabre-6quad/scripts/dramboot.ld @@ -0,0 +1,123 @@ +/**************************************************************************** + * configs/sabre-6quad/scripts/dramboot.ld + * + * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* The i.MX6 has 256 KB of OCRAM beginning at virtual address 0x0090:0000 + * This memory configuration, however, loads into the 1GB DDR3 on board + * the Sabre 6Quad K which lies at 0x1000:0000. + * + * Vectors in low memory are assumed and 16KB of OCRAM is reserved at the + * high end of OCRAM for the page table. + */ + +MEMORY +{ + oscram (W!RX) : ORIGIN = 0x00900000, LENGTH = 256K - 16K + ddr3 (W!RX) : ORIGIN = 0x10000000, LENGTH = 1024K +} + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +ENTRY(entry) +ENTRY(_stext) + +SECTIONS +{ + .text : { + _stext = ABSOLUTE(.); + *(.vectors) + *(.text .text.*) + *(.fixup) + *(.gnu.warning) + *(.rodata .rodata.*) + *(.gnu.linkonce.t.*) + *(.glue_7) + *(.glue_7t) + *(.got) + *(.gcc_except_table) + *(.gnu.linkonce.r.*) + *(.ARM.extab*) + *(.gnu.linkonce.armextab.*) + _etext = ABSOLUTE(.); + } > ddr3 + + .init_section : { + _sinit = ABSOLUTE(.); + *(.init_array .init_array.*) + _einit = ABSOLUTE(.); + } > ddr3 + + .ARM.extab : { + *(.ARM.extab*) + } > ddr3 + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + + PROVIDE_HIDDEN (__exidx_start = .); + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > ddr3 + PROVIDE_HIDDEN (__exidx_end = .); + + .data : { + _sdata = ABSOLUTE(.); + *(.data .data.*) + *(.gnu.linkonce.d.*) + CONSTRUCTORS + _edata = ABSOLUTE(.); + } > ddr3 + + .bss : { + _sbss = ABSOLUTE(.); + *(.bss .bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + _ebss = ABSOLUTE(.); + } > ddr3 + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_info 0 : { *(.debug_info) } + .debug_line 0 : { *(.debug_line) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_aranges 0 : { *(.debug_aranges) } +} diff --git a/configs/sabre-6quad/src/Makefile b/configs/sabre-6quad/src/Makefile index 86cdf71ad5..6492cd66e8 100644 --- a/configs/sabre-6quad/src/Makefile +++ b/configs/sabre-6quad/src/Makefile @@ -36,10 +36,16 @@ -include $(TOPDIR)/Make.defs ASRCS = -CSRCS = imx6_boardinit.c imx6_bringup.c +CSRCS = imx_boardinit.c imx_bringup.c ifeq ($(CONFIG_LIB_BOARDCTL),y) -CSRCS += imx6_appinit.c +CSRCS += imx_appinit.c +endif + +ifeq ($(CONFIG_ARCH_LEDS),y) +CSRCS += imx_autoleds.c +else +CSRCS += imx_userleds.c endif include $(TOPDIR)/configs/Board.mk diff --git a/configs/sabre-6quad/src/imx6_appinit.c b/configs/sabre-6quad/src/imx_appinit.c similarity index 97% rename from configs/sabre-6quad/src/imx6_appinit.c rename to configs/sabre-6quad/src/imx_appinit.c index 869d5466ac..a1022c6cf1 100644 --- a/configs/sabre-6quad/src/imx6_appinit.c +++ b/configs/sabre-6quad/src/imx_appinit.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sabre-6quad/src/imx6_appinit.c + * config/sabre-6quad/src/imx_appinit.c * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -64,7 +64,7 @@ int board_app_initialize(void) #ifndef CONFIG_BOARD_INITIALIZE /* Perform board initialization */ - return imx6_bringup(); + return imx_bringup(); #else return OK; #endif diff --git a/configs/sabre-6quad/src/imx_autoleds.c b/configs/sabre-6quad/src/imx_autoleds.c new file mode 100644 index 0000000000..7e6b69881e --- /dev/null +++ b/configs/sabre-6quad/src/imx_autoleds.c @@ -0,0 +1,146 @@ +/**************************************************************************** + * configs/sabre-6quad/include/imx_autoleds.c + * + * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* LEDs + * + * A single LED is available driven by USR_DEF_RED_LED. + * + * These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is + * defined. In that case, the usage by the board port is defined in + * include/board.h and src/imx_autoleds.c. The LEDs are used to encode + * OS-related events as follows: + * + * ------------------- ----------------------- ------ + * SYMBOL Meaning LED + * ------------------- ----------------------- ------ + * LED_STARTED NuttX has been started OFF + * LED_HEAPALLOCATE Heap has been allocated OFF + * LED_IRQSENABLED Interrupts enabled OFF + * LED_STACKCREATED Idle stack created ON + * LED_INIRQ In an interrupt N/C + * LED_SIGNAL In a signal handler N/C + * LED_ASSERTION An assertion failed N/C + * LED_PANIC The system has crashed FLASH + * + * Thus is LED is statically on, NuttX has successfully booted and is, + * apparently, running normally. If LED is flashing at approximately + * 2Hz, then a fatal error has been detected and the system has halted. + */ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include + +#include "sabre-6quad.h" + +#ifdef CONFIG_ARCH_LEDS + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* REVISIT: There is no GPIO logic in place yet */ +#warning Missing logic +#define imx_configgpio(a) +#define imx_gpiowrite(a,b) + +/* CONFIG_DEBUG_LEDS enables debug output from this file (needs CONFIG_DEBUG + * with CONFIG_DEBUG_VERBOSE too) + */ + +#ifdef CONFIG_DEBUG_LEDS +# define leddbg lldbg +# define ledvdbg llvdbg +#else +# define leddbg(x...) +# define ledvdbg(x...) +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_autoled_initialize + ****************************************************************************/ + +void board_autoled_initialize(void) +{ + /* Configure LED PIOs for output */ + + imx_configgpio(GPIO_LED0); +} + +/**************************************************************************** + * Name: board_autoled_on + ****************************************************************************/ + +void board_autoled_on(int led) +{ + if (led == 1 || led == 3) + { + imx_gpiowrite(GPIO_LED0, false); /* Low illuminates */ + } +} + +/**************************************************************************** + * Name: board_autoled_off + ****************************************************************************/ + +void board_autoled_off(int led) +{ + if (led == 3) + { + imx_gpiowrite(GPIO_LED0, true); /* High extinguishes */ + } +} + +#endif /* CONFIG_ARCH_LEDS */ diff --git a/configs/sabre-6quad/src/imx6_boardinit.c b/configs/sabre-6quad/src/imx_boardinit.c similarity index 85% rename from configs/sabre-6quad/src/imx6_boardinit.c rename to configs/sabre-6quad/src/imx_boardinit.c index e95f70c312..e287ed2c86 100644 --- a/configs/sabre-6quad/src/imx6_boardinit.c +++ b/configs/sabre-6quad/src/imx_boardinit.c @@ -1,5 +1,5 @@ -/************************************************************************************ - * configs/sabre-6quad/src/imx6_boot.c +/**************************************************************************** + * configs/sabre-6quad/src/imx_boot.c * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -31,11 +31,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include @@ -46,29 +46,39 @@ #include "chip.h" #include "up_arch.h" -/************************************************************************************ +#include "imx_boot.h" +#include "sabre-6quad.h" + +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Private Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ - * Name: imx6_board_initialize +/**************************************************************************** + * Name: imx_board_initialize * * Description: - * All i.MX6 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. + * All i.MX6 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. * - ************************************************************************************/ + * Input Parameters: + * None + * + * Returned Value: + * None + * + ****************************************************************************/ -void imx6_board_initialize(void) +void imx_board_initialize(void) { } @@ -90,6 +100,6 @@ void board_initialize(void) { /* Perform board initialization */ - (void)imx6_bringup(); + (void)imx_bringup(); } #endif /* CONFIG_BOARD_INITIALIZE */ diff --git a/configs/sabre-6quad/src/imx6_bringup.c b/configs/sabre-6quad/src/imx_bringup.c similarity index 97% rename from configs/sabre-6quad/src/imx6_bringup.c rename to configs/sabre-6quad/src/imx_bringup.c index 0b66119594..d4ace48cd4 100644 --- a/configs/sabre-6quad/src/imx6_bringup.c +++ b/configs/sabre-6quad/src/imx_bringup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * config/sabre-6quad/src/imx6_bringup.c + * config/sabre-6quad/src/imx_bringup.c * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -65,14 +65,14 @@ ****************************************************************************/ /**************************************************************************** - * Name: imx6_bringup + * Name: imx_bringup * * Description: * Bring up board features * ****************************************************************************/ -int imx6_bringup(void) +int imx_bringup(void) { return OK; } diff --git a/configs/sabre-6quad/src/imx_userleds.c b/configs/sabre-6quad/src/imx_userleds.c new file mode 100644 index 0000000000..51980ccf0e --- /dev/null +++ b/configs/sabre-6quad/src/imx_userleds.c @@ -0,0 +1,98 @@ +/**************************************************************************** + * configs/sabre-6quad/src/imx_userleds.c + * + * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include + +#include "sabre-6quad.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* REVISIT: There is no GPIO logic in place yet */ +#warning Missing logic +#define imx_configgpio(a) +#define imx_gpiowrite(a,b) + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: board_userled_initialize + ****************************************************************************/ + +void board_userled_initialize(void) +{ + /* Configure LED PIOs for output */ + + imx_configgpio(GPIO_LED0); +} + +/**************************************************************************** + * Name: board_userled + ****************************************************************************/ + +void board_userled(int led, bool ledon) +{ + if (led == BOARD_LED0) + { + imx_gpiowrite(GPIO_LED0, !ledon); /* Low illuminates */ + } +} + +/**************************************************************************** + * Name: board_userled_all + ****************************************************************************/ + +void board_userled_all(uint8_t ledset) +{ + /* Low illuminates */ + + imx_gpiowrite(GPIO_LED0, (ledset & BOARD_LED0_BIT) == 0)); +} diff --git a/configs/sabre-6quad/src/sabre-6quad.h b/configs/sabre-6quad/src/sabre-6quad.h index 57e69deda2..5627a8ba4e 100644 --- a/configs/sabre-6quad/src/sabre-6quad.h +++ b/configs/sabre-6quad/src/sabre-6quad.h @@ -66,7 +66,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: imx6_bringup + * Name: imx_bringup * * Description: * Bring up board features @@ -74,7 +74,7 @@ ************************************************************************************/ #if defined(CONFIG_LIB_BOARDCTL) || defined(CONFIG_BOARD_INITIALIZE) -int imx6_bringup(void); +int imx_bringup(void); #endif #endif /* __ASSEMBLY__ */