⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 retarget.c

📁 一个很好的Atmel 的ARM的启动代码。(已经调试过了)
💻 C
字号:
/*=================================文件信息================================*/
/*文   件   名:retarget     .c                                            */
/*创   建   人:葛康                                                       */
/*最后修改日期:2006年3月14日                                              */
/*文 件 描  述: 无                                                        */
/*=========================================================================*/

//* Semihosting Flag
//#ifndef SEMIHOSTING

#include <rt_misc.h>

/*-------------------------------------------------------------------------*/
/*define the heap size                                                     */
/*                                                                         */
/*       RAM:                                                              */
/*                             ---------------                             */ 
/*           SP -> top of RAM |   0x20x0000   |                            */
/*                            |               |                            */
/*           Heap base        | SP - HEAP_SIZE|                            */
/*                             ---------------                             */
/*                            |               |                            */
/*           text(code)       |   0x2000000   |                            */
/*                            |  reset + size |                            */
/*                             ---------------                             */
/*                            |   0x2000000   | Entry point                */
/*           reset(code)       ---------------                             */
/*-------------------------------------------------------------------------*/

#define HEAP_SIZE 	(64 *1024)


/***************************************************************************/
/*函数名称:_sys_exit                                                      */
/*功能描述:Wait for error system return main. Called, eventually          */
/*          by all exits from the library                                  */
/*输入参数:return_code                                                    */
/*输出参数:无                                                             */
/*调用函数:无                                                             */
/***************************************************************************/
void _sys_exit(int return_code)
{
  while(1); //* endless loop
}


/***************************************************************************/
/*函数名称:_ttywrch                                                       */
/*功能描述:This function writes a character to the console. The           */
/*          console might have been redirected. You can use this           */
/*          function as a last resort error handling routine.              */
/*输入参数:ch                                                             */
/*输出参数:none                                                           */
/*调用函数:none                                                           */
/***************************************************************************/
void _ttywrch(int ch)
{

}

/***************************************************************************/
/*函数名称:__user_initial_stackheap                                       */
/*功能描述:Returns the locations of the initial stack and heap.           */
/*输入参数:none                                                           */
/*输出参数:The values returned in r0 to r3 depend on whether you          */
/*          are using the one or two region model                          */
/*          One region (r0,r1) is the single stack and heap region. r1 is  */
/*          greater than r0. r2 and r3 are ignored.                        */
/*          Two regions (r0, r2) is the initial heap and (r3, r1) is       */
/*          the initial stack. r2 is greater than or equal to r0. r3 is    */
/*          less than r1.                                                  */
/*调用函数:none                                                           */
/***************************************************************************/
__value_in_regs struct __initial_stackheap __user_initial_stackheap(
        unsigned R0, unsigned SP, unsigned R2, unsigned SL)
{
    struct __initial_stackheap config;

    config.heap_base = SP - HEAP_SIZE;
    config.stack_base = SP;

    return config;
}

//#endif // SEMIHOSTING

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -