cancel
Showing results for 
Search instead for 
Did you mean: 

cosmic C to use 0x100~0x17F and 0x200~0x27F and 0x80~0xFF as RAM

rejoy_wu
Associate II
Posted on October 26, 2006 at 16:00

cosmic C to use 0x100~0x17F and 0x200~0x27F and 0x80~0xFF as RAM

6 REPLIES 6
rejoy_wu
Associate II
Posted on August 25, 2006 at 00:23

Our project need much RAM(about 360 bytes).

The MCU(ST72F324J4) have 512 bytes RAM (0x80~0x180).

The IDE we us is ''ST7 Visual Develop''

But the cosmic linker say RAM overflow.We find that RAM between

0x100~0x1FF can't be use,which is use as ''stack''.But we don't need such

much stack(about 60 bytes).

How can I use these RAM(e.g. include 0x100~0x17F and 0x200~0x27F and 0x80~0xFF, stack use 0x180~0x1FF)?

When we write this project in assemble language,we know how to us.But cosmic C ...... .

Thank you!

:(

rejoy_wu
Associate II
Posted on August 25, 2006 at 00:25

sorry

The MCU(ST72F324J4) have 512 bytes RAM (0x80~0x280).

luca239955_st
Associate III
Posted on August 25, 2006 at 11:41

Hi,

you've got to work on your linker file until it looks like the following:

+seg .bsct -b 0x80 -m 0x80 -n .bsct # 128 bytes of page 0 data: initialised..

+seg .ubsct -a .bsct # ..+ uninitialized

+seg .data -b 0x100 -m 0x80 -n .data # 128 bytes of ''16 bit'' data handled automatically : initialised..

+seg .bss -a .data # ..+ uninitialized

+seg .data -b 0x200 -m 0x80 -n .data1 # 128 bytes of ''16 bit'' data in a user section

Some notes:

1) when using stvd7, it usually creates a linker file for you. In the event where you could not produce a linker file this complex, you have an option in stvd7 to edit the linker file by hand

2) .bsct, .ubsct, .data and .bss are sections managed automatically by the compiler (look in the manual for the details) respectively for page0 (the first two) and non-page0 variables. How these sections are filled depends on the memory model used and on the @tiny and @near keywords. .data1 instead is a section that you must define yourself (again, see the manual for the details). Note that the fact that the total ram available is ''broken'' in 3 different spaces can cause problems (memory waste) if you have large data structures.

Hope it helps.

Regards,

Luca (Cosmic)

rejoy_wu
Associate II
Posted on August 27, 2006 at 01:37

It can work now!

Thank you very much!

:p

emmanuel23
Associate II
Posted on September 01, 2006 at 10:06

hi rejoy,

there is a way to do the same through STVD7 user interface:

open the project settings, select the Linker page and the input category.

Righ click in the list and select Add segment in the menu. Give a name to this segment, such as RAM2. Then, Change the from and to value to 0x100 and 0x1C0 (keep 60 bytes from 1C0 to 1FF if I well understood your need).

Finally drag and drop the ''Data'' section from the ''segment'' RAM to RAM2...

Now select ok and rebuild.

Emmanuel.

dpeter
Associate II
Posted on October 26, 2006 at 16:00

Thanks for the tip. I had a similar problem with a K2. I used the STVD7 project settings interface method and it worked well. (also transfered .bss from Zero Page to new segment) I did have to use @near for all the variables to put in the new segment, and make sure the @near declarations were in all the modules .

Thanks !!! :D