New PPC startup file.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8048 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
048acf5bdf
commit
d0bd017d3b
|
@ -39,7 +39,7 @@
|
||||||
</cconfiguration>
|
</cconfiguration>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
<project id="RT-SPC560B-EVB.null.2129661677" name="RT-SPC560B-EVB"/>
|
<project id="RT-SPC560P-EVB.null.2129661677" name="RT-SPC560P-EVB"/>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="scannerConfiguration">
|
<storageModule moduleId="scannerConfiguration">
|
||||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||||
<storageModule moduleId="refreshScope" versionNumber="2">
|
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||||
<configuration configurationName="Default">
|
<configuration configurationName="Default">
|
||||||
<resource resourceType="PROJECT" workspacePath="/RT-SPC560B-EVB"/>
|
<resource resourceType="PROJECT" workspacePath="/RT-SPC560P-EVB"/>
|
||||||
</configuration>
|
</configuration>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||||
|
|
|
@ -19,12 +19,74 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file PPC/crt0.s
|
* @file PPC/crt0.s
|
||||||
* @brief Generic PowerPC startup file for ChibiOS/RT.
|
* @brief Generic PowerPC startup file for ChibiOS.
|
||||||
*
|
*
|
||||||
* @addtogroup PPC_CORE
|
* @addtogroup PPC_CORE
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Module constants. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
#if !defined(FALSE) || defined(__DOXYGEN__)
|
||||||
|
#define FALSE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(TRUE) || defined(__DOXYGEN__)
|
||||||
|
#define TRUE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Module pre-compile time settings. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Stack segments initialization switch.
|
||||||
|
*/
|
||||||
|
#if !defined(CRT0_STACKS_FILL_PATTERN) || defined(__DOXYGEN__)
|
||||||
|
#define CRT0_STACKS_FILL_PATTERN 0x55555555
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Stack segments initialization switch.
|
||||||
|
*/
|
||||||
|
#if !defined(CRT0_INIT_STACKS) || defined(__DOXYGEN__)
|
||||||
|
#define CRT0_INIT_STACKS TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DATA segment initialization switch.
|
||||||
|
*/
|
||||||
|
#if !defined(CRT0_INIT_DATA) || defined(__DOXYGEN__)
|
||||||
|
#define CRT0_INIT_DATA TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief BSS segment initialization switch.
|
||||||
|
*/
|
||||||
|
#if !defined(CRT0_INIT_BSS) || defined(__DOXYGEN__)
|
||||||
|
#define CRT0_INIT_BSS TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Constructors invocation switch.
|
||||||
|
*/
|
||||||
|
#if !defined(CRT0_CALL_CONSTRUCTORS) || defined(__DOXYGEN__)
|
||||||
|
#define CRT0_CALL_CONSTRUCTORS TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Destructors invocation switch.
|
||||||
|
*/
|
||||||
|
#if !defined(CRT0_CALL_DESTRUCTORS) || defined(__DOXYGEN__)
|
||||||
|
#define CRT0_CALL_DESTRUCTORS TRUE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
/* Code section. */
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
#if !defined(__DOXYGEN__)
|
#if !defined(__DOXYGEN__)
|
||||||
|
|
||||||
.section .crt0, "ax"
|
.section .crt0, "ax"
|
||||||
|
@ -32,27 +94,58 @@
|
||||||
.globl _boot_address
|
.globl _boot_address
|
||||||
.type _boot_address, @function
|
.type _boot_address, @function
|
||||||
_boot_address:
|
_boot_address:
|
||||||
/*
|
/* Stack setup.*/
|
||||||
* Stack setup.
|
|
||||||
*/
|
|
||||||
lis %r1, __process_stack_end__@h
|
lis %r1, __process_stack_end__@h
|
||||||
ori %r1, %r1, __process_stack_end__@l
|
ori %r1, %r1, __process_stack_end__@l
|
||||||
li %r0, 0
|
li %r0, 0
|
||||||
stwu %r0, -8(%r1)
|
stwu %r0, -8(%r1)
|
||||||
/*
|
|
||||||
* Small sections registers initialization.
|
/* Small sections registers initialization.*/
|
||||||
*/
|
|
||||||
lis %r2, __sdata2_start__@h
|
lis %r2, __sdata2_start__@h
|
||||||
ori %r2, %r2, __sdata2_start__@l
|
ori %r2, %r2, __sdata2_start__@l
|
||||||
lis %r13, __sdata_start__@h
|
lis %r13, __sdata_start__@h
|
||||||
ori %r13, %r13, __sdata_start__@l
|
ori %r13, %r13, __sdata_start__@l
|
||||||
/*
|
|
||||||
* Early initialization.
|
/* Early initialization.*/
|
||||||
*/
|
|
||||||
bl __early_init
|
bl __early_init
|
||||||
/*
|
|
||||||
* BSS clearing.
|
#if CRT0_INIT_STACKS == TRUE
|
||||||
*/
|
/* Stacks fill pattern.*/
|
||||||
|
lis %r7, CRT0_STACKS_FILL_PATTERN@h
|
||||||
|
ori %r7, %r7, CRT0_STACKS_FILL_PATTERN@l
|
||||||
|
|
||||||
|
/* IRQ Stack initialization. Note, the architecture does not use this
|
||||||
|
stack, the size is usually zero. An OS can have special SW handling
|
||||||
|
and require this. A 4 bytes alignment is assmend and required.*/
|
||||||
|
lis %r4, __irq_stack_base__@h
|
||||||
|
ori %r4, %r4, __irq_stack_base__@l
|
||||||
|
lis %r5, __irq_stack_end__@h
|
||||||
|
ori %r5, %r5, __irq_stack_end__@l
|
||||||
|
.irqsloop:
|
||||||
|
cmpl cr0, %r4, %r5
|
||||||
|
bge cr0, .irqsend
|
||||||
|
stw %r7, 0(%r4)
|
||||||
|
addi %r4, %r4, 4
|
||||||
|
b .irqsloop
|
||||||
|
.irqsend:
|
||||||
|
|
||||||
|
/* Process Stack initialization. Note, does not overwrite the already
|
||||||
|
written EABI frame. A 4 bytes alignment is assmend and required.*/
|
||||||
|
lis %r4, __process_stack_base__@h
|
||||||
|
ori %r4, %r4, __process_stack_base__@l
|
||||||
|
lis %r5, (__process_stack_end__ - 8)@h
|
||||||
|
ori %r5, %r5, (__process_stack_end__ - 8)@l
|
||||||
|
.prcsloop:
|
||||||
|
cmpl cr0, %r4, %r5
|
||||||
|
bge cr0, .prcsend
|
||||||
|
stw %r7, 0(%r4)
|
||||||
|
addi %r4, %r4, 4
|
||||||
|
b .prcsloop
|
||||||
|
.prcsend:
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CRT0_INIT_BSS == TRUE
|
||||||
|
/* BSS clearing.*/
|
||||||
lis %r4, __bss_start__@h
|
lis %r4, __bss_start__@h
|
||||||
ori %r4, %r4, __bss_start__@l
|
ori %r4, %r4, __bss_start__@l
|
||||||
lis %r5, __bss_end__@h
|
lis %r5, __bss_end__@h
|
||||||
|
@ -65,9 +158,10 @@ _boot_address:
|
||||||
addi %r4, %r4, 4
|
addi %r4, %r4, 4
|
||||||
b .bssloop
|
b .bssloop
|
||||||
.bssend:
|
.bssend:
|
||||||
/*
|
#endif
|
||||||
* DATA initialization.
|
|
||||||
*/
|
#if CRT0_INIT_DATA == TRUE
|
||||||
|
/* DATA initialization.*/
|
||||||
lis %r4, __romdata_start__@h
|
lis %r4, __romdata_start__@h
|
||||||
ori %r4, %r4, __romdata_start__@l
|
ori %r4, %r4, __romdata_start__@l
|
||||||
lis %r5, __data_start__@h
|
lis %r5, __data_start__@h
|
||||||
|
@ -83,37 +177,66 @@ _boot_address:
|
||||||
addi %r5, %r5, 4
|
addi %r5, %r5, 4
|
||||||
b .dataloop
|
b .dataloop
|
||||||
.dataend:
|
.dataend:
|
||||||
/*
|
#endif
|
||||||
* Late initialization.
|
|
||||||
*/
|
/* Late initialization.*/
|
||||||
bl __late_init
|
bl __late_init
|
||||||
/*
|
|
||||||
* Main program invocation.
|
#if CRT0_CALL_CONSTRUCTORS == TRUE
|
||||||
*/
|
/* Constructors invocation.*/
|
||||||
|
lis %r4, __init_array_start@h
|
||||||
|
ori %r4, %r4, __init_array_start@l
|
||||||
|
lis %r5, __init_array_end@h
|
||||||
|
ori %r5, %r5, __init_array_end@l
|
||||||
|
.iniloop:
|
||||||
|
cmplw %cr0, %r4, %r5
|
||||||
|
bge %cr0, .iniend
|
||||||
|
lwz %r6, 0(%r4)
|
||||||
|
mtctr %r6
|
||||||
|
addi %r4, %r4, 4
|
||||||
|
bctrl
|
||||||
|
b .iniloop
|
||||||
|
.iniend:
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Main program invocation.*/
|
||||||
bl main
|
bl main
|
||||||
b _main_exit_handler
|
|
||||||
|
|
||||||
/*
|
#if CRT0_CALL_DESTRUCTORS == TRUE
|
||||||
* Default main exit code, infinite loop.
|
/* Destructors invocation.*/
|
||||||
*/
|
lis %r4, __fini_array_start@h
|
||||||
.weak _main_exit_handler
|
ori %r4, %r4, __fini_array_start@l
|
||||||
.globl _main_exit_handler
|
lis %r5, __fini_array_end@h
|
||||||
.type _main_exit_handler, @function
|
ori %r5, %r5, __fini_array_end@l
|
||||||
_main_exit_handler:
|
.finiloop:
|
||||||
b _main_exit_handler
|
cmplw %cr0, %r4, %r5
|
||||||
|
bge %cr0, .finiend
|
||||||
|
lwz %r6, 0(%r4)
|
||||||
|
mtctr %r6
|
||||||
|
addi %r4, %r4, 4
|
||||||
|
bctrl
|
||||||
|
b .finiloop
|
||||||
|
.finiend:
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/* Branching to the defined exit handler.*/
|
||||||
* Default early initialization code, none.
|
b __default_exit
|
||||||
*/
|
|
||||||
|
/* Default main exit code, infinite loop.*/
|
||||||
|
.weak __default_exit
|
||||||
|
.globl __default_exit
|
||||||
|
.type __default_exit, @function
|
||||||
|
__default_exit:
|
||||||
|
b __default_exit
|
||||||
|
|
||||||
|
/* Default early initialization code, none.*/
|
||||||
.weak __early_init
|
.weak __early_init
|
||||||
.globl __early_init
|
.globl __early_init
|
||||||
.type __early_init, @function
|
.type __early_init, @function
|
||||||
__early_init:
|
__early_init:
|
||||||
blr
|
blr
|
||||||
|
|
||||||
/*
|
/* Default late initialization code, none.*/
|
||||||
* Default late initialization code, none.
|
|
||||||
*/
|
|
||||||
.weak __late_init
|
.weak __late_init
|
||||||
.globl __late_init
|
.globl __late_init
|
||||||
.type __late_init, @function
|
.type __late_init, @function
|
||||||
|
|
Loading…
Reference in New Issue