Main Site Documentation

G120 hdr & rlp


#1

Hi,

Could you give me the RLP base address and Length for the G120 module ?
Can I use EMX configuration (found in RLP Starter Example) ?

Thanks in advance.


#2

Welcome to the forum!

Yeah, looks like it is missing. Very new product, so the docs fall behind a little bit.


#3

@ lexa

Welcome to the community.

The RLP address is the same as on the EMX.


#4

Which is:

RLP Address: 0xA0F00000. RLP Size: 0x000FFFFC

By the way new 4.2 documentation refers to product documentation for the actual value of the address, but there is no information about that in the product description.

The only way to find it is to check 4.1 Premium documentation.


#5

Hello,

I’ve got a problem with RLP in G120HDR module

During uploading the elf file: RLP.LoadELF the module crash and resets after a while.
No exceptions are thrown.

Code:
byte[] elf_file = Resources.GetBytes(Resources.BinaryResources.RLPext_example);
RLP.LoadELF(elf_file);

Used example RLP_Extensions_Example in RLP_User.
Compiler: yagarto 4.7.2.

RLP_ADDRESS 0xA0F00000
RLP_SIZE 0x000FFFFC

Regards,
Andrew


#6

Any ideas?


#7

We would need a simplified example that we can try on our end


#8

Hello,

I wrote a very simple code to test and I have the same problem (on G120HDR module).

The yagarto version is 4.7.2 and the RLP address and RLP size are correct (ORIGIN = 0xA0F00000, LENGTH = 0x000FFFFC).

C

int testProcedure(unsigned int* array, void** args, unsigned int argsCount , unsigned int* argSize)
{
    int length = *(int*)args[0];
    return length;
}

C#

using System;
using GHI.Premium.Native;
using Microsoft.SPOT;

namespace RLP_exemple
{
    public class Program
    {
        public static void Main()
        {
            Debug.Print("RLP exemple");

            Byte[] elf_file = Resources.GetBytes(Resources.BinaryResources.RLP_test);

            RLP.LoadELF(elf_file);

            RLP.Procedure testProcedure = RLP.GetProcedure(elf_file, "testProcedure");

            elf_file = null;
            Debug.GC(true);

            UInt32[] array = new UInt32[] { 1, 2, 3 };

            Int32 length = testProcedure.InvokeEx(array, array.Length);

            Debug.Print("Length = " + length.ToString());
        }
    }
}

The same code works with EMX.

Someone already managed to use the RLP with a G120 ?

Regards,

LME


#9

Did you compile it arm, thumb or thumb2? You need thumb2


#10

I compiled it arm…

I find no example for the G120 module, what should I change to compile it thumb2 ?


#11

Could any native-programming master post a worked G120 RLP sample project?


#12

The g120 is a premium board so you definitely don’t want the oshw one… I don’t have a g120 to validate your findings though so we’ll have to leave it to GHI to comment


#13

My code also halts on LoadELF, I am not sure if I have the correct Makefile configuration for G120.

Could someone that got the RLP running on G120 post the makefile config?

I have changed the address space to suit G120.


#14

I made my 1st little step towards RLP on G120 and FW 4.2.8
I followed these instructions: http://wiki.tinyclr.com/index.php?title=RLP_Getting_Started
I’m using the ‘unmodifed’ EMX\RLP_Starter_Example sample
All I did is updating the references and using statement.

I assume that I do not have to change ORIGIN and LENGTH in RLP_LinkScript.lds as it is:

MEMORY
{
  SDRAM (wx) : ORIGIN = 0xA0F00000, LENGTH = 0x000FFFFC
}

I have called make which was successful and copied the new RLP_test.elf into the resource folder.
Then I deployed and run it on my G120.
Loading the elf file and getting the procedures seams to work (I get valid lookin pointers)
But when it calls the 1st RLP Method

int size = FillByteArray.Invoke(myArray, 40);

It never returns. A while later G120 reboots. It also reboots without debugger all the time.

I tried to change

OUTPUT_ARCH(arm)

to

OUTPUT_ARCH(thumb2)

as Gus suggested in this thread, but then make tells me:

c:/yagarto-20121222/bin/../lib/gcc/arm-none-eabi/4.7.2/../../../../arm-none-eabi/bin/ld.exe: cannot represent machine `thumb2'

I have:
yagarto-tools-20121018-setup
and
yagarto-bu-2.23.1_gcc-4.7.2-c-c++_nl-1.20.0_gdb-7.5.1_eabi_20121222
installed.

Any Idea, is there a new RLP sample for G120?


#15

I have these settings in the makefil

[quote]
INCL=./include

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

CCFLAGS= -g -mlittle-endian -mcpu=cortex-m3 -mthumb -Wall -I. -I$(INCL)
CCFLAGS+= -mapcs-frame -fno-builtin

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


#16

@ Honken - Thanks for the info
Using these values it works a little better.
FillByteArray.Invoke works now, but now it hangs on

int error = ArgumentTest.InvokeEx(uintArray, -5, 4.7f, "Hello!", byteArray);

Followed by a BSOD after a while
Also I have to reflash the G120 to be able to deploy again.
Could you post your full maefile and LinkScript please? Here are mine:

####################################################
 ###### Copyright(c) 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=cortex-m3 -mthumb  -Wall -I. -I$(INCL)
CCFLAGS+= -mapcs-frame -fno-builtin

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

OBJS+= RLP_test1.o \
       RLP_test2.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

RLP_test2.o: RLP_test2.c 
	$(CC) -c $(CCFLAGS) RLP_test2.c -o RLP_test2.o
clean:
	-rm *.o ./Output/*.elf ./Output/*.map

del_o:
	-rm *.o

del_map:
	-rm ./Output/*.map
/*************************************/
/* Copyright(c) GHI Electronics, LLC */
/*************************************/

OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)

MEMORY
{
  SDRAM (wx) : ORIGIN = 0xA0F00000, LENGTH = 0x000FFFFC
}

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

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

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

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



#17


 ####################################################
 ###### Copyright(c) GHI Electronics, LLC ######
 ####################################################

OUTFILE=RLP_RSA1024
LINKERSCRIPT = RLP_LinkScript.lds

INCL=./include

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

CCFLAGS=  -g -mlittle-endian -mcpu=cortex-m3 -mthumb -Wall -I. -I$(INCL)
CCFLAGS+= -mapcs-frame -fno-builtin

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

OBJS+=	RLP_RSA1024.o \
		mini-gmp.o

rebuild: clean all del_o

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

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

mini-gmp.o: mini-gmp.c 
	$(CC) -c $(CCFLAGS) mini-gmp.c -o mini-gmp.o


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

del_o:
	-rm *.o

del_map:
	-rm ./Output/*.map

//
/
Copyright© GHI Electronics, LLC /
/
/

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

MEMORY
{
SDRAM (wx) : ORIGIN = 0xA0F00000, LENGTH = 0x000FFFFC
}

SECTIONS
{
HEAPSIZE = 128;

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

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

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

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





#18

It look like as if two of the C sample methods does cause this:
Any call to FillByteArray_c() works, no matter if I call it by Invoke or InvokeEx.
But when I call ArgumentTest() or FloatTest() with InvokeEx it hangs.
Must there something be changed on these?

// a second file that you can use to add your code
// You might need to change this depending on the location of the header file
 #include <RLP.h>

// CSharp Method
// uint[] uintArray = new uint[]{1,123456789,32};
// byte[] byteArray = new byte[]{0x12,0xFF,0x2D};
// ArgumentTest.Invoke(uintArray, -5, 4.7f, "Hello!", byteArray)
int ArgumentTest(unsigned int *generalArray, void **args, unsigned int argsCount, unsigned int *argData)
{
    
    int number = *(int*)args[0];
    float fnum = *(float*)args[1];
    char *string = (char*)args[2];
    unsigned char *byteArray = (unsigned char*)args[3];	// same byteArray in C#

    if(generalArray == 0)
        return -1; // error
    if(generalArray[0] != 1 || generalArray[1] != 123456789 || generalArray[2] != 32)
        return -2; // error
    if(number != -5)
        return -3;	// error
    if(fnum != 4.7f)
        return -4;	// error
    if(strcmp(string,"Hello!")!=0)
        return -5;
    if(byteArray[0] != 0x12 || byteArray[1] != 0xFF || byteArray[2] != 0x2D)
        return -6; // error
    
    return 0;
    
        
}

// CSharp Method
// float[] farray = new float[200];
// FloatTest.Invoke(farray, farray.Length, 1.23f);
int FloatTest(float *generalArray, void **args, unsigned int argsCount, unsigned int *argData)
{
    int farray_lenght = *(int*)args[0];
    int i = 0;
    float dividor = *(float*)args[1];

    for( i = 0; i < farray_lenght; i++)
    {
        generalArray[i] = i/(1+dividor);
    }
    return 0;
}

The only real difference I see between them and FillByteArray_c() is that they access the generalArray.
EDIT: Nope, generalArray is not the reason, then may be because the 2 methodts are in the 2nd .c file!?
EDIT: Nope, copied the same method with differnt name 3 times in both .c files and they work as expected

Edit:
In FloatTest I tracked it down to the following line of code:

generalArray[i] = i/(1+dividor);

here are two working replacements:

generalArray[i] = dividor;

If I check the array after the call the values in the array is as expected: 1.23

generalArray[i] = 1.123f;

here are some not working replacements:

generalArray[i] = (1+dividor);
generalArray[i] = (1.0f+dividor);
generalArray[i] = (float)i/dividor;

It looks like as soon as there is a computation after the assignment it hangs, then reboots
Haven’t tracked down the hang/reboot reason in ArgumentTest so far.
What is the expected behaviour if there is an exception (like division by zero) in C code?
Can I catch the exceptions somehow?
btw. If I try to reflash G120 with FirmwareUpdater 2 times in a row, FirmwareUpdater crashes on the 2nd try. It needs to be restarted for every flash cycle!


#19

@ GHI - You have fixed RLP for G120 in 4.2.8. Could you share your test project?


#20

@ GHI - I just have tried it with 4.2.9: same problems as described above.
Can this have to do something with the yartgo tool chain version or the settings in the makefile?
GHI: could you please share your tool chain version, make and linkerScript files for G120.