OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [sw/] [common/] [crt0.S] - Diff between revs 32 and 39

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 32 Rev 39
Line 102... Line 102...
  csrrw zero, mstatus, x10
  csrrw zero, mstatus, x10
  csrrw zero, mie, zero // clear mie
  csrrw zero, mie, zero // clear mie
 
 
 
 
// *********************************************************
// *********************************************************
// Setup pointers using linker script symbol
// Setup pointers using linker script symbols
// *********************************************************
// *********************************************************
__crt0_pointer_init:
__crt0_pointer_init:
.option push
.option push
.option norelax
.option norelax
  la    sp, __crt0_stack_begin
  la    sp, __crt0_stack_begin
Line 115... Line 115...
  la gp, __global_pointer$ // global pointer
  la gp, __global_pointer$ // global pointer
.option pop
.option pop
 
 
 
 
// *********************************************************
// *********************************************************
// Init trap handler base address
// Initialize dummy trap handler base address
// *********************************************************
// *********************************************************
__crt0_neorv32_trap_init:
__crt0_neorv32_trap_init:
  la    x11, __crt0_dummy_trap_handler
  la    x11, __crt0_dummy_trap_handler
  csrw  mtvec, x11 // set address of first-level exception handler
  csrw  mtvec, x11 // set address of first-level exception handler
 
 
Line 172... Line 172...
 
 
__crt0_copy_data_loop_end:
__crt0_copy_data_loop_end:
 
 
 
 
// *********************************************************
// *********************************************************
// Call main function (with argc = argv = 0)
// Call main function
// *********************************************************
// *********************************************************
__crt0_main_entry:
__crt0_main_entry:
 
 
 
  // setup arguments for calling main
  addi x10, zero, 0 // argc = 0
  addi x10, zero, 0 // argc = 0
  addi x11, zero, 0 // argv = 0
  addi x11, zero, 0 // argv = 0
 
 
 
  // clear cycle and instruction counters
 
  csrw mcycle,    zero
 
  csrw mcycleh,   zero
 
  csrw minstret,  zero
 
  csrw minstreth, zero
 
 
  jal ra, main
  jal ra, main
 
 
 
 
// *********************************************************
// *********************************************************
// Go to endless sleep mode if main returns
// Go to endless sleep mode if main returns
// *********************************************************
// *********************************************************
__crt0_this_is_the_end:
__crt0_this_is_the_end:
  csrrci zero, mstatus, 8 // mstatus: disable global IRQs (MIE)
  csrrci zero, mstatus, 8 // mstatus: disable global IRQs (MIE)
 
  nop
  wfi
  wfi
  j . // in case WFI is not available
__crt0_this_is_the_end_my_friend:
 
  j __crt0_this_is_the_end_my_friend // in case WFI is not available
 
 
 
 
// *********************************************************
// *********************************************************
// dummy trap handler (for exceptions & IRQs)
// dummy trap handler (for exceptions & IRQs)
// tries to move on to next instruction
// tries to move on to next instruction

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.