<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Read pointer when increasing address does not access data LPC2136</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/35688/read-pointer-when-increasing-address-does-not-access-data-lpc2136</link><description> 
your help please, this pointer initially takes the first value
extracted from the address, but when I try to increase the pointer to
access the next value it does not do anything.(ARM7TDMI LPC2136): 

 
void static commandList(const uint8_t *addr) </description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Read pointer when increasing address does not access data LPC2136</title><link>https://community.arm.com/thread/131685?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 11:10:40 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b2b1515a-8d3c-431e-8347-dbd9821b8ea2</guid><dc:creator>Raul</dc:creator><description>&lt;p&gt;&lt;p&gt;
after doing several tests remove the &amp;quot;static&amp;quot; modifier from the
function and leave it as a normal call. after this I am capturing the
values correctly from the pointer.&lt;/p&gt;

&lt;p&gt;
I must clarify that this function belongs to the library of the
TFT LCD 128x160 with the ST7735 driver.&lt;/p&gt;

&lt;p&gt;
Thank you (Andrew Neil) and the others for your comments!!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read pointer when increasing address does not access data LPC2136</title><link>https://community.arm.com/thread/149594?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 10:12:26 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3a8c07b1-01fc-4532-bf4b-4201d5e8843f</guid><dc:creator>Westonsupermare Pier</dc:creator><description>&lt;p&gt;&lt;p&gt;
Compiled on a PC, generates sequences you&amp;#39;re not handling
properly&lt;/p&gt;

&lt;p&gt;
# 15&lt;br /&gt;
CMD 11 (17)&lt;br /&gt;
DELAY&lt;br /&gt;
CMD 96 (150)&lt;br /&gt;
DAT 80 .&lt;br /&gt;
DAT FF .&lt;br /&gt;
DAT 33 3&lt;br /&gt;
DAT 03 .&lt;br /&gt;
DAT 01 .&lt;br /&gt;
DAT 2C ,&lt;br /&gt;
DAT 2D -&lt;br /&gt;
DAT 44 D&lt;br /&gt;
DAT 03 .&lt;br /&gt;
DAT 01 .&lt;br /&gt;
DAT 2C ,&lt;br /&gt;
DAT 2D -&lt;br /&gt;
DAT 55 U&lt;/p&gt;

&lt;p&gt;
Took liberties with the missing defines, but still looks broken to
me.&lt;/p&gt;

&lt;p&gt;
&amp;gt;&amp;gt;if you are interested I can take screenshots with the
assembler code.&lt;br /&gt;
A listing file, or FromELF disassembly might be better, but the
underlying logic is flawed. Instrument the code, understand what it
actually does. Compiler doing what you tell it to do.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read pointer when increasing address does not access data LPC2136</title><link>https://community.arm.com/thread/131684?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 09:47:45 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:fede7a77-de1a-4bfd-8ea1-bc54115381f1</guid><dc:creator>Raul</dc:creator><description>&lt;p&gt;&lt;p&gt;
Is that &amp;#39;const&amp;#39; in the right place ... ? Yes, it is.&lt;/p&gt;

&lt;p&gt;
This code if I compile it for the arm cortex of texas Tiva C
tm4c123g. works correctly. but when I carry the code and compile for
the ARM7tdmi lpc2136 it gives this problem with the pointer. and with
the simulation of delays.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read pointer when increasing address does not access data LPC2136</title><link>https://community.arm.com/thread/129540?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 07:00:51 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1eff1342-0552-45b0-9d05-9188c4f3e281</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;pre&gt;
void static commandList( &lt;b&gt;const &lt;/b&gt;uint8_t *addr )
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read pointer when increasing address does not access data LPC2136</title><link>https://community.arm.com/thread/121334?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 06:41:38 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0c4821a8-b253-40e8-9b1c-b9c5252cc78a</guid><dc:creator>Raul</dc:creator><description>&lt;p&gt;&lt;p&gt;
But does writecommand() actually receive the correct value?&lt;/p&gt;

&lt;p&gt;
As I said earlier the instruction * (addr ++) is not working.&lt;/p&gt;

&lt;p&gt;
No, it is not taking the values. will take the value zero at all
times.&lt;/p&gt;

&lt;p&gt;
And does numArgs get set to the correct value?&lt;/p&gt;

&lt;p&gt;
No, it is not taking the values. will take the value zero at all
times.&lt;/p&gt;

&lt;p&gt;
I have run the program step by step but I did not identify the
reason of the problem. if you are interested I can take screenshots
with the assembler code.&lt;/p&gt;

&lt;p&gt;
Thanks.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read pointer when increasing address does not access data LPC2136</title><link>https://community.arm.com/thread/118797?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 05:49:22 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1e717a72-bce1-4449-9249-a5ad265e2b43</guid><dc:creator>Westonsupermare Pier</dc:creator><description>&lt;p&gt;&lt;p&gt;
Instrument your code with printf() to understand what happening in
the loop and in the writedata() function.&lt;/p&gt;

&lt;p&gt;
Variables may be held in registers, not memory&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read pointer when increasing address does not access data LPC2136</title><link>https://community.arm.com/thread/109503?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 05:35:49 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:565a62dd-d31a-40f1-ad55-3c73a021534e</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Your indentation is a bit messed-up.&lt;/p&gt;

&lt;pre&gt;
void static commandList(const uint8_t *addr) {

  uint8_t numCommands, numArgs;
  uint16_t ms;

  numCommands = *(addr++);           // This value is recieved correct

  while(numCommands--) {             // For each command...
    writecommand( *(addr++) );       //   Read, issue the pointer not increment correctly
    numArgs  = *(addr++);            //   Number of args to follow
    ms       = numArgs &amp;amp; DELAY;      //   If hibit set, delay follows args
    numArgs &amp;amp;= ~DELAY;               //   Mask out delay bit

    while(numArgs--) {               //   For each argument...
      writedata( *(addr++) );        //     Read, issue argument
    }

    Delay();
  }
}
&lt;/pre&gt;

&lt;p&gt;
&lt;i&gt;&amp;quot;the pointer does not increase&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
But does writecommand() actually receive the correct value?&lt;/p&gt;

&lt;p&gt;
And does numArgs get set to the correct value?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read pointer when increasing address does not access data LPC2136</title><link>https://community.arm.com/thread/94437?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 05:11:40 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:13d4e187-0b03-4c0c-b8a7-2409d1090bda</guid><dc:creator>Raul</dc:creator><description>&lt;p&gt;&lt;p&gt;
This is the array that receives the function through the pointer.
in the first instruction it correctly receives the data of the first
position but from the second increment of address it does not change
and the data is not extracted.&lt;/p&gt;

&lt;pre&gt;
static const uint8_t
  Rcmd1[] = {                 // Init for 7735R, part 1 (red or green tab)
    15,                       // 15 commands in list:
    ST7735_SWRESET,   DELAY,  //  1: Software reset, 0 args, w/delay
      150,                    //     150 ms delay
    ST7735_SLPOUT ,   DELAY,  //  2: Out of sleep mode, 0 args, w/delay
      255,                    //     500 ms delay
    ST7735_FRMCTR1, 3      ,  //  3: Frame rate ctrl - normal mode, 3 args:
      0x01, 0x2C, 0x2D,       //     Rate = fosc/(1x2+40) * (LINE+2C+2D)
    ST7735_FRMCTR2, 3      ,  //  4: Frame rate control - idle mode, 3 args:
      0x01, 0x2C, 0x2D,       //     Rate = fosc/(1x2+40) * (LINE+2C+2D)
    ST7735_FRMCTR3, 6      ,  //  5: Frame rate ctrl - partial mode, 6 args:
      0x01, 0x2C, 0x2D,       //     Dot inversion mode
      0x01, 0x2C, 0x2D,       //     Line inversion mode
    ST7735_INVCTR , 1      ,  //  6: Display inversion ctrl, 1 arg, no delay:
      0x07,                   //     No inversion
    ST7735_PWCTR1 , 3      ,  //  7: Power control, 3 args, no delay:
      0xA2,
      0x02,                   //     -4.6V
      0x84,                   //     AUTO mode
    ST7735_PWCTR2 , 1      ,  //  8: Power control, 1 arg, no delay:
      0xC5,                   //     VGH25 = 2.4C VGSEL = -10 VGH = 3 * AVDD
    ST7735_PWCTR3 , 2      ,  //  9: Power control, 2 args, no delay:
      0x0A,                   //     Opamp current small
      0x00,                   //     Boost frequency
    ST7735_PWCTR4 , 2      ,  // 10: Power control, 2 args, no delay:
      0x8A,                   //     BCLK/2, Opamp current small &amp;amp; Medium low
      0x2A,
    ST7735_PWCTR5 , 2      ,  // 11: Power control, 2 args, no delay:
      0x8A, 0xEE,
    ST7735_VMCTR1 , 1      ,  // 12: Power control, 1 arg, no delay:
      0x0E,
    ST7735_INVOFF , 0      ,  // 13: Don&amp;#39;t invert display, no args, no delay
    ST7735_MADCTL , 1      ,  // 14: Memory access control (directions), 1 arg:
      0xC8,                   //     row addr/col addr, bottom to top refresh
    ST7735_COLMOD , 1      ,  // 15: set color mode, 1 arg, no delay:
      0x05 };

&lt;/pre&gt;
&lt;pre&gt;
void static commandList(const uint8_t *addr) {

  uint8_t numCommands, numArgs;
  uint16_t ms;

  numCommands = *(addr++);               // This value is recieved correct
        while(numCommands--) {                 // For each command...
    writecommand(*(addr++));             //   Read, issue the pointer not increment correctly
    numArgs  = *(addr++);                //   Number of args to follow
    ms       = numArgs &amp;amp; DELAY;          //   If hibit set, delay follows args
    numArgs &amp;amp;= ~DELAY;                   //   Mask out delay bit
    while(numArgs--) {                   //   For each argument...
      writedata(*(addr++));              //     Read, issue argument
    }


    Delay();
   }

}

&lt;/pre&gt;

&lt;p&gt;
commandList(Rcmd1); //this is the called&lt;/p&gt;

&lt;p&gt;
this instruction is fine: numCommands = *(addr++);&lt;br /&gt;
after these instructions the pointer does not increase:
writecommand(*(addr++));&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read pointer when increasing address does not access data LPC2136</title><link>https://community.arm.com/thread/94427?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 00:52:03 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:4e2f556c-f3b7-494b-a9cd-16cf46035aa5</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
For the hard-of-reading, here is a picture to help you:&lt;/p&gt;

&lt;p&gt;
&lt;b&gt;&lt;br /&gt;
&lt;a href="http://www.danlhenry.com/caps/keil_code.png"&gt;www.danlhenry.com/.../keil_code.png&lt;/a&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Read pointer when increasing address does not access data LPC2136</title><link>https://community.arm.com/thread/86357?ContentTypeID=1</link><pubDate>Sun, 10 Jun 2018 09:05:56 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:499a7ac3-c549-405a-9f4f-3c480560be54</guid><dc:creator>Westonsupermare Pier</dc:creator><description>&lt;p&gt;&lt;p&gt;
Please read the posting instructions for source code, otherwise it
is just unreadable.&lt;/p&gt;

&lt;p&gt;
If you don&amp;#39;t understand the problem&lt;/p&gt;

&lt;p&gt;
Use a debugger to step through it&lt;br /&gt;
Review the code generated by the compiler&lt;br /&gt;
Instrument the code so understand *what* is happening&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>