Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/misoc
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b7aff65ca9cc
Choose a base ref
...
head repository: m-labs/misoc
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8db098dd8f2b
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Jul 29, 2015

  1. Copy the full SHA
    a4e14f1 View commit details
  2. 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.
    whitequark committed Jul 29, 2015
    Copy the full SHA
    8db098d View commit details
Showing with 14 additions and 30 deletions.
  1. +1 −1 misoclib/soc/__init__.py
  2. +1 −1 misoclib/soc/cpuif.py
  3. +7 −23 software/bios/linker.ld
  4. +5 −5 software/bios/main.c
2 changes: 1 addition & 1 deletion misoclib/soc/__init__.py
Original file line number Diff line number Diff line change
@@ -146,7 +146,7 @@ def register_mem(self, name, address, interface, size=None):
if size is not None:
self.add_memory_region(name, address, size)

def register_rom(self, interface, rom_size=0x10000):
def register_rom(self, interface, rom_size=0xa000):
self.add_wb_slave(mem_decoder(self.mem_map["rom"]), interface)
self.add_memory_region("rom", self.cpu_reset_address, rom_size)

2 changes: 1 addition & 1 deletion misoclib/soc/cpuif.py
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ def get_cpu_mak(cpu_type):
clang = ""
elif cpu_type == "or1k":
triple = "or1k-linux"
cpuflags = "-fPIC -mhard-mul -mhard-div"
cpuflags = "-mhard-mul -mhard-div"
clang = "1"
else:
raise ValueError("Unsupported CPU type: "+cpu_type)
30 changes: 7 additions & 23 deletions software/bios/linker.ld
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
INCLUDE generated/output_format.ld
ENTRY(_start)

__DYNAMIC = 0;

INCLUDE generated/regions.ld

SECTIONS
@@ -14,35 +12,18 @@ SECTIONS
_etext = .;
} > rom

.got :
{
_GLOBAL_OFFSET_TABLE_ = .;
*(.got)
} > rom

.got.plt :
{
*(.got.plt)
} > rom

.rodata :
{
. = ALIGN(4);
_frodata = .;
*(.rodata .rodata.* .gnu.linkonce.r.*)
*(.rodata1)
_erodata = .;
} > rom

/* We shouldn't have a .data section, but the GNU crapchain whines if we don't */
.data :
{
/* Make sure the file is aligned on disk as well
as in memory; CRC calculation requires that. */
FILL(0);
. = ALIGN(4);
_fdata = .;
*(.data .data.* .gnu.linkonce.d.*)
*(.data1)
*(.sdata .sdata.* .gnu.linkonce.s.*)
_edata = .;
_erodata = .;
} > rom

.bss :
@@ -64,6 +45,9 @@ SECTIONS
{
*(.eh_frame)
*(.comment)
*(.data .data.* .gnu.linkonce.d.*)
*(.data1)
*(.sdata .sdata.* .gnu.linkonce.s.*)
}
}

10 changes: 5 additions & 5 deletions software/bios/main.c
Original file line number Diff line number Diff line change
@@ -409,7 +409,7 @@ static void do_command(char *c)
printf("Command not found\n");
}
extern unsigned int _ftext, _edata;
extern unsigned int _ftext, _erodata;

static void crcbios(void)
{
@@ -419,14 +419,14 @@ static void crcbios(void)
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.
* 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.
*/
offset_bios = (unsigned int)&_ftext;
expected_crc = _edata;
length = (unsigned int)&_edata - offset_bios;
expected_crc = _erodata;
length = (unsigned int)&_erodata - offset_bios;
actual_crc = crc32((unsigned char *)offset_bios, length);
if(expected_crc == actual_crc)
printf("BIOS CRC passed (%08x)\n", actual_crc);