This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Code Compiled, linked, downloaded but not running

Hi,
Do you have faced with this problem ? The USB debug adapter runs but the IDE debugger not. I can put breakpoint on the first line of the main but no break, no timer it generated too, when i stop running no stop on the code line executing.
It seems there is a problem just before the main call.

thx

Parents Reply Children
  • he rule of no variables initialized at the declaration:

    It has been there 'forever', and I recall there were many reasons, but do I remember them all, I doubt it.

    First, the origin of 'the rule' has nothing to do with software. A board made for the company before the company had any engineering could not do a straight movx (the latch had to be set manually - ARGH) and thus any 'automatic code' referencing xdata would fail.
    We then discussed whether to have the rule just for this project or global and decided for many reasons to make it global.
    as I recall:
    One I do remember was that there were state machines with 'idle' defined as all kinds of values, the 'rule' forced all idle's to be zero which saved a whole lot of lookups.
    The rule forces anyone to make 'inactive' a zero, again saving a whole lot of lookups.
    The only case where I can see a justification for 'inactive' being anything else than zero is a SFR or port bit, I have not investigated that, but I doubt you can write sbit 0x83 = 1 and come up with p0.3 a one.
    also it forces 'value tables' to be 'code', again an advantage.
    Oh, also it allow the use of #define UC xxx unsigned char where xxx is defined as extern in all modules but one.

    So, what does 'the rule' buy us? consistency

    of course some feel that this is restrictive, but when you want 'program responsibility' to be transferable, you need consistency.

    Erik

    PS Mr. Sardine owes me an apology for his bile about init always being included, but that, I am sure would be too much to ask.

  • PS Mr. Sardine owes me an apology for his bile about init always being included, but that, I am sure would be too much to ask.

    Not at all - I apologise. I was sloppy.

    A precompiled version of the code contained in init.a51 is always linked into your project unless you avoid two fairly fundamental features of the 'C' language:

    1) Explicit initialisation of variables declared at file scope
    2) Explicit initialisation of local variables with static storage duration

    I understand you have a rule based on some ill-remembered premise preventing 1) - do you also have a rule preventing 2)?

  • Pride and prejudice? I thought you preached that people should have an open mind...

    I have no idea what you thought I meant, but I can assure you you've got it wrong.