git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3213 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
cd7e1aa36d
commit
cbcbaa0efe
|
@ -25,7 +25,7 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "chtypes.h"
|
#include <stdint.h>
|
||||||
|
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
#define TRUE (!FALSE)
|
#define TRUE (!FALSE)
|
||||||
|
@ -39,45 +39,80 @@ typedef funcp_t * funcpp_t;
|
||||||
* stack (dual stack mode).
|
* stack (dual stack mode).
|
||||||
*/
|
*/
|
||||||
#if !defined(CRT0_CONTROL_INIT) || defined(__DOXYGEN__)
|
#if !defined(CRT0_CONTROL_INIT) || defined(__DOXYGEN__)
|
||||||
#define CRT0_CONTROL_INIT 0x00000002
|
#define CRT0_CONTROL_INIT 0x00000002
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DATA segment initialization switch.
|
* @brief DATA segment initialization switch.
|
||||||
*/
|
*/
|
||||||
#if !defined(CRT0_INIT_DATA) || defined(__DOXYGEN__)
|
#if !defined(CRT0_INIT_DATA) || defined(__DOXYGEN__)
|
||||||
#define CRT0_INIT_DATA TRUE
|
#define CRT0_INIT_DATA TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief BSS segment initialization switch.
|
* @brief BSS segment initialization switch.
|
||||||
*/
|
*/
|
||||||
#if !defined(CRT0_INIT_BSS) || defined(__DOXYGEN__)
|
#if !defined(CRT0_INIT_BSS) || defined(__DOXYGEN__)
|
||||||
#define CRT0_INIT_BSS TRUE
|
#define CRT0_INIT_BSS TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Constructors invocation switch.
|
* @brief Constructors invocation switch.
|
||||||
*/
|
*/
|
||||||
#if !defined(CRT0_CALL_CONSTRUCTORS) || defined(__DOXYGEN__)
|
#if !defined(CRT0_CALL_CONSTRUCTORS) || defined(__DOXYGEN__)
|
||||||
#define CRT0_CALL_CONSTRUCTORS TRUE
|
#define CRT0_CALL_CONSTRUCTORS TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destructors invocation switch.
|
* @brief Destructors invocation switch.
|
||||||
*/
|
*/
|
||||||
#if !defined(CRT0_CALL_DESTRUCTORS) || defined(__DOXYGEN__)
|
#if !defined(CRT0_CALL_DESTRUCTORS) || defined(__DOXYGEN__)
|
||||||
#define CRT0_CALL_DESTRUCTORS TRUE
|
#define CRT0_CALL_DESTRUCTORS TRUE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0))
|
#define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Main thread stack initial position.
|
* @brief Main stack lower boundary.
|
||||||
* @details This symbol must be exported by the linker script and represents
|
* @details This symbol must be exported by the linker script and represents
|
||||||
* the main thread stack initial position.
|
* the main stack lower boundary.
|
||||||
*/
|
*/
|
||||||
extern uint8_t __process_stack_end__;
|
extern uint32_t __main_stack_base__;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Main stack initial position.
|
||||||
|
* @details This symbol must be exported by the linker script and represents
|
||||||
|
* the main stack initial position.
|
||||||
|
*/
|
||||||
|
extern uint32_t __main_stack_end__;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Process stack lower boundary.
|
||||||
|
* @details This symbol must be exported by the linker script and represents
|
||||||
|
* the process stack lower boundary.
|
||||||
|
*/
|
||||||
|
extern uint32_t __process_stack_base__;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Process stack initial position.
|
||||||
|
* @details This symbol must be exported by the linker script and represents
|
||||||
|
* the process stack initial position.
|
||||||
|
*/
|
||||||
|
extern uint32_t __process_stack_end__;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ROM image of the data segment start.
|
* @brief ROM image of the data segment start.
|
||||||
|
@ -176,6 +211,19 @@ void _default_exit(void) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Memory fill.
|
||||||
|
*
|
||||||
|
* @param[in] start fill area start
|
||||||
|
* @param[in] end fill area end
|
||||||
|
* @param[in] filler filler pattern
|
||||||
|
*/
|
||||||
|
static void fill32(uint32_t *start, uint32_t *end, uint32_t filler) {
|
||||||
|
|
||||||
|
while (start < end)
|
||||||
|
*start++ = filler;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reset vector.
|
* @brief Reset vector.
|
||||||
*/
|
*/
|
||||||
|
@ -199,6 +247,16 @@ void ResetHandler(void) {
|
||||||
/* Early initialization hook invocation.*/
|
/* Early initialization hook invocation.*/
|
||||||
__early_init();
|
__early_init();
|
||||||
|
|
||||||
|
#if CRT0_INIT_STACKS
|
||||||
|
/* Main and Process stacks initialization.*/
|
||||||
|
fill32(&__main_stack_base__,
|
||||||
|
&__main_stack_end__,
|
||||||
|
CRT0_STACKS_FILL_PATTERN);
|
||||||
|
fill32(&__process_stack_base__,
|
||||||
|
&__process_stack_end__,
|
||||||
|
CRT0_STACKS_FILL_PATTERN);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CRT0_INIT_DATA
|
#if CRT0_INIT_DATA
|
||||||
/* DATA segment initialization.*/
|
/* DATA segment initialization.*/
|
||||||
{
|
{
|
||||||
|
@ -213,13 +271,7 @@ void ResetHandler(void) {
|
||||||
|
|
||||||
#if CRT0_INIT_BSS
|
#if CRT0_INIT_BSS
|
||||||
/* BSS segment initialization.*/
|
/* BSS segment initialization.*/
|
||||||
{
|
fill32(&_bss_start, &_bss_end, 0);
|
||||||
uint32_t *bp;
|
|
||||||
|
|
||||||
bp = &_bss_start;
|
|
||||||
while (bp < &_bss_end)
|
|
||||||
*bp++ = 0;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Late initialization hook invocation.*/
|
/* Late initialization hook invocation.*/
|
||||||
|
|
|
@ -89,6 +89,9 @@
|
||||||
(backported to 2.2.4).
|
(backported to 2.2.4).
|
||||||
- FIX: Fixed timeout problem in the lwIP interface layer (bug 3302420)
|
- FIX: Fixed timeout problem in the lwIP interface layer (bug 3302420)
|
||||||
(backported to 2.2.4).
|
(backported to 2.2.4).
|
||||||
|
- NEW: The ARMCMx startup file (crt0.c) now is able to fill the stack areas
|
||||||
|
with a filler (default behavior). This is required in order to easily assess
|
||||||
|
the stack usage at runtime.
|
||||||
- NEW: Added the new CMSIS 2.1 headers, now CMSIS resides into a shared
|
- NEW: Added the new CMSIS 2.1 headers, now CMSIS resides into a shared
|
||||||
location: ./os/ports/common/ARMCMx/CMSIS. Old CMSIS files have been
|
location: ./os/ports/common/ARMCMx/CMSIS. Old CMSIS files have been
|
||||||
removed from the various platforms.
|
removed from the various platforms.
|
||||||
|
|
Loading…
Reference in New Issue