ZeroPain in DWCDriver
Jon Abbott (1421) 2651 posts |
DWCDriver appears to be making assumptions about where the stack is and triggers a Zero Pain error when an single tasking app changes it to point to application space. Although it mentions FTPc, I was testing a game at the time it was triggered.
|
Colin (478) 2433 posts |
FTPc also switches the stack to application space between wimp polls when transferring data so the above could be from FTPc. The fact that DWCDriver caught the problem implies to me a socket call problem. Sockets transfer data via etherusb to the USBDriver. Did you have FTPc running before running your task. If so was it doing anything? Is the zeropain output repeatable? I knew I shouldn’t have woke FTPc up. |
Jon Abbott (1421) 2651 posts |
FTPc was sitting idle in the background, I hadn’t made any connections. I don’t believe a Module should be making assumptions about the stack location, hence why I posted this in a separate thread.
Not sure what you mean, is there more logging that what I posted above? |
Jeffrey Lee (213) 6048 posts |
All C modules assume that the SVC stack (and IRQ stack?) have their base on a 1MB boundary. It’s due to the nasty way in which they need to set up the C relocation offsets at the base of the stack. I don’t like it, but I don’t think it’s something that we can change without breaking compatibility with all existing C modules. |
Jon Abbott (1421) 2651 posts |
Nasty. Who decided C Modules were a good idea with that restriction? (Don’t answer that one!!) Will have to put my thinking hat on, as that’s a bit of a showstopper with the amount of C Modules appearing in RO these days. |
Colin (478) 2433 posts |
Jon.
|
Jon Abbott (1421) 2651 posts |
@Colin – possibly, I’ll need to figure out which game triggered it. Elite, Wolfenstein 3D, Lemmings 2, Diggers, Populous, James Pond II, DarkWood to name a few I was testing at the time. |
Jon Abbott (1421) 2651 posts |
Could OS_DynamicArea 0 be extended to allow DA’s to be created on a 1MB boundary? I can’t think of any other legal method to allocate stack space to comply with CLib’s restrictions. |
Jeffrey Lee (213) 6048 posts |
Yeah, I guess that would make sense. Maybe it’s also time we expose OS_Heap 7 via OS_Module so that you can allocated aligned blocks from the RMA (technically you could call OS_Heap 7 on the RMA manually, but then you’d also have to deal with manually growing the RMA to the right size if the call fails, so it’s better to just let the OS do it) |
Jon Abbott (1421) 2651 posts |
Exposing OS_Heap 7 via OS_Module won’t help with this particular quirk of C Modules, but I suppose there may be a case for it at some point, cache alignment perhaps. Just be mindful of PRM1-207 when updating documentation to match:
|
Jeffrey Lee (213) 6048 posts |
You can request a block with 1MB alignment. But I guess in terms of RAM usage it would be much better to create a dynamic area – if the RMA was used (especially if you wanted multiple stacks) you’d end up with a big block of free space which may never get filled. |
Jon Abbott (1421) 2651 posts |
I don’t touch the RMA for stack space, they’re created as DA’s to trap over/underruns. Following your thinking though, I could create them as 2MB DA’s and only use the 4kb that’s 1MB aligned. |