mirror of
https://github.com/apache/nuttx.git
synced 2026-08-14 17:03:29 +00:00
arch/arm/src/max326xx: Get's past a few initial compile problems. Still a long road ahead.
This commit is contained in:
parent
6d5c1ec64f
commit
8e18e8ae54
14 changed files with 225 additions and 37 deletions
|
|
@ -58,9 +58,10 @@
|
|||
|
||||
/* Common Processor Exceptions (vectors 0-15) */
|
||||
|
||||
#define MAX326_IRQ_RESERVED (0) /* Reserved vector (only used with CONFIG_DEBUG_FEATURES) */
|
||||
/* Vector 0: Reset stack pointer value */
|
||||
/* Vector 1: Reset (not handler as an IRQ) */
|
||||
#define MAX326_IRQ_RESERVED (0) /* Reserved vector (only used with
|
||||
* CONFIG_DEBUG_FEATURES) */
|
||||
/* Vector 0: Reset stack pointer value */
|
||||
/* Vector 1: Reset (not handler as an IRQ) */
|
||||
#define MAX326_IRQ_NMI (2) /* Vector 2: Non-Maskable Interrupt (NMI) */
|
||||
#define MAX326_IRQ_HARDFAULT (3) /* Vector 3: Hard fault */
|
||||
#define MAX326_IRQ_MEMFAULT (4) /* Vector 4: Memory management (MPU) */
|
||||
|
|
@ -68,7 +69,7 @@
|
|||
#define MAX326_IRQ_USAGEFAULT (6) /* Vector 6: Usage fault */
|
||||
#define MAX326_IRQ_SVCALL (11) /* Vector 11: SVC call */
|
||||
#define MAX326_IRQ_DBGMONITOR (12) /* Vector 12: Debug Monitor */
|
||||
/* Vector 13: Reserved */
|
||||
/* Vector 13: Reserved */
|
||||
#define MAX326_IRQ_PENDSV (14) /* Vector 14: Pendable system service request */
|
||||
#define MAX326_IRQ_SYSTICK (15) /* Vector 15: System tick */
|
||||
|
||||
|
|
@ -78,7 +79,7 @@
|
|||
|
||||
#if defined(CONFIG_ARCH_FAMILY_MAX32620) || defined(CONFIG_ARCH_FAMILY_MAX32630)
|
||||
# include <arch/max326xx/max32620_30_irq.h>
|
||||
#if defined(CONFIG_ARCH_FAMILY_MAX32660)
|
||||
#elif defined(CONFIG_ARCH_FAMILY_MAX32660)
|
||||
# include <arch/max326xx/max32660_irq.h>
|
||||
#else
|
||||
# error "Unsupported MAX326XX family"
|
||||
|
|
|
|||
|
|
@ -153,3 +153,17 @@ endif
|
|||
ifeq ($(CONFIG_MAX326XX_HAVE_SPIM),y)
|
||||
CHIP_CSRCS += max326_spim.c
|
||||
endif
|
||||
|
||||
# Paths to source files
|
||||
|
||||
VPATH += chip/common
|
||||
|
||||
ifeq ($(CONFIG_ARCH_FAMILY_MAX32620),y)
|
||||
VPATH += chip/max32620_30
|
||||
else ifeq ($(CONFIG_ARCH_FAMILY_MAX32630),y)
|
||||
VPATH += chip/max32620_30
|
||||
endif
|
||||
ifeq ($(CONFIG_ARCH_FAMILY_MAX32660),y)
|
||||
VPATH += chip/max32660
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* arch/arm/src/max326xx/max326_irq.c
|
||||
* arch/arm/src/max326xx/common/max326_irq.c
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* arch/arm/src/max326xx/max326_mpuinit.c
|
||||
* arch/arm/src/max326xx/common/max326_mpuinit.c
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* arch/arm/src/max326xx/max326_start.c
|
||||
* arch/arm/src/max326xx/common/max326_start.c
|
||||
*
|
||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
|
|
@ -47,7 +47,6 @@
|
|||
#include "up_internal.h"
|
||||
#include "nvic.h"
|
||||
|
||||
#include "chip/max326_syscon.h"
|
||||
#include "max326_clockconfig.h"
|
||||
#include "max326_userspace.h"
|
||||
#include "max326_lowputc.h"
|
||||
|
|
@ -78,18 +77,9 @@
|
|||
|
||||
/* This describes the initial PLL configuration */
|
||||
|
||||
static const struct pll_setup_s g_initial_pll_setup =
|
||||
static const struct clock_setup_s g_initial_clock_setup =
|
||||
{
|
||||
.pllclksel = BOARD_PLL_CLKSEL,
|
||||
.pllctrl = SYSCON_SYSPLLCTRL_SELR(BOARD_PLL_SELR) |
|
||||
SYSCON_SYSPLLCTRL_SELI(BOARD_PLL_SELI) |
|
||||
SYSCON_SYSPLLCTRL_SELP(BOARD_PLL_SELP),
|
||||
.pllmdec = (SYSCON_SYSPLLMDEC_MDEC(BOARD_PLL_MDEC)),
|
||||
.pllndec = (SYSCON_SYSPLLNDEC_NDEC(BOARD_PLL_NDEC)),
|
||||
.pllpdec = (SYSCON_SYSPLLPDEC_PDEC(BOARD_PLL_PDEC)),
|
||||
.pllfout = BOARD_PLL_FOUT,
|
||||
.pllflags = PLL_SETUPFLAG_WAITLOCK | PLL_SETUPFLAG_POWERUP,
|
||||
.ahbdiv = SYSCON_AHBCLKDIV_DIV(BOARD_AHBCLKDIV)
|
||||
#warning Missing logic
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -198,7 +188,6 @@ void __start(void)
|
|||
{
|
||||
const uint32_t *src;
|
||||
uint32_t *dest;
|
||||
uint32_t regval;
|
||||
|
||||
/* Make sure that interrupts are disabled */
|
||||
|
||||
|
|
@ -209,7 +198,7 @@ void __start(void)
|
|||
* .bss or .data have been initialized.
|
||||
*/
|
||||
|
||||
max326_clockconfig(&g_initial_pll_setup);
|
||||
max326_clockconfig(&g_initial_clock_setup);
|
||||
max326_lowsetup();
|
||||
showprogress('A');
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* arch/arm/src/max326xx/max326_timerisr.c
|
||||
* arch/arm/src/max326xx/common/max326_timerisr.c
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/****************************************************************************
|
||||
* arch/arm/src/max326xx/max326_userspace.c
|
||||
* arch/arm/src/max326xx/common/max326_userspace.c
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/************************************************************************************
|
||||
* arch/arm/src/max326xx/max32660_gpio.h
|
||||
* arch/arm/src/max326xx/max32660/max32660_gpio.h
|
||||
*
|
||||
* Copyright (C) 2018 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
|
|
@ -33,8 +33,8 @@
|
|||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifndef __ARCH_ARM_SRC_MAX326XX_MAX32660_GPIO_H
|
||||
#define __ARCH_ARM_SRC_MAX326XX_MAX32660_GPIO_H
|
||||
#ifndef __ARCH_ARM_SRC_MAX326XX_MAX32660_MAX32660_GPIO_H
|
||||
#define __ARCH_ARM_SRC_MAX326XX_MAX32660_MAX32660_GPIO_H
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
|
|
@ -186,4 +186,4 @@
|
|||
|
||||
typedef uint16_t max326_pinset_t;
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_MAX326XX_MAX32660_GPIO_H */
|
||||
#endif /* __ARCH_ARM_SRC_MAX326XX_MAX32660_MAX32660_GPIO_H */
|
||||
|
|
@ -68,8 +68,8 @@
|
|||
|
||||
#undef HAVE_UART_DEVICE
|
||||
|
||||
#if defined(CONFIG_MAX326XX_UART0) || CONFIG_MAX326XX_UART3(HAVE_UART1) || \
|
||||
defined(CONFIG_MAX326XX_UART1) || defined(CONFIG_MAX326XX_UART3))
|
||||
#if defined(CONFIG_MAX326XX_UART0) || defined(CONFIG_MAX326XX_UART2) || \
|
||||
defined(CONFIG_MAX326XX_UART1) || defined(CONFIG_MAX326XX_UART3)
|
||||
# define HAVE_UART_DEVICE 1
|
||||
#endif
|
||||
|
||||
|
|
@ -79,22 +79,22 @@
|
|||
|
||||
#undef HAVE_UART_CONSOLE
|
||||
|
||||
#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(HAVE_UART0)
|
||||
#if defined(CONFIG_UART0_SERIAL_CONSOLE)
|
||||
# undef CONFIG_UART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART3_SERIAL_CONSOLE
|
||||
# define HAVE_UART_CONSOLE 1
|
||||
#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(HAVE_UART1)
|
||||
#elif defined(CONFIG_UART1_SERIAL_CONSOLE)
|
||||
# undef CONFIG_UART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART3_SERIAL_CONSOLE
|
||||
# define HAVE_UART_CONSOLE 1
|
||||
#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(HAVE_UART2)
|
||||
#elif defined(CONFIG_UART2_SERIAL_CONSOLE)
|
||||
# undef CONFIG_UART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART3_SERIAL_CONSOLE
|
||||
# define HAVE_UART_CONSOLE 1
|
||||
#elif defined(CONFIG_UART3_SERIAL_CONSOLE) && defined(HAVE_UART3)
|
||||
#elif defined(CONFIG_UART3_SERIAL_CONSOLE)
|
||||
# undef CONFIG_UART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART2_SERIAL_CONSOLE
|
||||
|
|
|
|||
|
|
@ -51,12 +51,12 @@
|
|||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Bit-encoded input to max326_gpio_config() ******************************************/
|
||||
/* Bit-encoded input to max326_gpio_config() ****************************************/
|
||||
|
||||
#if defined(CONFIG_ARCH_FAMILY_MAX32620) || defined(CONFIG_ARCH_FAMILY_MAX32630)
|
||||
# include "max32620_30_gpio.h"
|
||||
# include "max32620_30/max32620_30_gpio.h"
|
||||
#if defined(CONFIG_ARCH_FAMILY_MAX32660)
|
||||
# include "max32660_gpio.h"
|
||||
# include "max32660/max32660_gpio.h"
|
||||
#else
|
||||
# error "Unsupported MAX326XX family"
|
||||
#endif
|
||||
|
|
|
|||
118
arch/arm/src/max326xx/max326_lowputc.h
Normal file
118
arch/arm/src/max326xx/max326_lowputc.h
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
/****************************************************************************
|
||||
* arch/arm/src/max326xx/max326_lowputc.h
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_ARM_SRC_MAX326XX_MAX326_LOWPUTC_H
|
||||
#define __ARCH_ARM_SRC_MAX326XX_MAX326_LOWPUTC_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "max326_config.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HAVE_UART_DEVICE
|
||||
/* This structure describes the configuration of an UART */
|
||||
|
||||
struct uart_config_s
|
||||
{
|
||||
uint32_t baud; /* Configured baud */
|
||||
uint32_t fclk; /* Input UART function clock frequency */
|
||||
uint8_t parity; /* 0=none, 1=odd, 2=even */
|
||||
uint8_t bits; /* Number of bits (5-9) */
|
||||
uint8_t txlevel; /* TX level for event generation */
|
||||
uint8_t rxlevel; /* RX level for event generation */
|
||||
bool stopbits2; /* true: Configure with 2 stop bits instead of 1 */
|
||||
#ifdef CONFIG_SERIAL_IFLOWCONTROL
|
||||
bool iflow; /* true: Input flow control supported */
|
||||
#endif
|
||||
#ifdef CONFIG_SERIAL_OFLOWCONTROL
|
||||
bool oflow; /* true: Output flow control supported. */
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: max326_lowsetup
|
||||
*
|
||||
* Description:
|
||||
* Called at the very beginning of _start. Performs low level
|
||||
* initialization including setup of the console UART. This UART
|
||||
* initialization is done early so that the serial console is available
|
||||
* for debugging very early in the boot sequence.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void max326_lowsetup(void);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: max326_usart_configure
|
||||
*
|
||||
* Description:
|
||||
* Configure a UART for non-interrupt driven operation
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HAVE_UART_DEVICE
|
||||
void max326_usart_configure(uintptr_t base,
|
||||
FAR const struct uart_config_s *config);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: max326_usart_disable
|
||||
*
|
||||
* Description:
|
||||
* Disable a UART. it will be necessary to again call
|
||||
* max326_usart_configure() in order to use this UART channel again.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HAVE_UART_DEVICE
|
||||
void max326_usart_disable(uintptr_t base);
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_MAX326XX_MAX326_LOWPUTC_H */
|
||||
66
arch/arm/src/max326xx/max326_serial.h
Normal file
66
arch/arm/src/max326xx/max326_serial.h
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/****************************************************************************
|
||||
* arch/arm/src/max326xx/max326_serial.h
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __ARCH_ARM_SRC_MAX326XX_MAX326_SERIAL_H
|
||||
#define __ARCH_ARM_SRC_MAX326XX_MAX326_SERIAL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include "max326_config.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: max326_earlyserialinit
|
||||
*
|
||||
* Description:
|
||||
* Performs the low level USART initialization early in debug so that the
|
||||
* serial console will be available during bootup. This must be called
|
||||
* before max326_serialinit. NOTE: This function depends on GPIO pin
|
||||
* configuration performed in xmc_lowsetup() and main clock initialization
|
||||
* performed in xmc_clock_configure().
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef USE_EARLYSERIALINIT
|
||||
void max326_earlyserialinit(void);
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_MAX326XX_MAX326_SERIAL_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue