📄 genldscript.sh
字号:
#!/bin/sh#******************************************************************************## genldscript.sh - Script to generate a linker script for gcc tools.## Copyright (c) 2006-2007 Luminary Micro, Inc. All rights reserved.## Software License Agreement## Luminary Micro, Inc. (LMI) is supplying this software for use solely and# exclusively on LMI's microcontroller products.## The software is owned by LMI and/or its suppliers, and is protected under# applicable copyright laws. All rights are reserved. Any use in violation# of the foregoing restrictions may subject the user to criminal sanctions# under applicable laws, as well as to civil liability for the breach of the# terms and conditions of this license.## THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED# OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.# LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR# CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.## This is part of revision 1049 of the Stellaris Driver Library.##******************************************************************************## Default part number is the LMS3101#PARTTYPE=LM3S101## Default base address of FLASH is 0x00000000 and SRAM is 0x20000000.#declare -i ROBASE=0x00000000declare -i FlashBase=0x00000000## This integer will hold the size of the flash for the given part.#declare -i FlashSize## Default the filename to standalone.ld.#FILE="standalone.ld"## Default location of code is to run from FLASH.#TEXT_LOAD="FLASH"## Scan the command line arguments.#while getopts ":f:r:w:p:" optdo case $opt in # # -f specifies the name of the output scatter file. # f) FILE=$OPTARG ;; # # -r specifies the read-only base address. # r) ROBASE=$OPTARG ;; # # -p specifies the part number. # p) PARTTYPE=$OPTARG ;; # # All other arugments are invalid. # \?) echo "Usage: genldscript.sh {-f <filename>} {-r <robase}" \ "{-p partnum}" echo "Where:" echo " -f <filename> specifies the name of the output script" \ "file (default is " echo " 'standalone.xcl')." echo " -r <robase> specifies the read-only base address" \ "(default is '0x00000000')." echo " -p <partnum> specifies the part number (default is" \ "'LM3S101')." exit ;; esacdone## Set the Flash and SRAM size based on part.#case $PARTTYPE in # # The LM3S101 has 8 KB of flash and 2 KB of SRAM. # LM3S101) FlashSize=0x00002000 SRAMSize=0x00000800 ;; # # The LM3S102 has 8 KB of flash and 2 KB of SRAM. # LM3S102) FlashSize=0x00002000 SRAMSize=0x00000800 ;; # # The LM3S301 has 16 KB of flash and 2 KB of SRAM. # LM3S301) FlashSize=0x00004000 SRAMSize=0x00000800 ;; # # The LM3S310 has 16 KB of flash and 4 KB of SRAM. # LM3S310) FlashSize=0x00004000 SRAMSize=0x00001000 ;; # # The LM3S315 has 16 KB of flash and 4 KB of SRAM. # LM3S315) FlashSize=0x00004000 SRAMSize=0x00001000 ;; # # The LM3S316 has 16 KB of flash and 4 KB of SRAM. # LM3S316) FlashSize=0x00004000 SRAMSize=0x00001000 ;; # # The LM3S317 has 16 KB of flash and 4 KB of SRAM. # LM3S317) FlashSize=0x00004000 SRAMSize=0x00001000 ;; # # The LM3S328 has 16 KB of flash and 4 KB of SRAM. # LM3S328) FlashSize=0x00004000 SRAMSize=0x00001000 ;; # # The LM3S601 has 32 KB of flash and 8 KB of SRAM. # LM3S601) FlashSize=0x00008000 SRAMSize=0x00002000 ;; # # The LM3S610 has 32 KB of flash and 8 KB of SRAM. # LM3S610) FlashSize=0x00008000 SRAMSize=0x00002000 ;; # # The LM3S611 has 32 KB of flash and 8 KB of SRAM. # LM3S611) FlashSize=0x00008000 SRAMSize=0x00002000 ;; # # The LM3S612 has 32 KB of flash and 8 KB of SRAM. # LM3S612) FlashSize=0x00008000 SRAMSize=0x00002000 ;; # # The LM3S613 has 32 KB of flash and 8 KB of SRAM. # LM3S613) FlashSize=0x00008000 SRAMSize=0x00002000 ;; # # The LM3S615 has 32 KB of flash and 8 KB of SRAM. # LM3S615) FlashSize=0x00008000 SRAMSize=0x00002000 ;; # # The LM3S617 has 32 KB of flash and 8 KB of SRAM. # LM3S617) FlashSize=0x00008000 SRAMSize=0x00002000 ;; # # The LM3S618 has 32 KB of flash and 8 KB of SRAM. # LM3S618) FlashSize=0x00008000 SRAMSize=0x00002000 ;; # # The LM3S628 has 32 KB of flash and 8 KB of SRAM. # LM3S628) FlashSize=0x00008000 SRAMSize=0x00002000 ;; # # The LM3S801 has 64 KB of flash and 8 KB of SRAM. # LM3S801) FlashSize=0x00010000 SRAMSize=0x00002000 ;; # # The LM3S811 has 64 KB of flash and 8 KB of SRAM. # LM3S811) FlashSize=0x00010000 SRAMSize=0x00002000 ;; # # The LM3S812 has 64 KB of flash and 8 KB of SRAM. # LM3S812) FlashSize=0x00010000 SRAMSize=0x00002000 ;; # # The LM3S815 has 64 KB of flash and 8 KB of SRAM. # LM3S815) FlashSize=0x00010000 SRAMSize=0x00002000 ;; # # The LM3S817 has 64 KB of flash and 8 KB of SRAM. # LM3S817) FlashSize=0x00010000 SRAMSize=0x00002000 ;; # # The LM3S818 has 64 KB of flash and 8 KB of SRAM. # LM3S818) FlashSize=0x00010000 SRAMSize=0x00002000 ;; # # The LM3S828 has 64 KB of flash and 8 KB of SRAM. # LM3S828) FlashSize=0x00010000 SRAMSize=0x00002000 ;;esac## If the .text is located in SRAM 0x20000000 then set the address to SRAM and# if the .text is located below SRAM then reduce the flash size by the amount# that the code was offset into FLASH.#if [ $ROBASE -ge 536870912 ]then TEXT_LOAD="SRAM"else FlashBase=$ROBASE FlashSize="$FlashSize - $ROBASE" DataLoad="AT (ADDR(.text) + SIZEOF(.text))"fi## Generate the FLASH section definition.#FLASH_SECTION=`printf "FLASH (rx) : ORIGIN = 0x%08x, LENGTH = 0x%08x" $(( $FlashBase )) $(( $FlashSize ))`## Redirect the rest of the printing of this script to the scatter load file.#exec > ${FILE}echo "/******************************************************************************"echo " *"echo " ****************** WARNING THIS FILE IS AUTOMATICALLY GENERATED **************"echo " ****************** DO NOT MODIFY *********************************************"echo " *"echo " * ${FILE##*/} - Scatter file for Gnu tools"echo " *"echo " * Copyright (c) 2006-2007 Luminary Micro, Inc. All rights reserved."echo " *"echo " * Software License Agreement"echo " *"echo " * Luminary Micro, Inc. (LMI) is supplying this software for use solely and"echo " * exclusively on LMI's microcontroller products."echo " *"echo " * The software is owned by LMI and/or its suppliers, and is protected under"echo " * applicable copyright laws. All rights are reserved. Any use in violation"echo " * of the foregoing restrictions may subject the user to criminal sanctions"echo " * under applicable laws, as well as to civil liability for the breach of the"echo " * terms and conditions of this license."echo " *"echo " * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED"echo " * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF"echo " * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE."echo " * LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR"echo " * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER."echo " *"echo " *****************************************************************************/"echo ""echo "MEMORY"echo "{"echo " $FLASH_SECTION"echo " SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = $SRAMSize"echo "}"echo ""echo "SECTIONS"echo "{"echo " .text :"echo " {"echo " _text = .;"echo " KEEP(*(.isr_vector))"echo " *(.text)"echo " *(.rodata*)"echo " _etext = .;"echo " } > $TEXT_LOAD"echo " .data : $DataLoad"echo " {"echo " _data = .;"echo " *(vtable)"echo " *(.data)"echo " _edata = .;"echo " } > SRAM"echo " .bss :"echo " {"echo " _bss = .;"echo " *(.bss)"echo " *(COMMON)"echo " _ebss = .;"echo " } > SRAM"echo "}"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -