looks like you're missing a function prototype which says that cpu_demand
is dword.
However, if you then compare 'demand' against zero after this call, the result
assembly after call instruction does the right thing.
cheers,
~d
On Monday 08 December 2003 19:19, Tjerk Hofmeijer wrote:
> Hello,
>
> I think I have found a bug in mspgcc:
>
> I'm using Windows XP
> I'm using prebuilt installer msp430-toolchain-win32-20030210.exe
> I use a MSP430F149
> I compile every c file with the following rule :
>
> %.o: %.c
> msp430-gcc -g -mmcu=msp430x149 -O3 -c -I./include -o $@ $<
>
>
> dword is defined as follows:
> typedef unsigned long int dword;
>
>
> this is the code for cpu_demand (it doesn't do anything but the
> generated code is correct)
>
> dword cpu_demand(dword t, word taskcount, OS_Task_Specification *spec)
> {
> word i;
> dword sum=0,tmp;
> sum=0x12345678;
> return (dword) sum;
> }
>
> 000069fe <cpu_demand>:
> 69fe: 3e 40 78 56 mov #22136, r14 ;#0x5678
> 6a02: 3f 40 34 12 mov #4660, r15 ;#0x1234
> 6a06: 30 41 ret
>
>
> demand is a global variable defined as:
> dword demand;
>
> and its location is:
> 0000066c g O .bss 00000004 demand
>
>
> What I want is to execute the following line of code:
> demand=cpu_demand((dword) SHELL_PERIOD,1,(OS_Task_Specification
> *)taskspec);
>
> This results in the following code:
>
> 8768: 3c 40 86 86 mov #-31098,r12 ;#0x8686
> 876c: 1d 43 mov #1, r13 ;subst r3 with As==01
> 876e: 3e 40 20 03 mov #800, r14 ;#0x0320
> 8772: 0f 43 clr r15 ;
> 8774: b0 12 fe 69 call #27134 ;#0x69fe
> 8778: 82 4f 6c 06 mov r15, &0x066c ;
> 877c: 92 42 6c 06 6e 06 mov &0x066c,&0x066e ;src addr 0x066c
> 8782: 92 52 6e 06 6e 06 rla &0x066e ;
> 8788: 92 72 6e 06 6e 06 subc &0x066e,&0x066e ;src addr 0x066e
> 878e: b2 e3 6e 06 xor #-1, &0x066e ;subst r3 with As==11
>
>
>
> Since the global defined var demand resides at 0x066c
> I expect that with the following prototype:
>
> extern dword cpu_demand(dword t, word taskcount,
> OS_Task_Specification *spec);
>
> the value of r14 (lsw) is written at 0x066c and the value of r15 (msw)
> at 0x066e
> This however not the case (see code)
>
> If I use the global var demand afterwards the value it contains is
> 0000:msw instead of msw:lsw
>
> Maybe I'm doing something realy stupid....
>
> regards,
> Tjerk Hofmeijer
> [email protected]
>
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: IBM Linux Tutorials.
> Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
> Free Linux Tutorials. Learn everything from the bash shell to sys admin.
> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
> _______________________________________________
> Mspgcc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
--
/*****************************************************************
("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ
`6_ 6 ) `-. ( ).`-.__.`) State Polytechnical Univ.
(_Y_.)' ._ ) `._ `. ``-..-' Radio-Physics Departament
_..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia
(il),-'' (li),' ((!.-' +7 (812) 5403923, 5585314
*****************************************************************/