EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Code compiled with GNU gives data abort problem

Started by icarus_31 December 28, 2006
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 - uclibc). 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 = 0x00002000
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

69: {
0x00000828 E1A0C00D MOV R12,R13
0x0000082C E92DD870 STMDB R13!,{R4-R6,R11-R12,R14-PC}
0x00000830 E24CB004 SUB R11,R12,#0x00000004
70: u32 i = 0;
71: // u32 j = 0;

But once the line STMDB is executed, it goes directly to:

123: LDR PC, DAbt_Addr
0x00000010 E59FF018 LDR PC,[PC,#0x0018]
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.
Thanks in advance for your help

An Engineer's Guide to the LPC2100 Series

GNU version

At the beginning, R13 = 0x40003F70
Once the abort occurs, R13 = 0x40003FFC

Keil version

At the beginning, R13 = 0x400004A8
I don't know why the SP (R13) is out of range when the code is compiled
with GNU. Somebody has a clue?
--- In l..., "icarus_31" wrote:
>
> 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 - uclibc). 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 = 0x00002000
> 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
>
> 69: {
> 0x00000828 E1A0C00D MOV R12,R13
> 0x0000082C E92DD870 STMDB R13!,{R4-R6,R11-R12,R14-PC}
> 0x00000830 E24CB004 SUB R11,R12,#0x00000004
> 70: u32 i = 0;
> 71: // u32 j = 0;
>
> But once the line STMDB is executed, it goes directly to:
>
> 123: LDR PC, DAbt_Addr
> 0x00000010 E59FF018 LDR PC,[PC,#0x0018]
> 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.
> Thanks in advance for your help
>
>
The problem was resolved changing the:
.equ Top_Stack, 0x40004000

from Startup.s file to:
.equ Top_Stack, 0x40002000

--- In l..., "icarus_31" wrote:
> GNU version
>
> At the beginning, R13 = 0x40003F70
> Once the abort occurs, R13 = 0x40003FFC
>
> Keil version
>
> At the beginning, R13 = 0x400004A8
> I don't know why the SP (R13) is out of range when the code is compiled
> with GNU. Somebody has a clue?
> --- In l..., "icarus_31" wrote:
> >
> > 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 - uclibc). 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 = 0x00002000
> >
> >
> > 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
> >
> > 69: {
> > 0x00000828 E1A0C00D MOV R12,R13
> > 0x0000082C E92DD870 STMDB R13!,{R4-R6,R11-R12,R14-PC}
> > 0x00000830 E24CB004 SUB R11,R12,#0x00000004
> > 70: u32 i = 0;
> > 71: // u32 j = 0;
> >
> > But once the line STMDB is executed, it goes directly to:
> >
> > 123: LDR PC, DAbt_Addr
> > 0x00000010 E59FF018 LDR PC,[PC,#0x0018]
> >
> >
> > 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.
> >
> >
> > Thanks in advance for your help
> >
> >
> >
> >
>

The 2024 Embedded Online Conference