combining XC and C++
-
- Active Member
- Posts: 39
- Joined: Mon Jul 29, 2013 4:41 pm
This one is happening to me! I'm going to start a new thread, but in my case I'm calling into assembly from C. It only happens when you have >1 thread. Not sure what to do about it. The #pragma fix doesn't seem to work.
-
- Active Member
- Posts: 59
- Joined: Thu May 05, 2011 10:00 pm
- Location: Budapest
Hi TjBordelon,
in asm you have to define functionname.nstackwords and maxthreads
linker directive. Better to see in document. Page 5, paragraph 5.3 Resource usage
http://www.xmos.com/download/public/Ass ... I(1.0).pdf
in asm you have to define functionname.nstackwords and maxthreads
linker directive. Better to see in document. Page 5, paragraph 5.3 Resource usage
http://www.xmos.com/download/public/Ass ... I(1.0).pdf
-
- Active Member
- Posts: 59
- Joined: Thu May 05, 2011 10:00 pm
- Location: Budapest
Hi ,
Iam just wondering, if is it any runtime check for the calling stack size?
I mean, ok we could specify / override the size with the #pragma stackwords n.
But this number may less than the real requirements.
Iam just wondering, if is it any runtime check for the calling stack size?
I mean, ok we could specify / override the size with the #pragma stackwords n.
But this number may less than the real requirements.
-
- Respected Member
- Posts: 507
- Joined: Wed Apr 25, 2012 8:52 pm
I have followed yzoer's example and made a global.h
I have a cpp file with code, and a .h file something(?) like this. I am only making some empty code, to try to get som grasp of it, so most is removed from the RadioHead code:
This .h file is not included in my .xc file (it contains C++ syntax, so I guess it shouldn't). Now I am referring this in the .xc file tile this:
But I constantly get errors, no matter how much I tweak it:
Have I supplied enough code (and is the .h file correct)?
I guess the question is as simple as how do I specify a pointer to a class from xc? And later, to an instantiated object? Or are there other ways? I haven't found this documented(!?)
PS. I am trying to port some code for a radio board, see Porting to XMOS / XC - disclaimer: no money, no gifts, no ads, just fun and expenses
I have a cpp file with code, and a .h file something(?) like this. I am only making some empty code, to try to get som grasp of it, so most is removed from the RadioHead code:
Code: Select all
class RHGenericSPI;
class RHSPIDriver : public RHGenericDriver
{
public:
RHSPIDriver(uint8_t slaveSelectPin, RHGenericSPI& spi);
bool init();
void spiUsingInterrupt(uint8_t interruptNumber);
};
class RH_RF69 : public RHSPIDriver
{
public:
RH_RF69(uint8_t slaveSelectPin, uint8_t interruptPin, RHGenericSPI& spi);
// ...
};
Code: Select all
EXTERNAL void RHGenericSPI();
EXTERNAL void RH_RF69 (uint8_t slaveSelectPin, uint8_t interruptPin, RHGenericSPI& spi); // Maybe REFERENCE_PARAM(type,value) in last param here?
Code: Select all
../src/__arduino_on_xmos_test.xc:34:70: error: parse error before "RHGenericSPI"
EXTERNAL void RH_RF69 (uint8_t slaveSelectPin, uint8_t interruptPin, RHGenericSPI& spi); // Maybe REFERENCE_PARAM(type,value) in last param here?
^
I guess the question is as simple as how do I specify a pointer to a class from xc? And later, to an instantiated object? Or are there other ways? I haven't found this documented(!?)
PS. I am trying to port some code for a radio board, see Porting to XMOS / XC - disclaimer: no money, no gifts, no ads, just fun and expenses
--
Øyvind Teig
Trondheim (Norway)
https://www.teigfam.net/oyvind/home/
Øyvind Teig
Trondheim (Norway)
https://www.teigfam.net/oyvind/home/