Roger S
Posts: 1
Joined: Sun Jan 07, 2018 10:05 pm

Problem with str instruction in as

Sun Jan 07, 2018 11:34 pm

I an currently porting a version of Forth written for a Microchip PIC to ARM code for my Pi. I am using as and gcc.
However I have problems with the following

Code: Select all

lit:
	ldr 	r1,  [r12]				@ get immediate word
	add	r12, r12, #4
	str	r1, [r11]				@ push on parameter stack    THIS INSTRUCTION CAUSES PROBLEMS
	add	r11, r11, #4
	b	 NEXT

store:
	ldmdb	r11, {r0, r1}		@ get address and data
	str	r0,  [r1]				@SAVE IT
	b NEXT
	- - - - - - 
	- - - - - -
QUIT:
	b docolon
	,word CR
	.word lit,  0x51,  EMIT
	.word store
	.word interpret	
	.word endcolon
The instruction str r1, [r11] causes the linker to not find the store label. I get the message:-

(.text+0x190): undefined reference to 'store'

If I comment out the str instruction the linker works but of course the "lit" word does not. If I comment out the line " .word store" again the linker works but obviously the QUIT word fails. By moving the "lit" code about in the program I find that it appears to be the label/labels immediately following the "lit" code which are not found.

Other thin the above the threaded code is working and includes the same str about 10 times without this problem.

Return to “Other languages”

Who is online

Users browsing this forum: No registered users and 1 guest