@ECHO OFF

REM -------------------------------------------------------------

REM Copyright (c) 2007, Silicon Laboratories, Inc.

REM Filename : USB_BL_Build.txt
REM Project  : USB Bootloader (USB_BL)
REM Created  : 12 APR 2006 / PKC
REM Devices  : C8051F320/1/6/7/'F34x
REM Toolchain: Keil

REM Description:
REM This is a batch file that accepts a parameter. 
REM To prevent accidental execution, this has been renamed to *.txt
REM See other batch files in this folder (*.bat) on how to call this file correctly

REM -------------------------------------------------------------

ECHO.
ECHO.USB Bootloader Version 2.0.1 - Beginning Build...
ECHO.

if "%1"=="_C8051F320_1_" GOTO STARTBUILD
if "%1"=="_C8051F326_7_" GOTO STARTBUILD
if "%1"=="_C8051F34X_32K_" GOTO STARTBUILD
if "%1"=="_C8051F34X_64K_" GOTO STARTBUILD

ECHO.Invalid microcontroller choice. See USB_BL_Build_F320_1.bat for an example call.
GOTO QUITBUILD

:STARTBUILD

C:\Keil\C51\BIN\c51.exe USB_BL_ISR.c DB OE OT(9,Size) DEFINE(%1)
C:\Keil\C51\BIN\c51.exe USB_BL_Main.c DB OE OT(9,Size) DEFINE(%1)
C:\Keil\C51\BIN\c51.exe USB_BL_QueueMgmt.c DB OE OT(9,Size) DEFINE(%1)
C:\Keil\C51\BIN\c51.exe USB_BL_USB_Descriptor.c DB OE OT(9,Size) DEFINE(%1)
C:\Keil\C51\BIN\A51.EXE USB_BL_STARTUP.A51 XR GEN DB EP DEFINE(%1)

if "%1"=="_C8051F320_1_" GOTO F320_16K_LINK
if "%1"=="_C8051F326_7_" GOTO F326_16K_LINK
if "%1"=="_C8051F34X_32K_" GOTO F34X_32K_LINK
if "%1"=="_C8051F34X_64K_" GOTO F34X_64K_LINK

:F320_16K_LINK
C:\Keil\C51\BIN\BL51.EXE @F320_16K_LINK.TXT
C:\Keil\C51\BIN\OH51.EXE USB_BL_F320_1_16K.OMF
GOTO QUITBUILD

:F326_16K_LINK
C:\Keil\C51\BIN\BL51.EXE @F326_16K_LINK.TXT
C:\Keil\C51\BIN\OH51.EXE USB_BL_F326_7_16K.OMF
GOTO QUITBUILD

:F34X_32K_LINK
C:\Keil\C51\BIN\BL51.EXE @F34X_32K_LINK.TXT
C:\Keil\C51\BIN\OH51.EXE USB_BL_F34X_32K.OMF
GOTO QUITBUILD

:F34X_64K_LINK
C:\Keil\C51\BIN\BL51.EXE @F34X_64K_LINK.TXT
C:\Keil\C51\BIN\OH51.EXE USB_BL_F34X_64K.OMF

:QUITBUILD
ECHO.
ECHO.End of build process.