Skip to content

Commit

Permalink
sw: Add .wide_spm section
Browse files Browse the repository at this point in the history
  • Loading branch information
colluca committed Jan 16, 2024
1 parent eb6642d commit 29645e2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions target/sim/sw/host/runtime/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ void initialize_bss() {
bss_size);
}

void initialize_wide_spm() {
extern volatile uint64_t __wide_spm_start, __wide_spm_end;

size_t wide_spm_size =
(size_t)(&__wide_spm_end) - (size_t)(&__wide_spm_start);
if (wide_spm_size)
sys_dma_blk_memcpy(SPM_WIDE_BASE_ADDR, (uint64_t)(&__wide_spm_start),
wide_spm_size);
}

void enable_fpu() {
uint64_t mstatus;

Expand Down
9 changes: 9 additions & 0 deletions target/sim/sw/host/runtime/host.ld
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ SECTIONS
__bss_end = . ;
} > DRAM

.wide_spm :
{
. = ALIGN(8);
__wide_spm_start = . ;
*(.wide_spm)
. = ALIGN(8);
__wide_spm_end = . ;
} > DRAM

__end = .;

.devicebin : { *(.devicebin) } > DRAM
Expand Down
1 change: 1 addition & 0 deletions target/sim/sw/host/runtime/start.S
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ _start:
la gp, __global_pointer$
.option pop
call initialize_bss
call initialize_wide_spm
call enable_fpu
call main

Expand Down

0 comments on commit 29645e2

Please sign in to comment.