Are you making sure that after you have declared your variables in Zeropage that you follow it with a
#pragma DATA_SEG DEFAULT
I was bit by that not too long ago.
frogman_sr
Hi JJ,
The _device_ defaults to a stack pointer of $FF for backward compatability not CW.
The compatability issue is very good IMHO.
My experience is that CW moves the stack pointer to the top of RAM by default and then alocates the RAM from here down to the highest other allocation to the stack.
Did you not glean any info from perusing your .map file as suggested by CC.
BR Peg
Message Edited by peg on 04-27-200609:49 AM
Hi Peg,
Do you usually use absolute assembly? I just tried creating a few test projects and if you do relocatable assembly or C, then the .prm file generated by CW always contains a line that says, "STACKSIZE 0x50". The size varies depending on the device, but the line is always there on my version. Then when you simulate, the stack pointer defaults to 0xFF on reset like you said, but the start-up routine (either compiled code, or default relocatable assembly code) initializes the stack pointer to 0x50 bytes higher than the address of the last global variable. I tried putting "asm LDHX #$00FF; asm TXS;" at the beginning of main(), but then that instruction makes the simulator complain that the device is accessing unallocated memory. It might work on the actual device in user mode. I've never tried that.
Do you do this stuff for a living or a hobby? You answer almost every post here and you are very knowledgable. Freescale should be paying you. :smileyhappy:
Message Edited by rhinoceroshead on 04-27-200611:34 AM
Hi rhinoceroshead,
I now totally agree with what you said in your last post.
I am _sure_ I have seen this "top of ram stack move" but now when I do a more thorough check the action is how you describe.
Perhaps, like you, I wanted to believe this was what it would do???
I usually write in assembler using P&E tools.
I do this for a living, and a hobby I guess.
Freescale have my address for the cheques.
I have only recently started using CW because of the examples and SMAC for Zigbee stuff.
Regards Peg
Message Edited by peg on 04-28-200608:22 AM
Zigbee, huh? I bought a couple of those DLP-RF2-Z boards from DLP design, but I've been too busy to play with them so far. I thought it would be fun to build a little remote-controlled robot for my house that I could command from the Internet through a Java applet, and have it send live images back to the browser. I guess it would be sort of like those Mars rovers, but *slightly* less cool since it would only be exploring my house. At this point in my life, this stuff is mostly just a hobby for me. I'm just fascinated by these little things though. They're simple enough for one person to see a project all the way through in not too much time, but sophisticated enough to do just about anything you can imagine (within reason).
I'd better say something on topic so Alban doesn't have to slap my hand...
How big of a deal is it really to be using that first page of RAM anyway? I've never worried about the speed boost that gives. I'm also usually using C, which doesn't necessarily compile into the most efficient code anyway, and I've never had a problem. If you really are pushing the performance limitations of the device, wouldn't you just use a faster chip? I could maybe understand reaching the limit if you were running a fast control algorithm or doing some DSP, but the AD converter on this chip isn't all that fast and this isn't the best choice for DSP either. Has anyone ever had an application that absolutely had to use the direct page addressing mode?
You probably don't notice this when you write in C, but some instructions only work in page zero, and others don't have the extended addressing mode available.
rhinoceroshead wrote:How big of a deal is it really to be using that first page of RAM anyway? I've never worried about the speed boost that gives.
tsss... As if I wouldn't myself write something out of subject I'm non violent and maybe even flexible.
In large productions like automotive, the price of each MCU is important. Therefore they will try and stretch the part to its maximum.
I'm thinking that having an Operating System on a HC08 with little RAM could already be a challenge. But I see some Contributors already tackled that, well done !!!
So I forward to the Admins of the board that we need a big fat cheque for Peg !
Cheers,
Alban. {Peace & Love}
Hello
This message is generated when the area Z_RAM is full.
Where did you place the stack? You can also look at the .map file generated by the linker. You will see a list of the object which have not been allocated because missing memory.
CrasyCat
OK Alban, I am going to question your comments on two points.
1. I thought CW's default action was to move the stack to the top of RAM.
2. Does having the stack in page zero make for faster execution. Most stack manipulation is done automatically, like return addresses being pushed on. Perhaps some direct stack data manipultion may be able to be executed faster in page zero but this would be at the loss of space for other data that could be kept there and definately manipulated faster.
BR Peg
Message Edited by rhinoceroshead on 04-24-200612:30 PM