cancel
Showing results for 
Search instead for 
Did you mean: 

casting double to long

worlag
Associate II
Posted on April 03, 2014 at 10:11

Hi

I'm using STM32f4 i was trying this code:

int
main()
{
signed
long
sArg;
double
dArg;
sArg = ( 
signed
long
) dArg;
}

the build is ok , but when tryin to program the target i got ''no source available for 0x0''. is there a problem casting double to long ? also using atof() : unsigned char buf[10]; dArg = atof(buf); give the same problem. with this code i was able to run:

int
main()
{
signed
long
sArg;
double
dArg;
float
fArg;
fArg = (
float
) dArg;
sArg = ( 
signed
long
)fArg
}

any explanations? thanks, Ari.
8 REPLIES 8
frankmeyer9
Associate II
Posted on April 03, 2014 at 11:06

but when tryin to program the target i got ''no source available for 0x0''.

 

is there a  problem  casting double to long ?

 

No surely not. It seems to be a problem of your toolchain.

BTW, you could have mentioned which one.

Do you use Windows, and have your project in the ''C:\Program Files\'' path ?

worlag
Associate II
Posted on April 03, 2014 at 12:01

I'm using Atollic TrueStudio for ARM , (windows).

my project is not in ''C:\Program Files\''.

But i checked on the STM3240G Evaluation board . and same elf file runs perfect.

Only when i'm trying to run  it on our new board i get this problem...

Thogh, as you see the i don't do any HW configurations in main()..

so, what can it be ? where this kind of problem should point me ?

thanks,

Ari

frankmeyer9
Associate II
Posted on April 03, 2014 at 12:34

I am not an Atollic user - about two years ago I evaluated it, having several troubles with building, flashing and debugging when projects were located in the system path.

Is your debug configuration correct ?

Can you confirm your code had actually been flashed to the target ?

That message suggests to me that either the executable had not been flashed, or the IDE lost track between source code and machine instructions.

I would additionally consult the IDE documentation and an Atollic forum.

Posted on April 03, 2014 at 13:27

Optimization? That main() exits and the code does nothing permanent?

A while(1); would stop the exiting issue.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
worlag
Associate II
Posted on April 03, 2014 at 14:04

thanks fm, i'll give a look.

clive,

my compiler optimization is None.

i've tried the while(1) , but still stuck..

any suggestions ?

thanks ,Ari

frankmeyer9
Associate II
Posted on April 03, 2014 at 15:08

As I understood your first post, you can't even download your program.

Perhaps some project setting issue ?

I'd try to setup a new project from scratch, possibly copying the main routine.

worlag
Associate II
Posted on April 03, 2014 at 15:17

that's right, it's not even downloading.

Perhaps some project setting issue ?

 

I'd try to setup a new project from scratch, possibly copying the main routine.

but the same workspace, same project , same build, works fine on the evaluation board !!

i only change the target connected to my Segger j-link..

i wonder , what it got to do with different boards ?

thanks

Ari

frankmeyer9
Associate II
Posted on April 03, 2014 at 15:28

AFAIK, you need to change the Eclipse debug configuration if you change the debug adapter.

But as said, I'm no Eclipse/Atollic user, and moving on thin ice here ...