Skip to content

Commit

Permalink
Move memory to 0x10000000 for ALL configurations.
Browse files Browse the repository at this point in the history
Prevent linker bug: riscvarchive/riscv-gcc#120

In addition this prevents bumping into the IO region when >64K
  • Loading branch information
tomtor committed Jan 14, 2019
1 parent d2c4478 commit eeb7679
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion progmem-flash.lds
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ENTRY(start)

MEMORY {
bram (rwx) : ORIGIN = 0x00000000, LENGTH = 8K
bram (rwx) : ORIGIN = 0x10000000, LENGTH = 8K
flash (rx) : ORIGIN = 0x01100000, LENGTH = 3M
}

Expand Down
6 changes: 4 additions & 2 deletions progmem-ram.lds
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ENTRY(start)

MEMORY {
bram (rwx) : ORIGIN = 0x00000000, LENGTH = 8K
bram (rwx) : ORIGIN = 0x10000000, LENGTH = 8K
}

SECTIONS {
Expand All @@ -11,9 +11,11 @@ SECTIONS {
*(.text.*);
} > bram

.data : {
.data : ALIGN(4) {
*(.data);
*(.data.*);

. = ALIGN(4);
} > bram

.rodata : {
Expand Down
4 changes: 4 additions & 0 deletions ram64k.sv
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module ram (
logic [31:0] read_value;
logic ready;

`ifdef ICE40
SB_SPRAM256KA ram_low( // bits[15:0]
.DATAOUT(read_value[15:0]),
.ADDRESS(address_in[15:2]),
Expand Down Expand Up @@ -46,6 +47,9 @@ module ram (
.SLEEP(1'b0),
.POWEROFF(1'b1)
);
`elsif ECP5
// TODO
`endif


assign read_value_out = sel_in ? read_value : 0;
Expand Down
6 changes: 1 addition & 5 deletions top.sv
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,11 @@ module top (
mem_fault = 0;

casez (mem_address)
`ifdef RAM64K
32'b00010000_00000000_????????_????????: ram_sel = 1;
`else
32'b00000000_00000000_????????_????????: ram_sel = 1;
`endif
32'b00000000_00000001_00000000_000000??: leds_sel = 1;
32'b00000000_00000010_00000000_0000????: uart_sel = 1;
32'b00000000_00000011_00000000_0000????: timer_sel = 1;
32'b00000001_????????_????????_????????: flash_sel = 1;
32'b00010000_00000000_????????_????????: ram_sel = 1;
default: mem_fault = 1;
endcase
end
Expand Down

0 comments on commit eeb7679

Please sign in to comment.