Line 85... |
Line 85... |
|
|
|
|
// *********************************************************
|
// *********************************************************
|
// Setup global pointer
|
// Setup global pointer
|
// *********************************************************
|
// *********************************************************
|
#ifndef __BOOTLOADER_START_CODE__
|
|
__crt0_global_pointer_init:
|
__crt0_global_pointer_init:
|
.option push
|
.option push
|
.option norelax
|
.option norelax
|
la gp, __global_pointer$
|
la gp, __global_pointer$
|
.option pop
|
.option pop
|
#endif
|
|
|
|
|
|
// *********************************************************
|
// *********************************************************
|
// Init trap handler base address
|
// Init trap handler base address
|
// *********************************************************
|
// *********************************************************
|
Line 107... |
Line 105... |
// *********************************************************
|
// *********************************************************
|
// Reset/deactivate IO/peripheral devices
|
// Reset/deactivate IO/peripheral devices
|
// Devices, that are not implemented, will cause a store access fault
|
// Devices, that are not implemented, will cause a store access fault
|
// which is captured but actually ignored due to the dummy handler.
|
// which is captured but actually ignored due to the dummy handler.
|
// *********************************************************
|
// *********************************************************
|
#ifndef __BOOTLOADER_START_CODE__
|
|
__crt0_reset_io:
|
__crt0_reset_io:
|
li x11, IO_BEGIN // start of processor-internal IO region
|
li x11, IO_BEGIN // start of processor-internal IO region
|
|
|
__crt0_reset_io_loop:
|
__crt0_reset_io_loop:
|
sw zero, 0(x11)
|
sw zero, 0(x11)
|
addi x11, x11, 4
|
addi x11, x11, 4
|
bne zero, x11, __crt0_reset_io_loop
|
bne zero, x11, __crt0_reset_io_loop
|
#endif
|
|
|
|
|
|
// *********************************************************
|
// *********************************************************
|
// Clear .bss section (byte-wise)
|
// Clear .bss section (byte-wise)
|
// *********************************************************
|
// *********************************************************
|
#ifndef __BOOTLOADER_START_CODE__
|
|
__crt0_clear_bss:
|
__crt0_clear_bss:
|
la x11, __crt0_bss_start
|
la x11, __crt0_bss_start
|
la x12, __crt0_bss_end
|
la x12, __crt0_bss_end
|
|
|
__crt0_clear_bss_loop:
|
__crt0_clear_bss_loop:
|
Line 133... |
Line 128... |
sb zero, 0(x11)
|
sb zero, 0(x11)
|
addi x11, x11, 1
|
addi x11, x11, 1
|
j __crt0_clear_bss_loop
|
j __crt0_clear_bss_loop
|
|
|
__crt0_clear_bss_loop_end:
|
__crt0_clear_bss_loop_end:
|
#endif
|
|
|
|
|
|
// *********************************************************
|
// *********************************************************
|
// Copy initialized .data section from ROM to RAM (byte-wise)
|
// Copy initialized .data section from ROM to RAM (byte-wise)
|
// *********************************************************
|
// *********************************************************
|
#ifndef __BOOTLOADER_START_CODE__
|
|
__crt0_copy_data:
|
__crt0_copy_data:
|
la x11, __crt0_copy_data_src_begin // start of data area (copy source)
|
la x11, __crt0_copy_data_src_begin // start of data area (copy source)
|
la x12, __crt0_copy_data_dst_begin // start of data area (copy destination)
|
la x12, __crt0_copy_data_dst_begin // start of data area (copy destination)
|
la x13, __crt0_copy_data_dst_end // last address of destination data area
|
la x13, __crt0_copy_data_dst_end // last address of destination data area
|
|
|
Line 154... |
Line 147... |
addi x11, x11, 1
|
addi x11, x11, 1
|
addi x12, x12, 1
|
addi x12, x12, 1
|
j __crt0_copy_data_loop
|
j __crt0_copy_data_loop
|
|
|
__crt0_copy_data_loop_end:
|
__crt0_copy_data_loop_end:
|
#endif
|
|
|
|
|
|
// *********************************************************
|
// *********************************************************
|
// Call main function (with argc = argv = 0)
|
// Call main function (with argc = argv = 0)
|
// *********************************************************
|
// *********************************************************
|