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

BOOLEAN VARS MAKE MY FW FAIL ?

Hi people,

I'm a bit stuck with a serious problem at work using the Keil C51.

I've modified a FW that was working fine, I add many functions, but they only call once as long as the EEPROM is new, and once the task is done, they are never called again.

What happened ?

I started to have problems with functions that were working properly just before. What I find out, that the failure was only cuased by some boolean field that are used to control the flow inside the function.
As long as I change the boolean type with a byte (just a 8 bit wide flag) the problem dissapers.
Three different and good working functions had this issue and the issue has gone when bit flags were changed to bytes.

Now, although I get the thing running I'm very frightened, and completely lost about this failure.
Have someone experimented something like that. Any clue. I don't want to patch the FW anymore. I want to discover where the issue is.

It's quite difficult to help without knowing the FW, but believe me that all the things I added call once when the product is bring to life and then they remain unused.

The functions are managed by a FSM in a nonblocking fashion as expected.

I had some failure with other FW just one byte before the RAM space had overflow. The program crashed and crashed. I added one var and realizaed the RAM was full. I cleaned several bytes and the crashes stoped.
Just seems like the overlaying feature was failling due to the no left RAM.
I was wondering if this problem could be a compiler realted, or .A51 related ....

A little notice:

I was getting a "recursive call" warning form C51. I changed the FW in order to not get this anymore. At first I thought the problem were related to this, but the warning sttoped and the problem continued to happen.

I doesn't happen in all boards and all the times you try but happens.

Suggestions or clues are very welcomed

Many thanks for your time

Pedro.

Parents
  • Many thanks for your response
    I know what you mean, but all the vars are supposed have been allocated by C51. Just a couple of arrays has fixed base address with the @. Then, the vars are declared in each module as a list without adress, just let Keil to manage that. Perhaps I'm wrong.
    I have a view to the dissasembly code at nigth and noticed that every time a FALSE or TRUE is passed to a function, also a FALSE or a TRUE inside a function is managed all the way with the same bit llocation (actually 0x25.2). There is a 10ms interrupt that uses this bit, and many other two. any chance they are overwritting it ?. It is supposed de compiler to take care of this.

    The fact is that the functions work fine if I change the bool return to unsigned char return (let TRUE = 0xFF and FALSE 0x00). In other case is I change the bool flag inside for an unsigned char.
    They are dinamically allocated, I don't know really if they are shading or not. I was sure that Keil made the magic with the allocation and the overlaying

    The functions I tell you were in the previos firmware version and worked fine, I used this FW for two years and know it behaviour very well.

    Just added some code and vars, and this functions (that are in other module) start to crash.
    The vars I added, were added without @, just dinamyc allocation

    Many thanks for your help

    Pedro.

Reply
  • Many thanks for your response
    I know what you mean, but all the vars are supposed have been allocated by C51. Just a couple of arrays has fixed base address with the @. Then, the vars are declared in each module as a list without adress, just let Keil to manage that. Perhaps I'm wrong.
    I have a view to the dissasembly code at nigth and noticed that every time a FALSE or TRUE is passed to a function, also a FALSE or a TRUE inside a function is managed all the way with the same bit llocation (actually 0x25.2). There is a 10ms interrupt that uses this bit, and many other two. any chance they are overwritting it ?. It is supposed de compiler to take care of this.

    The fact is that the functions work fine if I change the bool return to unsigned char return (let TRUE = 0xFF and FALSE 0x00). In other case is I change the bool flag inside for an unsigned char.
    They are dinamically allocated, I don't know really if they are shading or not. I was sure that Keil made the magic with the allocation and the overlaying

    The functions I tell you were in the previos firmware version and worked fine, I used this FW for two years and know it behaviour very well.

    Just added some code and vars, and this functions (that are in other module) start to crash.
    The vars I added, were added without @, just dinamyc allocation

    Many thanks for your help

    Pedro.

Children
No data