I'm using the Silicon Laboratories C8051F345 with the Keil IDE.
I now have two different projects of which the firmware won't execute. If I comment random pieces of code the firmware will execute. I am still within the memory limits of the device.
From my point of view, the compiler is not configured correctly for the device or I assign my variables incorrectly. I ran out of ideas, tired of searching and pulled almost all my hair out of my head.
I program alone and don't have anyone to look at my source.
I want to ask if someone experienced will please have a look at my project to point any possible mistakes or problems.
You never mentioned the name of the function that the first LJMP jumped to.
Do you have any functions with leading underscores?
Maybe you have a function with the same name as an initialization function in the runtime library. The startup code may try to call an init function in the runtime library to set up the required variables for printf(), ... and now manages to call one of your functions instead.
"where did you put my file?"
The forum does not accept attachments so I uploaded it to the location you specified (/dev/null, IIRC).
I had a look at the assembly.
The startup code has a LJMP to C_START (In this case C_START is at address 0x112E). But the firmware at this address is a function that is called at a later stage during execution. So the C_START address is incorrect. But just after that assembly line is another LJMP to the correct address (main() at address 0x17E5) which is not executed.
Before the firmware execute the LJMP to 0x112E I change the PC to 0x17E5 and the program will the execute as it should.
Why will C_START have the wrong address?
It will be in IDATA
http://www.keil.com/support/man/docs/uv3/uv3_cm_display.htm
How do I view the stack memory (RAM) in the Keil IDE. I can only find a view of the code memory?
Yes, it is attached.
What web browser are you using?
looks like I've come to the wrong sort of forum :-o
-The stimulator did not give me much pleasure
-I give her the need to vibrate
Erik
"I give her the need to vibrate..."
Yes, at a 50% duty cycle.
Timers at the ready!
What about the linker/locater, could it be possible that the wrong memory size and/or location is defined?
I doubt it, unless you are getting a warning during linking.
What you can do upon startup is to fill your stack with a known pattern, like 0x55 interleaved with 0xAA, and check the stack space with the debugger / code. if the pattern is gone, so is your program...
Yes sorry for not providing all the necessary info. I was tired and fed up.
Aren't we all. Can you imagine somebody here making a hit on you here (see 'Miss Embededd'. the typos are in the source, not mine! I give her the need to vibrate, or something).
I still haven't had a chance to look at the problem again but can I increase the stack size? (In the startup code?)
Is it I good idea to increase the stack size (if possible) or should I reduce the nested calls. Not that I think I branch to much.
"When I say it stops working, I mean, It does not execute as it is supposed to (It jumps to locations where it is not supposed to)."
Never abreviate when you ask for help with a problem. Give the symptoms as clearly as you can instead of just saying that it fails.
Stack overflow will often result in the application jumping to strange locations. Without room on the stack, the application will fail when returning from a function call or an interrupt service routine. It is quite easy to catch a stack overflow in the normal call sequence, but stack overflows for an interrupt is very problematic, since the interrupts happens asynchronously.
Thanks for the replies. I will try all recommendations and come back to this topic.
A few things that I can reply on:
-The stimulator did not give me much pleasure. -When I debug the firmware real time, it jumps to an interrupt and get stuck there (I need to verify this again). - When I say it stops working, I mean, It does not execute as it is supposed to (It jumps to locations where it is not supposed to). -When I check for errors I do check for corrupt pointers and bad interrupts but did not have a look at the stack. -I have 4k of RAM and use a large memory model. -No, I don't bank.
sir henry
where did you put my file? i can not find it!
did you attach to the message?
king kang = king kong ?
View all questions in Keil forum