Page 1 of 1

Memory Size Mismatch

PostPosted: Tue Sep 19, 2017 9:31 pm
by cwpdev
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?

Re: Memory Size Mismatch

PostPosted: Wed Sep 20, 2017 2:11 am
by jar
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

Re: Memory Size Mismatch

PostPosted: Wed Sep 20, 2017 2:56 am
by cwpdev
It was something obvious....

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

:roll: