Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BIOS: Flashboot without main ram #55

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions litex/soc/software/bios/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,17 @@ void netboot(void)
#endif

#ifdef FLASH_BOOT_ADDRESS

/* On systems with exernal SDRAM we copy out of the SPI flash into the SDRAM
before running, as it is faster. If we have no SDRAM then we have to
execute directly out of the SPI flash. */
#ifdef MAIN_RAM_BASE
#define FIRMWARE_BASE_ADDRESS MAIN_RAM_BASE
#else
/* Firmware code starts after (a) length and (b) CRC -- both unsigned ints */
#define FIRMWARE_BASE_ADDRESS (FLASH_BOOT_ADDRESS + 2 * sizeof(unsigned int))
#endif

void flashboot(void)
{
unsigned int *flashbase;
Expand All @@ -306,14 +317,17 @@ void flashboot(void)
return;
}

#ifdef MAIN_RAM_BASE
printf("Loading %d bytes from flash...\n", length);
memcpy((void *)MAIN_RAM_BASE, flashbase, length);
got_crc = crc32((unsigned char *)MAIN_RAM_BASE, length);
#endif

got_crc = crc32((unsigned char *)FIRMWARE_BASE_ADDRESS, length);
if(crc != got_crc) {
printf("CRC failed (expected %08x, got %08x)\n", crc, got_crc);
return;
}
boot(0, 0, 0, MAIN_RAM_BASE);
boot(0, 0, 0, FIRMWARE_BASE_ADDRESS);
}
#endif

Expand Down