diff --git a/arch/arm/src/xmc4/xmc4_lowputc.h b/arch/arm/src/xmc4/xmc4_lowputc.h index f8016c3d78..61d850f7ba 100644 --- a/arch/arm/src/xmc4/xmc4_lowputc.h +++ b/arch/arm/src/xmc4/xmc4_lowputc.h @@ -44,6 +44,7 @@ #include +#include "up_internal.h" #include "xmc4_config.h" #include "xmc4_usic.h" @@ -78,6 +79,22 @@ struct uart_config_s void xmc4_lowsetup(void); +/**************************************************************************** + * Name: xmc4_earlyserialinit + * + * Description: + * Performs the low level UART initialization early in debug so that the + * serial console will be available during bootup. This must be called + * before xmc4_serialinit. NOTE: This function depends on GPIO pin + * configuration performed in xmc_lowsetup() and main clock iniialization + * performed in xmc_clock_configure(). + * + ****************************************************************************/ + +#ifdef USE_EARLYSERIALINIT +void xmc4_earlyserialinit(void); +#endif + /**************************************************************************** * Name: xmc4_uart_configure * diff --git a/arch/arm/src/xmc4/xmc4_serial.c b/arch/arm/src/xmc4/xmc4_serial.c index 8f4fb4026d..d9eaf0db53 100644 --- a/arch/arm/src/xmc4/xmc4_serial.c +++ b/arch/arm/src/xmc4/xmc4_serial.c @@ -1019,7 +1019,7 @@ static bool xmc4_txempty(struct uart_dev_s *dev) ****************************************************************************/ /**************************************************************************** - * Name: up_earlyserialinit + * Name: xmc4_earlyserialinit * * Description: * Performs the low level UART initialization early in debug so that the @@ -1031,7 +1031,7 @@ static bool xmc4_txempty(struct uart_dev_s *dev) ****************************************************************************/ #if defined(USE_EARLYSERIALINIT) -void up_earlyserialinit(void) +void xmc4_earlyserialinit(void) { /* Disable interrupts from all UARTS. The console is enabled in * pic32mx_consoleinit() @@ -1068,7 +1068,7 @@ void up_earlyserialinit(void) * * Description: * Register serial console and serial ports. This assumes - * that up_earlyserialinit was called previously. + * that xmc4_earlyserialinit was called previously. * * Input Parameters: * None diff --git a/arch/arm/src/xmc4/xmc4_start.h b/arch/arm/src/xmc4/xmc4_start.h index 2be470640b..ec76e2bf64 100644 --- a/arch/arm/src/xmc4/xmc4_start.h +++ b/arch/arm/src/xmc4/xmc4_start.h @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_XMC4_XMC4_CLOCKCONFIG_H -#define __ARCH_ARM_SRC_XMC4_XMC4_CLOCKCONFIG_H +#ifndef __ARCH_ARM_SRC_XMC4_XMC4_START_H +#define __ARCH_ARM_SRC_XMC4_XMC4_START_H /************************************************************************************ * Included Files @@ -58,4 +58,4 @@ void xmc4_board_initialize(void); -#endif /* __ARCH_ARM_SRC_XMC4_XMC4_CLOCKCONFIG_H */ +#endif /* __ARCH_ARM_SRC_XMC4_XMC4_START_H */ diff --git a/configs/xmc4500-relax/nsh/Make.defs b/configs/xmc4500-relax/nsh/Make.defs index 2d795a8ee1..4f4b4d98c8 100644 --- a/configs/xmc4500-relax/nsh/Make.defs +++ b/configs/xmc4500-relax/nsh/Make.defs @@ -37,11 +37,7 @@ include ${TOPDIR}/.config include ${TOPDIR}/tools/Config.mk include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs -ifeq ($(CONFIG_ARMV7M_DTCM),y) - LDSCRIPT = flash-dtcm.ld -else - LDSCRIPT = flash-sram.ld -endif +LDSCRIPT = flash.ld ifeq ($(WINTOOL),y) # Windows-native toolchains diff --git a/configs/xmc4500-relax/scripts/flash.ld b/configs/xmc4500-relax/scripts/flash.ld new file mode 100644 index 0000000000..f805eeafaf --- /dev/null +++ b/configs/xmc4500-relax/scripts/flash.ld @@ -0,0 +1,134 @@ +/**************************************************************************** + * configs/xmc4500-relax/scripts/flash.ld + * + * Copyright (C) 2017 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/* The XMC4500 has 1024Kb of FLASH beginning at address 0x0800:0000 and + * 64Kb of SRAM beginning at 0x2000:0000. + * + * When booting from FLASH, FLASH memory is aliased to address 0x0000:0000 + * where the code expects to begin execution by jumping to the entry point in + * the 0x0800:0000 address + * range. + */ + +MEMORY +{ + flash (rx) : ORIGIN = 0x08000000, LENGTH = 1024K + sram (rwx) : ORIGIN = 0x20000000, LENGTH = 64K +} + +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 + _edata = ABSOLUTE(.); + } > sram AT > flash + + .bss : + { + _sbss = ABSOLUTE(.); + *(.bss .bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + _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) } +} diff --git a/configs/xmc4500-relax/src/Makefile b/configs/xmc4500-relax/src/Makefile index d609e49ac8..f7a63f4630 100644 --- a/configs/xmc4500-relax/src/Makefile +++ b/configs/xmc4500-relax/src/Makefile @@ -42,7 +42,7 @@ ifeq ($(CONFIG_BUTTONS),y) CSRCS += xmc4_buttons.c endif -ifeq ($(CONFIG_USERLED),y) +ifeq ($(CONFIG_ARCH_LEDS),y) CSRCS += xmc4_autoleds.c else CSRCS += xmc4_userleds.c diff --git a/configs/xmc4500-relax/src/xmc4_appinit.c b/configs/xmc4500-relax/src/xmc4_appinit.c index 0c8ffcf2c6..1621317d4d 100644 --- a/configs/xmc4500-relax/src/xmc4_appinit.c +++ b/configs/xmc4500-relax/src/xmc4_appinit.c @@ -43,6 +43,8 @@ #include +#include "xmc4500-relax.h" + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/configs/xmc4500-relax/src/xmc4_boot.c b/configs/xmc4500-relax/src/xmc4_boot.c index 994cdf86c6..cc5fec0c19 100644 --- a/configs/xmc4500-relax/src/xmc4_boot.c +++ b/configs/xmc4500-relax/src/xmc4_boot.c @@ -49,7 +49,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: xmc4_boardinitialize + * Name: xmc4_board_initialize * * Description: * All STM32 architectures must provide the following entry point. This entry point @@ -58,7 +58,7 @@ * ************************************************************************************/ -void xmc4_boardinitialize(void) +void xmc4_board_initialize(void) { #ifdef CONFIG_ARCH_LEDS /* Configure on-board LEDs if LED support has been selected. */