mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
Make sure the BIOS file ends on an aligned boundary.
If it does not, the address to which mkmscimg.py writes the CRC and the address from which it is read could differ.
This commit is contained in:
parent
a4e14f1058
commit
8db098dd8f
2 changed files with 12 additions and 15 deletions
|
@ -18,18 +18,12 @@ SECTIONS
|
||||||
_frodata = .;
|
_frodata = .;
|
||||||
*(.rodata .rodata.* .gnu.linkonce.r.*)
|
*(.rodata .rodata.* .gnu.linkonce.r.*)
|
||||||
*(.rodata1)
|
*(.rodata1)
|
||||||
_erodata = .;
|
|
||||||
} > rom
|
|
||||||
|
|
||||||
/* We shouldn't have a .data section, but the GNU crapchain whines if we don't */
|
/* Make sure the file is aligned on disk as well
|
||||||
.data :
|
as in memory; CRC calculation requires that. */
|
||||||
{
|
FILL(0);
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_fdata = .;
|
_erodata = .;
|
||||||
*(.data .data.* .gnu.linkonce.d.*)
|
|
||||||
*(.data1)
|
|
||||||
*(.sdata .sdata.* .gnu.linkonce.s.*)
|
|
||||||
_edata = .;
|
|
||||||
} > rom
|
} > rom
|
||||||
|
|
||||||
.bss :
|
.bss :
|
||||||
|
@ -51,6 +45,9 @@ SECTIONS
|
||||||
{
|
{
|
||||||
*(.eh_frame)
|
*(.eh_frame)
|
||||||
*(.comment)
|
*(.comment)
|
||||||
|
*(.data .data.* .gnu.linkonce.d.*)
|
||||||
|
*(.data1)
|
||||||
|
*(.sdata .sdata.* .gnu.linkonce.s.*)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -409,7 +409,7 @@ static void do_command(char *c)
|
||||||
printf("Command not found\n");
|
printf("Command not found\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
extern unsigned int _ftext, _edata;
|
extern unsigned int _ftext, _erodata;
|
||||||
|
|
||||||
static void crcbios(void)
|
static void crcbios(void)
|
||||||
{
|
{
|
||||||
|
@ -419,14 +419,14 @@ static void crcbios(void)
|
||||||
unsigned int actual_crc;
|
unsigned int actual_crc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* _edata is located right after the end of the flat
|
* _erodata is located right after the end of the flat
|
||||||
* binary image. The CRC tool writes the 32-bit CRC here.
|
* binary image. The CRC tool writes the 32-bit CRC here.
|
||||||
* We also use the address of _edata to know the length
|
* We also use the address of _erodata to know the length
|
||||||
* of our code.
|
* of our code.
|
||||||
*/
|
*/
|
||||||
offset_bios = (unsigned int)&_ftext;
|
offset_bios = (unsigned int)&_ftext;
|
||||||
expected_crc = _edata;
|
expected_crc = _erodata;
|
||||||
length = (unsigned int)&_edata - offset_bios;
|
length = (unsigned int)&_erodata - offset_bios;
|
||||||
actual_crc = crc32((unsigned char *)offset_bios, length);
|
actual_crc = crc32((unsigned char *)offset_bios, length);
|
||||||
if(expected_crc == actual_crc)
|
if(expected_crc == actual_crc)
|
||||||
printf("BIOS CRC passed (%08x)\n", actual_crc);
|
printf("BIOS CRC passed (%08x)\n", actual_crc);
|
||||||
|
|
Loading…
Reference in a new issue