Merge pull request #503 from rprinz08/master

BIOS boot firmware from SPI with address offset
This commit is contained in:
enjoy-digital 2020-05-13 08:36:43 +02:00 committed by GitHub
commit bf7857f553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -399,7 +399,7 @@ static unsigned int check_image_in_flash(unsigned int base_address)
return length;
}
#if defined(MAIN_RAM_BASE) && defined(CONFIG_CPU_TYPE_VEXRISCV) && defined(CONFIG_CPU_VARIANT_LINUX)
#if defined(MAIN_RAM_BASE) && defined(CONFIG_CPU_TYPE_VEXRISCV) && defined(FLASH_BOOT_ADDRESS)
static int copy_image_from_flash_to_ram(unsigned int flash_address, unsigned int ram_address)
{
unsigned int length;
@ -408,7 +408,7 @@ static int copy_image_from_flash_to_ram(unsigned int flash_address, unsigned int
if(length > 0) {
printf("Copying %d bytes from 0x%08x to 0x%08x...\n", length, flash_address, ram_address);
// skip length and crc
memcpy((void *)ram_address, (void *)flash_address + 8, length);
memcpy((void *)ram_address, (unsigned int *)(flash_address + 2 * sizeof(unsigned int)), length);
return 1;
}
@ -432,9 +432,9 @@ static int copy_image_from_flash_to_ram(unsigned int flash_address, unsigned int
void flashboot(void)
{
unsigned int length;
unsigned int result;
#if defined(MAIN_RAM_BASE) && defined(CONFIG_CPU_TYPE_VEXRISCV) && defined(CONFIG_CPU_VARIANT_LINUX)
unsigned int result;
printf("Loading Image from flash...\n");
result = copy_image_from_flash_to_ram(
@ -469,15 +469,15 @@ void flashboot(void)
}
#endif
printf("Booting from flash...\n");
printf("Booting from flash addr 0x%08x...\n", FLASH_BOOT_ADDRESS);
length = check_image_in_flash(FLASH_BOOT_ADDRESS);
if(!length)
return;
#ifdef MAIN_RAM_BASE
printf("Loading %d bytes from flash...\n", length);
// skip length and crc
memcpy((void *)MAIN_RAM_BASE, (unsigned int *)(FLASH_BOOT_ADDRESS + 2 * sizeof(unsigned int)), length);
result = copy_image_from_flash_to_ram(FLASH_BOOT_ADDRESS, MAIN_RAM_BASE);
if(!result)
return;
#endif
boot(0, 0, 0, FIRMWARE_BASE_ADDRESS);

View File

@ -43,7 +43,7 @@ static void fw(int nb_params, char **params)
if (nb_params == 2) {
count = 1;
} else {
count = strtoul(count, &c, 0);
count = strtoul(params[2], &c, 0);
if (*c != 0) {
printf("Incorrect count");
return;