Advertisement
Guest User

Edited makedefs for MSP432 Energia

a guest
Sep 23rd, 2015
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 6.54 KB | None | 0 0
  1. #******************************************************************************
  2. #
  3. # makedefs - Definitions common to all makefiles.
  4. #
  5. # Copyright (c) 2005-2012 Texas Instruments Incorporated.  All rights reserved.
  6. # Software License Agreement
  7. #
  8. #   Redistribution and use in source and binary forms, with or without
  9. #   modification, are permitted provided that the following conditions
  10. #   are met:
  11. #
  12. #   Redistributions of source code must retain the above copyright
  13. #   notice, this list of conditions and the following disclaimer.
  14. #
  15. #   Redistributions in binary form must reproduce the above copyright
  16. #   notice, this list of conditions and the following disclaimer in the
  17. #   documentation and/or other materials provided with the  
  18. #   distribution.
  19. #
  20. #   Neither the name of Texas Instruments Incorporated nor the names of
  21. #   its contributors may be used to endorse or promote products derived
  22. #   from this software without specific prior written permission.
  23. #
  24. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  25. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  26. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  27. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  28. # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  29. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  30. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  31. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  32. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  33. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  34. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35. #
  36. # This is part of revision 9453 of the Stellaris Firmware Development Package.
  37. #
  38. #******************************************************************************
  39.  
  40. #******************************************************************************
  41. #
  42. # Get the operating system name.  If this is Cygwin, the .d files will be
  43. # munged to convert c: into /cygdrive/c so that "make" will be happy with the
  44. # auto-generated dependencies.
  45. #
  46. #******************************************************************************
  47. os:=${shell uname -s}
  48.  
  49. #******************************************************************************
  50. #
  51. # The compiler to be used.
  52. #
  53. #******************************************************************************
  54. ifndef COMPILER
  55. COMPILER=gcc
  56. endif
  57.  
  58. #******************************************************************************
  59. #
  60. # Definitions for using GCC.
  61. #
  62. #******************************************************************************
  63. ifeq (${COMPILER}, gcc)
  64.  
  65. #
  66. # Get the prefix for the tools to use.  Use arm-stellaris-eabi if it exists,
  67. # otherwise fall back to arm-none-eabi.
  68. #
  69. #PREFIX=${shell type arm-stellaris-eabi-gcc > /dev/null 2>&1 && \
  70. #         echo arm-stellaris-eabi || echo arm-none-eabi}
  71.  
  72. PREFIX=C:\energia\hardware\tools\lm4f\bin\arm-none-eabi
  73.  
  74. #
  75. # The command for calling the compiler.
  76. #
  77. CC=${PREFIX}-gcc
  78.  
  79. #
  80. # The location of the C compiler
  81. # ARMGCC_ROOT is used by some makefiles that need to know where the compiler
  82. # is installed.  It is not used further for normal stellarisware apps
  83. #
  84. ARMGCC_ROOT:=${shell dirname '${shell sh -c "which ${CC}"}'}/..
  85.  
  86. #
  87. # Determine the compiler CPU/FPU options based on the processor variant.
  88. #
  89. ifndef VARIANT
  90. CPU=-mcpu=cortex-m3
  91. FPU=
  92. else
  93. ifeq (${VARIANT}, cm3)
  94. CPU=-mcpu=cortex-m3
  95. FPU=
  96. else
  97. ifeq (${VARIANT}, cm4f)
  98. CPU=-mcpu=cortex-m4
  99. FPU=-mfpu=fpv4-sp-d16 -mfloat-abi=hard
  100. else
  101. $(error Unknown processor variant ${VARIANT}!)
  102. endif
  103. endif
  104. endif
  105.  
  106. #
  107. # The flags passed to the assembler.
  108. #
  109. AFLAGS=-mthumb \
  110.        ${CPU}  \
  111.        ${FPU}  \
  112.        -MD
  113.  
  114. #
  115. # The flags passed to the compiler.
  116. #
  117. CFLAGS=-mthumb             \
  118.        ${CPU}              \
  119.        ${FPU}              \
  120.        -Os                 \
  121.        -ffunction-sections \
  122.        -fdata-sections     \
  123.        -MD                 \
  124.        -std=c99            \
  125.        -Wall               \
  126.        -D${TARGET}         \
  127.        -D${PART}           \
  128.        -g                  \
  129.        -c
  130.  
  131. #
  132. # The command for calling the library archiver.
  133. #
  134. AR=${PREFIX}-ar
  135.  
  136. #
  137. # The command for calling the linker.
  138. #
  139. LD=${PREFIX}-ld
  140.  
  141. #
  142. # The flags passed to the linker.
  143. #
  144. LDFLAGS=--gc-sections
  145.  
  146. #
  147. # Get the location of libgcc.a from the GCC front-end.
  148. #
  149. LIBGCC=${shell ${CC} ${CFLAGS} -print-libgcc-file-name}
  150.  
  151. #
  152. # Get the location of libc.a from the GCC front-end.
  153. #
  154. LIBC=${shell ${CC} ${CFLAGS} -print-file-name=libc.a}
  155.  
  156. #
  157. # Get the location of libm.a from the GCC front-end.
  158. #
  159. LIBM=${shell ${CC} ${CFLAGS} -print-file-name=libm.a}
  160.  
  161. #
  162. # The command for extracting images from the linked executables.
  163. #
  164. OBJCOPY=${PREFIX}-objcopy
  165.  
  166. #
  167. # Tell the compiler to include debugging information if the DEBUG environment
  168. # variable is set.
  169. #
  170. ifdef DEBUG
  171. CFLAGS+=-g -D DEBUG
  172. endif
  173.  
  174. #
  175. # Add the tool specific CFLAGS.
  176. #
  177. CFLAGS+=${CFLAGSgcc}
  178.  
  179. #
  180. # Add the include file paths to AFLAGS and CFLAGS.
  181. #
  182. AFLAGS+=${patsubst %,-I%,${subst :, ,${IPATH}}}
  183. CFLAGS+=${patsubst %,-I%,${subst :, ,${IPATH}}}
  184.  
  185. CFLAGS+=-I../../../common -I../../cores/msp432/driverlib -I../../cores/msp432/driverlib/MSP432P4xx -I../../cores/msp432/inc -I../../cores/msp432/inc/CMSIS @"compiler.opt"
  186.  
  187. #
  188. # The rule for building the object file from each C source file.
  189. #
  190. VERBOSE=foo
  191. lib/${COMPILER}${SUFFIX}/%.o: %.c
  192.     @${CC} ${CFLAGS} -D${COMPILER} -o ${@} ${<}
  193. ifneq ($(findstring CYGWIN, ${os}), )
  194.     @sed -i -r 's/ ([A-Za-z]):/ \/cygdrive\/\1/g' ${@:.o=.d}
  195. endif
  196.  
  197. #
  198. # The rule for building the object file from each assembly source file.
  199. #
  200. lib/${COMPILER}${SUFFIX}/%.o: %.S
  201.     @${CC} ${AFLAGS} -D${COMPILER} -o ${@} -c ${<}
  202. ifneq ($(findstring CYGWIN, ${os}), )
  203.     @sed -i -r 's/ ([A-Za-z]):/ \/cygdrive\/\1/g' ${@:.o=.d}
  204. endif
  205.  
  206. #
  207. # The rule for creating an object library.
  208. #
  209. lib/${COMPILER}${SUFFIX}/%.a:
  210.     @${AR} -cr ${@} ${^}
  211.  
  212. #
  213. # The rule for linking the application.
  214. #
  215. lib/${COMPILER}${SUFFIX}/%.axf:
  216.          ldname="${ROOT}/gcc/standalone.ld";                              \
  217.     ${LD} -T $${ldname}                                                   \
  218.           --entry ${ENTRY_${notdir ${@:.axf=}}}                           \
  219.           ${LDFLAGSgcc_${notdir ${@:.axf=}}}                              \
  220.           ${LDFLAGS} -o ${@} $(filter %.o %.a, ${^})                      \
  221.           '${LIBM}' '${LIBC}' '${LIBGCC}'
  222.     @${OBJCOPY} -O binary ${@} ${@:.axf=.bin}
  223. endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement