EASy68K  
It is currently Sat Jun 06, 2020 7:21 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon May 07, 2012 8:34 am 
Offline

Joined: Tue Oct 20, 2009 12:01 pm
Posts: 16
Location: scotland
Hi,

I am developing some code using the IDE68K developement environment, my project has, other than the usual cstart.asm, 2 code modules a 68000 assembly .a68 file and a C source .c file.

within the Assembly there is a varuable defined and used

section data
align
xdef __exitflag
__exitflag: dcb 1,0 * define exit flag 1 byte, set to 0
align

And my assembly references the __exitflag as you would expect.

But I also want to reference this byte in memory from the C program and for it to be referenced by its name and not coded to be in a fixed memory location. So my C code is :

extern unsigned char __exitflag;

within the definitions and then later in the C code :

while (__exitflag == 0)
{
}


which obviously waits for the __exitflag to be non zero.


But when I build the project I always get an "Undefined symbol" error when assembling the combined project .src file.


Any ideas where I am going wrong? I suspect the problem is in the assembly define and I've tried a few variations but still undefined....


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 07, 2012 2:01 pm 
Offline

Joined: Mon Jul 26, 2010 11:43 pm
Posts: 198
Location: Aurora, IL
I think the C compiler adds a '_' on to all procedures and variables. Also consider marking it as volatile if it is touched outside the scope of the routine, ie via interrupt.

Code:
extern volatile unsigned char _exitflag;

// ...

while (_exitflag == 0)
{
}

Review the listing file from IDE68K to see what it is doing.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 07, 2012 8:06 pm 
Offline

Joined: Tue Oct 20, 2009 12:01 pm
Posts: 16
Location: scotland
Bingo!

Thanks very much; the extra "_" was the issue.


And yes it was an interupt routine that was setting the __exitflag.


Thanks again


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group