retarget.c
来自「realview22.rar」· C语言 代码 · 共 65 行
C
65 行
/*
** Copyright (C) ARM Limited, 2002. All rights reserved.
*/
#include <stdio.h>
#include <rt_misc.h>
extern unsigned int Image$$HEAP$$ZI$$Base;
extern unsigned int Image$$STACKS$$ZI$$Limit;
extern void clock_speed(int);
/*
The functions below are patched onto main - in later versions of ARM tools,
callouts from C Library Initialisation code will be available.
__rt_entry could be used instead of main
*/
extern void $Super$$main(void);
void $Sub$$main(void)
{
#ifdef SET_CLOCK
clock_speed(120);
#endif
$Super$$main(); // calls the original function
}
/*
This function re-implements the C Library semihosted function. The stack pointer
has aready been set and is passed back to the funtion, The base of the heap is
set from the scatter file
*/
__value_in_regs struct __initial_stackheap __user_initial_stackheap(
unsigned R0, unsigned SP, unsigned R2, unsigned SL)
{
struct __initial_stackheap config;
config.heap_base = (unsigned int)&Image$$HEAP$$ZI$$Base;
config.stack_base = (unsigned int)&Image$$STACKS$$ZI$$Limit;
return config;
}
/*
Below is an equivalent example assembler version of __user_initial_stackheap.
It will be entered with the value of the stackpointer in r1 (as set in init.s),
this does not need to be changed and so can be passed unmodified out of the
function.
IMPORT bottom_of_heap
EXPORT __user_initial_stackheap
__user_initial_stackheap
LDR r0,=bottom_of_heap
MOV pc,lr
*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?