#16257 - Dan_attacker - Wed Feb 11, 2004 8:41 am
How do i make it show how much free ram I have left?
#16277 - poslundc - Wed Feb 11, 2004 3:24 pm
Well, you can call the nm utility on your .elf file to give a readout of where everything is being placed in memory. Use the -n switch to order everything in terms of memory location, and you'll be able to easily tell where your various memory sections start and end.
That's:
nm -n file.elf
Dan.
#16294 - Dan_attacker - Wed Feb 11, 2004 10:22 pm
Well, that worked, but it shows so much stuff that it scrolls off the screen. Actually, this is my problem... there are lines of code in this program i'm modifying that break the program. Here is one of those lines...
bs_mpg.bits = (unsigned char *) mem_alloc ((long) 13824, "MPG Bits");
If I change the number 13824 to something like 10 then it works... but the way it is now freezes the program. Did I run out of memory?
PS: I have no idea how this program works but it compiled and I wanna make it work. lol
#16298 - poslundc - Wed Feb 11, 2004 11:27 pm
Dan_attacker wrote: |
bs_mpg.bits = (unsigned char *) mem_alloc ((long) 13824, "MPG Bits");
If I change the number 13824 to something like 10 then it works... but the way it is now freezes the program. Did I run out of memory? |
Well, probably. If the mem_alloc function uses EWRAM then I'd say no, but since you're crashing it probably use IWRAM, and if it's doing some kind of MPEG decompression it would probably need to use IWRAM for the speed.
You've only got 32K of IWRAM, and your buffer is 13.5K. That still leaves over half of the IWRAM left, so I'm guessing your app is pretty IWRAM-heavy?
Quote: |
PS: I have no idea how this program works but it compiled and I wanna make it work. lol |
Unfortunately, compilation in no way guarantees that the code you're using works or is correctly written. :P Have you tried reading the documentation of the program you're using?
As for everything scrolling by on your screen too quickly, does your terminal program not have a scrollback feature? (ie. scrollbars?) You can always try piping it through more (nm -n file.elf | more) which works on Unix and I think works on Win/DOS as well.
Dan.
#16354 - Dan_attacker - Fri Feb 13, 2004 3:33 am
How would I move that reserved buffer space over to the EWRAM? I'm not too concerned with speed right now. Anyways, I'm just playing around. I don't have the knowledge to work on a program this complicated. I'm still a C++ newbie.
#16358 - poslundc - Fri Feb 13, 2004 4:25 am
Well, if you don't know what the program is doing it's probably not a good idea to mess with how it works. You can get a pointer to EWRAM just by changing your line to a fixed address located in EWRAM, such as:
bs_mpg.bits = (unsigned char *)0x02000000;
... but if the program uses EWRAM for anything else (or if it is a multiboot program) this will cause problems. You could also be inviting any number of errors with the speed issue - more than just slowdown, depending on how the program is designed and if it relies on having the fast RAM.
Dan.