- bootloader: read boot image offset from via board provided method
- bootloader_with_flash: fixed apperent bug with GPIO alignmentand masking git-svn-id: http://moon:8086/svn/mips@134 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
#define MAGIC_EB 0x4A464931 // "JFI1" in big-endian;
|
||||
#define MAGIC_EL 0x3149464A // "JFI1" in little-endian;
|
||||
|
||||
extern uint32_t getBootOffset(uint32_t sel);
|
||||
|
||||
typedef struct _sflash_img_hdr_t
|
||||
{
|
||||
uint32_t magic;
|
||||
@@ -74,17 +76,24 @@ int main(int argc, char *argv[])
|
||||
uint8_t buf[256];
|
||||
srec_t srec;
|
||||
int result, srec_state, i;
|
||||
uint32_t haddr;
|
||||
uint32_t haddr = 0;
|
||||
volatile uint8_t *pMem;
|
||||
haddr = 0;
|
||||
|
||||
flash_img_hdr_t img_hdr;
|
||||
|
||||
volatile uint32_t *pFlashMem = (uint32_t*)(FLASH_BASE_MEM + 0x00100000); // Flash in cached area
|
||||
volatile uint32_t *pFlashMem = (uint32_t*)(FLASH_BASE_MEM); // Flash in cached area
|
||||
volatile uint32_t *pSdram32 = (uint32_t*)SDRAM_BASE;
|
||||
volatile uint32_t *pGPIO_DATA = (uint32_t*)SYS_GPIO_0_DATA;
|
||||
volatile uint32_t *pGPIO_DIR = (uint32_t*)SYS_GPIO_0_DIR;
|
||||
|
||||
*pGPIO_DIR = GPIO_0_DFLT_DIR;
|
||||
*pGPIO_DATA = GPIO_0_DFLT_DATA;
|
||||
uint32_t block_sel = (uint32_t)((*pGPIO_DATA >> GPIO_0_ALIGN_DIP) & GPIO_0_MASK_DIP);
|
||||
uint32_t flash_offset = getBootOffset(block_sel);
|
||||
|
||||
sputs("\nMIPS bootloader\n");
|
||||
|
||||
pFlashMem += flash_offset >> 2;
|
||||
|
||||
// ----------------------------------------------------------
|
||||
sputs("Loading image from flash at ");print_word((int)pFlashMem);sputs("\n");
|
||||
img_hdr = *((flash_img_hdr_t*)pFlashMem);
|
||||
|
||||
Reference in New Issue
Block a user