⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 makefile

📁 U盘控制器USB97C223的固件代码,对2kPAGE NAND FLASH 有很好的支持.
💻
字号:

################################################################################
##  ____________________________________________________________________________
##                                ______________________________________________
##   SSSS  M   M          CCCC          Standard Microsystems Corporation
##  S      MM MM   SSSS  C                    Austin Design Center
##   SSS   M M M  S      C                 11000 N. Mopac Expressway
##      S  M   M   SSS   C                Stonelake Bldg. 6, Suite 500
##  SSSS   M   M      S   CCCC                Austin, Texas 78759
##                SSSS            ______________________________________________
##  ____________________________________________________________________________
##
##  Copyright(C) 1999, Standard Microsystems Corporation
##  All Rights Reserved.
##
##  This program code listing is proprietary to SMSC and may not be copied,
##  distributed, or used without a license to do so.  Such license may have
##  Limited or Restricted Rights. Please refer to the license for further
##  clarification.
##  ____________________________________________________________________________
##
##  Notice: The program contained in this listing is a proprietary trade
##  secret of SMSC, Hauppauge, New York, and is copyrighted
##  under the United States Copyright Act of 1976 as an unpublished work,
##  pursuant to Section 104 and Section 408 of Title XVII of the United
##  States code. Unauthorized copying, adaption, distribution, use, or
##  display is prohibited by this law.
##  ____________________________________________________________________________
##
##  Use, duplication, or disclosure by the Government is subject to
##  restrictions as set forth in subparagraph(c)(1)(ii) of the Rights
##  in Technical Data and Computer Software clause at DFARS 52.227-7013.
##  Contractor/Manufacturer is Standard Microsystems Corporation,
##  80 Arkay Drive, Hauppauge, New York, 1178-8847.
##  ____________________________________________________________________________
##  ____________________________________________________________________________
##
##  <module name> - <module description>
##  ____________________________________________________________________________
##
##  comments
##  this makefile is for use with microsoft nmake.exe
##  nmake is part of visual studio.  the documentation
##  is included with visual studio.
##  ____________________________________________________________________________
##
##  Revision History
##  Date      Who  Comment
##  ________  ___  ____________________________________________________________
##  03/17/01  tbh  initial version
##  10/04/01  tbh  no longer pushes files
##  11/29/01  tbh  added upgrade.c and upgrade.h to enable dfu support
##  11/29/01  tbh  ported to minimos-2.2 build style
##  02/26/02  tbh  updated to optionally build components as specified via env vars
##  04/01/02  tbh  updated optional build so map.c, media.c, ata.c are optional
##  06/05/02  cds  updated optional build to include smhd lun
##  07/19/02  tbh  added k_opt_$(OPT)
##  07/30/02  cds  added the 'ORDER' compile-time flag to optimize paging of
##                 media_data into xdata variables
##  08/06/02  tbh  changed $(OPT) to $(OPT0), $(OPT1), ... to allow more options,
##                 albeit in a particularly crude way.
##  09/11/02  tbh  tweaked nvstore optsrc so as to allow nvdata in otprom with nand.
##  09/22/02  tbh  added OPT2 for dfu
##  10/05/02  cds  fixed OPT2 to define k_opt_dfu and include upgrade.c in OPTSRC
##  05/07/03  ds   changed the optimization setting to 'Optimize for code size'
##                 (OPTIMIZE(9, SIZE))
##  06/03/03  ds   fixed a trgen bug, where it fails on fastcopy.a51.
##  06/24/03  sbs  The (OPTIMIZE(9, SIZE)) breaks the OTPROM Update discriptor.
##                 Changed the OPT level to 8.
##  07/07/03  tbh  unwind the 06/24/03 change.
##                 some functions must be fully relocatable so that they can be
##                 copied from flash into executable ram, allowing them to
##                 execute while the flash is unavailable (programming or erasing).
##                 optimization level 9, specified in this file, forces
##                 common block subroutine optimization (level 9), injecting
##                 subroutines for compiler identified common blocks.
##                 that results in calls from the relocated routines to compiler
##                 generated subroutines in the flash during the time that the
##                 flash is inoperable.  that causes execution to halt.
##                 the solution is to enclose the sensitive routines within
##                 #pragma OPTIMIZE(8, size), preventing the compiler from
##                 performing common block subroutine optimization for the sensitive
##                 routines only.  the remainder of the code is unaffected.
##                 the following modules are affected:
##                   flash.c
##                   upgrade.c
## 07/30/03  sbs   Some of the ISR functions and mcu_suspend fuction has to be 
##                 located at absolute address space to support the DFU bank
##                 switch application.Please reafer to release doc on detailed
##                 information.
## 09/12/03  am    Added OPT4 and OPT5 to build options to support code hiding.
##                 OPT4 is used for xD. OPT5 is for future SD use.


################################################################################

!include "version.inc"

ROM = fmc
ROMFILE = $(ROM).$(MAJOR_DEVICE_VER).$(MINOR_DEVICE_VER).$(EXTERNAL_CHANGE_VER).$(INTERNAL_CHANGE_VER)

# NOTE=> define on command line MCU
# MCU must be one of the following:
#  97201
#  97210


#specify which assembler to use
AS = a51


#specify which compiler to use
CC = c51

#specify which linker to use
LD = bl51

#specify which librarian to use
AR = lib51

#specify assembler options
ASFLAGS = XR GEN  OBJECT($@)

#specify compiler options
# CD - no assembly code listed
# DB - debug info (for romfilter/romset)
# SB - list symbols
# OE - object extend, additional debug info
# OR - keep variables in order declared
# REGPARMS - pass up to 3 parameters in registers where possible
# MODDP2 - dual data pointers
# these are the production build options for u2dp on 10x
CCFLAGS = CD DB ORDER MODDP2 OPTIMIZE(9, SIZE)

#specify linker options
# NODL - exclude debug from listing
# NODS - exclude symbol information
# NODP - exclude public symbol information
# NOMA - exclude map from listing
# NOPU - exclude public sumbols from listing
# NOSY - exclude local symbols form listing
# NOLI - exclude line numbers from listing
# NOOL - prevent data segment overlaying
# IXREF - include cross reference
LDFLAGS = NODL NOLI NOOL IXREF RS(256) XDATA(4000H) CODE(?PR?_?MCU_START_SUSPEND?MCU (0x1000),?PR?_?BANK_SWITCH_IRQ?ISR (0x2000),?PR?_?ISR8?ISR (0x6F03)) PRINT(out.map)

#specify the combined build options for the compiler
CCBUILD = $(CCFLAGS) OBJECT($@) DF(k_opt_$(OPT0),\
                                   k_opt_$(OPT1),\
                                   k_opt_$(OPT2),\
                                   k_opt_$(OPT3),\
				   k_opt_$(OPT4),\
				   k_opt_$(OPT5),\
                                   k_pfm_$(PFM),\
                                   k_mcu_$(MCU),\
                                   k_max_log_lun=$(MAXLUN),\
                                   k_log_lun_cf=$(LUNCF),\
                                   k_log_lun_ms=$(LUNMS),\
                                   k_log_lun_sm=$(LUNSM),\
                                   k_log_lun_sd=$(LUNSD),\
                                   k_log_lun_mmc=$(LUNSD),\
                                   k_log_lun_nand=$(LUNNAND))

#the optional source files: cf, mapper, ms, sm, sd, nand, softare ecc, non-volatile store, dfu, or security
OPTSRC =%cf%map%ms%sm%sd%nand%ecc%nvs%dfu!
OPTOBJ =%cf%map%ms%sm%sd%nand%ecc%nvs%dfu!

!IF $(LUNCF)<$(MAXLUN)
OPTSRC =$(OPTSRC:%cf=ata.c cf.c)
OPTOBJ =$(OPTOBJ:%cf=ata.obj cf.obj)
!ELSE
OPTSRC =$(OPTSRC:%cf=)
OPTOBJ =$(OPTOBJ:%cf=)
!ENDIF

!IF $(LUNMS)<$(MAXLUN)
OPTSRC =$(OPTSRC:%ms=ms.c ms_media.c)
OPTOBJ =$(OPTOBJ:%ms=ms.obj ms_media.obj)
!ELSE
OPTSRC =$(OPTSRC:%ms=)
OPTOBJ =$(OPTOBJ:%ms=)
!ENDIF

!IF $(LUNSM)<$(MAXLUN) || $(LUNMS)<$(MAXLUN) || $(LUNNAND)<$(MAXLUN)
OPTSRC =$(OPTSRC:%map=map.c media.c)
OPTOBJ =$(OPTOBJ:%map=map.obj media.obj)
!ELSE
OPTSRC =$(OPTSRC:%map=)
OPTOBJ =$(OPTOBJ:%map=)
!ENDIF

!IF $(LUNSM)<$(MAXLUN) || $(LUNNAND)<$(MAXLUN)
OPTSRC =$(OPTSRC:%sm=sm.c sm_media.c)
OPTOBJ =$(OPTOBJ:%sm=sm.obj sm_media.obj)
!ELSE
OPTSRC =$(OPTSRC:%sm=)
OPTOBJ =$(OPTOBJ:%sm=)
!ENDIF

!IF $(LUNNAND)<$(MAXLUN)
OPTSRC =$(OPTSRC:%nand=nand.c nand_media.c nand_2k_media.c)
OPTOBJ =$(OPTOBJ:%nand=nand.obj nand_media.obj nand_2k_media.obj)
!ELSE
OPTSRC =$(OPTSRC:%nand=)
OPTOBJ =$(OPTOBJ:%nand=)
!ENDIF

!IF $(LUNSM)<$(MAXLUN)
OPTSRC =$(OPTSRC:%ecc=ecc.c)
OPTOBJ =$(OPTOBJ:%ecc=ecc.obj)
!ELSE
OPTSRC =$(OPTSRC:%ecc=)
OPTOBJ =$(OPTOBJ:%ecc=)
!ENDIF

!IF "$(OPT0)"=="eeprom"
OPTSRC =$(OPTSRC:%nvs=eeprom.c)
OPTOBJ =$(OPTOBJ:%nvs=eeprom.obj)
!ELSE IF "$(OPT0)"=="otprom"
OPTSRC =$(OPTSRC:%nvs=flash.c)
OPTOBJ =$(OPTOBJ:%nvs=flash.obj)
!ELSE IF $(LUNNAND)<$(MAXLUN)
OPTSRC =$(OPTSRC:%nvs=)
OPTOBJ =$(OPTOBJ:%nvs=)
!ENDIF

!IF $(LUNSD)<$(MAXLUN)
OPTSRC =$(OPTSRC:%sd=sd.c mmc.c fastcopy.a51 )
OPTOBJ =$(OPTOBJ:%sd=sd.obj mmc.obj fastcopy.obj)
!ELSE
OPTSRC =$(OPTSRC:%sd=)
OPTOBJ =$(OPTOBJ:%sd=)
!ENDIF

!IF "$(OPT2)"=="dfu"
OPTSRC =$(OPTSRC:%dfu=upgrade.c)
OPTOBJ =$(OPTOBJ:%dfu=upgrade.obj)
!ELSE
OPTSRC =$(OPTSRC:%dfu=)
OPTOBJ =$(OPTOBJ:%dfu=)
!ENDIF

OPTSRC =$(OPTSRC:.c =.c)
OPTSRC =$(OPTSRC:.c=.c )
OPTSRC =$(OPTSRC: !=)

OPTOBJ =$(OPTOBJ:.obj =.obj)
OPTOBJ =$(OPTOBJ:.obj=.obj )
OPTOBJ =$(OPTOBJ: !=)

#specify the source files (for maketp to preprocess)
CSOURCE = device.c\
          stream.c\
          protocol.c\
          mscbot.c\
          fmc.c\
          lun.c\
          flash.c\
          pwr.c\
          security.c\
          ..\inc\minimos.h\
          $(OPTSRC)

#specify the dependencies
HEADERS = makefile\
          project.h\
          fastmath.h\
          eeprom.h\
          stream.h\
          upgrade.h\
          protocol.h\
          mscbot.h\
          fmc.h\
          lun.h\
          ata.h\
          dev.h\
          cf.h\
          ms.h\
          ms_media.h\
          sm.h\
          sm_media.h\
          sd.h\
          mmc.h\
          media.h\
          map.h\
          nand.h\
          nand_media.h\
          nand_2k_media.h\
          pwr.h\
          security.h\
          flash.h

#specify the dependencies
INCLUDE = $(HEADERS)\
          ..\inc\*.h

#specify the object files (bl51)
OBJECTS = device.obj\
          stream.obj\
          protocol.obj\
          mscbot.obj\
          fmc.obj\
          lun.obj\
          pwr.obj\
          security.obj\
          $(OPTOBJ)

$(ROM): trace $(ROM).hex

!IF "$(SRC)"==""
SRC = c:\projects\minimos.23\src
!ENDIF

!IF "$(CFG)"==""
CFG = c:\projects\fmc.10\src
!ENDIF

KNL_DIR = $(SRC)
INC_SRC = $(SRC)
LIB_SRC = $(SRC)

# $(OPT) is still used for kernel builds, though there are currently no valid options
# except "hub" for the 102...
kernel: $(KNL_DIR)
  cd $(KNL_DIR)
  nmake clean
  nmake config CFG=$(CFG)
  nmake MCU=$(MCU) OPT=$(OPT) PFM=$(PFM) TRC=$(TRC)
  cd $(CFG)
  nmake install

install:
  copy /Y $(INC_SRC)\*.h ..\inc
  copy /Y $(INC_SRC)\minimos.$(MCU).$(OPT).$(TRC).tp ..\inc\minimos.tp
  copy /Y $(LIB_SRC)\minimos.$(MCU).$(OPT).$(TRC).lib ..\lib\minimos.lib
  copy /Y $(LIB_SRC)\minimos.$(MCU).$(OPT).$(TRC).lib ..\lib\minimos.$(MCU).$(OPT).$(TRC).lib

trace:
! IF "$(TRC)"=="troff"
  nmake troff
! ELSE
  nmake tron
! ENDIF


.IGNORE:
.PRECIOUS:
$(ROM).hex: build.obj
  OH51 build.obj HEXFILE ($(ROM).hex)
  @echo VER: $(ROMFILE).hex
  @echo MCU: $(MCU)
  @echo PFM: $(PFM)
  @echo OPT: $(OPT0) $(OPT1) $(OPT2)
  @copy /y $(ROM).hex $(ROM).$(MAJOR_DEVICE_VER).$(MINOR_DEVICE_VER).$(EXTERNAL_CHANGE_VER).$(INTERNAL_CHANGE_VER).hex

build.obj: $(OBJECTS)
  @$(LD) @<<
  $(OBJECTS: =,) , ..\lib\minimos.lib TO build.obj $(LDFLAGS)
<<

.SUFFIXES: .a51

{.}.a51.obj:
  @echo ASSEMBLING: $<
  @$(AS) $< $(ASFLAGS)


{.}.c.obj:
  @echo COMPILING: $<
  @$(CC) $< $(CCBUILD) OJ($*.obj)

.IGNORE:
troff:
  ..\bin\trgen -cat xxx -f $(CSOURCE) $(HEADERS)


.IGNORE:
tron:
#  ..\bin\trgen -v -cat $(CAT) -lvl $(LVL)  -m ..\inc\minimos.tp -f $(CSOURCE) $(HEADERS)
  ..\bin\trgen  -cat $(CAT) -lvl $(LVL)  -m ..\inc\minimos.tp -f $(CSOURCE) $(HEADERS)


.IGNORE:
clean:
  del *.obj
  del *.lst
  del *.bak

.IGNORE:
pristine:
  del *.obj
  del *.lst
  del *.bak
  del *.lib

################################################################################
# eof

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -