This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Code compiled with GNU gives memory problem

Hi,

Setup:
- Keil MCB2103 Evaluation Kit
- Keilmdk303j.exe installed
- gccARM331.exe installed

I did a little software with I2C, Timer, WD, etc. It compiled with the Keil compiler. I tried the software on flash and ram and worked as expected.

Then, I tried to compile with GNU (Cygnus). I had some issues, but did succeed.

Because I am new with GNU, I used the LinkerScript.ld from C:\Keil\ARM\GNU. I changed the size to:

  CODE (rx) : ORIGIN = 0x00000000, LENGTH = 0x00004000
  DATA (rw) : ORIGIN = 0x40000000, LENGTH = 0x00004000


In the /Options for Target/Linker I have:

Text Start: 0x00000000
Data Start: 0x40000000


I took the Startup.s file from C:\Keil\ARM\GNU\Boards\Keil\MCB2100\Blinky

Once the debugger is started, the first line that is pointed is

   119: Vectors:        LDR     PC, Reset_Addr
0x00000000  E59F4034  LDR       R4,[PC,#0x0034]

Then, I step by step in the code until I reached the swp line:

   120:                 LDR     PC, Undef_Addr
0x00000004  E3A05002  MOV       R5,#0x00000002
   121:                 LDR     PC, SWI_Addr
0x00000008  E5845000  STR       R5,[R4]
   122:                 LDR     PC, PAbt_Addr
0x0000000C  E3A05003  MOV       R5,#0x00000003
   123:                 LDR     PC, DAbt_Addr
0x00000010  E5845004  STR       R5,[R4,#0x0004]
   124:                 NOP                            /* Reserved Vector */
0x00000014  E59F201C  LDR       R2,[PC,#0x001C]
   125:                 LDR     PC, IRQ_Addr
0x00000018  E3A03000  MOV       R3,#0x00000000
   126:                 LDR     PC, FIQ_Addr
   127:
   128: Reset_Addr:     .word   Reset_Handler
   129: Undef_Addr:     .word   Undef_Handler
   130: SWI_Addr:       .word   SWI_Handler
   131: PAbt_Addr:      .word   PAbt_Handler
   132: DAbt_Addr:      .word   DAbt_Handler
   133:                 .word   0                      /* Reserved Address */
   134: IRQ_Addr:       .word   IRQ_Handler
   135: FIQ_Addr:       .word   FIQ_Handler
   136:
0x0000001C  E1020093  SWP       R0,R3,[R2]
0x00000020  E2822028  ADD       R2,R2,#0x00000028
0x00000024  E1021093  SWP       R1,R3,[R2]


What happened after that line is the code points to:

0xFFFFFFF3  FFFF      (???)     PC, Reset_Addr


Not good at all!

Anybody has a clue why I have this behavior. It looks like I did not configure my memory correctly, but I am not sure.

I tried the C:\Keil\ARM\GNU\Boards\Keil\MCB2100\Blinky. After the debugger is started, it points to:

    50: int main (void) {
    51:   unsigned int n;
    52:
0x00000310  E1A0C00D  MOV       R12,R13


After couple of lines, it goes to

   123:                 LDR     PC, DAbt_Addr
0x00000010  E59FF018  LDR       PC,[PC,#0x0018]

Not really good either.

Thanks in advance for your help

0