Doubts about RAM in MC9S08QE8 device

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Doubts about RAM in MC9S08QE8 device

Jump to solution
1,332 Views
Giox79
Contributor I

Good morning,

I have a doubt about my platform setup. 

I'm using a MC9S08QG8 device, and I have some problem running my program.

In fact it seems that I have some stack related problem, since after running a subroutine some global (.common section) variable change value. So I tried increasing the stack size but the linker tells me that it don't have enough space.

However looking at the .map file it seems to me that I still have some space:

 

 

Summary of section sizes per section type:
READ_ONLY (R):        144B (dec:     5195)
READ_WRITE (R/W):      160 (dec:      352)
NO_INIT (N/I):          55 (dec:       85)

 

 

So I'm using 0x160 bytes in RAM, but QG8 device has 0x200 bytes of RAM. Why I can't increase my stack size at 0xF0? (at present time 0xD0).

If I try, I get the following error:

 

 

Out of allocation space in segment RAM at address 0x18A

 

Is there some one that can clarify this point?

 

I provide also my .map file (renamed with txt extension)

Giovanni

Labels (1)
0 Kudos
Reply
1 Solution
715 Views
bigmac
Specialist III

Hello,

 

You are correct - the default RAM does not make use of zero page RAM.  You will therfore need to explicitly allocate some of your variables to zero page, using the appropriate pragma.  According to the map file, you are currently using six bytes within page zero (apparently required by the startup code), and 138 bytes within page 1 (it appears you are consuming 128 bytes within three array variables).

 

Since total RAM usage for all variables is 144 bytes, and 160 bytes is available within zero page, all static ahd global variables could actually be placed within zero page RAM.

 

Alternatively, you could alter the PRM file so that default RAM lists the zero-page RAM section prior to the other RAM.

 

Regards,

Mac

 

View solution in original post

0 Kudos
Reply
3 Replies
715 Views
Giox79
Contributor I

Helo everybody,

 

I think I understood by myself, I have to use the zero page section, can you confirm that?

Giox

0 Kudos
Reply
716 Views
bigmac
Specialist III

Hello,

 

You are correct - the default RAM does not make use of zero page RAM.  You will therfore need to explicitly allocate some of your variables to zero page, using the appropriate pragma.  According to the map file, you are currently using six bytes within page zero (apparently required by the startup code), and 138 bytes within page 1 (it appears you are consuming 128 bytes within three array variables).

 

Since total RAM usage for all variables is 144 bytes, and 160 bytes is available within zero page, all static ahd global variables could actually be placed within zero page RAM.

 

Alternatively, you could alter the PRM file so that default RAM lists the zero-page RAM section prior to the other RAM.

 

Regards,

Mac

 

0 Kudos
Reply
715 Views
Giox79
Contributor I

Hello BigMac.

Many thanks for your reply.

It confirms that I was on the right direction :-D.

 

Many thanks also for the analysis of my .prm file, you have been very kind.

 

Have a nice day

Giovanni

0 Kudos
Reply