Crasy cat
a) Just 10 minutes ago I did something wich worked!!!
I think it has something to do with your help...that is:
In the begining I declared a const array ( I call tables) in a cpp file and so extern it in its such .h file.
Well, this was not enough to work fine..
So I tried to include the h file in the cpp file, although I thought it should not be needed..
BUT for my surprise, now everything is OK..there is..my tables (const arrays) are in ROM !!!!!
Is it what you mean?
b) By the way..could help me or direct me to a post about:
I have many functions wich are states of state machine processor, so they are accessed only by pointers.
CW simply put all functions in NOT USED section.
The ENTRIES usage in PRM file will be very hard taks, due to a state machine based application has many many states/functions.
Imagine if for each new one I need to copy it into prm file?
Usages by pointer (by name) are still usages. As long a function is referred to anywhere it should get linked. The only case linking would not happen automatically is if the numerical address is used to call functions (or to refer to objects in general),
e.g. Calls like ((void(*)())0xF000)()
wont cause a function located at 0xF000 to be linked.
But with this setup, the hard part is to make sure the numbers are all correct, and not to list the function in the prm.
In case all addresses are offsets into a global table (function pointer array) then listing the name of that table in the prm ENTRIES is all that is needed.
Daniel
Hi guys
I´m facing this problem right now using a QE128 in CW6.0 pro (C++).
I have used "const" (when in C) to put anything in ROM, like
uint8 const init_table[]={1,2,3,4};
For my surpise ( I´ve used CW for many years...) my current design (the first in C++), wich has about 10 tables like the above, simply allocates some (major..) tables in RAM (.bss in map file).
I tried:
-Cc option = not work
__far = not work
I don´t use any SEGMENT pragma in my application, there is, the ordinary const keyword
should be enough to put such tables in ROM, right?
I spent the weekend on it, but I lost ....
Some tip for me?
Thanks in adavnce !!
Ricardo Raupp
Hello
I did a short test in C++ and got my constant table in .rodata without any trouble.
There is one thing that you need to know when it goes around constants and C++.
In C++, constants, which are defined in a module, but are not declared previously, are supposed to be static. An external declaration must precede the constant definition
CrasyCat
CrasyCat
I´m in troubles again...
Although I included the h file into my app file (this solved my problem earlier) it is not working now...
What do you mean by :
- module defined x previously declaration?
- would be a external declaration just as:
external str_a_t str_a;// in another cpp file (i.e. main.cpp)?
Thanks
To solve the 'defined previously' you have to define the same segment in the header file i.e. if you use MY_SECTION in the c file, use MY SECTION in the header file.
CarlFST60L
In fact the "defined previously" error was solved by adding the segment specification in the h file, as you suggested.
Very thanks for your help.
Ricardo Raupp
Hello
Are you using CodeWarrior compiler?
Normally you just have to define your constant as constants using const keyword.
Example:
const int version= 0x34;
Be careful, if you want to define a constant table of pointer to int, you have to define it as
int *const tab2[] = {0x01, 0x02, 0x03, 0x04};
I hope this helps.
CrasyCat
Hello
Hum.
canst unsigned into step[16]={1,1,1,1,1,1,1,3,5,9,11,16,20,29,45,60}; should go to ROAM.
Do you have a pragma DATA_SEG in front of it?
an you try to add #pragma DATA_SEG DEFAULT prior to constant definition.
Is it working better?
-cc will not help as it is ignore in ELF DWARF file format. It is a legacy option for an older release of the tools.
CrasyCat