**bleep** PRAGMA

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

**bleep** PRAGMA

2,001 Views
SebaS
Contributor III
Hello!

I've got a very big problem...... I use this sentence "#pragma CODE_SEG PAG_1" so, the following code is in that page... But when I compile it, the code appears at the DEFAULT_ROM page.
That's part of what's inside the prm file:

PAGE_3C = READ_ONLY 0x3C8000 TO 0x3CBFFF;

PAG_1 INTO PAGE_3C;


Any idea of what's going on? Or maybe you know where I'm wrong at...

Thanks a lot. :smileywink:
Labels (1)
0 Kudos
3 Replies

425 Views
CompilerGuru
NXP Employee
NXP Employee
strange, your syntax looks ok.
What I would check:
- how does the #pragma look like after preprocessing. #define's can cause many surprises...
- does it work if you use another name at those two places (#pragma & prm)? Same reason than for the first suggestion, just to check for some name collisions.
- the section containing the object refered to with INIT is special (default _Startup)
Is this here the case? The content of this section ends up in ".init".
- I would actually decode the object file, but its content may be hard to decipher if you are not familiar with ELF. With "-e -ed -d" decoder/importer options everything is displayed (usually too much...)
- this is about code, not constants, correct? (use #pragma CONST_SEG name for constants).

Well, these are about all ideas I have. If they dont help, please show us a complete sample.

Daniel
0 Kudos

425 Views
Lundin
Senior Contributor IV
What would happen if not compiling with -Mb (banked memory)? Could be the cause of the problem.
0 Kudos

425 Views
CompilerGuru
NXP Employee
NXP Employee
With small (and with no __FAR_SEG qualifier in the #pragma CODE_SEG)
the compiler will use a JSR to call those functions.
But appart that it may not work at runtime, this does not explain why the functions do not end up at the right address.
So the memory model matters if it works at runtime, but it does not matter for the allocation behaviour.

Daniel
0 Kudos