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.
I would agree to start with the stack. Count the number of nested calls (where one function calls another) Do the same for the interrupts (And again for each priority level used) Then add them up. That Plus the memory uses should be greater than 256.
Note is you are using a chip with less than 256 RAM use that. Insure you are using the correct memory model. Are you using Banking?
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.
"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.
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.
Yes sorry for not providing all the necessary info. I was tired and fed up.
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...
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 give her the need to vibrate..."
Yes, at a 50% duty cycle.
Timers at the ready!
-The stimulator did not give me much pleasure
-I give her the need to vibrate
Erik
looks like I've come to the wrong sort of forum :-o
View all questions in Keil forum