This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Why use pointer?
- To: "ecos-discuss" <ecos-discuss at sources dot redhat dot com>
- Subject: [ECOS] Why use pointer?
- From: "John" <john at imining dot com dot tw>
- Date: Tue, 3 Apr 2001 17:57:44 +0800
Hi all,
I'm new to ecos.
I see the following code in vectors.S of arm platform.
It uses PTR(init_flag) to make a pointer.
And then uses
ldr r0,.init_flag
ldr r1,[r0]
to load data at address init_flag.
Why not use
ldr r1,init_flag
like init_done below?
Is the pointer for some special purpose or some reason?
Thanks in advance.
.globl start
start:
LED 5
#if defined(CYG_HAL_STARTUP_RAM) && \
!defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS)
// If we get restarted, hang here to avoid corrupting memory
ldr r0,.init_flag
ldr r1,[r0]
1: cmp r1,#0
bne 1b
ldr r1,init_done
str r1,[r0]
----
謝豪哲
John Hsieh
發現者國際股份有限公司
iMining Technology Co., Ltd.
john@imining.com.tw
TEL: 886-2-27235122
FAX: 886-2-27232287
www.imining.com.tw