#27319 - gb_feedback - Sat Oct 09, 2004 2:24 pm
First a short intro:
I'm using a fairly old version of devkitadv via Visual Studio 6 to develop.
I prefer to use C++ normally as I'm used to it, but also have several working apps for the GBA which use C.
I'm currently writing another pogoshell plug-in / standalone application for displaying GIF files. This is supposed to handle animated GIFs too and is intended to work at a reasonable speed. I'm using a full-screen short excerpt from an animated movie at 12 fps as a sample. Currently it works functionally but is too slow.
So I intended to transfer the speed critical part, to IWRAM as I have so many times before.
However previously I have been using C for this, as in the following example:
In the header file
In the .c file which is compiled for ARM (and interworking):
When calling this from the THUMB (and interworking) compiled module:
And this has always worked fine. Now, for this new project, I have been using C++, so I tried:-
In the header file:
In the .cpp file which is compiled for ARM (and interworking):
When calling this from the THUMB (and interworking) compiled module:
Well, as you've realised by now, it doesn't work - just crashes (goes off and executes at some non-existant address).
I realise I've got a lot of work ahead to sort this out as my understanding of ARM assembly code and GCC are minimal (I've just been using them for the results!). But it would be nice to know before I start if anyone else has moved a C++ class member function into IWRAM and successfully called it, or am I asking the impossible?
Remember, the code worked just before I moved the function into IWRAM...
Any ideas, guys?
_________________
http://www.bookreader.co.uk/
I'm using a fairly old version of devkitadv via Visual Studio 6 to develop.
I prefer to use C++ normally as I'm used to it, but also have several working apps for the GBA which use C.
I'm currently writing another pogoshell plug-in / standalone application for displaying GIF files. This is supposed to handle animated GIFs too and is intended to work at a reasonable speed. I'm using a full-screen short excerpt from an animated movie at 12 fps as a sample. Currently it works functionally but is too slow.
So I intended to transfer the speed critical part, to IWRAM as I have so many times before.
However previously I have been using C for this, as in the following example:
In the header file
Code: |
#define CODE_IN_IWRAM __attribute__ ((section (".iwram"), long_call))
extern void ResetGba(void) CODE_IN_IWRAM; |
In the .c file which is compiled for ARM (and interworking):
Code: |
CODE_IN_IWRAM void ResetGba(void)
{ ... } |
When calling this from the THUMB (and interworking) compiled module:
Code: |
...
ResetGba(); ... |
And this has always worked fine. Now, for this new project, I have been using C++, so I tried:-
In the header file:
Code: |
#define CODE_IN_IWRAM __attribute__ ((section (".iwram"), long_call))
class CGif { ... public: bool GifDecompressImage (GIFINFO* gifInfo) CODE_IN_IWRAM; ... }; |
In the .cpp file which is compiled for ARM (and interworking):
Code: |
CODE_IN_IWRAM bool CGif::GifDecompressImage (GIFINFO* gifInfo)
{ ... } |
When calling this from the THUMB (and interworking) compiled module:
Code: |
... m_gifFunc.GifDecompressImage (&m_gifInfo); ... |
Well, as you've realised by now, it doesn't work - just crashes (goes off and executes at some non-existant address).
I realise I've got a lot of work ahead to sort this out as my understanding of ARM assembly code and GCC are minimal (I've just been using them for the results!). But it would be nice to know before I start if anyone else has moved a C++ class member function into IWRAM and successfully called it, or am I asking the impossible?
Remember, the code worked just before I moved the function into IWRAM...
Any ideas, guys?
_________________
http://www.bookreader.co.uk/