boards/arm/xmc4: add initial support for the Infineon XMC4700 Relax board

This commit is contained in:
raiden00pl 2020-03-21 23:42:09 +01:00 committed by patacongo
parent 6821d0e85f
commit 1b4425ab5d
17 changed files with 1416 additions and 2 deletions

View file

@ -1910,7 +1910,16 @@ config ARCH_BOARD_XMC4500RELAX
select ARCH_HAVE_BUTTONS
select ARCH_HAVE_IRQBUTTONS
---help---
Infineon XMC4000 Relax Lite v1
Infineon XMC4500 Relax Lite v1
config ARCH_BOARD_XMC4700RELAX
bool "Infineon XMC4700 Relax"
depends on ARCH_CHIP_XMC4700
select ARCH_HAVE_LEDS
select ARCH_HAVE_BUTTONS
select ARCH_HAVE_IRQBUTTONS
---help---
Infineon XMC4700 Relax
config ARCH_BOARD_Z16F2800100ZCOG
bool "Zilog Z16F2800100ZCOG Development Kit"
@ -2250,6 +2259,7 @@ config ARCH_BOARD
default "us7032evb1" if ARCH_BOARD_US7032EVB1
default "viewtool-stm32f107" if ARCH_BOARD_VIEWTOOL_STM32F107
default "xmc4500-relax" if ARCH_BOARD_XMC4500RELAX
default "xmc4700-relax" if ARCH_BOARD_XMC4700RELAX
default "z16f2800100zcog" if ARCH_BOARD_Z16F2800100ZCOG
default "z20x" if ARCH_BOARD_Z20X
default "z80sim" if ARCH_BOARD_Z80SIM
@ -2767,6 +2777,9 @@ endif
if ARCH_BOARD_XMC4500RELAX
source "boards/arm/xmc4/xmc4500-relax/Kconfig"
endif
if ARCH_BOARD_XMC4700RELAX
source "boards/arm/xmc4/xmc4700-relax/Kconfig"
endif
if ARCH_BOARD_AVR32DEV1
source "boards/avr/at32uc3/avr32dev1/Kconfig"
endif

View file

@ -863,7 +863,10 @@ boards/arm/stm32/viewtool-stm32f107
See http://www.viewtool.com/ for further information.
config/xmc4500-relax
Infineon XMC4000 Relax Lite v1
Infineon XMC4500 Relax Lite v1
config/xmc4700-relax
Infineon XMC4700 Relax
boards/z16/z16f/z16f2800100zcog
z16f Microcontroller. This port use the Zilog z16f2800100zcog

View file

@ -0,0 +1,4 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

View file

@ -0,0 +1,10 @@
README for the XMC4700 Relax
============================
The directory provides board support for the Infineon XMC4700 Relax Kit.
Status
======
2020-03-21: The XMC4700 Relax boots into NSH, provides the NSH prompt,
and the LEDs are working.

View file

@ -0,0 +1,50 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_ARCH_RAMFUNCS is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="xmc4700-relax"
CONFIG_ARCH_BOARD_XMC4700RELAX=y
CONFIG_ARCH_BUTTONS=y
CONFIG_ARCH_CHIP="xmc4"
CONFIG_ARCH_CHIP_XMC4700=y
CONFIG_ARCH_CHIP_XMC4=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_IRQBUTTONS=y
CONFIG_ARCH_STACKDUMP=y
CONFIG_ARMV7M_LAZYFPU=y
CONFIG_BOARD_LOOPSPERMSEC=8000
CONFIG_BUILTIN=y
CONFIG_DEBUG_NOOPT=y
CONFIG_INTELHEX_BINARY=y
CONFIG_MAX_TASKS=16
CONFIG_MAX_WDOGPARMS=2
CONFIG_NFILE_DESCRIPTORS=8
CONFIG_NFILE_STREAMS=8
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_LINELEN=64
CONFIG_NSH_READLINE=y
CONFIG_PREALLOC_MQ_MSGS=4
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAM_SIZE=65536
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_WAITPID=y
CONFIG_SDCLONE_DISABLE=y
CONFIG_START_DAY=10
CONFIG_START_MONTH=3
CONFIG_START_YEAR=2014
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_RAMTEST=y
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_XMC4_USIC0=y
CONFIG_XMC4_USIC0_CHAN1_NONE=y

View file

@ -0,0 +1,339 @@
/****************************************************************************
* boards/arm/xmc4/xmc4700-relax/include/board.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_ARM_XMC4_XMC4700_RELAX_INCLUDE_BOARD_H
#define __BOARDS_ARM_XMC4_XMC4700_RELAX_INCLUDE_BOARD_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#ifndef __ASSEMBLY__
# include <stdint.h>
# include <stdbool.h>
#endif
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Clocking *****************************************************************/
/* The maximum frequency for the XMC4700 is 144MHz. */
#undef BOARD_FCPU_120MHZ
#define BOARD_FCPU_144MHZ 1
/* Watchdog clock source selection */
#define WDT_CLKSRC_FOFI 0 /* fOFI clock */
#define WDT_CLKSRC_FSTDY 1 /* fSTDY clock */
#define WDT_CLKSRC_FPLL 2 /* fPLL clock */
/* External Clock source selection */
#define EXT_CLKSRC_FSYS 0 /* fSYS clock */
#define EXT_CLKSRC_FUSB 2 /* fUSB clock divided by ECKDIV */
#define EXT_CLKSRC_FPLL 3 /* fPLL clock divided by ECKDIV */
/* Factory Calibration */
#undef BOARD_FOFI_CALIBRATION /* Enable factory calibration */
/* On-board crystals */
#define BOARD_XTAL_FREQUENCY 12000000 /* 12MHz XTAL */
#define BOARD_RTC_XTAL_FRQUENCY 32769 /* 32.768KHz RTC XTAL */
/* TODO: enable the RTC osc, use RTC for time/date
*/
/* Select the external crystal as the PLL clock source */
#define BOARD_PLL_CLOCKSRC_XTAL 1 /* PLL Clock source == extnernal crystal */
#undef BOARD_PLL_CLOCKSRC_OFI /* PLL Clock source != internal fast oscillator */
/* PLL Configuration:
*
* fXTAL = 12Mhz
* 260 MHz <= fVCO <= 520 MHz
*
* fVCO = fXTAL * ndiv / pdiv
* fPLL = fVCO / k2div
* fSYS = fPLL / sysdiv
* fETH = fSYS / 2 (fixed div by 2)
* fCCU = fSYS / ccudiv (div by 1 or 2)
* fCPU = fSYS / cpudiv (div by 1 or 2)
* fPERIPH = fCPU / pbdiv (div by 1 or 2)
*/
#define BOARD_ENABLE_PLL 1 /* enable the PLL */
#define CPU_FREQ 120 /* MHz */
/* TODO: Automate PLL calculations */
#if CPU_FREQ == 120
/* 120 MHz
*
* fVCO = 12MHz * 40 / 2 = 480MHz
* fPLL = 480MHz / 2 = 240MHz
* fSYS = fPLL / 2 = 120MHz
* fCCU = fSYS / 2 = 60MHz
* fCPU = fSYS / 1 = 120MHz
* fPB = fCPU / 2 = 60MHz
* fETH = fSYS / 2 = 60MHz
*/
# define BOARD_PLL_NDIV 40
# define BOARD_PLL_PDIV 1
# define BOARD_PLL_K2DIV 4
# define BOARD_PLL_SYSDIV 1
# define BOARD_PLL_CPUDIV 1
# define BOARD_PLL_PBDIV 2
# define BOARD_PLL_CCUDIV 2
# define BOARD_PLL_EBUDIV 4
#elif CPU_FREQ == 144
/* 144 MHz
*
* fVCO = 12MHz * 36 / 1 = 432MHz
* fPLL = 432MHz / 3 = 144MHz
* fSYS = fPLL / 1 = 144MHz
* fCCU = fSYS / 2 = 72MHz
* fCPU = fSYS / 1 = 144MHz
* fPB = fCPU / 2 = 72MHz
* fETH = fSYS / 2 = 72MHz
*/
# define BOARD_PLL_NDIV 36
# define BOARD_PLL_PDIV 1
# define BOARD_PLL_K2DIV 3
# define BOARD_PLL_SYSDIV 1
# define BOARD_PLL_CPUDIV 1
# define BOARD_PLL_PBDIV 2
# define BOARD_PLL_CCUDIV 2
# define BOARD_PLL_EBUDIV 2
#else
# error "Illegal or Unsupported CPU Frequency"
#endif
# define BOARD_CCUDIV_ENABLE (BOARD_PLL_CCUDIV - 1)
# define BOARD_CPUDIV_ENABLE (BOARD_PLL_CPUDIV - 1)
# define BOARD_VCO_FREQUENCY (BOARD_XTAL_FREQUENCY * BOARD_PLL_NDIV / BOARD_PLL_PDIV)
# define BOARD_PLL_FREQUENCY (BOARD_VCO_FREQUENCY / BOARD_PLL_K2DIV)
# define BOARD_SYS_FREQUENCY (BOARD_PLL_FREQUENCY / BOARD_PLL_SYSDIV)
# define BOARD_CCU_FREQUENCY (BOARD_SYS_FREQUENCY / BOARD_PLL_CCUDIV)
# define BOARD_CPU_FREQUENCY (BOARD_SYS_FREQUENCY / BOARD_PLL_CPUDIV)
# define BOARD_PERIPH_FREQUENCY (BOARD_CPU_FREQUENCY / BOARD_PLL_PBDIV)
# define BOARD_ETH_FREQUENCY (BOARD_SYS_FREQUENCY / 2)
# define BOARD_WDT_SOURCE WDT_CLKSRC_FOFI
# define BOARD_WDTDIV 1
# define BOARD_WDT_FREQUENCY 24000000
# define BOARD_EXT_SOURCE EXT_CLKSRC_FPLL
# define BOARD_PLL_ECKDIV 480 /* [1,512] */
# define kHz_1 1000
# define MHz_1 (kHz_1 * kHz_1)
# define MHz_50 ( 50 * MHz_1)
# define MHz_260 (260 * MHz_1)
# define MHz_520 (520 * MHz_1)
/* range check VCO frequency */
# if (BOARD_VCO_FREQUENCY < MHz_260)
# error "VCO freq must be >= 260 MHz"
# endif
# if (BOARD_VCO_FREQUENCY > MHz_520)
# error "VCO freq must be <= 520 MHz"
# endif
/* range check Ethernet MAC frequency */
# if (BOARD_ETH_FREQUENCY <= MHz_50)
# error "ETH freq must be > 50 MHz"
# endif
/* check ccudiv cpudiv pbdiv against Table 11-5
* of XMC4700 User Manual
*/
#define CLKDIV_INDEX (4 * (BOARD_PLL_CCUDIV-1) + \
2 * (BOARD_PLL_CPUDIV-1) + \
(BOARD_PLL_PBDIV-1) )
#if (CLKDIV_INDEX == 3) || (CLKDIV_INDEX == 4) || (CLKDIV_INDEX > 6)
# error "Illegal combination of dividers! Ref: Table 11-5 of UM"
#endif
/* EXT clock settings */
#define BOARD_EXTCKL_ENABLE 1 /* 0 disables output */
#if BOARD_EXTCKL_ENABLE
# define EXTCLK_PIN_P0_8 8
# define EXTCLK_PIN_P1_15 15
# define BOARD_EXTCLK_PIN EXTCLK_PIN_P0_8
# define BOARD_EXT_SOURCE EXT_CLKSRC_FPLL
# define BOARD_EXT_FREQUENCY (250 * kHz_1) /* Desired output freq */
# define BOARD_EXTDIV (BOARD_PLL_FREQUENCY / BOARD_EXT_FREQUENCY)
/* range check EXTDIV */
# if BOARD_EXTDIV > 512
# error "EXTCLK Divisor out of range!"
# endif
#endif
/* Standby clock source selection
*
* BOARD_STDBY_CLOCKSRC_OSI - Internal 32.768KHz slow oscillator
* BOARD_STDBY_CLOCKSRC_OSCULP - External 32.768KHz crystal
*/
#define BOARD_STDBY_CLOCKSRC_OSI 1
#undef BOARD_STDBY_CLOCKSRC_OSCULP
#define BOARD_STDBY_FREQUENCY 32768
/* USB PLL settings.
*
* fUSBPLL = 48MHz and fUSBPLLVCO = 384 MHz
*
* Note: Implicit divider of 2 and fUSBPLLVCO >= 260 MHz and
* fUSBPLLVCO <= 520 MHz
*/
#undef BOARD_ENABLE_USBPLL
#define BOARD_USB_PDIV 2
#define BOARD_USB_NDIV 64
/* FLASH wait states */
#define BOARD_FLASH_WS 5
/* LED definitions **********************************************************/
/* The XMC4700 Relax board has two LEDs:
*
* LED1 P5.9 High output illuminates
* LED2 P5.8 High output illuminates
*
* 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 LEDs.
*/
/* LED index values for use with board_userled() */
#define BOARD_LED0 0
#define BOARD_LED1 1
#define BOARD_NLEDS 2
/* LED bits for use with board_userled_all() */
#define BOARD_LED0_BIT (1 << BOARD_LED0)
#define BOARD_LED1_BIT (1 << BOARD_LED1)
/* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
* defined. In that case, the usage by the board port is defined in
* include/board.h and src/sam_autoleds.c. The LEDs are used to encode
* OS-related events as follows:
*
* SYMBOL Meaning LED state
* LED2 LED1
* --------------------- -------------------------- ------ ------
*/
#define LED_STARTED 0 /* NuttX has been started OFF OFF */
#define LED_HEAPALLOCATE 0 /* Heap has been allocated OFF OFF */
#define LED_IRQSENABLED 0 /* Interrupts enabled OFF OFF */
#define LED_STACKCREATED 1 /* Idle stack created ON OFF */
#define LED_INIRQ 2 /* In an interrupt No change */
#define LED_SIGNAL 2 /* In a signal handler No change */
#define LED_ASSERTION 2 /* An assertion failed No change */
#define LED_PANIC 3 /* The system has crashed N/C Blinking */
#undef LED_IDLE /* MCU is is sleep mode Not used */
/* Thus if LED1 is statically on, NuttX has successfully booted and is,
* apparently, running normally. If LED2 is flashing at approximately
* 2Hz, then a fatal error has been detected and the system has halted.
*/
/* Button definitions *******************************************************/
/* The XMC4700 Relax board has two buttons:
*
* BUTTON1 P15.13 Low input sensed when button pressed
* BUTTON2 P15.12 Low input sensed when button pressed
*/
#define BUTTON_0 0
#define BUTTON_1 1
#define NUM_BUTTONS 2
#define BUTTON_0_BIT (1 << BUTTON_0)
#define BUTTON_1_BIT (1 << BUTTON_1)
/* USIC0 ********************************************************************/
/* USIC0 CH0 is used as UART0
*
* RX - P1.4
* TX - P1.5
*/
#define BOARD_UART0_DX USIC_DXB
#define GPIO_UART0_RXD GPIO_U0C0_DX0B
#define GPIO_UART0_TXD (GPIO_U0C0_DOUT0_3 | GPIO_PADA1P_STRONGSOFT | GPIO_OUTPUT_SET)
/****************************************************************************
* Public Data
****************************************************************************/
#ifndef __ASSEMBLY__
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_XMC4_XMC4700_RELAX_INCLUDE_BOARD_H */

View file

@ -0,0 +1,109 @@
############################################################################
# boards/arm/xmc4/xmc4700-relax/scripts/Make.defs
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
include ${TOPDIR}/.config
include ${TOPDIR}/tools/Config.mk
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
LDSCRIPT = flash.ld
ifeq ($(WINTOOL),y)
# Windows-native toolchains
DIRLINK = $(TOPDIR)/tools/copydir.sh
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
MKDEP = $(TOPDIR)/tools/mkwindeps.sh
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
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
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
CC = $(CROSSDEV)gcc
CXX = $(CROSSDEV)g++
CPP = $(CROSSDEV)gcc -E
LD = $(CROSSDEV)ld
STRIP = $(CROSSDEV)strip --strip-unneeded
AR = $(CROSSDEV)ar rcs
NM = $(CROSSDEV)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)
endif
ARCHCFLAGS = -fno-builtin
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fcheck-new -fno-rtti
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -fno-strict-aliasing
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
# Loadable module definitions
CMODULEFLAGS = $(CFLAGS) -mlong-calls # --target1-abs
LDMODULEFLAGS = -r -e module_initialize
ifeq ($(WINTOOL),y)
LDMODULEFLAGS += -T "${shell cygpath -w $(TOPDIR)/libs/libc/modlib/gnu-elf.ld}"
else
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
endif
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 =

View file

@ -0,0 +1,126 @@
/****************************************************************************
* boards/arm/xmc4/xmc4700-relax/scripts/flash.ld
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
*
****************************************************************************/
/* The XMC4700 has 2048Kb of FLASH accessible via:
* 1) the cacheable address space at 0x0800:0000
* 2) the non-cacheable address space at 0x0c00:0000
*
* The on-chip SRAM is split up into three blocks:
* 1) 96Kb of program memory beginning at the address 0x1ffe:8000
* 2) 128Kb of data memory beginning at the address 0x2000:0000
* 3) 128Kb of communication memory beginning at the address 0x2002:0000
*/
MEMORY
{
flash (rx) : ORIGIN = 0x0c000000, LENGTH = 2048K
psram (rwx) : ORIGIN = 0x1ffe8000, LENGTH = 96K
sram (rwx) : ORIGIN = 0x20000000, LENGTH = 256K
dsram1 (rwx) : ORIGIN = 0x20000000, LENGTH = 128K
dsram2 (rwx) : ORIGIN = 0x20020000, LENGTH = 128K
}
OUTPUT_ARCH(arm)
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
.init_section :
{
_sinit = ABSOLUTE(.);
*(.init_array .init_array.*)
_einit = ABSOLUTE(.);
} > flash
.ARM.extab :
{
*(.ARM.extab*)
} > flash
__exidx_start = ABSOLUTE(.);
.ARM.exidx :
{
*(.ARM.exidx*)
} > flash
__exidx_end = ABSOLUTE(.);
_eronly = ABSOLUTE(.);
.data :
{
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
. = ALIGN(4);
_edata = ABSOLUTE(.);
} > sram AT > flash
.bss :
{
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
} > sram
/* Global data not cleared after reset. */
.noinit :
{
_snoinit = ABSOLUTE(.);
*(.noinit*)
_enoinit = 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) }
}

View file

@ -0,0 +1,44 @@
############################################################################
# boards/arm/xmc4/xmc4500-relax/src/Makefile
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership. The
# ASF licenses this file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance with the
# License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
############################################################################
-include $(TOPDIR)/Make.defs
ASRCS =
CSRCS = xmc4_boot.c xmc4_bringup.c
ifeq ($(CONFIG_BUTTONS),y)
CSRCS += xmc4_buttons.c
endif
ifeq ($(CONFIG_ARCH_LEDS),y)
CSRCS += xmc4_autoleds.c
else
CSRCS += xmc4_userleds.c
endif
ifeq ($(CONFIG_LIB_BOARDCTL),y)
CSRCS += xmc4_appinit.c
endif
ifeq ($(CONFIG_TESTING_OSTEST),y)
CSRCS += xmc4_ostest.c
endif
include $(TOPDIR)/boards/Board.mk

View file

@ -0,0 +1,89 @@
/****************************************************************************
* boards/arm/xmc4/xmc4700-relax/src/xmc4700-relax.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __BOARDS_ARM_XMC4_XMC4700_RELAX_SRC_XMC4700_RELAX_H
#define __BOARDS_ARM_XMC4_XMC4700_RELAX_SRC_XMC4700_RELAX_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include "xmc4_gpio.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* LEDs
*
* The XMC4700 Relax board has two LEDs:
*
* LED1 P5.9, Pad type A1+, High output illuminates
* LED2 P5.8, Pad type A1+ High output illuminates
*/
#define GPIO_LED1 (GPIO_OUTPUT | GPIO_OUTPUT_PUSHPULL | \
GPIO_PADA1P_STRONGSOFT | GPIO_PINCTRL_SOFTWARE | \
GPIO_OUTPUT_CLEAR | GPIO_PORT5 | GPIO_PIN9)
#define GPIO_LED2 (GPIO_OUTPUT | GPIO_OUTPUT_PUSHPULL | \
GPIO_PADA1P_STRONGSOFT | GPIO_PINCTRL_SOFTWARE | \
GPIO_OUTPUT_CLEAR | GPIO_PORT5 | GPIO_PIN8)
/* BUTTONS
*
* The XMC4700 Relax board has two buttons:
*
* BUTTON1 P15.13, Pad type A2, Low input sensed when button pressed
* BUTTON2 P15.12, Pad type A2, Low input sensed when button pressed
*/
#define GPIO_BUTTON1 (GPIO_INPUT | GPIO_PINCTRL_SOFTWARE | \
GPIO_PORT15 | GPIO_PIN13)
#define GPIO_BUTTON2 (GPIO_INPUT | GPIO_PINCTRL_SOFTWARE | \
GPIO_PORT15 | GPIO_PIN12)
/****************************************************************************
* Public Types
****************************************************************************/
/****************************************************************************
* Public data
****************************************************************************/
#ifndef __ASSEMBLY__
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: xmc4_bringup
*
* Description:
* Bring up board features
*
****************************************************************************/
int xmc4_bringup(void);
#endif /* __ASSEMBLY__ */
#endif /* __BOARDS_ARM_XMC4_XMC4700_RELAX_SRC_XMC4700_RELAX_H */

View file

@ -0,0 +1,71 @@
/****************************************************************************
* boards/arm/xmc4/xmc4700-relax/src/xmc4_appinit.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <arch/board/board.h>
#include "xmc4700-relax.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_app_initialize
*
* Description:
* Perform application specific initialization. This function is never
* called directly from application code, but only indirectly via the
* (non-standard) boardctl() interface using the command BOARDIOC_INIT.
*
* Input Parameters:
* arg - The boardctl() argument is passed to the board_app_initialize()
* implementation without modification. The argument has no
* meaning to NuttX; the meaning of the argument is a contract
* between the board-specific initialization logic and the
* matching application logic. The value 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)
{
#ifndef CONFIG_BOARD_LATE_INITIALIZE
/* Perform board initialization */
return xmc4_bringup();
#else
return OK;
#endif /* CONFIG_BOARD_LATE_INITIALIZE */
}

View file

@ -0,0 +1,177 @@
/****************************************************************************
* boards/arm/xmc4/xmc4700-relax/include/xmc4_autoleds.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/* The XMC4700 Relax Lite v1 board has two LEDs:
*
* LED1 P5.9 High output illuminates
* LED2 P5.8 High output illuminates
*
* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is
* defined. In that case, the usage by the board port is defined in
* include/board.h and src/sam_autoleds.c. The LEDs are used to encode
* OS-related events as follows:
*
* SYMBOL Meaning LED state
* LED1 LED2
* ------------------ ------------------------ ------ ------
* LED_STARTED NuttX has been started OFF OFF
* LED_HEAPALLOCATE Heap has been allocated OFF OFF
* LED_IRQSENABLED Interrupts enabled OFF OFF
* LED_STACKCREATED Idle stack created 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 N/C Blinking
* LED_IDLE MCU is is sleep mode Not used
*/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "xmc4_gpio.h"
#include "xmc4700-relax.h"
#ifdef CONFIG_ARCH_LEDS
/****************************************************************************
* Private Functions
****************************************************************************/
static void board_led1_on(int led)
{
bool ledon = false;
switch (led)
{
case 0: /* LED1=OFF */
break;
case 1: /* LED1=ON */
ledon = true;
break;
case 2: /* LED1=N/C */
case 3: /* LED1=N/C */
default:
return;
}
xmc4_gpio_write(GPIO_LED1, ledon);
}
static void board_led2_on(int led)
{
bool ledon = false;
switch (led)
{
case 0: /* LED2=OFF */
case 1: /* LED2=OFF */
break;
case 3: /* LED2=ON */
ledon = true;
break;
case 2: /* LED2=N/C */
default:
return;
}
xmc4_gpio_write(GPIO_LED2, ledon);
}
static void board_led1_off(int led)
{
switch (led)
{
case 0: /* LED1=OFF */
case 1: /* LED1=OFF */
break;
case 2: /* LED1=N/C */
case 3: /* LED1=N/C */
default:
return;
}
xmc4_gpio_write(GPIO_LED1, false);
}
static void board_led2_off(int led)
{
switch (led)
{
case 0: /* LED2=OFF */
case 1: /* LED2=OFF */
case 3: /* LED2=OFF */
break;
case 2: /* LED2=N/C */
default:
return;
}
xmc4_gpio_write(GPIO_LED2, false);
}
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_autoled_initialize
****************************************************************************/
void board_autoled_initialize(void)
{
/* Configure LED1-2 GPIOs for output */
xmc4_gpio_config(GPIO_LED1);
xmc4_gpio_config(GPIO_LED2);
}
/****************************************************************************
* Name: board_autoled_on
****************************************************************************/
void board_autoled_on(int led)
{
board_led1_on(led);
board_led2_on(led);
}
/****************************************************************************
* Name: board_autoled_off
****************************************************************************/
void board_autoled_off(int led)
{
board_led1_off(led);
board_led2_off(led);
}
#endif /* CONFIG_ARCH_LEDS */

View file

@ -0,0 +1,80 @@
/****************************************************************************
* boards/arm/xmc4/xmc4700-relax/src/xmc4_boot.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/board.h>
#include <arch/board/board.h>
#include "xmc4700-relax.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: xmc4_board_initialize
*
* Description:
* All STM32 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 xmc4_board_initialize(void)
{
#ifdef CONFIG_ARCH_LEDS
/* Configure on-board LEDs if LED support has been selected. */
board_autoled_initialize();
#endif
#ifdef CONFIG_XMC4_USCI_SPI
xmc4_spidev_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_intitialize() is called and just before the
* initial application is started. This additional initialization phase
* may be used, for example, to initialize board-specific device drivers.
*
****************************************************************************/
#ifdef CONFIG_BOARD_LATE_INITIALIZE
void board_late_initialize(void)
{
/* Perform board initialization */
xmc4_bringup();
}
#endif /* CONFIG_BOARD_LATE_INITIALIZE */

View file

@ -0,0 +1,55 @@
/****************************************************************************
* boards/arm/xmc4/xmc4700-relax/src/xmc4_bringup.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <debug.h>
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: xmc4_bringup
*
* Description:
* Bring up board features
*
****************************************************************************/
int xmc4_bringup(void)
{
int ret = OK;
#ifdef CONFIG_SENSORS_MAX6675
ret = xmc4_max6675initialize("/dev/temp0");
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: stm32_max6675initialize failed: %d\n", ret);
}
#endif
return ret;
}

View file

@ -0,0 +1,63 @@
/****************************************************************************
* boards/arm/xmc4/xmc4700-relax/src/xmc4_buttons.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <arch/board/board.h>
#include "xmc4700-relax.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_button_initialize
****************************************************************************/
void board_button_initialize(void)
{
#warning Missing logic
}
/****************************************************************************
* Name: board_buttons
****************************************************************************/
uint32_t board_buttons(void)
{
#warning Missing logic
return 0;
}
/****************************************************************************
* Name: board_button_irq
****************************************************************************/
#ifdef CONFIG_ARCH_IRQBUTTONS
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
{
#warning Missing logic
return -ENOSYS;
}
#endif /* CONFIG_ARCH_IRQBUTTONS */

View file

@ -0,0 +1,95 @@
/****************************************************************************
* boards/arm/xmc4/xmc4700-relax/src/xmc4_ostest.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <arch/board/board.h>
#include "up_arch.h"
#include "up_internal.h"
#include "xmc4700-relax.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
#undef HAVE_FPU
#if defined(CONFIG_ARCH_FPU) && !defined(CONFIG_TESTING_OSTEST_FPUTESTDISABLE) && \
defined(CONFIG_TESTING_OSTEST_FPUSIZE) && defined(CONFIG_SCHED_WAITPID)
# define HAVE_FPU 1
#endif
#ifdef HAVE_FPU
#if CONFIG_TESTING_OSTEST_FPUSIZE != (4*SW_FPU_REGS)
# error "CONFIG_TESTING_OSTEST_FPUSIZE has the wrong size"
#endif
/****************************************************************************
* Private Data
****************************************************************************/
static uint32_t g_saveregs[XCPTCONTEXT_REGS];
/****************************************************************************
* Public Functions
****************************************************************************/
/* Given an array of size CONFIG_TESTING_OSTEST_FPUSIZE, this function will
* return the current FPU registers.
*/
void arch_getfpu(FAR uint32_t *fpusave)
{
irqstate_t flags;
/* Take a snapshot of the thread context right now */
flags = enter_critical_section();
up_saveusercontext(g_saveregs);
/* Return only the floating register values */
memcpy(fpusave, &g_saveregs[REG_S0], (4*SW_FPU_REGS));
leave_critical_section(flags);
}
/* Given two arrays of size CONFIG_TESTING_OSTEST_FPUSIZE this function
* will compare them and return true if they are identical.
*/
bool arch_cmpfpu(FAR const uint32_t *fpusave1, FAR const uint32_t *fpusave2)
{
return memcmp(fpusave1, fpusave2, (4*SW_FPU_REGS)) == 0;
}
#endif /* HAVE_FPU */

View file

@ -0,0 +1,86 @@
/****************************************************************************
* boards/arm/xmc4/xmc4700-relax/src/xmc4_userleds.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <debug.h>
#include <arch/board/board.h>
#include "xmc4_gpio.h"
#include "xmc4700-relax.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: board_userled_initialize
****************************************************************************/
void board_userled_initialize(void)
{
/* Configure LED1-2 GPIOs for output */
xmc4_gpio_config(GPIO_LED1);
xmc4_gpio_config(GPIO_LED2);
}
/****************************************************************************
* Name: board_userled
****************************************************************************/
void board_userled(int led, bool ledon)
{
gpioconfig_t ledcfg;
if (led == BOARD_LED1)
{
ledcfg = GPIO_LED1;
}
else if (led == BOARD_LED2)
{
ledcfg = GPIO_LED2;
}
else
{
return;
}
xmc4_gpio_write(ledcfg, ledon);
}
/****************************************************************************
* Name: board_userled_all
****************************************************************************/
void board_userled_all(uint8_t ledset)
{
bool ledon;
ledon = ((ledset & BOARD_LED1_BIT) != 0);
xmc4_gpio_write(GPIO_LED1, ledon);
ledon = ((ledset & BOARD_LED2_BIT) != 0);
xmc4_gpio_write(GPIO_LED2, ledon);
}