Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Problem with GNUARM 3.4.3

2005-02-15 by Anton Erasmus

Hi,

I have installed the latest GNUARM which is based on gcc 3.4.3.
I downloaded the UT040803A.zip uart example from the files
area. 
I compiled and downloaded the code to a LPC2292 board. The code
runs as expected except for one thing. In stead of printing "Hello World!",
it displays garbage.
The main routine is as follows:

int main(void)
{
  uint32_t startTime;

  sysInit();
#if defined(UART0_TX_INT_MODE) || defined(UART0_RX_INT_MODE)
  enableIRQ();
#endif
  startTime = getSysTICs();
  uart0Puts("\r\nHello World!\r\n");

  for (;;)
    {
    do
      {
      int ch;

      if ((ch = uart0Getch()) >= 0)
        uart0Putch(ch);
      }
    while (getElapsedSysTICs(startTime) < HALF_SEC);

    IOPIN ^= LED2_BIT;

    startTime += HALF_SEC;
    }

  return 0;
}

The section after the uart0Puts works. When I press a key on the serial terminal, it is 
echoed correctly back. So it seems that the baud rate etc. is correct. If I compile the 
code with no optimisation  (Default is set to O2), then it prints the "Hello World!" as 
expected. If I add a uart0Putch('U') before the uart0Puts, the U is printed. If I add more, 
then sometimes the "Hello World!" is printed correctly. I have looked in the hex file 
generated, and the ASCII data is put in the .rodata section as expected. It looks as if
the ASCII strings are aligned at 4 byte boundaries, so I do not think it is an alignment 
problem.
Has anyone else had problems with literal strings using gcc 3.4.3 ? Any suggestions on
where I can look to find the problem would be appreciated.

Regards
   Anton Erasmus


-- 
A J Erasmus

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.