📄 crt0.c
字号:
(unsigned long)dummy, // 96 reserved
(unsigned long)dummy, // 97 reserved
(unsigned long)dummy, // 98 reserved
(unsigned long)dummy, // 99 reserved
(unsigned long)dummy, // 100 reserved
(unsigned long)dummy, // 101 reserved
(unsigned long)dummy, // 102 reserved
(unsigned long)dummy, // 103 reserved
(unsigned long)dummy, // 104 reserved
(unsigned long)dummy, // 105 reserved
(unsigned long)dummy, // 106 reserved
(unsigned long)dummy, // 107 reserved
(unsigned long)dummy, // 108 reserved
(unsigned long)dummy, // 109 reserved
(unsigned long)dummy, // 110 reserved
(unsigned long)dummy, // 111 reserved
(unsigned long)dummy, // 112 SIO with FIFO RxD Error
(unsigned long)dummy, // 113 SIO with FIFO RxD Buffer Full
(unsigned long)dummy, // 114 SIO with FIFO TxD Buffer Empty
};
//---------------------------------------------------------------------------------
// Function name : boot
// Function description : booting system
//
// Parameters
// Input : none
// Output : none
// I/O : none
//
// Return value : void
//
// Global variable : none
//---------------------------------------------------------------------------------
void boot(void)
{
asm("xld.w %r15,0x4000"); // Set SP in end of 8KB internal RAM
asm("ld.w %sp,%r15");
asm("ld.w %r15,0b10000"); // Set PSR to interrupt enable
asm("ld.w %psr,%r15");
asm("xld.w %r15,__dp"); // Set DPR is 0x0
codecpy(&__START_cache7,& __START_cache7_lma,&__END_cache7);
_init_bcu(); // Initialize BCU on boot time
_init_sysclk(SYS_OSC3);
_init_subclk(SUB_OSC_dt1);
_init_sdramc(); //16M x 16bit
_init_busarb(7); //From 1 to 15
// sysBssClear(); //Bss clear
sysDataCopy(); //data copy
_init_sys();
_init_lib();
main();
_exit(); // Go to exit in sys.c to use simulated I/O
}
//---------------------------------------------------------------------------------
// Function name : dummy
// Function description : dummy routine in interrupt vection table
//
// Parameters
// Input : none
// Output : none
// I/O : none
//
// Return value : void
//
// Global variable : none
//---------------------------------------------------------------------------------
void dummy(void)
{
INT_LOOP:
goto INT_LOOP;
}
//---------------------------------------------------------------------------------
// Function name : int_addr_err
// Function description : address error interrupt program.
//
// Parameters
// Input : none
// Output : none
// I/O : none
//
// Return value : void
//
// Global variable : none
//---------------------------------------------------------------------------------
void int_addr_err(void)
{
ADDR_ERR:
goto ADDR_ERR;
}
//---------------------------------------------------------------------------------
// Function name : codecpy
// Function description : copy memory from src to des
//
// Parameters
// Input : none
// Output : none
// I/O : none
//
// Return value : void
//
// Global variable : none
//---------------------------------------------------------------------------------
void codecpy(int *dst, int *src, int *size)
{
asm("HCOPY_LOOP: ");
asm("ld.uh %r10, [%r7]+ ");
asm("ld.h [%r6]+, %r10 ");
asm("sub %r8, 2 ");
asm("jrgt HCOPY_LOOP ");
}
/****************************************************************************
sysDataCopy()
----------------------------------------------------------------------------
description:
DATA
argument: (none)
return: (none)
input: (none)
output: (none)
flag: (none)
global: (none)
comment: (none)
****************************************************************************/
void sysDataCopy()
{
asm("InitDataSectionStart:");
asm("xld.w %r6, __START_data_lma");
asm("xld.w %r7, __END_data");
asm("xld.w %r8, __START_data");
asm("cmp %r8, %r7");
asm("jrlt InitDataSectionLoop");
asm("jp InitDataSectionEnd");
asm("InitDataSectionLoop:");
asm("ld.w %r10, [%r6]+");
asm("ld.w [%r8]+, %r10");
asm("cmp %r8, %r7");
asm("jrlt InitDataSectionLoop");
asm("InitDataSectionEnd:");
}
/**** End of function *******************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -