Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 5, 3 & 1 Forum Discussions

HuEl_264296
Level 5
25 sign-ins First solution authored 100 replies posted
Level 5

Hi all,

   

Just looking at the assembler output from PSoC Creator for the PSoC 3. The code:

   

 

   

uint8 *p=0;
p++;

   

 

   

produces this assembler:

   

 

   

MOV     DPTR,#p+01H
CLR     A
MOV     B,#01H
LCALL   ?C?IILDX
 

   

A call? To increment a pointer? What's with that?

   

 

   

Hugo

0 Likes
3 Replies
TeHe_281121
Level 3
Level 3

Looking at the Map file, shows the function residing in the C51L lib file.

   

....\PSOC CREATOR\IMPORT\KEIL\PK51\8.16\C51\LIB\C51L.LIB (?C?IILDX)
 

   

Using the library manager to create a list of the public functions of C51L.lib, verifies this.

   

?C?IILDX
      ?C?IILDX
 

   

..and looking at the MAP file again, shows it may be some 21 bytes long:

   

0100009AH   CODE     ---       ?C?IILDX
010000B0H   CODE     ---       ?C?ISTPTR
 

   

My guess it could be some bank switching or address checking code.

   

You may want to direct this question directly to KEIL.

   

PS: the \LIB folder contains code for the Lib files, but I can't seem to match the function in question.

0 Likes
HuEl_264296
Level 5
25 sign-ins First solution authored 100 replies posted
Level 5

I don't understand why people aren't more surprised and concerned about this? Incrementing a value is one of the most fundamental operations in any code.

   

 

   

Even MPLAB's basic C compiler for the PIC18  generates the expected instructions for an increment.

   

 

   

Are there any better compilers available for the PSoC ?

0 Likes
Rolf_Nooteboom
Level 5
5 solutions authored First solution authored 100 replies posted
Level 5

Are you sure the pointer increment isn't optimized out and the lcall belongs to this increment?

   

Regards,

   

Rolf

0 Likes