cancel
Showing results for 
Search instead for 
Did you mean: 

idesc copy from RAM to ROM using fctcpy

sjayapal
Associate II
Posted on March 22, 2006 at 07:39

idesc copy from RAM to ROM using fctcpy

12 REPLIES 12
sjayapal
Associate II
Posted on March 08, 2006 at 09:02

Hi,

I want to locate the idesc generated by the linker in the ROM to RAM using the _fctcpy() function call from an assembly file.

Kindly let me know whether this is possible. 😉

luca239955_st
Associate III
Posted on March 08, 2006 at 12:39

from the symbol names it looks like you are using our compiler (Cosmic); I'd be happy to help if only I could understand what the problem is or what you are trying to achieve...

Regards,

Luca

sjayapal
Associate II
Posted on March 09, 2006 at 01:11

Hi Luca,

Yup. The compiler used is Cosmic and it is for the ST7 micro ST7FL35.

My project is right now using the crtsx.s file provided by the cosmic, and i could see from the file that the idesc generated by the linker in the ROM is copied to the RAM. but i would like to modify this asm file by using the _fctcpy() command. is it possible to do so ? are there any examples for this?

Regards,

Suganya

luca239955_st
Associate III
Posted on March 09, 2006 at 04:47

Hi,

you are mixing two different things here: the _idesc_ symbol is used for automatic data initialization, whereas _fctcpy() is used to copy and execute code from RAM.

So the answer is no; what you want to do is not possible.

Still, I'm curious to understand WHY you would want to do anything like that: if you need automatic data initialization, crstx.s in the most efficent way to do it, and if you don't need it, you can use ctrs.s and save some bytes.

Regards,

Luca (Cosmic)

sjayapal
Associate II
Posted on March 10, 2006 at 05:23

Hi luca,

Thanks!

Now i am going ahead with the crstx.s, and i have a clarification in it.

My MAP file tells me the bss region as,

start 00000104 end 00000108 length 4 segment bss

But when the following statement in the crstx.s file is executed it gets the start address of the bss value as 0108 which is the end address and hence it does not initialize the bss region.

ld x,#low(__sbss) ; address LSB in X

X - register gets loaded with 08 here, i am expecting 04.

Please can i know what could be going wrong ?

Regards,

Suganya

luca239955_st
Associate III
Posted on March 10, 2006 at 10:42

that's strange; I tried a similar project here and it seems to work ok.

I sugget you do the following, possibly with a simulator:

- load your project

- fill the memory with a recognizable value (ex: 0xA5)

- put a breakpoint on main()

- run

- check the memory, where you believe your bss is

If it's 0, then the startup file somehow cleaned it; execute the startup step by step to undersand what it does exactly

If it's not zero (it will likely be 0xA5), than the startup did not initialize it correctly; post your project here so that I can see what's wrong.

Regards,

Luca

sjayapal
Associate II
Posted on March 14, 2006 at 03:47

I am not able to see my bss cleared still. In the map file i am able to see that my bss region is from 0x0104 to 0x0108 and I carried out the steps stated by you, but this region was not cleared. I have attached my project.

Kindly let me know what is the problem.

________________

Attachments :

tutorial_cosmic.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0AO&d=%2Fa%2F0X0000000bVq%2FIHmMTFAyQhh4hQDP9bwcjJuBUw1EpmMsHVIHT8lRuPk&asPdf=false
luca239955_st
Associate III
Posted on March 14, 2006 at 05:54

the attached application does not build.

Modifying one line of the linker file from

+seg .share -a .bss -is # simulated stack

to

+seg .share -a .ubsct -is # simulated stack

I'm able to build and the initialization of the bss is ok (starts from 104)

Make sure you are using the objects that you are compiling (maybe try to rebuild this project on a new machine), and try the init with a simulator.

Regards,

Luca

[ This message was edited by: _luca on 14-03-2006 10:27 ]

sjayapal
Associate II
Posted on March 14, 2006 at 08:58

Luca,

I am not getting that error, i am still working on it.

Between correct me if i am wrong,

The model which i have choosen is modmm, in that case the stack is to be located in the long range. then in that case following bss region should not be of problem right? and can we locate after the .ubsct region, would'nt that be short range of the stack?

Regards,

Suganya