forked from nuttx/nuttx-update
This commit adds support for the NXP S32K148EVB
Squashed commit of the following: boards/arm/s32k1xx/s32k148evb: Correct linker scripts for the S32K148, Update README files, Hook eht S32K148EVB into the configuration and build system. arm/s32k1xx/s32k148evb: Verify core and peripheral clocking. It is the same as the S32K146EVB. Fixed one-too-many copy-paste error in both. boards/arm/s32k1xx/s32k148evb: Correct LED and button pin number for the S32K148EVB. boards/arm/s32k1xx/s32k148evb: Change all occurrences of 146 to 148. boards/arm/s32k1xx/s32k148evb: Initial S32K148EVB. Initial commit is just clone of S32K146EVB with file name changes
This commit is contained in:
parent
5655a9d362
commit
507e01cb8e
25 changed files with 2098 additions and 7 deletions
|
@ -8,7 +8,7 @@
|
|||
<tr align="center" bgcolor="#e4e4e4">
|
||||
<td>
|
||||
<h1><big><font color="#3c34ec"><i>NuttX README Files</i></font></big></h1>
|
||||
<p>Last Updated: August 5, 2019</p>
|
||||
<p>Last Updated: August 20, 2019</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -183,8 +183,10 @@ nuttx/
|
|||
| | |- s32k1xx/
|
||||
| | | |- s32k118evb/
|
||||
| | | | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/boards/arm/s32k1xx/s32k118evb/README.txt" target="_blank"><b><i>README.txt</i></b></a>
|
||||
| | | `- s32k146evb/
|
||||
| | | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/boards/arm/s32k1xx/s32k146evb/README.txt" target="_blank"><b><i>README.txt</i></b></a>
|
||||
| | | |- s32k146evb/
|
||||
| | | | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/boards/arm/s32k1xx/s32k146evb/README.txt" target="_blank"><b><i>README.txt</i></b></a>
|
||||
| | | `- s32k148evb/
|
||||
| | | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/boards/arm/s32k1xx/s32k148evb/README.txt" target="_blank"><b><i>README.txt</i></b></a>
|
||||
| | |- sam34/
|
||||
| | | |- arduino-due/
|
||||
| | | | `- <a href="https://bitbucket.org/nuttx/nuttx/src/master/boards/arm/sam34/arduino-due/README.txt" target="_blank"><b><i>README.txt</i></b></a>
|
||||
|
|
|
@ -1888,7 +1888,9 @@ nuttx/
|
|||
| | |- s32k1xx/
|
||||
| | | |- s32k118evb/
|
||||
| | | | `- README.txt
|
||||
| | | `- s32k146evb/
|
||||
| | | |- s32k146evb/
|
||||
| | | | `- README.txt
|
||||
| | | `- s32k148evb/
|
||||
| | | `- README.txt
|
||||
| | |- sam34/
|
||||
| | | |- arduino-due/
|
||||
|
|
|
@ -1151,6 +1151,16 @@ config ARCH_BOARD_S32K146EVB
|
|||
This options selects support for NuttX on the NXP S32K146EVB board
|
||||
featuring the S32K146 Cortex-M4F.
|
||||
|
||||
config ARCH_BOARD_S32K148EVB
|
||||
bool "NXP S32K148EVB"
|
||||
depends on ARCH_CHIP_S32K148
|
||||
select ARCH_HAVE_LEDS
|
||||
select ARCH_HAVE_BUTTONS
|
||||
select ARCH_HAVE_IRQBUTTONS
|
||||
---help---
|
||||
This options selects support for NuttX on the NXP S32K148EVB board
|
||||
featuring the S32K148 Cortex-M4F.
|
||||
|
||||
config ARCH_BOARD_SABRE_6QUAD
|
||||
bool "NXP/Freescale i.MX6 Sabre-6Quad board"
|
||||
depends on ARCH_CHIP_IMX6_6QUAD
|
||||
|
@ -1983,6 +1993,7 @@ config ARCH_BOARD
|
|||
default "qemu-i486" if ARCH_BOARD_QEMU_I486
|
||||
default "s32k118evb" if ARCH_BOARD_S32K118EVB
|
||||
default "s32k146evb" if ARCH_BOARD_S32K146EVB
|
||||
default "s32k148evb" if ARCH_BOARD_S32K148EVB
|
||||
default "sabre-6quad" if ARCH_BOARD_SABRE_6QUAD
|
||||
default "sama5d2-xult" if ARCH_BOARD_SAMA5D2_XULT
|
||||
default "sama5d3x-ek" if ARCH_BOARD_SAMA5D3X_EK
|
||||
|
@ -2116,6 +2127,9 @@ endif
|
|||
if ARCH_BOARD_S32K146EVB
|
||||
source "boards/arm/s32k1xx/s32k146evb/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_S32K148EVB
|
||||
source "boards/arm/s32k1xx/s32k148evb/Kconfig"
|
||||
endif
|
||||
if ARCH_BOARD_SABRE_6QUAD
|
||||
source "boards/arm/imx6/sabre-6quad/Kconfig"
|
||||
endif
|
||||
|
|
|
@ -623,6 +623,10 @@ boards/arm/s32k1xx/s32k146evb
|
|||
This directory holds the port of NuttX to the NXP S32K146EVB board
|
||||
featuring the S32K146 Cortex-M4F.
|
||||
|
||||
boards/arm/s32k1xx/s32k148evb
|
||||
This directory holds the port of NuttX to the NXP S32K148EVB board
|
||||
featuring the S32K148 Cortex-M4F.
|
||||
|
||||
boards/arm/imx6/sabre-6quad
|
||||
This directory holds a port of NuttX to the NXP/Freescale Sabre board
|
||||
featuring the iMX 6Quad CPU.
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
/* The S32K146 has 1Mb of FLASH beginning at address 0x0000:0000 and
|
||||
* 124Kb of SRAM beginning at address 0x1fff:fc00 (plus 4Kb of FlexRAM)
|
||||
* 124Kb of SRAM beginning at address 0x1fff:0000 (plus 4Kb of FlexRAM)
|
||||
*
|
||||
* The on-chip RAM is split in two regions: SRAM_L and SRAM_U. The RAM is
|
||||
* implemented such that the SRAM_L and SRAM_U ranges form a contiguous
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
/* The S32K146 has 1Mb of FLASH beginning at address 0x0000:0000 and
|
||||
* 124Kb of SRAM beginning at address 0x1fff:fc00 (plus 4Kb of FlexRAM)
|
||||
* 124Kb of SRAM beginning at address 0x1fff:0000 (plus 4Kb of FlexRAM)
|
||||
*
|
||||
* The on-chip RAM is split in two regions: SRAM_L and SRAM_U. The RAM is
|
||||
* implemented such that the SRAM_L and SRAM_U ranges form a contiguous
|
||||
|
|
|
@ -118,7 +118,7 @@ const struct peripheral_clock_config_s g_peripheral_clockconfig0[] =
|
|||
.clkname = LPUART2_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_SIRC,
|
||||
.frac = 1,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
|
|
8
boards/arm/s32k1xx/s32k148evb/Kconfig
Normal file
8
boards/arm/s32k1xx/s32k148evb/Kconfig
Normal file
|
@ -0,0 +1,8 @@
|
|||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
if ARCH_BOARD_S32K148EVB
|
||||
|
||||
endif # ARCH_BOARD_S32K148EVB
|
120
boards/arm/s32k1xx/s32k148evb/README.txt
Normal file
120
boards/arm/s32k1xx/s32k148evb/README.txt
Normal file
|
@ -0,0 +1,120 @@
|
|||
README
|
||||
======
|
||||
|
||||
This directory hold the port to the NXP S32K148EVB-Q176 Development board.
|
||||
|
||||
Contents
|
||||
========
|
||||
|
||||
o Status
|
||||
o Serial Console
|
||||
o LEDs and Buttons
|
||||
o OpenSDA Notes
|
||||
o Configurations
|
||||
|
||||
Status
|
||||
======
|
||||
|
||||
2019-08-20: Configuration created but entirely untested.
|
||||
|
||||
Serial Console
|
||||
==============
|
||||
|
||||
By default, the serial console will be provided on the OpenSDA VCOM port:
|
||||
|
||||
OpenSDA UART TX PTC7 (LPUART1_TX)
|
||||
OpenSDA UART RX PTC6 (LPUART1_RX)
|
||||
|
||||
USB drivers for the PEMIcro CDC Serial port are available here:
|
||||
http://www.pemicro.com/opensda/
|
||||
|
||||
LEDs and Buttons
|
||||
================
|
||||
|
||||
LEDs
|
||||
----
|
||||
The S32K148EVB has one RGB LED:
|
||||
|
||||
RedLED PTE21
|
||||
GreenLED PTE22
|
||||
BlueLED PTE23
|
||||
|
||||
If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in
|
||||
any way. The following definitions are used to access individual RGB
|
||||
components.
|
||||
|
||||
The RGB components could, alternatively be controlled through PWM using
|
||||
the common RGB LED driver.
|
||||
|
||||
If CONFIG_ARCH_LEDs is defined, then NuttX will control the LEDs on board
|
||||
the s32k148evb. The following definitions describe how NuttX controls the
|
||||
LEDs:
|
||||
|
||||
==========================================+========+========+=========
|
||||
RED GREEN BLUE
|
||||
==========================================+========+========+=========
|
||||
|
||||
LED_STARTED NuttX has been started OFF OFF OFF
|
||||
LED_HEAPALLOCATE Heap has been allocated OFF OFF ON
|
||||
LED_IRQSENABLED Interrupts enabled OFF OFF ON
|
||||
LED_STACKCREATED Idle stack created OFF ON OFF
|
||||
LED_INIRQ In an interrupt (no change)
|
||||
LED_SIGNAL In a signal handler (no change)
|
||||
LED_ASSERTION An assertion failed (no change)
|
||||
LED_PANIC The system has crashed FLASH OFF OFF
|
||||
LED_IDLE S32K148EVN in sleep mode (no change)
|
||||
==========================================+========+========+=========
|
||||
|
||||
Buttons
|
||||
-------
|
||||
The S32K148EVB supports two buttons:
|
||||
|
||||
SW3 PTC12
|
||||
SW4 PTC13
|
||||
|
||||
OpenSDA Notes
|
||||
=============
|
||||
|
||||
- USB drivers for the PEMIcro CDC Serial port are available here:
|
||||
http://www.pemicro.com/opensda/
|
||||
|
||||
- The drag'n'drog interface expects files in .srec format.
|
||||
|
||||
- Using Segger J-Link: Easy... but remember to use the 20-pin SWD J10
|
||||
connector near the Ethernet connector and not J20 the 10-bit OpenSDA
|
||||
connector closer to the OpenSDA USB connector J24.
|
||||
|
||||
Configurations
|
||||
==============
|
||||
|
||||
Common Information
|
||||
------------------
|
||||
Each S32K148EVB configuration is maintained in a sub-directory and
|
||||
can be selected as follow:
|
||||
|
||||
tools/configure.sh s32k148evb:<subdir>
|
||||
|
||||
Where <subdir> is one of the sub-directories listed in the next paragraph
|
||||
|
||||
NOTES (common for all configurations):
|
||||
|
||||
1. This configuration uses the mconf-based configuration tool. To
|
||||
change this configuration using that tool, you should:
|
||||
|
||||
a. Build and install the kconfig-mconf tool. See nuttx/README.txt
|
||||
see additional README.txt files in the NuttX tools repository.
|
||||
|
||||
b. Execute 'make menuconfig' in nuttx/ in order to start the
|
||||
reconfiguration process.
|
||||
|
||||
2. Unless otherwise stated, the serial console used is LPUART1 at
|
||||
115,200 8N1. This corresponds to the OpenSDA VCOM port.
|
||||
|
||||
Configuration Sub-directories
|
||||
-----------------------------
|
||||
|
||||
nsh:
|
||||
---
|
||||
Configures the NuttShell (nsh) located at apps/examples/nsh. Support
|
||||
for builtin applications is enabled, but in the base configuration no
|
||||
builtin applications are selected.
|
67
boards/arm/s32k1xx/s32k148evb/configs/nsh/defconfig
Normal file
67
boards/arm/s32k1xx/s32k148evb/configs/nsh/defconfig
Normal file
|
@ -0,0 +1,67 @@
|
|||
#
|
||||
# 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_NSH_DISABLEBG is not set
|
||||
# CONFIG_NSH_DISABLE_EXEC is not set
|
||||
# CONFIG_NSH_DISABLE_EXIT is not set
|
||||
# CONFIG_NSH_DISABLE_HEXDUMP is not set
|
||||
# CONFIG_NSH_DISABLE_PS is not set
|
||||
# CONFIG_NSH_DISABLE_XD is not set
|
||||
CONFIG_ARCH="arm"
|
||||
CONFIG_ARCH_BOARD="s32k148evb"
|
||||
CONFIG_ARCH_BOARD_S32K148EVB=y
|
||||
CONFIG_ARCH_CHIP="s32k1xx"
|
||||
CONFIG_ARCH_CHIP_S32K148=y
|
||||
CONFIG_ARCH_CHIP_S32K14X=y
|
||||
CONFIG_ARCH_CHIP_S32K1XX=y
|
||||
CONFIG_ARCH_STACKDUMP=y
|
||||
CONFIG_BINFMT_DISABLE=y
|
||||
CONFIG_BOARD_LOOPSPERMSEC=2988
|
||||
CONFIG_DEFAULT_SMALL=y
|
||||
CONFIG_DISABLE_MOUNTPOINT=y
|
||||
CONFIG_DISABLE_MQUEUE=y
|
||||
CONFIG_HOST_WINDOWS=y
|
||||
CONFIG_LPUART1_RXBUFSIZE=64
|
||||
CONFIG_LPUART1_SERIAL_CONSOLE=y
|
||||
CONFIG_LPUART1_TXBUFSIZE=64
|
||||
CONFIG_MAX_TASKS=8
|
||||
CONFIG_MAX_WDOGPARMS=2
|
||||
CONFIG_MM_SMALL=y
|
||||
CONFIG_MOTOROLA_SREC=y
|
||||
CONFIG_NFILE_DESCRIPTORS=6
|
||||
CONFIG_NFILE_STREAMS=6
|
||||
CONFIG_NPTHREAD_KEYS=0
|
||||
CONFIG_NSH_DISABLE_CD=y
|
||||
CONFIG_NSH_DISABLE_CP=y
|
||||
CONFIG_NSH_DISABLE_MKDIR=y
|
||||
CONFIG_NSH_DISABLE_MOUNT=y
|
||||
CONFIG_NSH_DISABLE_RM=y
|
||||
CONFIG_NSH_DISABLE_RMDIR=y
|
||||
CONFIG_NSH_DISABLE_UMOUNT=y
|
||||
CONFIG_NSH_FILEIOSIZE=64
|
||||
CONFIG_NSH_LINELEN=80
|
||||
CONFIG_NUNGET_CHARS=0
|
||||
CONFIG_PREALLOC_TIMERS=0
|
||||
CONFIG_PREALLOC_WDOGS=4
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=1536
|
||||
CONFIG_RAM_SIZE=23552
|
||||
CONFIG_RAM_START=0x1ffffc00
|
||||
CONFIG_RR_INTERVAL=200
|
||||
CONFIG_S32K1XX_LPUART1=y
|
||||
CONFIG_SCHED_WAITPID=y
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
CONFIG_START_DAY=18
|
||||
CONFIG_START_MONTH=8
|
||||
CONFIG_START_YEAR=2019
|
||||
CONFIG_STDIO_DISABLE_BUFFERING=y
|
||||
CONFIG_SYMTAB_ORDEREDBYNAME=y
|
||||
CONFIG_SYSTEM_NSH=y
|
||||
CONFIG_TASK_NAME_SIZE=0
|
||||
CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE=1536
|
||||
CONFIG_USERMAIN_STACKSIZE=1536
|
||||
CONFIG_USER_ENTRYPOINT="nsh_main"
|
||||
CONFIG_WDOG_INTRESERVE=0
|
140
boards/arm/s32k1xx/s32k148evb/include/board.h
Normal file
140
boards/arm/s32k1xx/s32k148evb/include/board.h
Normal file
|
@ -0,0 +1,140 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/include/board.h
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_STM32F4DISCOVERY_INCLUDE_BOARD_H
|
||||
#define __BOARDS_ARM_STM32F4DISCOVERY_INCLUDE_BOARD_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
# include <stdbool.h>
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Clocking *****************************************************************/
|
||||
|
||||
/* The S32K148EVB is fitted with a 8MHz Crystal */
|
||||
|
||||
#define BOARD_XTAL_FREQUENCY 8000000
|
||||
|
||||
/* The S32K148 will run at 112MHz */
|
||||
|
||||
/* LED definitions **********************************************************/
|
||||
|
||||
/* The S32K148EVB has one RGB LED:
|
||||
*
|
||||
* RedLED PTE21
|
||||
* GreenLED PTE22
|
||||
* BlueLED PTE23
|
||||
*
|
||||
* If CONFIG_ARCH_LEDS is not defined, then the user can control the LEDs in
|
||||
* any way. The following definitions are used to access individual RGB
|
||||
* components.
|
||||
*
|
||||
* The RGB components could, alternatively be controlled through PWM using
|
||||
* the common RGB LED driver.
|
||||
*/
|
||||
|
||||
/* LED index values for use with board_userled() */
|
||||
|
||||
#define BOARD_LED_R 0
|
||||
#define BOARD_LED_G 1
|
||||
#define BOARD_LED_B 2
|
||||
#define BOARD_NLEDS 3
|
||||
|
||||
/* LED bits for use with board_userled_all() */
|
||||
|
||||
#define BOARD_LED_R_BIT (1 << BOARD_LED_R)
|
||||
#define BOARD_LED_G_BIT (1 << BOARD_LED_G)
|
||||
#define BOARD_LED_B_BIT (1 << BOARD_LED_B)
|
||||
|
||||
/* If CONFIG_ARCH_LEDs is defined, then NuttX will control the LEDs on board
|
||||
* the s32k148evb. The following definitions describe how NuttX controls the
|
||||
* LEDs:
|
||||
*
|
||||
*
|
||||
* SYMBOL Meaning LED state
|
||||
* RED GREEN BLUE
|
||||
* ------------------- ---------------------------- -----------------
|
||||
*/
|
||||
|
||||
#define LED_STARTED 1 /* NuttX has been started OFF OFF OFF */
|
||||
#define LED_HEAPALLOCATE 2 /* Heap has been allocated OFF OFF ON */
|
||||
#define LED_IRQSENABLED 0 /* Interrupts enabled OFF OFF ON */
|
||||
#define LED_STACKCREATED 3 /* Idle stack created OFF ON OFF */
|
||||
#define LED_INIRQ 0 /* In an interrupt (no change) */
|
||||
#define LED_SIGNAL 0 /* In a signal handler (no change) */
|
||||
#define LED_ASSERTION 0 /* An assertion failed (no change) */
|
||||
#define LED_PANIC 4 /* The system has crashed FLASH OFF OFF */
|
||||
#undef LED_IDLE /* S32K148EVN in sleep mode (Not used) */
|
||||
|
||||
/* Button definitions *******************************************************/
|
||||
|
||||
/* The S32K148EVB supports two buttons:
|
||||
*
|
||||
* SW3 PTC12
|
||||
* SW4 PTC13
|
||||
*/
|
||||
|
||||
#define BUTTON_SW3 0
|
||||
#define BUTTON_SW4 1
|
||||
#define NUM_BUTTONS 2
|
||||
|
||||
#define BUTTON_SW3_BIT (1 << BUTTON_SW3)
|
||||
#define BUTTON_SW4_BIT (1 << BUTTON_SW4)
|
||||
|
||||
/* Alternate function pin selections ****************************************/
|
||||
|
||||
/* By default, the serial console will be provided on the OpenSDA VCOM port:
|
||||
*
|
||||
* OpenSDA UART TX PTC7 (LPUART1_TX)
|
||||
* OpenSDA UART RX PTC6 (LPUART1_RX)
|
||||
*/
|
||||
|
||||
#define PIN_LPUART1_RX PIN_LPUART1_RX_1 /* PTC6 */
|
||||
#define PIN_LPUART1_TX PIN_LPUART1_TX_1 /* PTC7 */
|
||||
|
||||
/* DMA Channel/Stream Selections ********************************************/
|
||||
|
||||
|
||||
#endif /* __BOARDS_ARM_STM32F4DISCOVERY_INCLUDE_BOARD_H */
|
131
boards/arm/s32k1xx/s32k148evb/scripts/Make.defs
Normal file
131
boards/arm/s32k1xx/s32k148evb/scripts/Make.defs
Normal file
|
@ -0,0 +1,131 @@
|
|||
############################################################################
|
||||
# boards/arm/s32k1xx/s32k148evb/scripts/Make.defs
|
||||
#
|
||||
# Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include ${TOPDIR}/.config
|
||||
include ${TOPDIR}/tools/Config.mk
|
||||
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
|
||||
|
||||
ifeq ($(CONFIG_BOOT_RUNFROMFLASH),y)
|
||||
LDSCRIPT = flash.ld
|
||||
else ifeq ($(CONFIG_BOOT_RUNFROMISRAM),y)
|
||||
LDSCRIPT = sram.ld
|
||||
endif
|
||||
|
||||
$(warning, LDSCRIPT is $(LDSCRIPT))
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native toolchains
|
||||
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
|
||||
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/boards/$(CONFIG_ARCH)/$(CONFIG_ARCH_CHIP)/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}"
|
||||
else
|
||||
# Linux/Cygwin-native toolchain
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
|
||||
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
|
||||
ARCHSCRIPT = -T$(TOPDIR)/boards/$(CONFIG_ARCH)/$(CONFIG_ARCH_CHIP)/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)
|
||||
endif
|
||||
$(warning, LDSCRIPT is $(LDSCRIPT))
|
||||
$(warning, ARCHSCRIPT is $(ARCHSCRIPT))
|
||||
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
STRIP = $(CROSSDEV)strip --strip-unneeded
|
||||
AR = $(ARCROSSDEV)ar rcs
|
||||
NM = $(ARCROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
|
||||
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHCFLAGS = -fno-builtin
|
||||
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
||||
ARCHDEFINES =
|
||||
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
||||
|
||||
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||
LDNXFLATFLAGS = -e main -s 2048
|
||||
|
||||
ASMEXT = .S
|
||||
OBJEXT = .o
|
||||
LIBEXT = .a
|
||||
EXEEXT =
|
||||
|
||||
ifneq ($(CROSSDEV),arm-nuttx-elf-)
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
endif
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
|
||||
|
||||
HOSTCC = gcc
|
||||
HOSTINCLUDES = -I.
|
||||
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
|
||||
HOSTLDFLAGS =
|
||||
ifeq ($(CONFIG_HOST_WINDOWS),y)
|
||||
HOSTEXEEXT = .exe
|
||||
else
|
||||
HOSTEXEEXT =
|
||||
endif
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native host tools
|
||||
DIRLINK = $(TOPDIR)/tools/copydir.sh
|
||||
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
|
||||
MKDEP = $(TOPDIR)/tools/mkwindeps.sh
|
||||
else
|
||||
# Linux/Cygwin-native host tools
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
|
||||
endif
|
142
boards/arm/s32k1xx/s32k148evb/scripts/flash.ld
Normal file
142
boards/arm/s32k1xx/s32k148evb/scripts/flash.ld
Normal file
|
@ -0,0 +1,142 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/scripts/flash.ld
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 S32K148 has 2Mb of FLASH beginning at address 0x0000:0000 and
|
||||
* 252Kb of SRAM beginning at address 0x1ffe:0000 (plus 4Kb of FlexRAM)
|
||||
*
|
||||
* The on-chip RAM is split in two regions: SRAM_L and SRAM_U. The RAM is
|
||||
* implemented such that the SRAM_L and SRAM_U ranges form a contiguous
|
||||
* block in the memory map
|
||||
*
|
||||
* SRAM_L 1ffe0000 - 1fffffff 128Kb
|
||||
* SRAM_U 20000000 - 2001efff 124Kb
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
flash (rx) : ORIGIN = 0x00000000, LENGTH = 2M
|
||||
sram (rwx) : ORIGIN = 0x1fff0000, LENGTH = 252K
|
||||
}
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
EXTERN(_vectors)
|
||||
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.*)
|
||||
_etext = ABSOLUTE(.);
|
||||
} > flash
|
||||
|
||||
. = ALIGN(4);
|
||||
.init_section :
|
||||
{
|
||||
_sinit = ABSOLUTE(.);
|
||||
*(.init_array .init_array.*)
|
||||
_einit = ABSOLUTE(.);
|
||||
} > flash
|
||||
|
||||
. = ALIGN(4);
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab*)
|
||||
} >flash
|
||||
|
||||
. = ALIGN(4);
|
||||
__exidx_start = ABSOLUTE(.);
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx*)
|
||||
} >flash
|
||||
__exidx_end = ABSOLUTE(.);
|
||||
|
||||
. = ALIGN(4);
|
||||
.data :
|
||||
{
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data .data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
CONSTRUCTORS
|
||||
_edata = ABSOLUTE(.);
|
||||
} > sram AT > flash
|
||||
|
||||
_eronly = LOADADDR(.data);
|
||||
|
||||
.ramfunc ALIGN(4):
|
||||
{
|
||||
_sramfuncs = ABSOLUTE(.);
|
||||
*(.ramfunc .ramfunc.*)
|
||||
_eramfuncs = ABSOLUTE(.);
|
||||
} > sram AT > flash
|
||||
|
||||
_framfuncs = LOADADDR(.ramfunc);
|
||||
|
||||
.bss :
|
||||
{
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss .bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
_ebss = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
/* 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) }
|
||||
}
|
131
boards/arm/s32k1xx/s32k148evb/scripts/sram.ld
Normal file
131
boards/arm/s32k1xx/s32k148evb/scripts/sram.ld
Normal file
|
@ -0,0 +1,131 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/scripts/sram.ld
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 S32K148 has 2Mb of FLASH beginning at address 0x0000:0000 and
|
||||
* 252Kb of SRAM beginning at address 0x1ffe:0000 (plus 4Kb of FlexRAM)
|
||||
*
|
||||
* The on-chip RAM is split in two regions: SRAM_L and SRAM_U. The RAM is
|
||||
* implemented such that the SRAM_L and SRAM_U ranges form a contiguous
|
||||
* block in the memory map
|
||||
*
|
||||
* SRAM_L 1ffe0000 - 1fffffff 128Kb
|
||||
* SRAM_U 20000000 - 2001efff 124Kb
|
||||
*/
|
||||
|
||||
MEMORY
|
||||
{
|
||||
flash (rx) : ORIGIN = 0x00000000, LENGTH = 2M
|
||||
sram (rwx) : ORIGIN = 0x1fff0000, LENGTH = 252K
|
||||
}
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
EXTERN(_vectors)
|
||||
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.*)
|
||||
_etext = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
. = ALIGN(4);
|
||||
.init_section :
|
||||
{
|
||||
_sinit = ABSOLUTE(.);
|
||||
*(.init_array .init_array.*)
|
||||
_einit = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
. = ALIGN(4);
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab*)
|
||||
} >sram
|
||||
|
||||
. = ALIGN(4);
|
||||
__exidx_start = ABSOLUTE(.);
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx*)
|
||||
} >sram
|
||||
__exidx_end = ABSOLUTE(.);
|
||||
|
||||
. = ALIGN(4);
|
||||
.data :
|
||||
{
|
||||
_sdata = ABSOLUTE(.);
|
||||
*(.data .data.*)
|
||||
*(.gnu.linkonce.d.*)
|
||||
CONSTRUCTORS
|
||||
_edata = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
.bss :
|
||||
{
|
||||
_sbss = ABSOLUTE(.);
|
||||
*(.bss .bss.*)
|
||||
*(.gnu.linkonce.b.*)
|
||||
*(COMMON)
|
||||
_ebss = ABSOLUTE(.);
|
||||
} > sram
|
||||
|
||||
/* 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) }
|
||||
}
|
2
boards/arm/s32k1xx/s32k148evb/src/.gitignore
vendored
Normal file
2
boards/arm/s32k1xx/s32k148evb/src/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
/.depend
|
||||
/Make.dep
|
56
boards/arm/s32k1xx/s32k148evb/src/Makefile
Normal file
56
boards/arm/s32k1xx/s32k148evb/src/Makefile
Normal file
|
@ -0,0 +1,56 @@
|
|||
############################################################################
|
||||
# boards/arm/s32k1xx/s32k148evb/src/Makefile
|
||||
#
|
||||
# Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
-include $(TOPDIR)/Make.defs
|
||||
|
||||
ASRCS =
|
||||
CSRCS = s32k148_boot.c s32k148_bringup.c s32k148_clockconfig.c
|
||||
CSRCS += s32k148_periphclocks.c
|
||||
|
||||
ifeq ($(CONFIG_ARCH_LEDS),y)
|
||||
CSRCS += s32k148_autoleds.c
|
||||
else
|
||||
CSRCS += s32k148_userleds.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_BUTTONS),y)
|
||||
CSRCS += s32k148_buttons.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LIB_BOARDCTL),y)
|
||||
CSRCS += s32k148_appinit.c
|
||||
endif
|
||||
|
||||
include $(TOPDIR)/boards/Board.mk
|
94
boards/arm/s32k1xx/s32k148evb/src/s32k148_appinit.c
Normal file
94
boards/arm/s32k1xx/s32k148evb/src/s32k148_appinit.c
Normal file
|
@ -0,0 +1,94 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/src/s32k148_appinit.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <nuttx/config.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "s32k148evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef OK
|
||||
# define OK 0
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* 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)
|
||||
{
|
||||
#ifdef CONFIG_BOARD_LATE_INITIALIZE
|
||||
/* Board initialization already performed by board_late_initialize() */
|
||||
|
||||
return OK;
|
||||
#else
|
||||
/* Perform board-specific initialization */
|
||||
|
||||
return s32k148_bringup();
|
||||
#endif
|
||||
}
|
170
boards/arm/s32k1xx/s32k148evb/src/s32k148_autoleds.c
Normal file
170
boards/arm/s32k1xx/s32k148evb/src/s32k148_autoleds.c
Normal file
|
@ -0,0 +1,170 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/src/s32k148_autoleds.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 S32K148EVB has one RGB LED:
|
||||
*
|
||||
* RedLED PTE21
|
||||
* GreenLED PTE22
|
||||
* BlueLED PTE23
|
||||
*
|
||||
* If CONFIG_ARCH_LEDs is defined, then NuttX will control the LED on board
|
||||
* the Freedom K66F. The following definitions describe how NuttX controls
|
||||
* the LEDs:
|
||||
*
|
||||
* SYMBOL Meaning LED state
|
||||
* RED GREEN BLUE
|
||||
* ------------------- ----------------------- -----------------
|
||||
* LED_STARTED NuttX has been started OFF OFF OFF
|
||||
* LED_HEAPALLOCATE Heap has been allocated OFF OFF ON
|
||||
* LED_IRQSENABLED Interrupts enabled OFF OFF ON
|
||||
* LED_STACKCREATED Idle stack created OFF ON OFF
|
||||
* LED_INIRQ In an interrupt (no change)
|
||||
* LED_SIGNAL In a signal handler (no change)
|
||||
* LED_ASSERTION An assertion failed (no change)
|
||||
* LED_PANIC The system has crashed FLASH OFF OFF
|
||||
* LED_IDLE K66 is in sleep mode (Optional, not used)
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "s32k1xx_pin.h"
|
||||
#include "s32k148evb.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#ifdef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Summary of all possible settings */
|
||||
|
||||
#define LED_NOCHANGE 0 /* LED_IRQSENABLED, LED_INIRQ, LED_SIGNAL, LED_ASSERTION */
|
||||
#define LED_OFF_OFF_OFF 1 /* LED_STARTED */
|
||||
#define LED_OFF_OFF_ON 2 /* LED_HEAPALLOCATE */
|
||||
#define LED_OFF_ON_OFF 3 /* LED_STACKCREATED */
|
||||
#define LED_ON_OFF_OFF 4 /* LED_PANIC */
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_initialize(void)
|
||||
{
|
||||
/* Configure LED GPIOs for output */
|
||||
|
||||
s32k1xx_pinconfig(GPIO_LED_R);
|
||||
s32k1xx_pinconfig(GPIO_LED_G);
|
||||
s32k1xx_pinconfig(GPIO_LED_B);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_on
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_on(int led)
|
||||
{
|
||||
if (led != LED_NOCHANGE)
|
||||
{
|
||||
bool redoff = true;
|
||||
bool greenoff = true;
|
||||
bool blueoff = true;
|
||||
|
||||
switch (led)
|
||||
{
|
||||
default:
|
||||
case LED_OFF_OFF_OFF:
|
||||
break;
|
||||
|
||||
case LED_OFF_OFF_ON:
|
||||
blueoff = false;
|
||||
break;
|
||||
|
||||
case LED_OFF_ON_OFF:
|
||||
greenoff = false;
|
||||
break;
|
||||
|
||||
case LED_ON_OFF_OFF:
|
||||
redoff = false;
|
||||
break;
|
||||
}
|
||||
|
||||
s32k1xx_gpiowrite(GPIO_LED_R, redoff);
|
||||
s32k1xx_gpiowrite(GPIO_LED_G, greenoff);
|
||||
s32k1xx_gpiowrite(GPIO_LED_B, blueoff);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_autoled_off
|
||||
****************************************************************************/
|
||||
|
||||
void board_autoled_off(int led)
|
||||
{
|
||||
if (led == LED_ON_OFF_OFF)
|
||||
{
|
||||
s32k1xx_gpiowrite(GPIO_LED_R, true);
|
||||
s32k1xx_gpiowrite(GPIO_LED_G, true);
|
||||
s32k1xx_gpiowrite(GPIO_LED_B, true);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ARCH_LEDS */
|
101
boards/arm/s32k1xx/s32k148evb/src/s32k148_boot.c
Normal file
101
boards/arm/s32k1xx/s32k148evb/src/s32k148_boot.c
Normal file
|
@ -0,0 +1,101 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/src/s32k148_boot.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <nuttx/config.h>
|
||||
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "s32k148evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: s32k1xx_board_initialize
|
||||
*
|
||||
* Description:
|
||||
* All S32K1XX 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 s32k1xx_board_initialize(void)
|
||||
{
|
||||
#ifdef CONFIG_S32K1XX_SPI
|
||||
/* Configure SPI chip selects if 1) SPI is not disabled, and 2) the weak
|
||||
* function s32k148_spidev_initialize() has been brought into the link.
|
||||
*/
|
||||
|
||||
s32k148_spidev_initialize();
|
||||
#endif
|
||||
|
||||
#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-specific initialization */
|
||||
|
||||
(void)s32k148_bringup();
|
||||
}
|
||||
#endif
|
109
boards/arm/s32k1xx/s32k148evb/src/s32k148_bringup.c
Normal file
109
boards/arm/s32k1xx/s32k148evb/src/s32k148_bringup.c
Normal file
|
@ -0,0 +1,109 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/src/s32k148_bringup.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#ifdef CONFIG_BUTTONS
|
||||
# include <nuttx/input/buttons.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USERLED
|
||||
# include <nuttx/leds/userled.h>
|
||||
#endif
|
||||
|
||||
#include "s32k148evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: s32k148_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=n && CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int s32k148_bringup(void)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
#ifdef CONFIG_BUTTONS
|
||||
/* Register the BUTTON driver */
|
||||
|
||||
ret = btn_lower_initialize("/dev/buttons");
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: btn_lower_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USERLED
|
||||
/* Register the LED driver */
|
||||
|
||||
ret = userled_lower_initialize("/dev/userleds");
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: userled_lower_initialize() failed: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FS_PROCFS
|
||||
/* Mount the procfs file system */
|
||||
|
||||
ret = mount(NULL, "/proc", "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
164
boards/arm/s32k1xx/s32k148evb/src/s32k148_buttons.c
Normal file
164
boards/arm/s32k1xx/s32k148evb/src/s32k148_buttons.c
Normal file
|
@ -0,0 +1,164 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/src/s32k148_buttons.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 S32K148EVB supports two buttons:
|
||||
*
|
||||
* SW3 PTC12
|
||||
* SW4 PTC13
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "s32k1xx_pin.h"
|
||||
#include "s32k148evb.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#ifdef CONFIG_ARCH_BUTTONS
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void board_button_initialize(void)
|
||||
{
|
||||
/* Configure the GPIO pins as interrupting inputs. */
|
||||
|
||||
s32k1xx_pinconfig(GPIO_SW3);
|
||||
s32k1xx_pinconfig(GPIO_SW4);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_buttons
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint32_t ret = 0;
|
||||
|
||||
if (s32k1xx_gpioread(GPIO_SW3))
|
||||
{
|
||||
ret |= BUTTON_SW3_BIT;
|
||||
}
|
||||
|
||||
if (s32k1xx_gpioread(GPIO_SW4))
|
||||
{
|
||||
ret |= BUTTON_SW4_BIT;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that will
|
||||
* be called when a button is depressed or released. The ID value is a
|
||||
* button enumeration value that uniquely identifies a button resource. See the
|
||||
* BUTTON_* definitions in board.h for the meaning of enumeration
|
||||
* value.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
{
|
||||
uint32_t pinset;
|
||||
int ret;
|
||||
|
||||
/* Map the button id to the GPIO bit set. */
|
||||
|
||||
if (id == BUTTON_SW3)
|
||||
{
|
||||
pinset = GPIO_SW3;
|
||||
}
|
||||
else if (id == BUTTON_SW4)
|
||||
{
|
||||
pinset = GPIO_SW4;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* The button has already been configured as an interrupting input (by
|
||||
* board_button_initialize() above).
|
||||
*
|
||||
* Attach the new button handler.
|
||||
*/
|
||||
|
||||
ret = s32k1xx_pinirqattach(pinset, irqhandler, NULL);
|
||||
if (ret >= 0)
|
||||
{
|
||||
/* Then make sure that interrupts are enabled on the pin */
|
||||
|
||||
s32k1xx_pinirqenable(pinset);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_ARCH_BUTTONS */
|
225
boards/arm/s32k1xx/s32k148evb/src/s32k148_clockconfig.c
Normal file
225
boards/arm/s32k1xx/s32k148evb/src/s32k148_clockconfig.c
Normal file
|
@ -0,0 +1,225 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/src/s32k148_clockconfig.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Most of the settings within this file derives from NXP sample code for
|
||||
* the S32K148 MCUs. That sample code has this licensing information:
|
||||
*
|
||||
* Copyright (c) 2013 - 2015, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2018 NXP
|
||||
* All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED 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 NXP OR ITS 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 <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "s32k1xx_clockconfig.h"
|
||||
#include "s32k1xx_start.h"
|
||||
#include "s32k148evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Each S32K1xx board must provide the following initialized structure. This is
|
||||
* needed to establish the initial board clocking.
|
||||
*/
|
||||
|
||||
const struct clock_configuration_s g_initial_clkconfig =
|
||||
{
|
||||
.scg =
|
||||
{
|
||||
.sirc =
|
||||
{
|
||||
.range = SCG_SIRC_RANGE_HIGH, /* RANGE - High range (8 MHz) */
|
||||
.div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SIRCDIV1 */
|
||||
.div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SIRCDIV2 */
|
||||
.initialize = true, /* Initialize */
|
||||
.stopmode = false, /* SIRCSTEN */
|
||||
.lowpower = true, /* SIRCLPEN */
|
||||
.locked = false, /* LK */
|
||||
},
|
||||
.firc =
|
||||
{
|
||||
.range = SCG_FIRC_RANGE_48M, /* RANGE */
|
||||
.div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /* FIRCDIV1 */
|
||||
.div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /* FIRCDIV2 */
|
||||
.initialize = true, /* Initialize */
|
||||
.stopmode = false, /* */
|
||||
.lowpower = false, /* */
|
||||
.regulator = true, /* FIRCREGOFF */
|
||||
.locked = false, /* LK */
|
||||
},
|
||||
.sosc =
|
||||
{
|
||||
.mode = SCG_SOSC_MONITOR_DISABLE, /* SOSCCM */
|
||||
.gain = SCG_SOSC_GAIN_LOW, /* HGO */
|
||||
.range = SCG_SOSC_RANGE_MID, /* RANGE */
|
||||
.extref = SCG_SOSC_REF_OSC, /* EREFS */
|
||||
.div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SOSCDIV1 */
|
||||
.div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SOSCDIV2 */
|
||||
.initialize = true, /* Initialize */
|
||||
.stopmode = false, /* */
|
||||
.lowpower = false, /* */
|
||||
.locked = false, /* LK */
|
||||
},
|
||||
.spll =
|
||||
{
|
||||
.mode = SCG_SPLL_MONITOR_DISABLE, /* SPLLCM */
|
||||
.div1 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SPLLDIV1 */
|
||||
.div2 = SCG_ASYNC_CLOCK_DIV_BY_1, /* SPLLDIV2 */
|
||||
.prediv = 1, /* PREDIV */
|
||||
.mult = 28, /* MULT */
|
||||
.src = 0, /* SOURCE */
|
||||
.initialize = true, /* Initialize */
|
||||
.stopmode = false, /* */
|
||||
.locked = false, /* LK */
|
||||
},
|
||||
.rtc =
|
||||
{
|
||||
.initialize = true, /* Initialize */
|
||||
.clkin = 0 /* RTC_CLKIN */
|
||||
},
|
||||
.clockout =
|
||||
{
|
||||
.source = SCG_CLOCKOUT_SRC_FIRC, /* SCG CLKOUTSEL */
|
||||
.initialize = true, /* Initialize */
|
||||
},
|
||||
.clockmode =
|
||||
{
|
||||
.rccr = /* RCCR - Run Clock Control Register */
|
||||
{
|
||||
.src = SCG_SYSTEM_CLOCK_SRC_FIRC, /* SCS */
|
||||
.divslow = 2, /* DIVSLOW, range 1..16 */
|
||||
.divbus = 2, /* DIVBUS, range 1..16 */
|
||||
.divcore = 1 /* DIVCORE, range 1..16 */
|
||||
},
|
||||
.vccr = /* VCCR - VLPR Clock Control Register */
|
||||
{
|
||||
.src = SCG_SYSTEM_CLOCK_SRC_SIRC, /* SCS */
|
||||
.divslow = 4, /* DIVSLOW, range 1..16 */
|
||||
.divbus = 1, /* DIVBUS, range 1..16 */
|
||||
.divcore = 2 /* DIVCORE, range 1..16 */
|
||||
},
|
||||
.hccr =
|
||||
{
|
||||
.src = SCG_SYSTEM_CLOCK_SRC_SYS_PLL, /* SCS */
|
||||
.divslow = 4, /* DIVSLOW, range 1..16 */
|
||||
.divbus = 2, /* DIVBUS, range 1..16 */
|
||||
.divcore = 1 /* DIVCORE, range 1..16 */
|
||||
},
|
||||
/* .altclk */
|
||||
.initialize = true, /* Initialize */
|
||||
},
|
||||
},
|
||||
.sim =
|
||||
{
|
||||
.clockout = /* Clock Out configuration. */
|
||||
{
|
||||
.source = SIM_CLKOUT_SEL_SYSTEM_SCG_CLKOUT, /* CLKOUTSEL */
|
||||
.divider = 1, /* CLKOUTDIV, range 1..8 */
|
||||
.initialize = true, /* Initialize */
|
||||
.enable = false, /* CLKOUTEN */
|
||||
},
|
||||
.lpoclk = /* Low Power Clock configuration. */
|
||||
{
|
||||
.rtc_source = SIM_RTCCLK_SEL_SOSCDIV1_CLK, /* RTCCLKSEL */
|
||||
.lpo_source = SIM_LPO_CLK_SEL_LPO_128K, /* LPOCLKSEL */
|
||||
.initialize = true, /* Initialize */
|
||||
.lpo32k = true, /* LPO32KCLKEN */
|
||||
.lpo1k = true, /* LPO1KCLKEN */
|
||||
},
|
||||
.tclk = /* TCLK CLOCK configuration. */
|
||||
{
|
||||
.tclkfreq[0] = 0, /* TCLK0 */
|
||||
.tclkfreq[1] = 0, /* TCLK1 */
|
||||
.tclkfreq[2] = 0, /* TCLK2 */
|
||||
.initialize = true, /* Initialize */
|
||||
},
|
||||
.platgate = /* Platform Gate Clock configuration. */
|
||||
{
|
||||
.initialize = true, /* Initialize */
|
||||
.mscm = true, /* CGCMSCM */
|
||||
.mpu = true, /* CGCMPU */
|
||||
.dma = true, /* CGCDMA */
|
||||
.erm = true, /* CGCERM */
|
||||
.eim = true, /* CGCEIM */
|
||||
},
|
||||
.traceclk = /* Debug trace Clock Configuration. */
|
||||
{
|
||||
.source = CLOCK_TRACE_SRC_CORE_CLK, /* TRACECLK_SEL */
|
||||
.divider = 1, /* TRACEDIV, range 1..8 */
|
||||
.initialize = true, /* Initialize */
|
||||
.enable = true, /* TRACEDIVEN */
|
||||
.fraction = false, /* TRACEFRAC */
|
||||
},
|
||||
#ifdef CONFIG_S32K1XX_HAVE_QSPI
|
||||
.qspirefclk = /* Quad Spi Internal Reference Clock Gating. */
|
||||
{
|
||||
.refclk = false, /* Qspi reference clock gating */
|
||||
},
|
||||
#endif
|
||||
},
|
||||
.pcc =
|
||||
{
|
||||
.count = NUM_OF_PERIPHERAL_CLOCKS_0, /* Number peripheral clock configurations */
|
||||
.pclks = g_peripheral_clockconfig0 /* Peripheral clock configurations */
|
||||
},
|
||||
.pmc =
|
||||
{
|
||||
.lpoclk = /* Low Power Clock configuration. */
|
||||
{
|
||||
.trim = 0, /* Trimming value for LPO */
|
||||
.initialize = true, /* Initialize */
|
||||
.enable = true, /* Enable/disable LPO */
|
||||
},
|
||||
}
|
||||
};
|
159
boards/arm/s32k1xx/s32k148evb/src/s32k148_periphclocks.c
Normal file
159
boards/arm/s32k1xx/s32k148evb/src/s32k148_periphclocks.c
Normal file
|
@ -0,0 +1,159 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/src/s32k148_periphclks.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Most of the settings within this file derives from NXP sample code for
|
||||
* the S32K148 MCUs. That sample code has this licensing information:
|
||||
*
|
||||
* Copyright (c) 2013 - 2015, Freescale Semiconductor, Inc.
|
||||
* Copyright 2016-2018 NXP
|
||||
* All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED 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 NXP OR ITS 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 <nuttx/config.h>
|
||||
|
||||
#include "s32k1xx_periphclocks.h"
|
||||
#include "s32k148evb.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Each S32K1xx board must provide the following initialized structure. This is
|
||||
* needed to establish the initial peripheral clocking.
|
||||
*/
|
||||
|
||||
const struct peripheral_clock_config_s g_peripheral_clockconfig0[] =
|
||||
{
|
||||
{
|
||||
.clkname = ADC0_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_FIRC,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = ADC1_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_FIRC,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = LPTMR0_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_SIRC,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = LPUART0_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_SIRC,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = LPUART1_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_SIRC,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = LPUART2_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_SIRC,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTA_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTB_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTC_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTD_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
},
|
||||
{
|
||||
.clkname = PORTE_CLK,
|
||||
.clkgate = true,
|
||||
.clksrc = CLK_SRC_OFF,
|
||||
.frac = MULTIPLY_BY_ONE,
|
||||
.divider = 1,
|
||||
}
|
||||
};
|
116
boards/arm/s32k1xx/s32k148evb/src/s32k148_userleds.c
Normal file
116
boards/arm/s32k1xx/s32k148evb/src/s32k148_userleds.c
Normal file
|
@ -0,0 +1,116 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/src/s32k148_userleds.c
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
|
||||
#include "s32k1xx_pin.h"
|
||||
#include "s32k148evb.h"
|
||||
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#ifndef CONFIG_ARCH_LEDS
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_initialize
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_initialize(void)
|
||||
{
|
||||
/* Configure LED GPIOs for output */
|
||||
|
||||
s32k1xx_pinconfig(GPIO_LED_R);
|
||||
s32k1xx_pinconfig(GPIO_LED_G);
|
||||
s32k1xx_pinconfig(GPIO_LED_B);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled(int led, bool ledon)
|
||||
{
|
||||
uint32_t ledcfg;
|
||||
|
||||
if (led == BOARD_LED_R)
|
||||
{
|
||||
ledcfg = GPIO_LED_R;
|
||||
}
|
||||
else if (led == BOARD_LED_G)
|
||||
{
|
||||
ledcfg = GPIO_LED_G;
|
||||
}
|
||||
else if (led == BOARD_LED_B)
|
||||
{
|
||||
ledcfg = GPIO_LED_B;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
s32k1xx_gpiowrite(ledcfg, !ledon); /* Low illuminates */
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: board_userled_all
|
||||
****************************************************************************/
|
||||
|
||||
void board_userled_all(uint8_t ledset)
|
||||
{
|
||||
/* Low illuminates */
|
||||
|
||||
s32k1xx_gpiowrite(GPIO_LED_R, (ledset & BOARD_LED_R_BIT) == 0);
|
||||
s32k1xx_gpiowrite(GPIO_LED_G, (ledset & BOARD_LED_G_BIT) == 0);
|
||||
s32k1xx_gpiowrite(GPIO_LED_B, (ledset & BOARD_LED_B_BIT) == 0);
|
||||
}
|
||||
|
||||
#endif /* !CONFIG_ARCH_LEDS */
|
134
boards/arm/s32k1xx/s32k148evb/src/s32k148evb.h
Normal file
134
boards/arm/s32k1xx/s32k148evb/src/s32k148evb.h
Normal file
|
@ -0,0 +1,134 @@
|
|||
/****************************************************************************
|
||||
* boards/arm/s32k1xx/s32k148evb/src/s32k148evb.h
|
||||
*
|
||||
* Copyright (C) 2019 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __BOARDS_ARM_S32K1XX_S32K148EVB_SRC_S32K148EVB_H
|
||||
#define __BOARDS_ARM_S32K1XX_S32K148EVB_SRC_S32K148EVB_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "hardware/s32k1xx_pinmux.h"
|
||||
#include "s32k1xx_periphclocks.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* S32K148EVB GPIOs *********************************************************/
|
||||
|
||||
/* LEDs. The S32K148EVB has one RGB LED:
|
||||
*
|
||||
* RedLED PTE21
|
||||
* GreenLED PTE22
|
||||
* BlueLED PTE23
|
||||
*/
|
||||
|
||||
#define GPIO_LED_R (PIN_PTE21 | GPIO_LOWDRIVE | GPIO_OUTPUT_ONE)
|
||||
#define GPIO_LED_G (PIN_PTE22 | GPIO_LOWDRIVE | GPIO_OUTPUT_ONE)
|
||||
#define GPIO_LED_B (PIN_PTE23 | GPIO_LOWDRIVE | GPIO_OUTPUT_ONE)
|
||||
|
||||
/* Buttons. The S32K148EVB supports two buttons:
|
||||
*
|
||||
* SW3 PTC12
|
||||
* SW4 PTC13
|
||||
*/
|
||||
|
||||
#define GPIO_SW3 (PIN_PTC12 | PIN_INT_BOTH)
|
||||
#define GPIO_SW4 (PIN_PTC13 | PIN_INT_BOTH)
|
||||
|
||||
/* SPI chip selects */
|
||||
|
||||
|
||||
/* Count of peripheral clock user configurations */
|
||||
|
||||
#define NUM_OF_PERIPHERAL_CLOCKS_0 11
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public data
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/* User peripheral configuration structure 0 */
|
||||
|
||||
extern const struct peripheral_clock_config_s g_peripheral_clockconfig0[];
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: s32k148_bringup
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y :
|
||||
* Called from board_late_initialize().
|
||||
*
|
||||
* CONFIG_BOARD_LATE_INITIALIZE=y && CONFIG_LIB_BOARDCTL=y :
|
||||
* Called from the NSH library
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int s32k148_bringup(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: s32k148_spidev_initialize
|
||||
*
|
||||
* Description:
|
||||
* Called to configure SPI chip select GPIO pins for the s32k148evb
|
||||
* board.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_S32K1XX_SPI
|
||||
void s32k148_spidev_initialize(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __BOARDS_ARM_S32K1XX_S32K148EVB_SRC_S32K148EVB_H */
|
Loading…
Reference in a new issue