You are not logged in.
Lost Password?


Register To Post



 Bottom   Previous Topic   Next Topic

#1
crt0 and linker script - added small data sections for global pointer
Posted on: 2011/12/24 0:46
Nintendoid!
Joined 2007/8/8
Great Britain
201 Posts
CoderContributorHOTY09 EntryLong Time User (12 Years) App Coder
Hello,

I've updated the crt0 and linker script to enable the use of the sda attribute when declaring global/static variables. This enables global/static variables to be accessed in a single instruction using the global pointer register (r4).


__attribute
((sda)) int foo42;

The updated crt0 and linker script are attached. Let me know if you have any problems/suggestions.

There's also a compiler option -msda=n which puts all global/static variables of size n bytes or less into the small data area. The maximum size of the sda is 64K, the same as WRAM. However, when using this option the compiler rather unhelpfully creates a .rosdata section which I'm not quite sure what to do about yet, so use the sda attribute instead for now.

More info: NEC V850 development

dasi

Attach file:


s crt0.s Size: 6.22 KB; Hits: 170
ld vb.ld Size: 1.64 KB; Hits: 179
Top

#2
Re: crt0 and linker script - added small data sections for global pointer
Posted on: 2012/10/7 15:28
PVB Elite
Joined 2011/7/1
Germany
1109 Posts
CoderContributorTop10 PosterLong Time User (8 Years) App CoderPVBCC 2013 Entry
How exactly do I use the crt0 script? I added the linker script to the makefile and it seems like it is used now. However, I have no idea how to use the crt0 script...
Top

#3
Re: crt0 and linker script - added small data sections for global pointer
Posted on: 2012/10/7 19:45
PVB Elite
Joined 2011/7/1
Germany
1109 Posts
CoderContributorTop10 PosterLong Time User (8 Years) App CoderPVBCC 2013 Entry
Turns out it can simply be compiled to an object using:

v810-as.exe -o crt0.o crt0.s
Top

#4
Re: crt0 and linker script - added small data sections for global pointer
Posted on: 2012/12/16 19:52
PVB Elite
Joined 2011/7/1
Germany
1109 Posts
CoderContributorTop10 PosterLong Time User (8 Years) App CoderPVBCC 2013 Entry
After writing some 1000 lines of code I get this linker error:


v810
-gcc -Tvb.ld -Wall -nodefaultlibs -mv810 -xc -o fishbone.o fishbone.
/usr/local/v810/bin/ldaddress 0x501022c of fishbone.o section .data is not within region wram 
collect2
ld returned 1 exit status 
make
: *** [fishbone.oError 1


Any idea what this means and how to fix it?
Top

#5
Re: crt0 and linker script - added small data sections for global pointer
Posted on: 2012/12/16 21:19
PVB Elite
Joined 2008/12/28
Slovenia
628 Posts
Highscore Top ScoreHighscore Top ScoreCoderContributor10+ Game RatingsLong Time User (10 Years) App CoderPVBCC 2010 EntryPVBCC 2013 Entry
I'm not an expert on this, but it looks like you have used up all the WRAM (Work RAM), which is the RAM available for use by the game. It is 64K in size and accessible from 0x05000000 to 0x0500FFFF, then it is mirrored 255 times. Do you have any large static arrays in the code?
Top

#6
Re: crt0 and linker script - added small data sections for global pointer
Posted on: 2012/12/16 22:45
PVB Elite
Joined 2011/7/1
Germany
1109 Posts
CoderContributorTop10 PosterLong Time User (8 Years) App CoderPVBCC 2013 Entry
Quote:

HorvatM wrote:
I'm not an expert on this, but it looks like you have used up all the WRAM (Work RAM), which is the RAM available for use by the game. It is 64K in size and accessible from 0x05000000 to 0x0500FFFF, then it is mirrored 255 times. Do you have any large static arrays in the code?


I just had a look into the linker script and saw the same thing. I do have some larger array. I guess making them 'const' would solve the problem. I had some problems with large const arrays in the past so I tried avoiding them. Just out of curiosity: Why is the wram mirrored 255 times?
Top

 Top   Previous Topic   Next Topic


Register To Post