Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Portability problem in uCLinux with GetInt function. #100

Open
GoogleCodeExporter opened this issue May 17, 2015 · 2 comments
Open

Portability problem in uCLinux with GetInt function. #100

GoogleCodeExporter opened this issue May 17, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?

1. compile the sample program and library for uCLinux with cross compiler 
m68k-ucLinux-gcc  ( m68k-uclinux-tools) 

this is done for example : 
# /usr/local/m68k-uclinux-tools/bin/m68k-uclinux-g++  -o JSonClient-SPOTM3  
main.o -pipe -m5307 -static -Wl,-elf2flt='-s 8196' -Wl,-move-rodata

where main is the example provided bby rapidjason.

2. copy the binary JSonClient-SPOTM3 to the coldfire box with uCLinux.
3. run the binary


What is the expected output? What do you see instead?

Where Output in Linux/x86 platform is 
----------------------------------------
Original JSON:
  { "hello" : "world", "t" : true , "f" : false, "n": null, "i":123, "pi": 3.1416, "a":[1, 2, 3, 4] } 

Parsing in-situ with a buffer.

Parsing to document succeeded.

Access values in document:
hello = world
t = true
f = false
n = null
i = 123
pi = 3.1416
a[0] = 1
a[1] = 2
a[2] = 3
a[3] = 4


Modified JSON with reformatting:
{
    "hello": "rapidjson",
    "t": true,
    "f": false,
    "n": null,
    "i": 2432902008176640000,
    "pi": 3.1416,
    "a": [
        1,
        2,
        3,
        4,
        5,
        6,
        7,
        8,
        9,
        10,
        "Lua",
        "Mio"
    ],
    "author": "Milo Yip"
}

when running in uCLinux / coldfire platform 
----------------------------------------------

Original JSON:
  { "hello" : "world", "t" : true , "f" : false, "n": null, "i":123, "pi": 3.1416, "a":[1, 2, 3, 4] } 

Parsing in-situ with a buffer.

Parsing to document succeeded.

Access values in document:
hello = world
t = true
f = false
n = null
i = 0
pi = 3.1416
a[0] = 0
a[1] = 0
a[2] = 0
a[3] = 0


Modified JSON with reformatting:
{
    "hello": "rapidjson",
    "t": true,
    "f": false,
    "n": null,
    "i": 2432902008176640000,
    "pi": 3.1416,
    "a": [
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        "Lua",
        "Mio"
    ],
    "author": "Milo Yip"
}


What version of the product are you using? On what operating system?

Version is 0.11 and running in uCLinux in a coldfire processor.


Please provide any additional information below.

You can get the compiler from 
http://www.codesourcery.com/downloads/public/gnu_toolchain/m68k-uclinux/freescal
e-coldfire-4.3-209-m68k-uclinux.bin


Note: As a surprise this works on linux and when compiling for ARM processor 
with the crosscompiler  /opt/arm/2012.09-64/bin/arm-none-linux-gnueabi-g++ from 
CodeSourcery

wget 
http://www.codesourcery.com/downloads/public/gnu_toolchain/arm-none-linux-gnueab
i/arm-2009q3-67-arm-none-linux-gnueabi.bin




Original issue reported on code.google.com by [email protected] on 14 Feb 2014 at 3:28

@GoogleCodeExporter
Copy link
Author

Notice that the problem is that all GetInt() functions return cero ( 0) as 
value when doing printf ( ) or when using PrettyWritter

Original comment by [email protected] on 14 Feb 2014 at 3:33

@GoogleCodeExporter
Copy link
Author

I would suspect this to be an endianness problem.

Rapidjson tries to detect the endianness of the target processor via the 
'__BYTE_ORDER__' macro usually provided by GCC compilers and falls back to 
little endian by default.  Little endian would be wrong for m68k.

Does it help to compile with '-DRAPIDJSON_ENDIAN=RAPIDJSON_BIGENDIAN'?

Original comment by [email protected] on 16 Feb 2014 at 11:54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant