RLP on FEZ Raptor - Exception when invoking RLP.LoadELF

Hi everybody,

the procedure I took to get my first RLP program on a FEZ Raptor running was:

  • installed the YAGARTO toolchain and made sure it’s working.
  • downloaded RLP_User.zip and modified RLP_Starter_Example:
    • changed RLP_LinkScript.lds -> MEMORY -> SDRAM to
      • SDRAM (wx) : ORIGIN = 0xA0000000, LENGTH = 0x017FFFFC
    • changed makefile’s CCFLAGS mcpu to
      • -mcpu=arm926ej-s
  • invoked make from console which created the .elf and .map files.
  • added .elf to a simple test project’s ressource section and got this code snippet compiled:

byte[] elf_file = Resources.GetBytes(Resources.BinaryResources.RLP_test);
RLP.LoadELF(elf_file); // here I'll get an exception
RLP.InitializeBSSRegion(elf_file);
SwapArray = RLP.GetProcedure(elf_file, "SwapArray");
elf_file = null;
Debug.GC(true);

  • when running this causes an exception inside RLP.LoadELF(elf_file).

I went through all code snippets which I found and digged deep into almost any related subject - without success.

So here’s my question:

What’s wrong with my setup?

Thanks a lot in advance for your any suggestions.

Paste your makefile here…

Hi Simon,

thanks for reply. Here’s the makefile (modified version of the EMX example):

####################################################

Copyright© GHI Electronics, LLC

####################################################
OUTFILE=RLP_test
LINKERSCRIPT = RLP_LinkScript.lds

INCL=./include

CC =arm-none-eabi-gcc
LD =arm-none-eabi-gcc

CCFLAGS= -g -mlittle-endian -mcpu=arm926ej-s -Wall -I. -I$(INCL)
CCFLAGS+= -mapcs-frame -fno-builtin -g0

LDFLAGS =-nostartfiles -Wl,–Map -Wl,./Output/$(OUTFILE).map
LDFLAGS+=-lc -lgcc -Wl,–omagic
LDFLAGS+=-T $(LINKERSCRIPT)

OBJS+= RLP_test1.o

rebuild: clean all del_o

all: $(OBJS)
$(LD) $(LDFLAGS) -o ./Output/$(OUTFILE).elf $(OBJS) -lm

RLP_test1.o: RLP_test1.c
$(CC) -c $(CCFLAGS) RLP_test1.c -o RLP_test1.o

clean:
-rm .o ./Output/.elf ./Output/*.map

del_o:
-rm *.o

del_map:
-rm ./Output/*.map

###################### EOF ########################

Try adding -fdata-sections -ffunction-sections to CCFLAGS, something like this:

CCFLAGS+= -mapcs-frame -fno-builtin -g0 -fdata-sections -ffunction-sections

Also check RLP.H if the correct lines are uncommented (although for simple functions, RLP.h isn’t even needed).

Hi Simon,

this was fast… but I cannot test it right now - I’m living in Germany and me and my wife wanna go out in a Minute.

I’ll give it a try, tomorrow.

Cheers, Rolf

Thanks a lot for your efforts, Simon!
Problem got solved after a few trials. I’ve been heading forward, with my first gadgeteering steps, too fast…
I suddenly figured out that I didn’t update the elf file in VS - so I used one with wrong starting RLP mem address and size. Normally, I set up projects a way where no manual update needs to be done, but as I mentioned above - I’ve been heading forward too fast!
For someone who might be interested in my entire setup, I used the following make and linker script files:
[ul]makefile[/ul]
####################################################

Copyright© GHI Electronics, LLC

####################################################

OUTFILE=RLP_test
LINKERSCRIPT = RLP_LinkScript.lds

INCL=./include

CC =arm-none-eabi-gcc
LD =arm-none-eabi-gcc

CCFLAGS= -g -mlittle-endian -mcpu=arm926ej-s -Wall -I. -I$(INCL)
CCFLAGS+= -mapcs-frame -fno-builtin -g0

LDFLAGS =-nostartfiles -Wl,–Map -Wl,./Output/$(OUTFILE).map
LDFLAGS+=-lc -lgcc -Wl,–omagic
LDFLAGS+=-T $(LINKERSCRIPT)

OBJS+= RLP_test1.o

rebuild: clean all del_o

all: $(OBJS)
$(LD) $(LDFLAGS) -o ./Output/$(OUTFILE).elf $(OBJS) -lm

RLP_test1.o: RLP_test1.c
$(CC) -c $(CCFLAGS) RLP_test1.c -o RLP_test1.o

clean:
-rm .o ./Output/.elf ./Output/*.map

del_o:
-rm *.o

del_map:
-rm ./Output/*.map
####################### EOF ########################

[ul]RLP_LinkScript.lds[/ul]
//
/
Copyright© GHI Electronics, LLC /
/
/

OUTPUT_FORMAT(“elf32-littlearm”, “elf32-littlearm”, “elf32-littlearm”)
OUTPUT_ARCH(arm)

MEMORY
{
SDRAM (wx) : ORIGIN = 0xA0000000, LENGTH = 0x017FFFFC
}

SECTIONS
{

    . = ALIGN(4);
    .text : 
    { 
    	*(.text)
    } >SDRAM

    . = ALIGN(4);
    .rodata : 
    { 
      *(.rodata )
    } >SDRAM
    
    . = ALIGN(4);
    .data : 
    { 
    	*(.data)
    } >SDRAM

     . = ALIGN(4);
    .bss : 
    {
        __bss_start__ = .;
        *(.bss)
        __bss_end__ = .;
    } >SDRAM

}
end = .; /* define a global symbol marking the end of application RAM */

P.S.: Inside the link script the operator “>SDRAM” used inside SECTIONS is optional.