We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am using an 8051 (C51/BL51) with no off-chip memory. I have two functions with parameters:
void Detect( U8 iLed )
and
static U8 INHSampleHandler( U16 u16Sample )
Now I understand that Keil will allocate a variable (in DATA) for these. The problem seems to be that the locator is using the same memory location for both. I cannot understand why.
Below are excerpts from the scratchpad showing 2 "D:0026H". These are the only places these symbols are declared. Any ideas what I'm doing wrong?
Thanks, Jeff
BL51 BANKED LINKER/LOCATER V5.12 07/14/2011 09:36:23 PAGE 1 BL51 BANKED LINKER/LOCATER V5.12, INVOKED BY: Z:\TOOLS\SOFTWARE\KEIL\BL51.EXE Z:\Software\FB_CPU_Init.obj, >> Z:\Software\Settings.obj, Z:\Software\Glo >> bals.obj, Z:\Software\Devices\Clock.obj, Z:\ >> Software\Devices\Flash.obj, Z:\Software\Devices\HMI.obj >> , Z:\Software\Devices\INH.obj, Z:\ >> Software\Devices\ADC.obj, Z:\Software\Devices\Timer.obj, Z >> :\Software\Builds\TestINH - 06-00039-21-09\Main.obj >> , Z:\Software\Test\Test_Button.obj, Z:\So >> ftware\Builds\TestINH - 06-00039-21-09\Version.obj TO Z:\ >> Software\Builds\TestINH - 06-00039-21-09\06-00039-21-09-xx.wsp >> RS (256) PL (68) PW (78) XDATA (?XD?SETTINGS (0X0)) CODE (?CO?VERSION (0X7 >> FC0)) MEMORY MODEL: SMALL Deleted for brevity ------- PROC _INHSAMPLEHANDLER D:0026H SYMBOL u16Sample C:0BF1H LINE# 150 C:0BF5H LINE# 151 C:0BF5H LINE# 207 C:0BF7H LINE# 208 ------- ENDPROC _INHSAMPLEHANDLER ------- ENDMOD INH Deleted for brevity C:09FEH PUBLIC _Detect C:074EH PUBLIC main ------- PROC _DETECT D:0026H SYMBOL iLed
Just because you've managed to avoid the problems does not mean that there are no problems.
Just like crossing the road has many dangers - but most of us manage to do it every day by being aware of the dangers, and acting accordingly.
But saying there are NO dangers is untrue and unhelpful.
"Just because you've managed to avoid the problems does not mean that there are no problems."
Andy, what problems are you talking about? I certainly didn't have to avoid any problems. There weren't any problems in what I did. Why? because I understood how the 51 works, how the assembler works, what the compiler produced, how the linker works, and what I wanted to achieve. There were no problems and no gotchas.
"Just like crossing the road has many dangers ..."
That's an extremely poor example. Processors are (in general) highly predictable. Crossing the road is totally different. You are not in control of all the variables - Most importantly there is that unknown variable sitting behind the wheel of a large mass.
"But saying there are NO dangers is untrue and unhelpful."
That seems to lack a certain amount of context. Go back and you'll see my post ended with:
No problem, so long as you know what you're doing, period.
So ... going back to the full post and full context, what I was saying is that there is no danger in doing it per se. You (and others) might consider it a danger in the context of Keil's implementation of C - But in itself I stand by what I said.
"Just like crossing the road has many dangers - but most of us manage to do it every day by being aware of the dangers, and acting accordingly."
which of the following statement would you agree more?
1) don't cross the road (because there is danger); 2) it is OK to cross the road, as long as you understand the danger.
I would rephrase it like this:
"Would you like to establish a _habit_ of crossing the road at a dangerous spot for 10 other people, when you know that the risk involved is significant"?
To me, the question is not if it is dangerous or not. Risk can be managed, at least on the short term. The question is whether this is sustainable on the long term.
the answer to that would depend on many different factors:
1) if the pay-off is sufficient, I would; 2) if the 10 other people understand their risks they are taking, I would; 3) if we are prepared for the risk, we would; ...
it is stupid to say "there is risk so don't do it". we all take risks, one way or another. sometimes wisely and others not so.
there is nothing wrong with taking risks. you just need to plan out the pros / cons and be good at it. that's essentially what IB said, in a more generic form.
It is not necessarily stupid to say "there is risk so don't do it". There is a risk going very fast on a curvy road, to an inexperienced driver I'd say "there is risk so don't do it", to a NASCAR driver I would not.
Erik
"There is a risk going very fast on a curvy road, to an inexperienced driver I'd say "there is risk so don't do it", to a NASCAR driver I would not."
but that's precisely what IB said: "there is nothing wrong with doing X if you understand what you are doing" aka your NASCAR example.
the converse of what IB said would be "don't do X if you are an inexperienced driver".
you guys really really need to improve your reading comprehension.
"you guys really really need to improve your reading comprehension."
So now it's "you guys"? Why the generalization? It seldom helps an argument. How much credibility would you give to the statement: "Everyone knows that all bikers are criminals"?