Memory Size Mismatch

Discussion about Parallella (and Epiphany) Software Development

Moderators: amylaar, jeremybennett, simoncook

Memory Size Mismatch

Postby cwpdev » Tue Sep 19, 2017 9:31 pm

Probably (hopefully) something obvious here.

I'm getting a mismatch between the size of a declared variable type, and the size of the variables themselves. Specifically:

In the source code for my .elf file I've got:
Code: Select all
volatile double q_0      SECTION(".text_bank2");


This is compiled with:
Code: Select all
e-gcc -T ${ELDF} --std=gnu11 -O0 e_ants.c -o e_ants.elf -le-lib -lm

Where $ELDF=PATHTO/internal.ldf

Then in testing with e-gdb I'll try:
Code: Select all
(gdb) p sizeof(double)
$36 = 8
(gdb) p sizeof(q_0)
$37 = 4


Obviously, 4 does not equal 8. This is cascading and causing value errors as I try to write values from the host to the devices. So far, I experienced the issue with doubles (4!=8) and shorts (4!=2). Basically, every global variable is getting a size of 4, instead of a size corresponding the its specific type.

Where am I screwing this up?
cwpdev
 
Posts: 2
Joined: Tue Sep 19, 2017 9:15 pm

Re: Memory Size Mismatch

Postby jar » Wed Sep 20, 2017 2:11 am

I can't reproduce this. Here's what I did:

Code: Select all
$ cat test.c
#include "e-lib.h"
volatile double q_0  SECTION(".text_bank2");
$ e-gcc -g -c test.c -o test.o
$ e-gdb ./test.o
...
(gdb) p sizeof(double)
$1 = 8
(gdb) p sizeof(q_0)
$2 = 8
User avatar
jar
 
Posts: 295
Joined: Mon Dec 17, 2012 3:27 am

Re: Memory Size Mismatch

Postby cwpdev » Wed Sep 20, 2017 2:56 am

It was something obvious....

I was missing the -g from the compiler options...

:roll:
cwpdev
 
Posts: 2
Joined: Tue Sep 19, 2017 9:15 pm


Return to Programming Q & A

Who is online

Users browsing this forum: No registered users and 3 guests

cron