From 6256af21d50de95826090dc196840d6deb09177c Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 27 Jun 2019 08:39:12 -0600 Subject: [PATCH] configs/makerlisp/scripts: Add a linker script to support copying the NuttX image from FLASH into external SRAM. --- configs/makerlisp/scripts/Make.defs | 2 + .../scripts/makerlisp_copytoram.linkcmd | 98 +++++++++++++++++++ .../makerlisp/scripts/makerlisp_flash.linkcmd | 1 + .../makerlisp/scripts/makerlisp_ram.linkcmd | 1 + 4 files changed, 102 insertions(+) create mode 100644 configs/makerlisp/scripts/makerlisp_copytoram.linkcmd diff --git a/configs/makerlisp/scripts/Make.defs b/configs/makerlisp/scripts/Make.defs index 5b779d8b46..081771e504 100644 --- a/configs/makerlisp/scripts/Make.defs +++ b/configs/makerlisp/scripts/Make.defs @@ -162,6 +162,8 @@ ARFLAGS = -quiet -warn ifeq ($(CONFIG_BOOT_RUNFROMFLASH),y) LDSCRIPT = makerlisp_flash.linkcmd +else ifeq ($(CONFIG_MAKERLISP_COPYTORAM),y) + LDSCRIPT = makerlisp_copytoram.linkcmd else # ifeq ($(CONFIG_BOOT_RUNFROMEXTSRAM),y) LDSCRIPT = makerlisp_ram.linkcmd endif diff --git a/configs/makerlisp/scripts/makerlisp_copytoram.linkcmd b/configs/makerlisp/scripts/makerlisp_copytoram.linkcmd new file mode 100644 index 0000000000..e678ad0c90 --- /dev/null +++ b/configs/makerlisp/scripts/makerlisp_copytoram.linkcmd @@ -0,0 +1,98 @@ +/****************************************************************************/ +/* configs/makerlisp/scripts/makerlisp_copytoram.linkcmd */ +/* For configurations booting from flash but otherwise running out of RAM */ +/* */ +/* Copyright (C) 2019 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. */ +/* */ +/****************************************************************************/ + +-FORMAT=OMF695,INTEL32 +-map -maxhexlen=64 -quiet -warnoverlap -xref -unresolved=fatal +-sort NAME=ascending -warn -debug -NOigcase + +RANGE ROM $000000 : $03FFFF +RANGE RAM $040000 : $13FFFF +RANGE EXTIO $000000 : $00FFFF +RANGE INTIO $000000 : $0000FF + +CHANGE TEXT is CODE +CHANGE CODE is RAM +CHANGE STRSECT is CODE +ORDER .RESET,.IVECTS,.STARTUP,CODE,DATA +COPY CODE ROM +COPY DATA ROM + +DEFINE __low_romdata = copy base of DATA +DEFINE __low_data = base of DATA +DEFINE __len_data = length of DATA +DEFINE __low_bss = base of BSS +DEFINE __len_bss = length of BSS +DEFINE __stack = highaddr of RAM + 1 +DEFINE __heaptop = highaddr of RAM +DEFINE __heapbot = top of RAM + 1 +DEFINE __low_romcode = copy base of CODE +DEFINE __low_code = base of CODE +DEFINE __len_code = length of CODE +DEFINE __copy_code_to_ram = 1 +DEFINE __crtl = 1 + +DEFINE __CS0_LBR_INIT_PARAM = $04 +DEFINE __CS0_UBR_INIT_PARAM = $0b +DEFINE __CS0_CTL_INIT_PARAM = $08 +DEFINE __CS0_BMC_INIT_PARAM = $00 +DEFINE __CS1_LBR_INIT_PARAM = $0c +DEFINE __CS1_UBR_INIT_PARAM = $13 +DEFINE __CS1_CTL_INIT_PARAM = $08 +DEFINE __CS1_BMC_INIT_PARAM = $00 +DEFINE __CS2_LBR_INIT_PARAM = $20 +DEFINE __CS2_UBR_INIT_PARAM = $9f +DEFINE __CS2_CTL_INIT_PARAM = $88 +DEFINE __CS2_BMC_INIT_PARAM = $00 +DEFINE __CS3_LBR_INIT_PARAM = $00 +DEFINE __CS3_UBR_INIT_PARAM = $00 +DEFINE __CS3_CTL_INIT_PARAM = $00 +DEFINE __CS3_BMC_INIT_PARAM = $00 +DEFINE __RAM_CTL_INIT_PARAM = $80 +DEFINE __RAM_ADDR_U_INIT_PARAM = $AF +DEFINE __FLASH_CTL_INIT_PARAM = $88 +DEFINE __FLASH_ADDR_U_INIT_PARAM = $00 + +define _SYS_CLK_FREQ = 50000000 + +define _OSC_FREQ = 5000000 +define _SYS_CLK_SRC = 1 +define _OSC_FREQ_MULT = 10 +define __PLL_CTL0_INIT_PARAM = $41 + +define _zsl_g_clock_xdefine = 50000000 + +/* arch/z80/src/Makefile.zdsii will append target, object and library paths below */ + diff --git a/configs/makerlisp/scripts/makerlisp_flash.linkcmd b/configs/makerlisp/scripts/makerlisp_flash.linkcmd index a55476e2d6..47fec0eb74 100644 --- a/configs/makerlisp/scripts/makerlisp_flash.linkcmd +++ b/configs/makerlisp/scripts/makerlisp_flash.linkcmd @@ -1,5 +1,6 @@ /****************************************************************************/ /* configs/makerlisp/scripts/makerlisp_flash.linkcmd */ +/* For configurations running entirely out of FLASH */ /* */ /* Copyright (C) 2019 Gregory Nutt. All rights reserved. */ /* Author: Gregory Nutt */ diff --git a/configs/makerlisp/scripts/makerlisp_ram.linkcmd b/configs/makerlisp/scripts/makerlisp_ram.linkcmd index a717536bd7..d7e92ac199 100644 --- a/configs/makerlisp/scripts/makerlisp_ram.linkcmd +++ b/configs/makerlisp/scripts/makerlisp_ram.linkcmd @@ -1,5 +1,6 @@ /****************************************************************************/ /* configs/makerlisp/scripts/makerlisp_ram.linkcmd */ +/* For configurations running entirely out of RAM with nothing in FLASH */ /* */ /* Copyright (C) 2019 Gregory Nutt. All rights reserved. */ /* Author: Gregory Nutt */