Hi!
I am working on lpc1837 based project, in which I have a bootloader that should load a firmware image.
The firmware works with RTX kernel and bootloader doesn't. I had compiled firmware with base address as 0x1a020020 (0x20 bytes from 0x1a020000 used by firmware header info). And I had given the same for bootloader to branch and execute firmware. But this requires that I should handle stack and heap sizes in startup files which I couldn't understand well.
Can anyone help me how to get this?
Thanks in advance. ChetaN
The trick is to understand the requirements of the Cortex-M3, and come up with a plan that meets those instead of the odd plan you have contrived.
You need to compile/link you firmware at the address it is going to run at, not something packaged up with headers. The base of the image needs the vector table, or you need to copy the table into RAM and point the VTOR register at it. The vector table typically needs to fall on a 512/1024 boundary depending on it's size. If you must burn the header in flash, consider making it a size that matches the boundary conditions.
Thorsten's method works a lot better, because he understands what the processor expects. You'd do well to review it, and the TRM's for the part.
Thanks Pier.
I actually wanted to know about the stack size for the tasks created in firmware, because size of stack for task is what posing a problem in my case,rest of it is okay from the beginning. I mean the total application is working well.
The thing is that I have added much code in the tasks which, as far I could understand, need more stack size. But I couldn't get how much this size should be in these tasks. I can't try just by going on increasing stack size. This was my actual problem. And regarding previous doubts, they're well cleared by Thorsten.
I'd be thankful if you could suggest any method for this stack size.
Hi,
afaik there is no "magic weappon" finding the proper stack size as investigating your code. Our RTX does a stack check, it looks if the magic word it writes to the stack ends has been overwritten.
You know, that in RTX you can set the generic stack size, but you can also create tasks with a user defined RAM area as stack?
A good method would be that you manually fill your RAM with a pattern you can identify, and let your program run for a while. Then stop and read all the memory (you must find the task stacks, that can be a bit more tricky ...). After that you can see how much stack each task needs...
If you have no recursive function calls, it should be possible that you calculate the worst case stack through your function calls.
Thanks again!
I'll try this.