embedded system - board getting reset due to a constant changing

Hi!

The code has C & C++ on a proprietory OS. The problem is:

When a

#define VAR1 40

is changed to

#define VAR1 32,

the board resets repeatedly after power-on.

VAR1 is used in the code ONLY

1)to declare an array, Array1[(VAR1 * VAR2) + VAR1]

and

2)in a "for" loop, char1 < char_num
where char_num = VAR1 -2.

I have tried commenting various init functions in the startup code, with no success. Has anyone had a similar problem and what could be a possible reason?

Thanks a lot for any help/suggestions.

Regards,
ms

Comments

  • I work on embedded systems every day. I can't be sure what your problem is because everything you posted looks fine. The most common problem I have found for crashing my board is blowing an array.

    Try hard coding your array and make sure you don't excede it nowhere in your code. This will test that aray any way. Go through all your code and verify that you are not blowing any others.

    As far as your define value changing, that remains a mystery.
  • The reset issue has got solved and the system is working as required by

    1) keeping Array1 constant at [(VAR1 * VAR2) + VAR1] with VAR1 40 as before.
    2)For the "for" loop I defined a new constant VAR3 as 30.

    Anyway thank you for the suggestion.
  • : Hi!
    :
    : The code has C & C++ on a proprietory OS. The problem is:
    :
    : When a
    :
    : #define VAR1 40
    :
    : is changed to
    :
    : #define VAR1 32,
    :
    : the board resets repeatedly after power-on.
    :
    : VAR1 is used in the code ONLY
    :
    : 1)to declare an array, Array1[(VAR1 * VAR2) + VAR1]
    :
    : and
    :
    : 2)in a "for" loop, char1 < char_num
    : where char_num = VAR1 -2.
    :
    : I have tried commenting various init functions in the startup code, with no success. Has anyone had a similar problem and what could be a possible reason?
    :
    : Thanks a lot for any help/suggestions.
    :
    : Regards,
    : ms
    :

    Would you post little more code here. I got something on my mind but I could use little more information (code).
  • maybe somewhere else in the code there is something like
    Array1[35] which would of course not change with the #define, but will obviously cause an error.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories