git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@750 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
d934612e31
commit
c4c192b027
|
@ -24,7 +24,12 @@
|
||||||
|
|
||||||
#include <sam7x_serial.h>
|
#include <sam7x_serial.h>
|
||||||
|
|
||||||
extern void FiqHandler(void);
|
/*
|
||||||
|
* FIQ Handler, unused in this demo.
|
||||||
|
*/
|
||||||
|
__attribute__((interrupt("FIQ")))
|
||||||
|
static void FiqHandler(void) {
|
||||||
|
}
|
||||||
|
|
||||||
static CH_IRQ_HANDLER(SpuriousHandler) {
|
static CH_IRQ_HANDLER(SpuriousHandler) {
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,12 @@
|
||||||
#include <sam7x_serial.h>
|
#include <sam7x_serial.h>
|
||||||
#include <sam7x_emac.h>
|
#include <sam7x_emac.h>
|
||||||
|
|
||||||
extern void FiqHandler(void);
|
/*
|
||||||
|
* FIQ Handler, unused in this demo.
|
||||||
|
*/
|
||||||
|
__attribute__((interrupt("FIQ")))
|
||||||
|
static void FiqHandler(void) {
|
||||||
|
}
|
||||||
|
|
||||||
static CH_IRQ_HANDLER(SpuriousHandler) {
|
static CH_IRQ_HANDLER(SpuriousHandler) {
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ _start:
|
||||||
ldr pc, [pc,#-0xF20] /* AIC - AIC_FVR */
|
ldr pc, [pc,#-0xF20] /* AIC - AIC_FVR */
|
||||||
|
|
||||||
_reset:
|
_reset:
|
||||||
.word ResetHandler
|
.word ResetHandler /* In crt0.s */
|
||||||
_undefined:
|
_undefined:
|
||||||
.word UndHandler
|
.word UndHandler
|
||||||
_swi:
|
_swi:
|
||||||
|
@ -46,3 +46,26 @@ _abort:
|
||||||
.word 0
|
.word 0
|
||||||
.word 0
|
.word 0
|
||||||
.word 0
|
.word 0
|
||||||
|
|
||||||
|
.text
|
||||||
|
.code 32
|
||||||
|
.balign 4
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Default exceptions handlers. The handlers are declared weak in order to be
|
||||||
|
* replaced by the real handling code. Everything is defaulted to an infinite
|
||||||
|
* loop.
|
||||||
|
*/
|
||||||
|
.weak UndHandler
|
||||||
|
UndHandler:
|
||||||
|
|
||||||
|
.weak SwiHandler
|
||||||
|
SwiHandler:
|
||||||
|
|
||||||
|
.weak PrefetchHandler
|
||||||
|
PrefetchHandler:
|
||||||
|
|
||||||
|
.weak AbortHandler
|
||||||
|
AbortHandler:
|
||||||
|
|
||||||
|
.loop: b .loop
|
||||||
|
|
|
@ -34,7 +34,7 @@ _start:
|
||||||
ldr pc, _fiq
|
ldr pc, _fiq
|
||||||
|
|
||||||
_reset:
|
_reset:
|
||||||
.word ResetHandler
|
.word ResetHandler /* In crt0.s */
|
||||||
_undefined:
|
_undefined:
|
||||||
.word UndHandler
|
.word UndHandler
|
||||||
_swi:
|
_swi:
|
||||||
|
@ -47,3 +47,25 @@ _fiq:
|
||||||
.word FiqHandler
|
.word FiqHandler
|
||||||
.word 0
|
.word 0
|
||||||
.word 0
|
.word 0
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Default exceptions handlers. The handlers are declared weak in order to be
|
||||||
|
* replaced by the real handling code. Everything is defaulted to an infinite
|
||||||
|
* loop.
|
||||||
|
*/
|
||||||
|
.weak UndHandler
|
||||||
|
UndHandler:
|
||||||
|
|
||||||
|
.weak SwiHandler
|
||||||
|
SwiHandler:
|
||||||
|
|
||||||
|
.weak PrefetchHandler
|
||||||
|
PrefetchHandler:
|
||||||
|
|
||||||
|
.weak AbortHandler
|
||||||
|
AbortHandler:
|
||||||
|
|
||||||
|
.weak FiqHandler
|
||||||
|
FiqHandler:
|
||||||
|
|
||||||
|
.loop: b .loop
|
||||||
|
|
|
@ -119,16 +119,7 @@ bssloop:
|
||||||
/*
|
/*
|
||||||
* Late initialization.
|
* Late initialization.
|
||||||
*/
|
*/
|
||||||
#ifndef THUMB_NO_INTERWORKING
|
#ifdef THUMB_NO_INTERWORKING
|
||||||
bl hwinit1
|
|
||||||
/*
|
|
||||||
* main(0, NULL).
|
|
||||||
*/
|
|
||||||
mov r0, #0
|
|
||||||
mov r1, r0
|
|
||||||
bl main
|
|
||||||
bl port_halt
|
|
||||||
#else
|
|
||||||
add r0, pc, #1
|
add r0, pc, #1
|
||||||
bx r0
|
bx r0
|
||||||
.code 16
|
.code 16
|
||||||
|
@ -136,51 +127,40 @@ bssloop:
|
||||||
mov r0, #0
|
mov r0, #0
|
||||||
mov r1, r0
|
mov r1, r0
|
||||||
bl main
|
bl main
|
||||||
bl port_halt
|
ldr r1, =MainExitHandler
|
||||||
|
bx r1
|
||||||
.code 32
|
.code 32
|
||||||
|
#else
|
||||||
|
bl hwinit1
|
||||||
|
mov r0, #0
|
||||||
|
mov r1, r0
|
||||||
|
bl main
|
||||||
|
b MainExitHandler
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default exceptions handlers. The handlers are declared weak in order to be
|
* Default main function exit handler.
|
||||||
* replaced by the real handling code.
|
|
||||||
*/
|
*/
|
||||||
.weak UndHandler
|
.weak MainExitHandler
|
||||||
.globl UndHandler
|
.globl MainExitHandler
|
||||||
UndHandler:
|
MainExitHandler:
|
||||||
|
|
||||||
.weak SwiHandler
|
|
||||||
.globl SwiHandler
|
|
||||||
SwiHandler:
|
|
||||||
|
|
||||||
.weak PrefetchHandler
|
|
||||||
.globl PrefetchHandler
|
|
||||||
PrefetchHandler:
|
|
||||||
|
|
||||||
.weak AbortHandler
|
|
||||||
.globl AbortHandler
|
|
||||||
AbortHandler:
|
|
||||||
|
|
||||||
.weak FiqHandler
|
|
||||||
.globl FiqHandler
|
|
||||||
FiqHandler:
|
|
||||||
|
|
||||||
.loop: b .loop
|
.loop: b .loop
|
||||||
|
|
||||||
#ifdef THUMB_NO_INTERWORKING
|
|
||||||
.code 16
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default early initialization code. It is declared weak in order to be
|
* Default early initialization code. It is declared weak in order to be
|
||||||
* replaced by the real initialization code.
|
* replaced by the real initialization code.
|
||||||
* Early initialization is performed just after reset before BSS and DATA
|
* Early initialization is performed just after reset before BSS and DATA
|
||||||
* segments initialization.
|
* segments initialization.
|
||||||
*/
|
*/
|
||||||
.global hwinit0
|
#ifdef THUMB_NO_INTERWORKING
|
||||||
.weak hwinit0
|
|
||||||
.thumb_func
|
.thumb_func
|
||||||
|
.code 16
|
||||||
|
#endif
|
||||||
|
.weak hwinit0
|
||||||
hwinit0:
|
hwinit0:
|
||||||
bx lr
|
bx lr
|
||||||
|
.code 32
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default late initialization code. It is declared weak in order to be
|
* Default late initialization code. It is declared weak in order to be
|
||||||
|
@ -188,11 +168,14 @@ hwinit0:
|
||||||
* Late initialization is performed after BSS and DATA segments initialization
|
* Late initialization is performed after BSS and DATA segments initialization
|
||||||
* and before invoking the main() function.
|
* and before invoking the main() function.
|
||||||
*/
|
*/
|
||||||
.global hwinit1
|
#ifdef THUMB_NO_INTERWORKING
|
||||||
.weak hwinit1
|
|
||||||
.thumb_func
|
.thumb_func
|
||||||
|
.code 16
|
||||||
|
#endif
|
||||||
|
.weak hwinit1
|
||||||
hwinit1:
|
hwinit1:
|
||||||
bx lr
|
bx lr
|
||||||
|
.code 32
|
||||||
|
|
||||||
/** @endcond */
|
/** @endcond */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -138,3 +138,52 @@
|
||||||
* @file ports/ARM7/chcore.c Port related code.
|
* @file ports/ARM7/chcore.c Port related code.
|
||||||
*/
|
*/
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @defgroup ARM7_STARTUP Startup Support
|
||||||
|
* @{
|
||||||
|
* @brief ARM7 startup code support.
|
||||||
|
* @details ChibiOS/RT provides its own generic startup file for the ARM7 port.
|
||||||
|
* Of course it is not mandatory to use it but care should be taken about the
|
||||||
|
* startup phase details.
|
||||||
|
*
|
||||||
|
* <h2>Startup Process</h2>
|
||||||
|
* The startup process, as implemented, is the following:
|
||||||
|
* -# Initialize the various stacks assigning them the sizes defined in the
|
||||||
|
* linker script (usually named @p ch.ld). Stack areas are allocated from
|
||||||
|
* the highest RAM location downward.
|
||||||
|
* -# The ARM state is switched to System with both IRQ and FIQ sources
|
||||||
|
* disabled.
|
||||||
|
* -# An early initialization routine @p hwinit0 is invoked, if the symbol not
|
||||||
|
* defined then an empty default routine is executed (weak symbol).
|
||||||
|
* -# DATA and BSS segments are initialized.
|
||||||
|
* -# A late initialization routine @p hwinit1 is invoked, if the symbol not
|
||||||
|
* defined then an empty default routine is executed (weak symbol).<br>
|
||||||
|
* This late initialization function is also the proper place for a
|
||||||
|
* @a bootloader, if your application requires one.
|
||||||
|
* -# The @p main() function is invoked with the parameters @p argc and @p argv
|
||||||
|
* set to zero.
|
||||||
|
* -# Should the @p main() function return a branch is performed to the weak
|
||||||
|
* symbol MainExitHandler. The default code is an endless empty loop.
|
||||||
|
* .
|
||||||
|
* <h2>Expected linker symbols</h2>
|
||||||
|
* The startup code starts at the symbol @p ResetHandler and expects the
|
||||||
|
* following symbols to be defined in the linker script:
|
||||||
|
* - @p __ram_end__ RAM end location +1.
|
||||||
|
* - @p __und_stack_size__ Undefined Instruction stack size.
|
||||||
|
* - @p __abt_stack_size__ Memory Abort stack size.
|
||||||
|
* - @p __fiq_stack_size__ FIQ service stack size.
|
||||||
|
* - @p __irq_stack_size__ IRQ service stack size.
|
||||||
|
* - @p __svc_stack_size__ SVC service stack size.
|
||||||
|
* - @p __sys_stack_size__ System/User stack size. This is the stack used
|
||||||
|
* by the @p main() function.
|
||||||
|
* - @p _textdata address of the data segment source read only data.
|
||||||
|
* - @p _data data segment start location.
|
||||||
|
* - @p _edata data segment end location +1.
|
||||||
|
* - @p _bss_start BSS start location.
|
||||||
|
* - @p _bss_end BSS end location +1.
|
||||||
|
* .
|
||||||
|
* @ingroup ARM7
|
||||||
|
* @file ports/ARM7/crt0.s Startup code.
|
||||||
|
*/
|
||||||
|
/** @} */
|
||||||
|
|
|
@ -86,11 +86,20 @@ bloop:
|
||||||
isb
|
isb
|
||||||
/* Late initialization. */
|
/* Late initialization. */
|
||||||
bl hwinit1
|
bl hwinit1
|
||||||
/* main(0, NULL). */
|
|
||||||
movs r0, #0
|
movs r0, #0
|
||||||
mov r1, r0
|
mov r1, r0
|
||||||
bl main
|
bl main
|
||||||
bl port_halt
|
b MainExitHandler
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Default main exit code, just a loop.
|
||||||
|
* It is a weak symbol, the application code can redefine the behavior.
|
||||||
|
*/
|
||||||
|
.thumb_func
|
||||||
|
.global MainExitHandler
|
||||||
|
.weak MainExitHandler
|
||||||
|
MainExitHandler:
|
||||||
|
.loop: b .loop
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default early initialization code. It is declared weak in order to be
|
* Default early initialization code. It is declared weak in order to be
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
* Usually there is no need to change this value, please refer to the
|
* Usually there is no need to change this value, please refer to the
|
||||||
* Cortex-M3 technical reference manual for a detailed description.
|
* Cortex-M3 technical reference manual for a detailed description.
|
||||||
* - @p BASEPRI_KERNEL, this is the @p BASEPRI value for the kernel lock code.
|
* - @p BASEPRI_KERNEL, this is the @p BASEPRI value for the kernel lock code.
|
||||||
* The default value is 0x10.<br>
|
* The default value is 0x40.<br>
|
||||||
* Code running at higher priority levels must not invoke any OS API.<br>
|
* Code running at higher priority levels must not invoke any OS API.<br>
|
||||||
* Usually there is no need to change this value, please refer to the
|
* Usually there is no need to change this value, please refer to the
|
||||||
* Cortex-M3 technical reference manual for a detailed description.
|
* Cortex-M3 technical reference manual for a detailed description.
|
||||||
|
@ -110,6 +110,6 @@
|
||||||
* @{
|
* @{
|
||||||
* @brief ARM Cortex-M3 NVIC support.
|
* @brief ARM Cortex-M3 NVIC support.
|
||||||
*
|
*
|
||||||
* @ingroup ARMCM3_CORE
|
* @ingroup ARMCM3
|
||||||
*/
|
*/
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -101,6 +101,9 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
|
||||||
The options are no mode a simple define but a define with an assigned
|
The options are no mode a simple define but a define with an assigned
|
||||||
TRUE/FALSE value within an #ifndef block.
|
TRUE/FALSE value within an #ifndef block.
|
||||||
- NEW: Idle thread hook macro added to the configuration file.
|
- NEW: Idle thread hook macro added to the configuration file.
|
||||||
|
- NEW: Changed the ARM7 and Cortex-M3 startup files, now the action when
|
||||||
|
the main() function returns can be overridden by redefining the symbol
|
||||||
|
MainExitHandler.
|
||||||
- OPT: Improved ARM7 thumb port code, thanks to some GCC tricks involving
|
- OPT: Improved ARM7 thumb port code, thanks to some GCC tricks involving
|
||||||
registers usage now the kernel is much smaller, faster and most OS APIs
|
registers usage now the kernel is much smaller, faster and most OS APIs
|
||||||
use less RAM in stack frames (note, this is an ARM7 thumb mode specific
|
use less RAM in stack frames (note, this is an ARM7 thumb mode specific
|
||||||
|
|
1
todo.txt
1
todo.txt
|
@ -11,6 +11,7 @@ X lwIP TCP/IP stack integration.
|
||||||
- Multiple heaps, disjoint heaps, heaps in heaps.
|
- Multiple heaps, disjoint heaps, heaps in heaps.
|
||||||
- Multiple debug levels.
|
- Multiple debug levels.
|
||||||
- Stack guard pages.
|
- Stack guard pages.
|
||||||
|
- Threads profiling option.
|
||||||
* Idle loop hook macro.
|
* Idle loop hook macro.
|
||||||
* Switch the configuration options to TRUE/FALSE rather than def/undef.
|
* Switch the configuration options to TRUE/FALSE rather than def/undef.
|
||||||
- Abstract I/O channels rather than just serial ports.
|
- Abstract I/O channels rather than just serial ports.
|
||||||
|
|
Loading…
Reference in New Issue