Daniel
Meanwhile the post before I made:
ENTRIES
lcd_char_drv.cpp.o:*
keyboard_drv.cpp.o:*
buzzer_drv.cpp.o:*
gpio_drv.cpp.o:*
END
and all of my not referenced functions are now allocated in a specific address...
It seems nice..not hard taks, since the whole file can be added into list and not function by function as I thought...
Is it ok?Some side effect?
Thanks
Ricardo Raupp
Daniel
I have several functions wich in fact are accessed only through pointer to function.
I use it to state machine control.
CW considered these functions as NOT USED, and so my pointer has allways 0x0000.
I´m using CW6.0 Pro , C++.
How can I tell CW to keep these function active, that is, they are really needed although there is not a explicit call...
Use ENTRIES? for each function? for Claases?
Is tehere a global way to make it works, like a checkbox like:
( ) Don´t discard not used objects.
Thanks in advance !!
Ricardo Raupp
Usages through pointer to functions should be considered too as long as the function pointer on its own is referenced.
Where do you see "and so my pointer has allways 0x0000."?
In the map file or in a target data structure?
Daniel
Daniel
Attached a screenshot (JPG) of IDE..
It helps?
Ricardo
Strange, the first thing which comes to my mind is that the a,b,c, d locals are all unused local variables.
Therefore I wonder if the compiler did not just remove those variables.
Does it change anything if the code actually uses those variables (without ENTRIES) or with ENTRIES, are the seen values different? (without any other changes).
Which addresses does the debugger show when selecting a,b,c,d?
Daniel
Daniel
I think this question I solved now ...
I got the right address of those functions AFTER I add "static" in fornt of its declaration in the class.
About those variables a,b,c,d....they worked perfectly after I change the functions to static....
I undesrtood that that only static function can have its address "captured/read" by a var,pointer..whatever....
Is this understanding right?
If yes..so it is finished...
Thanks Daniel ...
Ricardo Raupp
Daniel
As I mentioned before, now my functions are allocated on ROM.Ican see their address in the map files.
Before the use of ENTRIES , none of them was there, unless in the NOT USED list...
In the constructor below I tried to catch the address of one function, but it is returning 0x00...
// general pointer4 to function declaration
typedef uint8 (*state_handler_t)(void*,Event const*)
Keyboard::Keyboard():
// Super_class constructor
Active_object((state_handler_t)&Keyboard:n_initial), // default state!!!
// timer(s) object(s) constructor(s)
main_timer(EVENT_KEYBOARD_MAIN_TIMER_TIMEOUT)
{
state_handler_t far a;
state_handler_t far d;
uint16 b;
uint8 c;
c=Keyboard:n_initial(this); // it really runs on_initial() function...
b=(uint16)&Keyboard:n_initial; // this result is zero.. ???
a=(state_handler_t)&(Keyboard:n_ready); // this result is zero.. ???
d=(state_handler_t)&(Keyboard:n_initial);// this result is zero.. ???
// dummy ...
if(a)
{
b++;
}
}
}
The map file shows:
Name Addr hSize dSize Ref Section RLIB
on_initial__8KeyboardFP8Keyboard 3254 15 21 1 .text
on_ready__8KeyboardFP8KeyboardPC5Event 3269 10 16 0 .text
The function is:
//
uint8 Keyboard:n_initial(Keyboard *me)
{
(void)me;
return FSM_NEW_STATE_HANDLER(&Keyboard:n_ready);
}
It is clean for you?
Very thanks for your attention Daniel ...