From f7cab905343bcdb414fc7a28df20f9afb5071cb5 Mon Sep 17 00:00:00 2001 From: Mike Line Date: Thu, 11 Nov 2010 13:29:03 -0500 Subject: [PATCH] Added two stage load for c6455 and c6474 The two stage load was added to the c6455 and c6474 --- src/cfg/c6455/iblcfg.h | 13 ++- src/device/c6455/c6455.c | 22 +--- src/device/c6455/c6455init.c | 57 +++++++++ src/device/c6472/c6472.c | 2 + src/device/c6474/c6474.c | 20 +--- src/device/c6474/c6474init.c | 47 ++++++++ src/device/c64x/make/makefile | 4 +- src/make/Makefile | 60 +++++++++- src/make/ibl_c6455/i2crom.map.pre | 71 +++++++++++ src/make/ibl_c6455/ibl.cmd | 64 ++-------- src/make/ibl_c6455/ibl_common.inc | 38 ++++++ src/make/ibl_c6455/ibl_init.cmd | 31 +++++ src/make/ibl_c6455/ibl_init.rmd | 11 ++ src/make/ibl_c6455/ibl_init_image.rmd | 10 ++ src/make/ibl_c6455/ibl_init_objs_template.inc | 18 +++ src/make/ibl_c6455/ibl_objs_template.inc | 56 +++++++++ src/make/ibl_c6472/i2crom.map.pre | 14 ++- src/make/ibl_c6472/ibl_objs_template.inc | 46 +++++--- src/make/ibl_c6474/i2crom.map.pre | 72 ++++++++++++ src/make/ibl_c6474/ibl.cmd | 64 ++-------- src/make/ibl_c6474/ibl_common.inc | 38 ++++++ src/make/ibl_c6474/ibl_init.cmd | 31 +++++ src/make/ibl_c6474/ibl_init.rmd | 11 ++ src/make/ibl_c6474/ibl_init_image.rmd | 10 ++ src/make/ibl_c6474/ibl_init_objs_template.inc | 18 +++ src/make/ibl_c6474/ibl_objs_template.inc | 57 +++++++++ src/make/makestg1 | 69 +++++++++++ src/make/makestg2 | 34 +++--- src/util/romparse/romparse.c | 110 +++++++++++------- src/util/romparse/romparse.h | 4 - 30 files changed, 861 insertions(+), 241 deletions(-) create mode 100644 src/device/c6455/c6455init.c create mode 100644 src/device/c6474/c6474init.c create mode 100644 src/make/ibl_c6455/i2crom.map.pre create mode 100644 src/make/ibl_c6455/ibl_common.inc create mode 100644 src/make/ibl_c6455/ibl_init.cmd create mode 100644 src/make/ibl_c6455/ibl_init.rmd create mode 100644 src/make/ibl_c6455/ibl_init_image.rmd create mode 100644 src/make/ibl_c6455/ibl_init_objs_template.inc create mode 100644 src/make/ibl_c6455/ibl_objs_template.inc create mode 100644 src/make/ibl_c6474/i2crom.map.pre create mode 100644 src/make/ibl_c6474/ibl_common.inc create mode 100644 src/make/ibl_c6474/ibl_init.cmd create mode 100644 src/make/ibl_c6474/ibl_init.rmd create mode 100644 src/make/ibl_c6474/ibl_init_image.rmd create mode 100644 src/make/ibl_c6474/ibl_init_objs_template.inc create mode 100644 src/make/ibl_c6474/ibl_objs_template.inc create mode 100644 src/make/makestg1 diff --git a/src/cfg/c6455/iblcfg.h b/src/cfg/c6455/iblcfg.h index e18706d..f74df83 100644 --- a/src/cfg/c6455/iblcfg.h +++ b/src/cfg/c6455/iblcfg.h @@ -51,13 +51,18 @@ #define IBL_I2C_OWN_ADDR 10 #define IBL_I2C_CFG_ADDR_DELAY 0x100 /* Delay between sending the address and reading data */ -#ifndef IBL_I2C_CFG_EEPROM_BUS_ADDR - #define IBL_I2C_CFG_EEPROM_BUS_ADDR 0x50 +/** + * @brief The default location for the i2c map information can be overridden during make + */ +#ifndef IBL_I2C_MAP_TABLE_DATA_BUS_ADDR + #define IBL_I2C_MAP_TABLE_DATA_BUS_ADDR 0x50 #endif -#define IBL_I2C_CFG_TABLE_DATA_ADDR (0x10000 - 0x300) - +#ifndef IBL_I2C_MAP_TABLE_DATA_ADDR + #define IBL_I2C_MAP_TABLE_DATA_ADDR 0x400 +#endif + diff --git a/src/device/c6455/c6455.c b/src/device/c6455/c6455.c index a5c631d..02dd691 100644 --- a/src/device/c6455/c6455.c +++ b/src/device/c6455/c6455.c @@ -57,26 +57,6 @@ Uint32 deviceLocalAddrToGlobal (Uint32 addr) } -/** - * @brief Configure the PLLs - * - * @details - * Only the main PLL is enabled. The second pll is used for - * emac and DDR, with a fixed multiplier, and is enabled - * at power up. The divider is configurable, but not done here. - */ -void devicePllConfig (void) -{ - if (ibl.pllConfig[ibl_MAIN_PLL].doEnable == TRUE) - hwPllSetPll (MAIN_PLL, - ibl.pllConfig[ibl_MAIN_PLL].prediv, - ibl.pllConfig[ibl_MAIN_PLL].mult, - ibl.pllConfig[ibl_MAIN_PLL].postdiv); - -} - - - /** * @brief * Enable the DDR @@ -171,10 +151,12 @@ int32 devicePowerPeriph (int32 modNum) * * @details */ +#ifndef EXCLUDE_NAND int32 deviceConfigureForNand(void) { return (0); } +#endif /** * @brief diff --git a/src/device/c6455/c6455init.c b/src/device/c6455/c6455init.c new file mode 100644 index 0000000..614df20 --- /dev/null +++ b/src/device/c6455/c6455init.c @@ -0,0 +1,57 @@ +/************************************************************************************ + * FILE PURPOSE: C6455 Device Specific functions used in the 1st load stage + ************************************************************************************ + * FILE NAME: c6455init.c + * + * DESCRIPTION: Implements the device specific functions for the IBL + * + * @file c6455.c + * + * @brief + * This file implements the device specific functions for the IBL + * + ************************************************************************************/ +#include "ibl.h" +#include "device.h" +#include "pllapi.h" +#include "emif31api.h" + + +/** + * @brief Configure the PLLs + * + * @details + * Only the main PLL is enabled. The second pll is used for + * emac and DDR, with a fixed multiplier, and is enabled + * at power up. The divider is configurable, but not done here. + */ +void devicePllConfig (void) +{ + if (ibl.pllConfig[ibl_MAIN_PLL].doEnable == TRUE) + hwPllSetPll (MAIN_PLL, + ibl.pllConfig[ibl_MAIN_PLL].prediv, + ibl.pllConfig[ibl_MAIN_PLL].mult, + ibl.pllConfig[ibl_MAIN_PLL].postdiv); + +} + + + +/** + * @brief + * Return the endian status of the device + * + * @details + * Returns true if the device is executing in little endian mode + */ +extern cregister volatile unsigned int CSR; + +bool deviceIsLittleEndian (void) +{ + if ((CSR & (1 << 8)) == 0) + return (FALSE); + + return (TRUE); + +} + diff --git a/src/device/c6472/c6472.c b/src/device/c6472/c6472.c index 26bdc0e..c5b17ff 100644 --- a/src/device/c6472/c6472.c +++ b/src/device/c6472/c6472.c @@ -108,6 +108,7 @@ int32 devicePowerPeriph (int32 modNum) * @details On the evm the nand controller is enabled by setting * gpio 14 high */ +#ifndef EXCLUDE_NAND int32 deviceConfigureForNand(void) { hwGpioSetDirection(NAND_MODE_GPIO, GPIO_OUT); @@ -115,6 +116,7 @@ int32 deviceConfigureForNand(void) return (0); } +#endif /** diff --git a/src/device/c6474/c6474.c b/src/device/c6474/c6474.c index 9622bcd..dd3d7ca 100644 --- a/src/device/c6474/c6474.c +++ b/src/device/c6474/c6474.c @@ -65,24 +65,6 @@ Uint32 deviceLocalAddrToGlobal (Uint32 addr) } -/** - * @brief Configure the PLLs - * - * @details - * Only the main PLL can be configured here. The DDR pll is enabled by default, - * and the network PLL is enabled through serdes configuration. - * the multiplier and dividers. - */ -void devicePllConfig (void) -{ - if (ibl.pllConfig[ibl_MAIN_PLL].doEnable == TRUE) - hwPllSetPll (MAIN_PLL, - ibl.pllConfig[ibl_MAIN_PLL].prediv, - ibl.pllConfig[ibl_MAIN_PLL].mult, - ibl.pllConfig[ibl_MAIN_PLL].postdiv); - -} - /** * @brief * Enable the DDR @@ -126,7 +108,7 @@ int32 devicePowerPeriph (int32 modNum) * @details On the evm the nand controller is enabled by setting * gpio 14 high */ -#if 0 +#ifndef EXCLUDE_NAND int32 deviceConfigureForNand(void) { hwGpioSetDirection(NAND_MODE_GPIO, GPIO_OUT); diff --git a/src/device/c6474/c6474init.c b/src/device/c6474/c6474init.c new file mode 100644 index 0000000..d6451d7 --- /dev/null +++ b/src/device/c6474/c6474init.c @@ -0,0 +1,47 @@ +/** + * @file c6474init.c + * + * @brief + * c6474 functions used during the initial stage of the ibl load + */ +#include "ibl.h" +#include "device.h" +#include "pllapi.h" + + +/** + * @brief Configure the PLLs + * + * @details + * Only the main PLL can be configured here. The DDR pll is enabled by default, + * and the network PLL is enabled through serdes configuration. + * the multiplier and dividers. + */ +void devicePllConfig (void) +{ + if (ibl.pllConfig[ibl_MAIN_PLL].doEnable == TRUE) + hwPllSetPll (MAIN_PLL, + ibl.pllConfig[ibl_MAIN_PLL].prediv, + ibl.pllConfig[ibl_MAIN_PLL].mult, + ibl.pllConfig[ibl_MAIN_PLL].postdiv); + +} + + +/** + * @brief + * Return the endian status of the device + * + * @details + * Returns true if the device is executing in little endian mode + */ +extern cregister volatile unsigned int CSR; + +bool deviceIsLittleEndian (void) +{ + if ((CSR & (1 << 8)) == 0) + return (FALSE); + + return (TRUE); + +} diff --git a/src/device/c64x/make/makefile b/src/device/c64x/make/makefile index 1452f85..155e507 100644 --- a/src/device/c64x/make/makefile +++ b/src/device/c64x/make/makefile @@ -18,10 +18,10 @@ ifeq ($(TARGET),c6472) CSRC= c6472.c c6472init.c else ifeq ($(TARGET),c6455) - CSRC= c6455.c + CSRC= c6455.c c6455init.c else ifeq ($(TARGET),c6474) - CSRC= c6474.c + CSRC= c6474.c c6474init.c else ifeq ($(TARGET),c6474l) CSRC= c6474l.c diff --git a/src/make/Makefile b/src/make/Makefile index 158284b..c24fcd0 100644 --- a/src/make/Makefile +++ b/src/make/Makefile @@ -8,9 +8,19 @@ #* Usage: make c6455 | c6472 | c6474 | c6474l | c6457 [DEBUG=yes] [ETH=no] [NAND=no] \ #* [BIS=no] [COFF=no] [BLOB=no] [ELF=no] [ENDIAN= both | big | little] [I2C_BUS_ADDR= 0x50 | 0x51] \ #* [COMPACT_I2C=yes] +#* +#* or to make a board specific configuraiton +#* +#* make evm_c6455 | evm_c6472 | evm_c6474 +#* +#* or to test the builds by making all the devices and testing excludes +#* +#* make test #******************************************************************************************* IBLS_C6X= c6455 c6472 c6474 c6474l c6457 +EVMS_C6X= evm_c6455 evm_c6472 evm_c6474 + # Excluding functions from the build reduces the I2C eeprom memory used and # speeds the initial boot time. Note that boot table cannot be excluded @@ -42,7 +52,6 @@ ifeq ($(ELF),no) EXCLUDES+= ELF endif -export EXCLUDES @@ -67,7 +76,7 @@ endif all: - @echo must specify a target [ $(IBLS_C6X) ] + @echo must specify a target [ $(IBLS_C6X) $(EVMS_C6X) ] # The debug flag changes compiler options @@ -78,8 +87,51 @@ export DEBUG $(IBLS_C6X): - make -f makestg1 ARCH=c64x TARGET=$@ I2C_BUS_ADDR=$(I2C_BUS_ADDR) COMPACT=$(COMPACT) ENDIAN_MODE=$(ENDIAN_MODE) $@ - + make -f makestg1 ARCH=c64x TARGET=$@ I2C_BUS_ADDR=$(I2C_BUS_ADDR) COMPACT_I2C=$(COMPACT_I2C) ENDIAN_MODE=$(ENDIAN_MODE) EXCLUDES='$(EXCLUDES)' $@ + + +# Configurations for individual evms +# The c455 EVM has a 128k eeprom (64k at 0x50, 64k at 0x51), so both endians are built with full functionality +evm_c6455: + make -f makestg1 ARCH=c64x TARGET=c6455 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES= c6455 + +# The c6472 EVM has a 128k eeprom (64k at 0x50, 64k at 0x51), so both endians are built with full functionality +evm_c6472: + make -f makestg1 ARCH=c64x TARGET=c6472 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES= c6472 + +# The 6474 EVM has a 32k eeprom. A stripped down version is build with only one endian. +evm_c6474: + make -f makestg1 ARCH=c64x TARGET=c6472 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=little EXCLUDES='ELF NAND BIS' c6474 + cp ibl_c6474/i2crom.dat ibl_c6474/i2crom.dat i2crom_0x50.dat + make -f makestg1 ARCH=c64x TARGET=c6472 I2C_BUS_ADDR=0x51 COMPACT_I2C=no ENDIAN_MODE=big EXCLUDES='ELF NAND BIS' c6474 + cp ibl_c6474/i2crom.dat ibl_c6474/i2crom.dat i2crom_0x51.dat + + +# Test - builds all the targets, with single component exclusion +test: + make -f makestg1 ARCH=c64x TARGET=c6455 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES= c6455 + make -f makestg1 ARCH=c64x TARGET=c6455 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=ETH c6455 + make -f makestg1 ARCH=c64x TARGET=c6455 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=NAND c6455 + make -f makestg1 ARCH=c64x TARGET=c6455 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=BIS c6455 + make -f makestg1 ARCH=c64x TARGET=c6455 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=COFF c6455 + make -f makestg1 ARCH=c64x TARGET=c6455 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=ELF c6455 + make -f makestg1 ARCH=c64x TARGET=c6455 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=BLOB c6455 + + make -f makestg1 ARCH=c64x TARGET=c6472 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES= c6455 + make -f makestg1 ARCH=c64x TARGET=c6472 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=ETH c6455 + make -f makestg1 ARCH=c64x TARGET=c6472 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=NAND c6455 + make -f makestg1 ARCH=c64x TARGET=c6472 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=BIS c6455 + make -f makestg1 ARCH=c64x TARGET=c6472 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=COFF c6455 + make -f makestg1 ARCH=c64x TARGET=c6472 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=ELF c6455 + make -f makestg1 ARCH=c64x TARGET=c6472 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=BLOB c6455 + + make -f makestg1 ARCH=c64x TARGET=c6474 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES= c6455 + make -f makestg1 ARCH=c64x TARGET=c6474 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=ETH c6455 + make -f makestg1 ARCH=c64x TARGET=c6474 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=NAND c6455 + make -f makestg1 ARCH=c64x TARGET=c6474 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=BIS c6455 + make -f makestg1 ARCH=c64x TARGET=c6474 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=COFF c6455 + make -f makestg1 ARCH=c64x TARGET=c6474 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=ELF c6455 + make -f makestg1 ARCH=c64x TARGET=c6474 I2C_BUS_ADDR=0x50 COMPACT_I2C=no ENDIAN_MODE=both EXCLUDES=BLOB c6455 # will need to add a line for each additional ARCH type added clean: diff --git a/src/make/ibl_c6455/i2crom.map.pre b/src/make/ibl_c6455/i2crom.map.pre new file mode 100644 index 0000000..a3f3d17 --- /dev/null +++ b/src/make/ibl_c6455/i2crom.map.pre @@ -0,0 +1,71 @@ +#include "iblcfg.h" +; This file is run through the C preprocessor to get the build time layout information +; The following values must be defined: +; I2C_BUS_ADDR - The I2C bus address of the eeprom holding the ROM boot info and the layout info +; INIT_EXE_FILE - The I2C blocked stage 1 of the ibl +; EXE_FILE_1 - The I2C blocked stage 2 of the ibl, must be the little endian version +; EXE_FILE_2 - The I2C blocked stage 2 of the ibl, must be the big endian version +; PAD_FILE_ID_1 - This pad holds the IBL configuration structure for the little endian version +; PAD_FILE_ID_2 - This pad holds the IBL configuration structure for the big endian version +; +; The section statement directs the ROM boot loader to load the initial endian independent +; portion of the IBL +section +{ + param_index = 0 + boot_mode = 5 + options = 1 + + core_freq_mhz = 50 + i2c_clk_freq_khz = 400 + + dev_addr_ext = I2C_BUS_ADDR + + multi_i2c_id = 0 + my_i2c_id = 1 + address_delay = 0 + exe_file = INIT_EXE_FILE +} + +; The layout statement defines how the resulting I2C image is layed out. The base address +; of this (given in the dev_addr) statement must be known to the initial IBL program +; at compile time. The layout block is simple a group of 32 bit i2c addresses, so +; the order of the exe_file and pad_file_id statements must be configured so as to +; match the definition of struct iblI2cMap_t defined in ibl.h. +layout +{ + dev_addr = IBL_I2C_MAP_TABLE_DATA_ADDR ; Defined in iblcfg.h + dev_addr_ext = I2C_BUS_ADDR + file_align = 0x80 + + exe_file = EXE_FILE_1 + pad_file_id = PAD_FILE_ID_1 + + + exe_file = EXE_FILE_2 + pad_file_id = PAD_FILE_ID_2 +} + +; The pad statements simply provide space for the IBL configuration structures. It is valid to +; have a single configuration structure which is used for both endian values. +pad +{ + pad_file_id = 1 + dev_addr = 0x500 + dev_addr_ext = I2C_BUS_ADDR + len = 0x300 +} + +#if (PAD_FILE_ID_1 != PAD_FILE_ID_2) +pad +{ + pad_file_id = 2 + dev_addr = 0x800 + dev_addr_ext = I2C_BUS_ADDR + len = 0x300 +} +#endif + + + + diff --git a/src/make/ibl_c6455/ibl.cmd b/src/make/ibl_c6455/ibl.cmd index 24fcead..676e8f9 100644 --- a/src/make/ibl_c6455/ibl.cmd +++ b/src/make/ibl_c6455/ibl.cmd @@ -7,72 +7,26 @@ * ************************************************************************************/ +/* In order to speed build time during debug, the object files are saved in + * both big and little endian format. The include file is generated by + * make to use the correct endian object files + */ +#include "ibl_objs.inc" -../main/c64x/make/iblmain.oc -../device/c64x/make/c6455.oc -../ethboot/c64x/make/ethboot.oc -../nandboot/c64x/make/nandboot.oc -../driver/c64x/make/net.oc -../driver/c64x/make/arp.oc -../driver/c64x/make/ip.oc -../driver/c64x/make/udp.oc -../driver/c64x/make/stream.oc -../driver/c64x/make/timer.oc -../driver/c64x/make/bootp.oc -../driver/c64x/make/tftp.oc -../driver/c64x/make/nand.oc -../hw/c64x/make/t64.oc -../hw/c64x/make/cpmacdrv.oc -../hw/c64x/make/pll.oc -../hw/c64x/make/emif31.oc -../hw/c64x/make/mdio.oc -../hw/c64x/make/gpio.oc -../hw/c64x/make/nandgpio.oc -../hw/c64x/make/i2c.oc -../interp/c64x/make/bis.oc -../interp/c64x/make/cload.oc -../interp/c64x/make/osal.oc -../interp/c64x/make/btblwrap.oc -../interp/c64x/make/btblpr.oc -../interp/c64x/make/gem.oc -../interp/c64x/make/blob.oc -../interp/c64x/make/dload.oc -../interp/c64x/make/elfwrap.oc -../interp/c64x/make/dlw_client.oc -../interp/c64x/make/dload_endian.oc -../interp/c64x/make/ArrayList.oc -../ecc/c64x/make/3byte_ecc.oc +/* Symbols from the 1st portion of the load, generated by the make process */ +#include "ibl_init_symbols.inc" +/* Common memory and section areas between ibl_init and ibl */ +#include "ibl_common.inc" --c --stack 0x400 --heap 0x6000 - - - -MEMORY -{ - TEXT : origin = 0x801000, length = 0x20000 - STACK : origin = 0x821000, length = 0x0800 - HEAP : origin = 0x821800, length = 0x6000 - DATA : origin = 0x827800, length = 0x3000 - CFG : origin = 0x831800, length = 0x0300 - STAT : origin = 0x831b00, length = 0x0200 -} SECTIONS { - .stack > STACK - .sysmem > HEAP .cinit > TEXT .const > TEXT .text > TEXT .switch > TEXT .far > DATA .bss > DATA - - .ibl_config_table > CFG - .ibl_status_table > STAT - } diff --git a/src/make/ibl_c6455/ibl_common.inc b/src/make/ibl_c6455/ibl_common.inc new file mode 100644 index 0000000..e9be06e --- /dev/null +++ b/src/make/ibl_c6455/ibl_common.inc @@ -0,0 +1,38 @@ +/************************************************************************************ + * FILE PURPOSE: Provide common memory and sections definitions for ibl_init and ibl + ************************************************************************************ + * FILE NAME: ibl_common.inc + * + * DESCRIPTION: Defines the common memory map and section placement required + * to get ibl and ibl_init to work together in a two stage load + * process. + *************************************************************************************/ + +-c +-stack 0x800 +-heap 0x6000 + + +MEMORY +{ + TEXT_INIT : origin = 0x801000, length = 0x2800 + TEXT : origin = 0x803800, length = 0xd800 + STACK : origin = 0x811000, length = 0x0800 + HEAP : origin = 0x811800, length = 0x6000 + DATA_INIT : origin = 0x817800, length = 0x0200 + DATA : origin = 0x817a00, length = 0x2e00 + CFG : origin = 0x821800, length = 0x0300 + STAT : origin = 0x821b00, length = 0x0200 +} + + +SECTIONS +{ + .stack > STACK + .sysmem > HEAP + + .ibl_config_table > CFG + .ibl_status_table > STAT + +} + diff --git a/src/make/ibl_c6455/ibl_init.cmd b/src/make/ibl_c6455/ibl_init.cmd new file mode 100644 index 0000000..9620990 --- /dev/null +++ b/src/make/ibl_c6455/ibl_init.cmd @@ -0,0 +1,31 @@ +/************************************************************************************ + * FILE PURPOSE: Define the memory usage of the ibl module for the c6455 + ************************************************************************************ + * FILE NAME: ibl.cmd + * + * DESCRIPTION: The memory placement for the IBL is defined + * + ************************************************************************************/ + +/* In order to speed build time during debug, the object files are saved in + * both big and little endian format. The include file is generated by + * make to use the correct endian object files + */ +#include "ibl_init_objs.inc" + + +/* Common memory and section areas between ibl_init and ibl */ +#include "ibl_common.inc" + + +SECTIONS +{ + .cinit > TEXT_INIT + .const > TEXT_INIT + .text > TEXT_INIT + .switch > TEXT_INIT + .far > DATA_INIT + .bss > DATA_INIT + +} + diff --git a/src/make/ibl_c6455/ibl_init.rmd b/src/make/ibl_c6455/ibl_init.rmd new file mode 100644 index 0000000..41c1b87 --- /dev/null +++ b/src/make/ibl_c6455/ibl_init.rmd @@ -0,0 +1,11 @@ +-a +-boot +-e _c_int00 + +ROMS +{ + ROM1: org = 0x0400, length = 0x20000, memwidth = 32, romwidth = 32 + files = { ibl_le.b } +} + + diff --git a/src/make/ibl_c6455/ibl_init_image.rmd b/src/make/ibl_c6455/ibl_init_image.rmd new file mode 100644 index 0000000..2d305e7 --- /dev/null +++ b/src/make/ibl_c6455/ibl_init_image.rmd @@ -0,0 +1,10 @@ +-a +-e _c_int00 + +ROMS +{ + ROM1: org = 0x801000, length = 0x20000, memwidth = 32, romwidth = 32 + files = { ibl_le.b } +} + + diff --git a/src/make/ibl_c6455/ibl_init_objs_template.inc b/src/make/ibl_c6455/ibl_init_objs_template.inc new file mode 100644 index 0000000..5f4a295 --- /dev/null +++ b/src/make/ibl_c6455/ibl_init_objs_template.inc @@ -0,0 +1,18 @@ +/* ibl_init_objs_template.inc + * + * list of object files tagged with the endian field for replacement during make + */ + +../main/c64x/make/iblinit.ENDIAN_TAG.oc +../device/c64x/make/c6455init.ENDIAN_TAG.oc +../hw/c64x/make/pll.ENDIAN_TAG.oc +../hw/c64x/make/i2c.ENDIAN_TAG.oc +../interp/c64x/make/btblwrap.ENDIAN_TAG.oc +../interp/c64x/make/btblpr.ENDIAN_TAG.oc +../interp/c64x/make/gem.ENDIAN_TAG.oc + + + + + + diff --git a/src/make/ibl_c6455/ibl_objs_template.inc b/src/make/ibl_c6455/ibl_objs_template.inc new file mode 100644 index 0000000..09400f1 --- /dev/null +++ b/src/make/ibl_c6455/ibl_objs_template.inc @@ -0,0 +1,56 @@ +/* ibl_objs_template.inc + * + * list of object files tagged with the endian field for replacement during make + */ + +../main/c64x/make/iblmain.ENDIAN_TAG.oc +../device/c64x/make/c6455.ENDIAN_TAG.oc +../driver/c64x/make/timer.ENDIAN_TAG.oc +../hw/c64x/make/t64.ENDIAN_TAG.oc +../hw/c64x/make/psc.ENDIAN_TAG.oc +../hw/c64x/make/emif31.ENDIAN_TAG.oc + + +#ifndef EXCLUDE_BIS +../interp/c64x/make/bis.ENDIAN_TAG.oc +#endif + +#ifndef EXCLUDE_COFF +../interp/c64x/make/cload.ENDIAN_TAG.oc +../interp/c64x/make/osal.ENDIAN_TAG.oc +#endif + +#ifndef EXCLUDE_BLOB +../interp/c64x/make/blob.ENDIAN_TAG.oc +#endif + + +#ifndef EXCLUDE_ELF +../interp/c64x/make/dload.ENDIAN_TAG.oc +../interp/c64x/make/elfwrap.ENDIAN_TAG.oc +../interp/c64x/make/dlw_client.ENDIAN_TAG.oc +../interp/c64x/make/dload_endian.ENDIAN_TAG.oc +../interp/c64x/make/ArrayList.ENDIAN_TAG.oc +#endif + +#ifndef EXCLUDE_ETH +../ethboot/c64x/make/ethboot.ENDIAN_TAG.oc +../driver/c64x/make/net.ENDIAN_TAG.oc +../driver/c64x/make/arp.ENDIAN_TAG.oc +../driver/c64x/make/ip.ENDIAN_TAG.oc +../driver/c64x/make/udp.ENDIAN_TAG.oc +../driver/c64x/make/stream.ENDIAN_TAG.oc +../driver/c64x/make/bootp.ENDIAN_TAG.oc +../driver/c64x/make/tftp.ENDIAN_TAG.oc +../hw/c64x/make/cpmacdrv.ENDIAN_TAG.oc +../hw/c64x/make/mdio.ENDIAN_TAG.oc +#endif + +#ifndef EXCLUDE_NAND +../nandboot/c64x/make/nandboot.ENDIAN_TAG.oc +../driver/c64x/make/nand.ENDIAN_TAG.oc +../ecc/c64x/make/3byte_ecc.ENDIAN_TAG.oc +../hw/c64x/make/gpio.ENDIAN_TAG.oc +../hw/c64x/make/nandgpio.ENDIAN_TAG.oc +#endif + diff --git a/src/make/ibl_c6472/i2crom.map.pre b/src/make/ibl_c6472/i2crom.map.pre index 0d15177..2964367 100644 --- a/src/make/ibl_c6472/i2crom.map.pre +++ b/src/make/ibl_c6472/i2crom.map.pre @@ -51,17 +51,19 @@ layout ; have a single configuration structure which is used for both endian values. pad { - pad_file_id = 1 - dev_addr = 0x500 - len = 0x300 + pad_file_id = 1 + dev_addr = 0x500 + dev_addr_ext = I2C_BUS_ADDR + len = 0x300 } #if (PAD_FILE_ID_1 != PAD_FILE_ID_2) pad { - pad_file_id = 2 - dev_addr = 0x800 - len = 0x300 + pad_file_id = 2 + dev_addr = 0x800 + dev_addr_ext = I2C_BUS_ADDR + len = 0x300 } #endif diff --git a/src/make/ibl_c6472/ibl_objs_template.inc b/src/make/ibl_c6472/ibl_objs_template.inc index 3ace89f..564da74 100644 --- a/src/make/ibl_c6472/ibl_objs_template.inc +++ b/src/make/ibl_c6472/ibl_objs_template.inc @@ -5,33 +5,51 @@ ../main/c64x/make/iblmain.ENDIAN_TAG.oc ../device/c64x/make/c6472.ENDIAN_TAG.oc -../ethboot/c64x/make/ethboot.ENDIAN_TAG.oc -../nandboot/c64x/make/nandboot.ENDIAN_TAG.oc -../driver/c64x/make/net.ENDIAN_TAG.oc -../driver/c64x/make/arp.ENDIAN_TAG.oc -../driver/c64x/make/ip.ENDIAN_TAG.oc -../driver/c64x/make/udp.ENDIAN_TAG.oc -../driver/c64x/make/stream.ENDIAN_TAG.oc ../driver/c64x/make/timer.ENDIAN_TAG.oc -../driver/c64x/make/bootp.ENDIAN_TAG.oc -../driver/c64x/make/tftp.ENDIAN_TAG.oc -../driver/c64x/make/nand.ENDIAN_TAG.oc ../hw/c64x/make/t64.ENDIAN_TAG.oc -../hw/c64x/make/cpmacdrv.ENDIAN_TAG.oc ../hw/c64x/make/psc.ENDIAN_TAG.oc ../hw/c64x/make/emif31.ENDIAN_TAG.oc -../hw/c64x/make/mdio.ENDIAN_TAG.oc -../hw/c64x/make/gpio.ENDIAN_TAG.oc -../hw/c64x/make/nandgpio.ENDIAN_TAG.oc + + +#ifndef EXCLUDE_BIS ../interp/c64x/make/bis.ENDIAN_TAG.oc +#endif + +#ifndef EXCLUDE_COFF ../interp/c64x/make/cload.ENDIAN_TAG.oc ../interp/c64x/make/osal.ENDIAN_TAG.oc +#endif + +#ifndef EXCLUDE_BLOB ../interp/c64x/make/blob.ENDIAN_TAG.oc +#endif +#ifndef EXCLUDE_ELF ../interp/c64x/make/dload.ENDIAN_TAG.oc ../interp/c64x/make/elfwrap.ENDIAN_TAG.oc ../interp/c64x/make/dlw_client.ENDIAN_TAG.oc ../interp/c64x/make/dload_endian.ENDIAN_TAG.oc ../interp/c64x/make/ArrayList.ENDIAN_TAG.oc +#endif + +#ifndef EXCLUDE_ETH +../ethboot/c64x/make/ethboot.ENDIAN_TAG.oc +../driver/c64x/make/net.ENDIAN_TAG.oc +../driver/c64x/make/arp.ENDIAN_TAG.oc +../driver/c64x/make/ip.ENDIAN_TAG.oc +../driver/c64x/make/udp.ENDIAN_TAG.oc +../driver/c64x/make/stream.ENDIAN_TAG.oc +../driver/c64x/make/bootp.ENDIAN_TAG.oc +../driver/c64x/make/tftp.ENDIAN_TAG.oc +../hw/c64x/make/cpmacdrv.ENDIAN_TAG.oc +../hw/c64x/make/mdio.ENDIAN_TAG.oc +#endif + +#ifndef EXCLUDE_NAND +../hw/c64x/make/gpio.ENDIAN_TAG.oc +../hw/c64x/make/nandgpio.ENDIAN_TAG.oc +../driver/c64x/make/nand.ENDIAN_TAG.oc +../nandboot/c64x/make/nandboot.ENDIAN_TAG.oc ../ecc/c64x/make/3byte_ecc.ENDIAN_TAG.oc +#endif diff --git a/src/make/ibl_c6474/i2crom.map.pre b/src/make/ibl_c6474/i2crom.map.pre new file mode 100644 index 0000000..19bb501 --- /dev/null +++ b/src/make/ibl_c6474/i2crom.map.pre @@ -0,0 +1,72 @@ +#include "iblcfg.h" +; This file is run through the C preprocessor to get the build time layout information +; The following values must be defined: +; I2C_BUS_ADDR - The I2C bus address of the eeprom holding the ROM boot info and the layout info +; INIT_EXE_FILE - The I2C blocked stage 1 of the ibl +; EXE_FILE_1 - The I2C blocked stage 2 of the ibl, must be the little endian version +; EXE_FILE_2 - The I2C blocked stage 2 of the ibl, must be the big endian version +; PAD_FILE_ID_1 - This pad holds the IBL configuration structure for the little endian version +; PAD_FILE_ID_2 - This pad holds the IBL configuration structure for the big endian version +; +; The section statement directs the ROM boot loader to load the initial endian independent +; portion of the IBL +section +{ + param_index = 1 + boot_mode = 257 + sw_pll = 20 + options = 1 + + core_freq_mhz = 1000 + i2c_clk_freq_khz = 100 + + dev_addr_ext = I2C_BUS_ADDR + + multi_i2c_id = 0 + my_i2c_id = 1 + address_delay = 200 + exe_file = INIT_EXE_FILE +} + +; The layout statement defines how the resulting I2C image is layed out. The base address +; of this (given in the dev_addr) statement must be known to the initial IBL program +; at compile time. The layout block is simple a group of 32 bit i2c addresses, so +; the order of the exe_file and pad_file_id statements must be configured so as to +; match the definition of struct iblI2cMap_t defined in ibl.h. +layout +{ + dev_addr = IBL_I2C_MAP_TABLE_DATA_ADDR ; Defined in iblcfg.h + dev_addr_ext = I2C_BUS_ADDR + file_align = 0x80 + + exe_file = EXE_FILE_1 + pad_file_id = PAD_FILE_ID_1 + + + exe_file = EXE_FILE_2 + pad_file_id = PAD_FILE_ID_2 +} + +; The pad statements simply provide space for the IBL configuration structures. It is valid to +; have a single configuration structure which is used for both endian values. +pad +{ + pad_file_id = 1 + dev_addr = 0x500 + dev_addr_ext = I2C_BUS_ADDR + len = 0x300 +} + +#if (PAD_FILE_ID_1 != PAD_FILE_ID_2) +pad +{ + pad_file_id = 2 + dev_addr = 0x800 + dev_addr_ext = I2C_BUS_ADDR + len = 0x300 +} +#endif + + + + diff --git a/src/make/ibl_c6474/ibl.cmd b/src/make/ibl_c6474/ibl.cmd index fdabe5a..8cc0067 100644 --- a/src/make/ibl_c6474/ibl.cmd +++ b/src/make/ibl_c6474/ibl.cmd @@ -7,61 +7,18 @@ * ************************************************************************************/ +/* In order to speed build time during debug, the object files are saved in + * both big and little endian format. The include file is generated by + * make to use the correct endian object files + */ +#include "ibl_objs.inc" -../main/c64x/make/iblmain.oc -../device/c64x/make/c6474.oc -../ethboot/c64x/make/ethboot.oc -../driver/c64x/make/net.oc -../driver/c64x/make/arp.oc -../driver/c64x/make/ip.oc -../driver/c64x/make/udp.oc -../driver/c64x/make/stream.oc -../driver/c64x/make/timer.oc -../driver/c64x/make/bootp.oc -../driver/c64x/make/tftp.oc -../hw/c64x/make/t64.oc -../hw/c64x/make/cpmacdrv.oc -../hw/c64x/make/pll.oc -../hw/c64x/make/psc.oc -../hw/c64x/make/emif31.oc -../hw/c64x/make/mdio.oc -../hw/c64x/make/i2c.oc -../hw/c64x/make/sgmii.oc -../interp/c64x/make/bis.oc -../interp/c64x/make/cload.oc -../interp/c64x/make/osal.oc -../interp/c64x/make/btblwrap.oc -../interp/c64x/make/btblpr.oc -../interp/c64x/make/gem.oc -../interp/c64x/make/blob.oc -/* ../interp/c64x/make/dload.oc */ -/* ../interp/c64x/make/elfwrap.oc */ -/* ../interp/c64x/make/dlw_client.oc */ -/* ../interp/c64x/make/dload_endian.oc */ -/* ../interp/c64x/make/ArrayList.oc */ +/* Symbols from the 1st portion of the load, generated by the make process */ +#include "ibl_init_symbols.inc" -/* ../nandboot/c64x/make/nandboot.oc */ -/* ../driver/c64x/make/nand.oc */ -/* ../ecc/c64x/make/3byte_ecc.oc */ -/* ../hw/c64x/make/gpio.oc */ -/* ../hw/c64x/make/nandgpio.oc */ - --c --stack 0x800 --heap 0x6000 - - - -MEMORY -{ - TEXT : origin = 0x801000, length = 0x20000 - STACK : origin = 0x821000, length = 0x0800 - HEAP : origin = 0x821800, length = 0x6000 - DATA : origin = 0x827800, length = 0x3000 - CFG : origin = 0x831800, length = 0x0300 - STAT : origin = 0x831b00, length = 0x0200 -} +/* Common memory and section areas between ibl_init and ibl */ +#include "ibl_common.inc" SECTIONS { @@ -74,8 +31,5 @@ SECTIONS .far > DATA .bss > DATA - .ibl_config_table > CFG - .ibl_status_table > STAT - } diff --git a/src/make/ibl_c6474/ibl_common.inc b/src/make/ibl_c6474/ibl_common.inc new file mode 100644 index 0000000..e9be06e --- /dev/null +++ b/src/make/ibl_c6474/ibl_common.inc @@ -0,0 +1,38 @@ +/************************************************************************************ + * FILE PURPOSE: Provide common memory and sections definitions for ibl_init and ibl + ************************************************************************************ + * FILE NAME: ibl_common.inc + * + * DESCRIPTION: Defines the common memory map and section placement required + * to get ibl and ibl_init to work together in a two stage load + * process. + *************************************************************************************/ + +-c +-stack 0x800 +-heap 0x6000 + + +MEMORY +{ + TEXT_INIT : origin = 0x801000, length = 0x2800 + TEXT : origin = 0x803800, length = 0xd800 + STACK : origin = 0x811000, length = 0x0800 + HEAP : origin = 0x811800, length = 0x6000 + DATA_INIT : origin = 0x817800, length = 0x0200 + DATA : origin = 0x817a00, length = 0x2e00 + CFG : origin = 0x821800, length = 0x0300 + STAT : origin = 0x821b00, length = 0x0200 +} + + +SECTIONS +{ + .stack > STACK + .sysmem > HEAP + + .ibl_config_table > CFG + .ibl_status_table > STAT + +} + diff --git a/src/make/ibl_c6474/ibl_init.cmd b/src/make/ibl_c6474/ibl_init.cmd new file mode 100644 index 0000000..6416ca2 --- /dev/null +++ b/src/make/ibl_c6474/ibl_init.cmd @@ -0,0 +1,31 @@ +/************************************************************************************ + * FILE PURPOSE: Define the memory usage of the ibl module for the c6474 + ************************************************************************************ + * FILE NAME: ibl.cmd + * + * DESCRIPTION: The memory placement for the IBL is defined + * + ************************************************************************************/ + +/* In order to speed build time during debug, the object files are saved in + * both big and little endian format. The include file is generated by + * make to use the correct endian object files + */ +#include "ibl_init_objs.inc" + + +/* Common memory and section areas between ibl_init and ibl */ +#include "ibl_common.inc" + + +SECTIONS +{ + .cinit > TEXT_INIT + .const > TEXT_INIT + .text > TEXT_INIT + .switch > TEXT_INIT + .far > DATA_INIT + .bss > DATA_INIT + +} + diff --git a/src/make/ibl_c6474/ibl_init.rmd b/src/make/ibl_c6474/ibl_init.rmd new file mode 100644 index 0000000..41c1b87 --- /dev/null +++ b/src/make/ibl_c6474/ibl_init.rmd @@ -0,0 +1,11 @@ +-a +-boot +-e _c_int00 + +ROMS +{ + ROM1: org = 0x0400, length = 0x20000, memwidth = 32, romwidth = 32 + files = { ibl_le.b } +} + + diff --git a/src/make/ibl_c6474/ibl_init_image.rmd b/src/make/ibl_c6474/ibl_init_image.rmd new file mode 100644 index 0000000..2d305e7 --- /dev/null +++ b/src/make/ibl_c6474/ibl_init_image.rmd @@ -0,0 +1,10 @@ +-a +-e _c_int00 + +ROMS +{ + ROM1: org = 0x801000, length = 0x20000, memwidth = 32, romwidth = 32 + files = { ibl_le.b } +} + + diff --git a/src/make/ibl_c6474/ibl_init_objs_template.inc b/src/make/ibl_c6474/ibl_init_objs_template.inc new file mode 100644 index 0000000..98cff0b --- /dev/null +++ b/src/make/ibl_c6474/ibl_init_objs_template.inc @@ -0,0 +1,18 @@ +/* ibl_init_objs_template.inc + * + * list of object files tagged with the endian field for replacement during make + */ + +../main/c64x/make/iblinit.ENDIAN_TAG.oc +../device/c64x/make/c6474init.ENDIAN_TAG.oc +../hw/c64x/make/pll.ENDIAN_TAG.oc +../hw/c64x/make/i2c.ENDIAN_TAG.oc +../interp/c64x/make/btblwrap.ENDIAN_TAG.oc +../interp/c64x/make/btblpr.ENDIAN_TAG.oc +../interp/c64x/make/gem.ENDIAN_TAG.oc + + + + + + diff --git a/src/make/ibl_c6474/ibl_objs_template.inc b/src/make/ibl_c6474/ibl_objs_template.inc new file mode 100644 index 0000000..c98b6b9 --- /dev/null +++ b/src/make/ibl_c6474/ibl_objs_template.inc @@ -0,0 +1,57 @@ +/* ibl_objs_template.inc + * + * list of object files tagged with the endian field for replacement during make + */ + +../main/c64x/make/iblmain.ENDIAN_TAG.oc +../device/c64x/make/c6474.ENDIAN_TAG.oc +../driver/c64x/make/timer.ENDIAN_TAG.oc +../hw/c64x/make/t64.ENDIAN_TAG.oc +../hw/c64x/make/psc.ENDIAN_TAG.oc +../hw/c64x/make/emif31.ENDIAN_TAG.oc + + +#ifndef EXCLUDE_BIS +../interp/c64x/make/bis.ENDIAN_TAG.oc +#endif + +#ifndef EXCLUDE_COFF +../interp/c64x/make/cload.ENDIAN_TAG.oc +../interp/c64x/make/osal.ENDIAN_TAG.oc +#endif + +#ifndef EXCLUDE_BLOB +../interp/c64x/make/blob.ENDIAN_TAG.oc +#endif + + +#ifndef EXCLUDE_ELF +../interp/c64x/make/dload.ENDIAN_TAG.oc +../interp/c64x/make/elfwrap.ENDIAN_TAG.oc +../interp/c64x/make/dlw_client.ENDIAN_TAG.oc +../interp/c64x/make/dload_endian.ENDIAN_TAG.oc +../interp/c64x/make/ArrayList.ENDIAN_TAG.oc +#endif + +#ifndef EXCLUDE_ETH +../ethboot/c64x/make/ethboot.ENDIAN_TAG.oc +../driver/c64x/make/net.ENDIAN_TAG.oc +../driver/c64x/make/arp.ENDIAN_TAG.oc +../driver/c64x/make/ip.ENDIAN_TAG.oc +../driver/c64x/make/udp.ENDIAN_TAG.oc +../driver/c64x/make/stream.ENDIAN_TAG.oc +../driver/c64x/make/bootp.ENDIAN_TAG.oc +../driver/c64x/make/tftp.ENDIAN_TAG.oc +../hw/c64x/make/cpmacdrv.ENDIAN_TAG.oc +../hw/c64x/make/mdio.ENDIAN_TAG.oc +../hw/c64x/make/sgmii.ENDIAN_TAG.oc +#endif + +#ifndef EXCLUDE_NAND +../nandboot/c64x/make/nandboot.ENDIAN_TAG.oc +../driver/c64x/make/nand.ENDIAN_TAG.oc +../ecc/c64x/make/3byte_ecc.ENDIAN_TAG.oc +../hw/c64x/make/gpio.ENDIAN_TAG.oc +../hw/c64x/make/nandgpio.ENDIAN_TAG.oc +#endif + diff --git a/src/make/makestg1 b/src/make/makestg1 new file mode 100644 index 0000000..592c233 --- /dev/null +++ b/src/make/makestg1 @@ -0,0 +1,69 @@ +#******************************************************************************************* +#* FILE PURPOSE: Top level make for the IBL +#******************************************************************************************* +#* FILE NAME: Makefile +#* +#* DESCRIPTION: Builds the Intermediate Boot Loader (IBL) +#* +#* Usage: make c6455 | c6472 | c6474 | c6474l | c6457 [DEBUG=yes] [ETH=no] [NAND=no] \ +#* [BIS=no] [COFF=no] [BLOB=no] [ELF=no] [ENDIAN= both | big | little] [I2C_BUS_ADDR= 0x50 | 0x51] \ +#* [COMPACT_I2C=yes] +#******************************************************************************************* + +IBLS_C6X= c6455 c6472 c6474 c6474l c6457 + +# Excluding functions from the build reduces the I2C eeprom memory used and +# speeds the initial boot time. Note that boot table cannot be excluded +# because it is required for the two stage I2C load process + +# The endian of the build. The default target builds a single ROM image with both endians present +ifeq ($(ENDIAN_MODE),big) + I2CROM= big_endian + STAGE1_TARGET= be_target +else + ifeq ($(ENDIAN_MODE),little) + I2CROM= little_endian + STAGE1_TARGET= le_target + else + I2CROM= both + STAGE1_TARGET= be_target le_target compare + endif +endif + +# The i2c ROM bus address. The code will advance accross I2C bus address boundaries (the code must +# be blocked so that a single block doesn't cross a boundary, however). +ifndef I2C_BUS_ADDR + I2C_BUS_ADDR=0x50 +endif + +# Excludes identify which components are not part of the build +export EXCLUDES + +all: + @echo must specify a target [ $(IBLS_C6X) ] + + + +be_target: + make -f makestg2 ARCH=c64x TARGET=$(TARGET) ENDIAN=big I2C_BUS_ADDR=$(I2C_BUS_ADDR) $(TARGET) + +le_target: + make -f makestg2 ARCH=c64x TARGET=$(TARGET) ENDIAN=little I2C_BUS_ADDR=$(I2C_BUS_ADDR) $(TARGET) + +compare: + make -f makestg2 ARCH=c64x TARGET=$(TARGET) compare + + +$(IBLS_C6X): $(STAGE1_TARGET) + make -f makestg2 ARCH=c64x TARGET=$@ I2CROM=$(I2CROM) I2C_BUS_ADDR=$(I2C_BUS_ADDR) COMPACT_I2C=$(COMPACT_I2C) i2cRom + + + + + + + + + + + diff --git a/src/make/makestg2 b/src/make/makestg2 index f675cca..9f0ed7a 100644 --- a/src/make/makestg2 +++ b/src/make/makestg2 @@ -11,11 +11,11 @@ ifndef IBL_ROOT IBL_ROOT=.. endif -MAIN_MODULE= main -MODULES= device ethboot nandboot driver hw interp ecc +CFG_MODULES= main device +MODULES= ethboot nandboot driver hw interp ecc CLEAN_MODULES=$(addprefix clean_,$(MODULES)) -CLEAN_MODULES+=$(addprefix clean,$(MAIN_MODULE)) +CLEAN_MODULES+=$(addprefix clean,$(CFG_MODULES)) TARGETS= c6472 c6474 c6474l c6455 c6457 @@ -39,10 +39,8 @@ else IEXT= be endif -ifeq ($(TARGET),c6474) +ifeq ($(COMPACT_I2C),yes) COMPACT= -compact -else - COMPACT= endif include $(IBL_ROOT)/make/$(ARCH)/makedefs.mk @@ -88,8 +86,8 @@ endif i2cRom: - cl6x -ppo -I../cfg/$(TARGET) $(I2C_DEFS) ibl_$(TARGET)/$@.map.pre - ../util/romparse/romparse $(COMPACT) ibl_$(TARGET)/$@.map.pp + $(CC) -ppo -I../cfg/$(TARGET) $(I2C_DEFS) ibl_$(TARGET)/$@.map.pre + ../util/romparse/romparse $(COMPACT) -rom_base $(I2C_BUS_ADDR) ibl_$(TARGET)/$@.map.pp $(CP) i2crom.ccs ibl_$(TARGET)/$@.ccs $(CP) i2crom.ccs ibl_$(TARGET)/$@.dat $(RM) i2crom.ccs ibl_le.b ibl.b @@ -108,11 +106,11 @@ compare: # For the init code a raw image is created as well as the i2c code to verify # endian independent code is generated. The symbols required for linking # the full application are then extracted -iblInit: $(MAIN_MODULE) $(MODULES) utils +iblInit: $(CFG_MODULES) $(MODULES) utils cat ibl_$(TARGET)/ibl_init_objs_template.inc | sed -e s/ENDIAN_TAG/$(IEXT)/g > ibl_$(TARGET)/ibl_init_objs.inc $(LD) -o ibl_$(TARGET)/ibl_$(TARGET)_init.out -m ibl_$(TARGET)/ibl_$(TARGET)_init.map ibl_$(TARGET)/ibl_init.cmd $(RTLIBS) - cp ibl_$(TARGET)/ibl_$(TARGET)_init.out ibl_$(TARGET)/ibl_$(TARGET)_init.$(IEXT).out - rm -f ibl_$(TARGET)/ibl_init_obj.inc + $(CP) ibl_$(TARGET)/ibl_$(TARGET)_init.out ibl_$(TARGET)/ibl_$(TARGET)_init.$(IEXT).out + $(RM) -f ibl_$(TARGET)/ibl_init_obj.inc hex6x $(HEX_OPT) ibl_$(TARGET)/ibl_init_image.rmd ibl_$(TARGET)/ibl_$(TARGET)_init.out $(CP) ibl_le.b ibl_$(TARGET)/ibl.b @@ -127,11 +125,13 @@ iblInit: $(MAIN_MODULE) $(MODULES) utils bash ../util/symExtract/symExtract ibl_$(TARGET)/ibl_$(TARGET)_init.map ibl_$(TARGET)/ibl_init_symbols.inc $(COMMON_SYMBOLS) -iblMain: iblInit $(MAIN_MODULE) $(MODULES) - cat ibl_$(TARGET)/ibl_objs_template.inc | sed -e s/ENDIAN_TAG/$(IEXT)/g > ibl_$(TARGET)/ibl_objs.inc +iblMain: iblInit $(CFG_MODULES) $(MODULES) + cat ibl_$(TARGET)/ibl_objs_template.inc | sed -e s/ENDIAN_TAG/$(IEXT)/g > ibl_$(TARGET)/ibl_objs.tmp + $(CC) -ppo $(MAINDEFS) -DENDIAN_TAG=$(IEXT) ibl_$(TARGET)/ibl_objs.tmp + $(CP) ibl_$(TARGET)/ibl_objs.pp ibl_$(TARGET)/ibl_objs.inc $(LD) -o ibl_$(TARGET)/ibl_$(TARGET).out -m ibl_$(TARGET)/ibl_$(TARGET).$(IEXT).map ibl_$(TARGET)/ibl.cmd $(RTLIBS) - cp ibl_$(TARGET)/ibl_$(TARGET).out ibl_$(TARGET)/ibl_$(TARGET).$(IEXT).out - rm -f ibl_$(TARGET)/ibl_obj.inc + $(CP) ibl_$(TARGET)/ibl_$(TARGET).out ibl_$(TARGET)/ibl_$(TARGET).$(IEXT).out + $(RM) -f ibl_$(TARGET)/ibl_obj.inc hex6x $(HEX_OPT) ibl_$(TARGET)/ibl.rmd ibl_$(TARGET)/ibl_$(TARGET).out ../util/bconvert/bconvert64x -$(IEXT) ibl_le.b ibl.b @@ -144,9 +144,9 @@ $(MODULES): @echo making $@ make -C $(IBL_ROOT)/$@/$(ARCH)/make $@ -$(MAIN_MODULE): +$(CFG_MODULES): @echo making $@ - make -C $(IBL_ROOT)/$@/$(ARCH)/make CDEFS=$(MAINDEFS) $@ + make -C $(IBL_ROOT)/$@/$(ARCH)/make CDEFS='$(MAINDEFS)' $@ utils: make -C $(IBL_ROOT)/util/btoccs diff --git a/src/util/romparse/romparse.c b/src/util/romparse/romparse.c index af925c2..c1162aa 100644 --- a/src/util/romparse/romparse.c +++ b/src/util/romparse/romparse.c @@ -21,6 +21,11 @@ #define DATA_BASE (PCI_PARAM_BASE + PCI_EEAI_PARAM_SIZE) +/************************************************************************************* + * Declaration: The base address of the i2c ROM being created. This is just + * the I2C bus address. The default is 0x50 + *************************************************************************************/ +int i2cRomBase = 0x50; /************************************************************************************* * Declaration: The flex input file is assigned based on the command line @@ -161,7 +166,7 @@ void initLayout (layout_t *cl) { cl->nPlt = 0; - cl->dev_addr = 0x50; + cl->dev_addr = i2cRomBase; cl->address = 0; cl->align = 0; @@ -213,7 +218,7 @@ void initPad (pad_t *p) { p->id = -1; p->address = 0; - p->dev_addr = 0x50; + p->dev_addr = i2cRomBase; p->len = 0; } @@ -499,6 +504,9 @@ void assignKeyVal (int field, int value) switch (field) { + case DEV_ADDR_EXT: pads[currentPad].dev_addr = value; + break; + case DEV_ADDR: pads[currentPad].address = value; break; @@ -567,7 +575,7 @@ void assignKeyStr (int value, char *y) current_file = i; if (current_table.i2c.dev_addr_ext == 0) - current_table.i2c.dev_addr_ext = 0x50; /* hard coded to i2c rom slave address */ + current_table.i2c.dev_addr_ext = i2cRomBase; /* hard coded to i2c rom slave address */ } else { /* LAYOUT */ @@ -599,7 +607,7 @@ void assignKeyStr (int value, char *y) current_file = i; if (current_table.i2c.dev_addr_ext == 0) - current_table.i2c.dev_addr_ext = 0x50; + current_table.i2c.dev_addr_ext = i2cRomBase; } else { /* LAYOUT */ @@ -628,12 +636,12 @@ void assignKeyStr (int value, char *y) * DESCRIPTION: The 32 bit value is placed in memory in big endian format. The * new offset is returned (4 bytes more then the input offset) ************************************************************************************/ -unsigned int imageWord (unsigned int base, unsigned char *image, unsigned int value) +unsigned int imageWord (unsigned int base, unsigned int start, unsigned char *image, unsigned int value) { - image[base+0] = (value >> 24) & 0xff; - image[base+1] = (value >> 16) & 0xff; - image[base+2] = (value >> 8) & 0xff; - image[base+3] = (value >> 0) & 0xff; + image[base-start+0] = (value >> 24) & 0xff; + image[base-start+1] = (value >> 16) & 0xff; + image[base-start+2] = (value >> 8) & 0xff; + image[base-start+3] = (value >> 0) & 0xff; return (base + 4); @@ -663,7 +671,7 @@ unsigned int formWord (unsigned int p, unsigned char *image) * DESCRIPTION: Byte (value 0) are added to the image to reach the desired address * The desired address is returned. ************************************************************************************/ -unsigned int imagePad (unsigned int base, unsigned char *image, unsigned int desired) +unsigned int imagePad (unsigned int base, unsigned int start, unsigned char *image, unsigned int desired) { int i; @@ -674,7 +682,7 @@ unsigned int imagePad (unsigned int base, unsigned char *image, unsigned int des } for (i = base; i < desired; i++) - image[i] = 0; + image[i-start] = 0; return (desired); @@ -691,8 +699,9 @@ void createOutput (void) int totalLenBytes; int i, j, k; int nTables, len; + int i2cRomStart; unsigned int value, v1, v2; - unsigned int base, obase; + unsigned int base; unsigned char *image; str = fopen ("i2crom.ccs", "w"); @@ -702,12 +711,12 @@ void createOutput (void) } /* Compact the i2c eeprom to use the minimum memory possible */ - base = PCI_PARAM_BASE; + base = (i2cRomBase << 16) + PCI_PARAM_BASE; nTables = NUM_BOOT_PARAM_TABLES; if ((compact != 0) && (pciSet == 0)) { nTables = max_index + 1; - base = nTables * 0x80; /* The number of parameter tables * size of a parameter table */ + base = (i2cRomBase << 16) + (nTables * 0x80); /* The number of parameter tables * size of a parameter table */ } if (pciSet) @@ -750,28 +759,25 @@ void createOutput (void) else { - /* Mask out device address bits but extend past 64k */ - v2 = v2 & I2C_ADDR_MASK; - if (base > v2) { - fprintf (stderr, "romparse: fatal error - layout block %d specified a start address of 0x%04x\n", j, layouts[j].address); + fprintf (stderr, "romparse: fatal error - layout block %d specified a start address of 0x%04x\n", j, (layouts[j].dev_addr << 16) + layouts[j].address); fprintf (stderr, " but this conflicts with the base mapping (ends at 0x%04x)\n", base); exit (-1); } - base = layouts[j].address + v1; + base = v2 + v1; /* new base is the base plus the size */ } } else { /* Otherwise this is a pad */ - if (base > pads[j].address) { - fprintf (stderr, "romparse: fatal error - pad block %d specified a start address of 0x%04x\n", j, pads[j].address); + if (base > ((pads[j].dev_addr << 16) + pads[j].address)) { + fprintf (stderr, "romparse: fatal error - pad block %d specified a start address of 0x%04x\n", j, (pads[j].dev_addr << 16) + pads[j].address); fprintf (stderr, " but this conflicts with the base mapping (ends at 0x%04x)\n", base); exit (-1); } - base = pads[j].address + pads[j].len; + base = (pads[j].dev_addr << 16) + pads[j].address + pads[j].len; } } @@ -779,7 +785,7 @@ void createOutput (void) for (i = 0; i < NUM_BOOT_PARAM_TABLES; i++) { if (progFile[i].align > 0) base = ((base + progFile[i].align - 1) / progFile[i].align) * progFile[i].align; - progFile[i].addressBytes = base + (0x50 << 16); /* For now hard code the base address */ + progFile[i].addressBytes = base; base = base + progFile[i].sizeBytes; } @@ -795,14 +801,14 @@ void createOutput (void) /* Round up the size to a multiple of 4 bytes to fit into a ccs data file */ base = (base + 3) & ~3; + i2cRomStart = (i2cRomBase << 16); /* The total length of the i2c eeprom is now stored in base */ /* Write out the ccs header */ - fprintf (str, "1651 1 10000 1 %x\n", base >> 2); - + fprintf (str, "1651 1 10000 1 %x\n", (base - i2cRomStart) >> 2); /* Create the image in memory */ - image = malloc (base * sizeof (unsigned char)); + image = malloc ((base - i2cRomStart) * sizeof (unsigned char)); if (image == NULL) { fprintf (stderr, "romparse: malloc failed creating the output image\n"); exit (-1); @@ -811,13 +817,13 @@ void createOutput (void) /* Write out the boot parameter tables. 0x80 bytes will be written out. * There are 16 bits in every parameter field, which is why the index * is from 0 to 0x40 */ - base = 0; + base = i2cRomBase << 16; for (i = 0; i < nTables; i++) { for (j = 0; j < (0x80 >> 1); j += 2) { v1 = boot_params[i].parameter[j]; v2 = boot_params[i].parameter[j+1]; value = (v1 << 16) | v2; - base = imageWord (base, image, value); + base = imageWord (base, i2cRomStart, image, value); } } @@ -825,7 +831,7 @@ void createOutput (void) * written out */ if (pciSet) { for (i = 0; i < PCI_DATA_LEN_32bit; i++) { - base = imageWord (base, image, pciFile.data[i]); + base = imageWord (base, i2cRomStart, image, pciFile.data[i]); } } @@ -835,28 +841,27 @@ void createOutput (void) v1 = (layouts[i].dev_addr << 16) + layouts[i].address; - /* Mask out device address bits */ - v1 = v1 & I2C_ADDR_MASK; + /* subtract out device address bits */ if (v1 > 0) - base = imagePad (base, image, v1); - obase = base; + base = imagePad (base, i2cRomStart, image, v1); + len = (layouts[i].nPlt * 4) + 4; /* Write out the block size and checksum */ - base = imageWord(base, image, len << 16); + base = imageWord(base, i2cRomStart, image, len << 16); for (j = 0; j < layouts[i].nPlt; j++) { if (layouts[i].plt[j].type == PLT_FILE) { if (layouts[i].plt[j].index == -1) { - base = imageWord (base, image, 0xffffffff); + base = imageWord (base, i2cRomStart, image, 0xffffffff); } else { - base = imageWord (base, image, progFile[layouts[i].plt[j].index].addressBytes); + base = imageWord (base, i2cRomStart, image, progFile[layouts[i].plt[j].index].addressBytes); } } else { v1 = pads[layouts[i].plt[j].index].dev_addr; v2 = pads[layouts[i].plt[j].index].address; - base = imageWord (base, image, (v1 << 16) + v2); + base = imageWord (base, i2cRomStart, image, (v1 << 16) + v2); } } @@ -867,14 +872,15 @@ void createOutput (void) /* Write out each of the program files */ for (i = 0; i < nProgFiles; i++) { - base = imagePad (base, image, (progFile[i].addressBytes & I2C_ADDR_MASK)); + v1 = progFile[i].addressBytes; + base = imagePad (base, i2cRomStart, image, v1); for (j = 0; j < progFile[i].sizeBytes >> 2; j++) - base = imageWord (base, image, (progFile[i]).data[j]); + base = imageWord (base, i2cRomStart, image, (progFile[i]).data[j]); } /* Write out the data file */ - for (i = 0; i < base; i += 4) + for (i = 0; i < base - i2cRomStart; i += 4) fprintf (str, "0x%08x\n", formWord (i, image)); free (image); @@ -895,6 +901,24 @@ void initPciParams (void) } /* initPciParams */ +/************************************************************************************ + * FUNCTION PURPOSE: Read an integer value from a string + ************************************************************************************ + * DESCRIPTION: A decimal or hex value is scanned + ************************************************************************************/ +int readVal (char *s) +{ + int ret; + + if ((s[0] == '0') && (s[1] == 'x')) + sscanf (&s[2], "%x", &ret); + else + sscanf (s, "%d", &ret); + + return (ret); + +} + /************************************************************************************ * FUNCTION PURPOSE: Parse the input arguments. @@ -906,7 +930,7 @@ int parseIt (int argc, char *argv[]) int i; if (argc < 2) { - fprintf (stderr, "usage: %s [-compact] inputfile\n", argv[0]); + fprintf (stderr, "usage: %s [-compact] [-rom_base x] inputfile\n", argv[0]); return (-1); } @@ -918,6 +942,10 @@ int parseIt (int argc, char *argv[]) compact = 1; i += 1; + } else if (!strcmp (argv[i], "-rom_base")) { + i2cRomBase = readVal (argv[i+1]); + i += 2; + } else { if (inputFile != NULL) { diff --git a/src/util/romparse/romparse.h b/src/util/romparse/romparse.h index 1ab0c54..e09a4b2 100644 --- a/src/util/romparse/romparse.h +++ b/src/util/romparse/romparse.h @@ -74,10 +74,6 @@ typedef struct { int align; } layout_t; -/* The i2c address masking is chosen to be 20 bits. This allows eproms to be stacked to use addresses - * from 0x50 - 0x5f */ -#define I2C_ADDR_MASK 0x0fffff - /* Pad section. The pad section creates a gap in the i2c memory map */ #define MAX_PADS 8 -- 2.39.2