This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Why use pointer?


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]