You are not logged in.
Lost Password?


Register To Post



 Bottom   Previous Topic   Next Topic

#1
experimental gcc4 patches
Posted on: 2010/4/4 22:10
VB Gamer
Joined 2008/8/31
Germany
41 Posts
PVBCC 2ndHighscore Top10 2ndHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreCoderLong Time User (10 Years) 20+ Game RatingsPVBCC 2013 1st
A while ago I used the existing gccvb patches to write new ones for gcc4. It's quite possible that they contain bugs.
So far I haven't tested code compiled with this version on a real VB, but it runs well in Reality Boy.

Attach file:


zip gccvb-patches.zip Size: 184.76 KB; Hits: 186
Top

#2
Re: experimental gcc4 patches
Posted on: 2010/4/5 20:34
Nintendoid!
Joined 2007/8/8
Great Britain
201 Posts
CoderContributorHOTY09 EntryLong Time User (11 Years) App Coder
Appears to run okay on hardware too, nice work M.K.!
Top

#3
Re: experimental gcc4 patches
Posted on: 2010/4/6 12:52
Nintendoid!
Joined 2007/8/8
Great Britain
201 Posts
CoderContributorHOTY09 EntryLong Time User (11 Years) App Coder
M.K., could you post the build script you used to compile this?

Also, I've noticed that 4.4.2, when calling functions, is frequently doing this:


movhi hi
(_posprintf),r0,r25    #, tmp130
movea lo(_posprintf),r25,r25    #, tmp130, tmp131

. . .

jal .+4
add 4
,r31
jmp r25    
# tmp131


Instead of simply doing this:


jal _posprintf


Maybe an incorrectly enabled optimisation option? Any ideas?
Top

#4
Re: experimental gcc4 patches
Posted on: 2010/4/7 23:47
VB Gamer
Joined 2008/8/31
Germany
41 Posts
PVBCC 2ndHighscore Top10 2ndHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreHighscore Top ScoreCoderLong Time User (10 Years) 20+ Game RatingsPVBCC 2013 1st
Thanks for testing.
The compiler seems not to generate PC-relative function calls. When I have time, I will try to fix it.
Top

#5
Re: experimental gcc4 patches
Posted on: 2010/4/23 3:02
PVB Elite
Joined 2003/7/26
USA
1462 Posts
PVBCC EntryCoderContributorSpecial AchievementTop10 PosterHOTY09 EntryLong Time User (15 Years) App Coder20+ Game RatingsPVBCC 2013 Entry
I've noticed another caveat with this version: it's much more strict about the syntax of in-line assembly blocks. Namely, the endings have to be right. Something like this:


asm
(
  
"jr foo%="
  "bar%=:"
   "ld.b 0[%0],r10"
   "foo%=:"
   
/* Output */
   
"r" (r10/* Input */
   
"r10" /* clobbered */
);


...used to work. Now you need something like:


asm
(
  
"jr foo%=;"
  "bar%=:\n\t"
   "ld.b 0[%0],r10;"
   "foo%=:\n\t"
   
/* Output */
   
"r" (r10/* Input */
   
"r10" /* Clobbered */
);


The thing to notice is the ";" or "\n\t" at the end of every statement line (which are interchangeable, I just used those for aesthetics). Just something to keep in mind when porting older code or writing new.
Top

#6
Re: experimental gcc4 patches
Posted on: 2010/5/6 21:53
VB Gamer
Joined 2010/5/5
USA
10 Posts
Long Time User (9 Years)
Hi,

I am attempting to patch and compile gcc for the first time, and I am running into some trouble.

I am using Ubuntu 10.04 32-bit and gcc 4.4.3. I have downloaded binutils-2.20.tar.bz2, gcc-core-4.4.2.tar.bz2, and newlib-1.17.0.tar.gz from their respective locations and applied the patches posted by M.K.

I followed the general outline of the "make_v810.sh" script in [http://goliathindustries.com/vb/downl ... cvb/vb_v810_gcc_03.tar.gz], which was originally intended for gcc 2.95. Essentially, I untarred the three archives, applied the three patches, built and installed binutils successfully, then continued on to configure and compile gcc.

The issue is that, during the gcc build, I eventually hit an error. Here's how I configured and compiled it:

> mkdir gcc_build
> cd gcc_build
> ../gcc-4.4.2/configure --target=v810 --prefix=/opt/gccvb/bin --enable-languages=c --without-headers --with-newlib
> make all install

And after several minutes of compiling, I hit this:

-------------------------
(A bit too long, so I uploaded it. Note that this output was produced without the --without-headers flag, but it's pretty much identical)
http://www.codeupload.com/526
-------------------------

I find it peculiar that the preprocessor cannot find "string.h" and the others, as they are definitely on my system. Note the line: "checking for string.h... (cached) no" This seems to be a configure step performed specifically for zlib.

How to I ensure compiler finds all the necessary headers? Am I missing a step or compiling incorrectly?

Thanks,
Steve
Top

#7
Re: experimental gcc4 patches
Posted on: 2010/5/10 21:51
VB Gamer
Joined 2010/5/5
USA
10 Posts
Long Time User (9 Years)
Just to follow up on my compilation problem: I successfully built GCC 4.4.2, used it to compile the VB demo from the dev wiki, and ran it on Mednafen.

Here's some of the commands I used:

1. mkdir binutils_build
2. cd binutils_build
3. ../binutils-2.20/configure --target=v810 --prefix=/opt/gccvb
4. make all install
5. PATH=$PATH:/opt/gccvb
6. mkdir ../gcc_build
7. cd ../gcc_build
8. ../gcc-4.4.2/configure --target=v810 --prefix=/opt/gccvb --enable-languages=c --without-headers --with-newlib --disable-shared --disable-threads
9. make all-gcc install-gcc
10. mkdir ../newlib_build
11. cd ../newlib_build
12. PATH=$PATH:/opt/gccvb/bin
13. sudo ln -s /opt/gccvb/bin/v810-gcc /opt/gccvb/bin/v810-cc # Because newlib wanted to use v810-cc but couldn't find it.
14. ../newlib-1.17.0/configure --target=v810 --prefix=/opt/gccvb
15. make all install
16. cd ../gcc_build/
17. ../gcc-4.4.2/configure --target=v810 --prefix=/opt/gccvb --enable-languages=c
18. make all install

I used these commands to compile the demo:

1. v810-as demo.vbh -o demo.zzh
2. v810-objcopy -S -O binary demo.zzh demo.hdr
3. rm demo.zzh
4. v810-gcc -nodefaultlibs -mv810 -x c -o demo.o demo.c
5. v810-objcopy -S -O binary demo.o demo.vb

Steve
Top

#8
Re: experimental gcc4 patches
Posted on: 2010/5/25 3:32
VUE(xpert)
Joined 2006/9/29
USA
267 Posts
CoderLong Time User (12 Years) PVBCC 2010 3rd
It was really ticking me off that I couldn't get the old gccvb to compile under linux, so I tried these new patches. Once I got all the minor glitches worked out, compilation seemed to go without a hitch... until I tried to use v810-gcc to compile something. I tried what Tarsius did to compile one of my demos, binutils seems to work as the header assembled properly, but then when I tried to compile, I got this:


[fwirt@sploopby demo1]$ v810-gcc -nodefaultlibs -mv810 -x c -o demo1.o demo1.c
/usr/local/bin/../lib/gcc/v810/4.4.2/../../../../v810/lib/crt0.oIn function `_int_table':
(.vbvectors+0x28): undefined reference to 
`_key_vector'

...there are 9 more of those errors, pertaining to undefined references to _tim_vector, _cro_vector, _com_vector, and _vpu_vector. I also tried compiling the simplest program I could think of:

int main
()
{
    return 
0;
}

...and got exactly the same result. Is this the result of me compiling gcc incorrectly? To be honest, I've never compiled gcc before, so I have no clue what I'm supposed to be doing. Any suggestions would be great, I haven't had the drive to write any VB code the last few days because booting into Windows just so I can use an outdated version of gccvb is kind of a pain...
Top

#9
Re: experimental gcc4 patches
Posted on: 2010/5/25 8:29
PVB Elite
Joined 2003/7/25
USA
1507 Posts
PVBCC 1stCoderContributor#3 PosterHOTY09 EntryLong Time User (15 Years) App CoderPVBCC 2010 EntryPVBCC 2013 Entry
Depending how you're set up you may need to declare your interrupt functions, like:
void key_vector(void){}
void tim_vector(void){}
void cro_vector(void){}
void com_vector(void){}
void vpu_vector(void){}

If that doesn't work, try:
extern u32 key_vector;
extern u32 tim_vector;
extern u32 cro_vector;
extern u32 com_vector;
extern u32 vpu_vector;

The first one actually declares the functions, the second one assumes that they exist, but are external to the code (some gccVB configurations use one, others use the other). From the error, I'd guess you need the first.

DogP
Top

#10
Re: experimental gcc4 patches
Posted on: 2010/5/25 10:46
VUE(xpert)
Joined 2006/9/29
USA
267 Posts
CoderLong Time User (12 Years) PVBCC 2010 3rd
I can't thank you enough... that did the trick. I recompiled everything 2 or 3 times today because I thought I had neglected to compile in support for a library or something... Any reason why that's necessary now when it didn't used to be? (And is there any way to disable interrupts so I don't need to do that every time? I guess I could just shove those lines into a header somewhere...) Well, at any rate, I had no idea how to put code at the interrupt vectors before, so this should do the trick. I've done some development on AVRs, but my knowledge is still pretty spotty when developing for a console like this. I hope that some day I have some idea of what I'm doing like you guys do...
Top

 Top   Previous Topic   Next Topic


Register To Post