warning C1805 on CW v4.6.2 for HCS12X

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

warning C1805 on CW v4.6.2 for HCS12X

2,369 Views
Sten
Contributor IV
I did update my CW 4.5 to 4.6.2 and I got a lot of C1805-warnings when initializing string constants. For example the following code gives a warning on every row:
 
Code:
#pragma STRING_SEG __GPAGE_SEG myStrConstconst char * far const classes[MAX_CLASS] = { "OLP",                                              "ASC",                                              "Analog inputs",                                              "Remote Control",                                              "Levers",                                              "Pressures",                                              "Digital inputs",                                              "Geometry",                                              "Stability",                                              "Digital outputs",                                              "Service",                                              "PLC",                                              "Various",                                              "HiCap" };
 

v4.5 did not give any warnings (and it does also work fine on 4.6.2 regardless of the warnings).

 
The Release Notes for the 4.6.2 Compiler Patch says:
 

NEW FEATURES:

1)       Compiler issues message "WARNING C1805: Non standard conversion used." when it does not perform address conversion at initialization of constant pointers. (MTWX21086).

 
But what does that mean? Is there anything I can do (other than "#pragma MESSAGE DISABLE C1805" )?
 
Sten
 
Labels (1)
Tags (1)
0 Kudos
5 Replies

578 Views
CrasyCat
Specialist III
Hello
 
This warning has been added to warn programmer when there is a risk of incorrect conversion from logical to global addresses.
 
In your PRM file did you define the segment where you decided to place myStrConst section using global addresses or logical ones?
 
If you define the array in a GPAGE_SEG section and define the corresponding segment with global addresses you should not see the messages.
 
CrasyCat
0 Kudos

578 Views
Sten
Contributor IV
Thanks CrasyCat for your reply, but you have to excuse me, I still don't understand. Here is a part of my PRM-file:
Code:
/* paged FLASH:                     0x8000 TO   0xBFFF; addressed through PPAGE */      PAGE_E0_0     = READ_ONLY   0xE08000 TO 0xE087FF;         /* cannot be mapped to XGATE; XGATE sees registers here */      PAGE_E0       = READ_ONLY   0xE08800 TO 0xE0BFFF ALIGN 2[1:1]; /* is also mapped to XGATE:  0x0800..0x3FFF        */      PAGE_E1       = READ_ONLY   0xE18000 TO 0xE1BFFF ALIGN 2[1:1]; /* is also mapped to XGATE:  0x4000..0x7FFF        */      PAGE_E2       = READ_ONLY   0xE28000 TO 0xE2BFFF;         /* cannot be mapped to XGATE; this module should NOT be */      PAGE_E3       = READ_ONLY   0xE38000 TO 0xE3BFFF;         /* used for HC12 code when also used for XGATE code     */      PAGE_E4       = READ_ONLY   0xE48000 TO 0xE4BFFF;         /* since the HC12 will have priority over the XGATE     */      PAGE_E5       = READ_ONLY   0xE58000 TO 0xE5BFFF;         /* accessing the FLASH modules resulting very poor      */      PAGE_E6       = READ_ONLY   0xE68000 TO 0xE6BFFF;         /* performance of the XGATE:                            */      PAGE_E7       = READ_ONLY   0xE78000 TO 0xE7BFFF;         /* Check allocation of this ranges in PLACEMENT below!  */      PAGE_F8       = READ_ONLY   0xF88000 TO 0xF8BFFF;      PAGE_F9       = READ_ONLY   0xF98000 TO 0xF9BFFF;      PAGE_FA       = READ_ONLY   0xFA8000 TO 0xFABFFF;      PAGE_FB       = READ_ONLY   0xFB8000 TO 0xFBBFFF;      PAGE_FC       = READ_ONLY   0xFC8000 TO 0xFCBFFF;/*    PAGE_FD       = READ_ONLY   0xFD8000 TO 0xFDBFFF; intentionally not defined: equivalent to ROM_4000 */      PAGE_FE       = READ_ONLY   0xFE8000 TO 0xFEBFFF;/*    PAGE_FF       = READ_ONLY   0xFF8000 TO 0xFFBFFF; intentionally not defined: equivalent to ROM_C000 */ENDPLACEMENT /* here all predefined and user segments are placed into the SEGMENTS defined above. */      _PRESTART,              /* Used in HIWARE format: jump to _Startup at the code start */      STARTUP,                /* startup data structures */      ROM_VAR,                /* constant variables */      STRINGS,                /* string literals */      VIRTUAL_TABLE_SEGMENT,  /* C++ virtual table segment */    //.ostext,                /* eventually OSEK code  */      NON_BANKED,             /* runtime routines which must not be banked */    //COPY                    /* copy down information: moved to banked flash */                              /* in case you want to use ROM_4000 here as well, make sure                                 that all files (incl. library files) are compiled with the                                 option: -OnB=b */                        INTO  ROM_C000, ROM_4000;      DEFAULT_ROM,      myStrConst,      COPY                    /* copy down information: how to initialize variables */                        INTO           PAGE_FE,          PAGE_FC, PAGE_FB, PAGE_FA, PAGE_F9, PAGE_F8,                              /* use the following ranges only when same module is NOT used for XGATE code */                              /* PAGE_E0, PAGE_E1, intentionally not listed: assigned to XGATE */                              PAGE_E7, PAGE_E6, PAGE_E5, PAGE_E4, PAGE_E3, PAGE_E2,        PAGE_E0_0;

 
How should I modify it to use global addresses?
 
The reason I have to use GPAGE for my strings is that they do no not fit into the non-banked area.
 
Btw, since the program seems to run fine, is there some risk in leaving it as it is, just using the #pragma message disable to get rid of the warning?
 
Sten
 


Message Edited by Sten on 2008-03-04 09:25 AM
0 Kudos

578 Views
CrasyCat
Specialist III
Hello
 
I do not know how large your constant segment is, but I would change that as follows (I put my changes in RED):
 
Code:
Code:/* paged FLASH:                     0x8000 TO   0xBFFF; addressed through PPAGE */      PAGE_E0_0     = READ_ONLY   0xE08000 TO 0xE087FF;         /* cannot be mapped to XGATE; XGATE sees registers here */      PAGE_E0       = READ_ONLY   0xE08800 TO 0xE0BFFF ALIGN 2[1:1]; /* is also mapped to XGATE:  0x0800..0x3FFF        */      PAGE_E1       = READ_ONLY   0xE18000 TO 0xE1BFFF ALIGN 2[1:1]; /* is also mapped to XGATE:  0x4000..0x7FFF        */      PAGE_E2       = READ_ONLY   0xE28000 TO 0xE2BFFF;         /* cannot be mapped to XGATE; this module should NOT be */      PAGE_E3       = READ_ONLY   0xE38000 TO 0xE3BFFF;         /* used for HC12 code when also used for XGATE code     */      PAGE_E4       = READ_ONLY   0xE48000 TO 0xE4BFFF;         /* since the HC12 will have priority over the XGATE     */      PAGE_E5       = READ_ONLY   0xE58000 TO 0xE5BFFF;         /* accessing the FLASH modules resulting very poor      */      PAGE_E6       = READ_ONLY   0xE68000 TO 0xE6BFFF;         /* performance of the XGATE:                            */      PAGE_E7       = READ_ONLY   0xE78000 TO 0xE7BFFF;         /* Check allocation of this ranges in PLACEMENT below!  */
     GPAGE_7E       = READ_ONLY   0x7E0000'G TO 0x7EFFFF'G;
/*  
      PAGE_F8       = READ_ONLY   0xF88000 TO 0xF8BFFF;      PAGE_F9       = READ_ONLY   0xF98000 TO 0xF9BFFF;      PAGE_FA       = READ_ONLY   0xFA8000 TO 0xFABFFF;      PAGE_FB       = READ_ONLY   0xFB8000 TO 0xFBBFFF;*/
      PAGE_FC       = READ_ONLY   0xFC8000 TO 0xFCBFFF;/*    PAGE_FD       = READ_ONLY   0xFD8000 TO 0xFDBFFF; intentionally not defined: equivalent to ROM_4000 */      PAGE_FE       = READ_ONLY   0xFE8000 TO 0xFEBFFF;/*    PAGE_FF       = READ_ONLY   0xFF8000 TO 0xFFBFFF; intentionally not defined: equivalent to ROM_C000 */ENDPLACEMENT /* here all predefined and user segments are placed into the SEGMENTS defined above. */      _PRESTART,              /* Used in HIWARE format: jump to _Startup at the code start */      STARTUP,                /* startup data structures */      ROM_VAR,                /* constant variables */      STRINGS,                /* string literals */      VIRTUAL_TABLE_SEGMENT,  /* C++ virtual table segment */    //.ostext,                /* eventually OSEK code  */      NON_BANKED,             /* runtime routines which must not be banked */    //COPY                    /* copy down information: moved to banked flash */                              /* in case you want to use ROM_4000 here as well, make sure                                 that all files (incl. library files) are compiled with the                                 option: -OnB=b */                        INTO  ROM_C000, ROM_4000;     myStrConst         INTO  GPAGE_7E;
      DEFAULT_ROM,      COPY                    /* copy down information: how to initialize variables */                        INTO           PAGE_FE,          PAGE_FC, /* PAGE_FB, PAGE_FA, PAGE_F9, PAGE_F8,*/                              /* use the following ranges only when same module is NOT used for XGATE code */                              /* PAGE_E0, PAGE_E1, intentionally not listed: assigned to XGATE */                              PAGE_E7, PAGE_E6, PAGE_E5, PAGE_E4, PAGE_E3, PAGE_E2,        PAGE_E0_0;

 
Just adjust the addresses of GPAGE_7E to your needs.
If you have more than 64K constants you need to define also a GPAGE_7D in the same way.
 
I hope this helps.
CrasyCat
 
 

578 Views
CompilerGuru
NXP Employee
NXP Employee
First, this prm change has no effect on the initial problem with the C1805 warning, as that warning is issued by the compiler which is not aware of the prm at all.

So this change is an optimization suggestion to use one global block instead of multiple 16k paged ones. Note that using such a global block only works for constants/strings, it does not work for code. Therefore I usually only suggest to use it if either the 4 additional block boundaries do cause to waste significant memory, or if a single element is larger than 16k.
If there is any object larger than 16k, then this change is mandatory, otherwise I personally do stick with paged addresses because then there is no danger placing code in there.Using a single kind of addresses also simplifies the understanding of the memory layout in the prm.
As summary, I would only do this change if you really have huge constants, I would not do it if you just have many relatively small ones as I would expect it to be with string literals.

Daniel

578 Views
Sten
Contributor IV
Thanks CrasyCat and Daniel for your replies!
 
My constant string segment fit into one 16k page (the reason I want it banked is that I need all the unbanked areas for other constants and program); so if I did understand Daniels reply correctly, I do not need to change to global addressing in the PRM-file. I guess the only way to get rid of the C1805 warning is to disable it?
 
Can I use this same way to put som of my other constants into paged flash; e.g. #pragma CONST_SEG __GPAGE_SEG myConstSeg? Do I have to make some changes in the libraries (libdefs.h) like I did when I made the strings paged?
 
Sten
 
0 Kudos