Certain parts of code not getting executed

2 posts / 0 new
Last post
vikramtheone
Offline
Last seen:4 years 10 months ago
加入:2015-06-12 08:42
Certain parts of code not getting executed

Hi,
I'm facing a strange situation. I have a custom board with a DA14580 and some sensors.

In my application, a part of the program isNOTgetting executed at all.

A simplified look of my code is as follows:

main()
-> function_1()
-----> function_2a()
-----> function_2b()
-----> function_2c()

The function_2a() is the last function that gets executed in function_1(), after that the control directly jumps to the end of function_1(). Actually speaking, my function_1() is a blocking call (as shown below) but the control simply comes out as a result of which program crashes. I checked using breakpoints there is a direct jump frombreakpoint 1tobreakpoint 4.


void function_1()
{
*breakpoint 1* while(function_2a() != 1);
*breakpoint 2* while(function_2b() != 1);
*breakpoint 3* while(function_2c() != 1);
*breakpoint 4* } // END of function_1

What I have tried out, so far:
1. At first I thought it was due to some optimizations, so I removed the compiler optimization flag to different levels: O1, O2, O3 and also "none". But no change.
2. I have reordered the code but no use.
3.我看使用的RAM,看到我f there is sufficient space for stack, when I build the project the tool says:
Program Size: Code=16054 RO-data=2370 RW-data=60 ZI-data=11484
So, I'm using (16054 + 60 + 11484)29816 Bytes (29KB), and I still have (42 - 29) 13KB space left for stack.

I don't know what else to attempt. Any suggestions will greatly help.

Keywords:
Device:
MT_dialog
Offline
Last seen:5 days 13 hours ago
Staff
加入:2015-06-08 11:34
Hi vikramtheone,

Hi vikramtheone,

Thats indeed a strange issue, the most probable reason i can think of is a logical error and not entering the other functions? Or perhaps some of the functions are perfoming somekind of a delay ? Perhaps the compliler is optimizing this out regardsless the optimization.

Thanks MT_dialog