RTEMS Logo

RTEMS 4.6.99.3 On-Line Library


Makefiles Makefiles Used Both During The BSP Design and its Use

PREV UP NEXT Bookshelf BSP and Device Driver Development Guide

3.2: Makefiles Used Both During The BSP Design and its Use

  • Makefiles Creating a New BSP Make Customization File
  • When building a BSP or an application using that BSP, it is necessary to tailor the compilation arguments to account for compiler flags, use custom linker scripts, include the RTEMS libraries, etc.. The BSP must be built using this information. Later, once the BSP is installed with the toolset, this same information must be used when building the application. So a BSP must include a build configuration file. The configuration file is make/custom/BSP.cfg.

    The configuration file is taken into account when building one's application using the RTEMS template Makefiles (make/templates). It is strongly advised to use these template Makefiles since they encapsulate a number of build rules along with the compile and link time options necessary to execute on the target board.

    There is a template Makefile provided for each of class of RTEMS Makefiles. The purpose of each class of RTEMS Makefile is to:

    The following is a shortened and heavily commented version of the make customization file for the gen68340 BSP. The original source for this file can be found in the make/custom directory.

    
    # The RTEMS CPU Family and Model
    RTEMS_CPU=m68k
    RTEMS_CPU_MODEL=mcpu32
    
    include $(RTEMS_ROOT)/make/custom/default.cfg
    
    # The name of the BSP directory used for the actual source code.
    # This allows for build variants of the same BSP source.
    RTEMS_BSP_FAMILY=gen68340
    
    # CPU flag to pass to GCC
    CPU_CFLAGS = -mcpu32
    
    # optimization flag to pass to GCC
    CFLAGS_OPTIMIZE_V=-O4 -fomit-frame-pointer
    
    # The name of the start file to be linked with.  This file is the first
    # part of the BSP which executes.
    START_BASE=start340
    
    # This make-exe macro is used in template makefiles to build the
    # final executable. Any other commands to follow, just as using
    # objcopy to build a PROM image or converting the executable to binary.
    
    define make-exe
    	$(CC) $(CFLAGS) $(CFLAGS_LD) -o $(basename $@).exe $(LINK_OBJS)
    	$(NM) -g -n $(basename $@).exe > $(basename $@).num
    	$(SIZE) $(basename $@).exe
    endif
    


    PREV UP NEXT Bookshelf BSP and Device Driver Development Guide

    Copyright © 1988-2004 OAR Corporation