You are here

Incrementing a pointer | Cypress Semiconductor

Incrementing a pointer

Summary: 3 Replies, Latest post by rolf on 16 Sep 2010 06:08 PM PDT
Verified Answers: 0
Last post
Log in to post new comments.
Rocketmagnet's picture
131 posts

Hi all,

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


uint8 *p=0;


produces this assembler:


MOV     DPTR,#p+01H
CLR     A
MOV     B,#01H

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





user_611219's picture
41 posts

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


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


..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.


Rocketmagnet's picture
131 posts

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 ?


user_2405011's picture
88 posts

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



Log in to post new comments.