Your test compiled fine for me (though I had to enable 32-bit doubles).
On disk, all my filenames are lower case. I'm guessing that's your issue - C/C++ is case sensitive, and the name of that linkage label is based on the filename, so if your filenames are lower case you can't use a mixed-case name in the code.
Now, given that this is what you sent me, you probably did that - so is yours linking now, or no? Is there a different issue?
I did notice that your main function returns, which you probably don't want, so I changed it to this:
int main()
{
blink();
while(1) {} // do nothing so the main cog doesn't return
}
And your PASM routine should do something similar at the end, like this:
mb_loop
waitcnt #0, #0
jmp #mb_loop
You generally don't want a cog function to just end because it'll try to execute "instructions" after your code, which are data, or other random things that may have bizarre side effects.
I was also able to get the code to compile and run after I set 32 bit doubles in the compiler tab. But I have 2 questions:
1. What is the PASM supposed to do. I used a QuickStart Board, changing the argument of high(26); to high(18); because of the difference in LED locations between the Activity Board and QuickStart Board. But all that it did was turn on the pin 18 led. Was it supposed to do something else?
2. For Jason or anyone else - Where are "use_cog_driver" and "load_cog_driver" defined. I can't find them in the simple libraries or in my copy of propeller.h or cog.h? But since the program compiled ok, they have to be somewhere
I did have a problem with the mixed cases.
I did not know what to do re the 32 bit doubles.
It now compiles OK! Life is Good! I can now use C and port over all my SPIN code using PASM.
The PASM code is just a chunk that I cut out for the purpose of getting something in PASM.
Jason, thanks again!
The C code really should have a structure(having 3 var fields) so that there are 3 values for the PASM to get the addresses for.
The other way to transfer multiple variables is by using an array variable in the C code. I did that with your code by declaring
int data [] = {var_1, var_2, var_3};
&data is the parameter in the load _ cog statement, and the first element is pointed to by par.
I would use that method where the variables are related, such as list of pin numbers.
I modified MByron's project to run on my Quick Start Board. It sends the data array to the PASM and lights the 8 LEDs on the board (pins 6 - 23). Then the C program modifies data array (subtracts bit 17 from the element which is the c_pin value) and the PASM or's the new c_pin value (located at c_pin_adr) with the original a_pin value (element 0 of the data array) and moves that or'ed value to outa which changes the LED pattern.
I haven't tried to make the code pretty, but it does work.
Comments
attached is the .zip file
On disk, all my filenames are lower case. I'm guessing that's your issue - C/C++ is case sensitive, and the name of that linkage label is based on the filename, so if your filenames are lower case you can't use a mixed-case name in the code.
Now, given that this is what you sent me, you probably did that - so is yours linking now, or no? Is there a different issue?
I did notice that your main function returns, which you probably don't want, so I changed it to this:
And your PASM routine should do something similar at the end, like this:
You generally don't want a cog function to just end because it'll try to execute "instructions" after your code, which are data, or other random things that may have bizarre side effects.
1. What is the PASM supposed to do. I used a QuickStart Board, changing the argument of high(26); to high(18); because of the difference in LED locations between the Activity Board and QuickStart Board. But all that it did was turn on the pin 18 led. Was it supposed to do something else?
2. For Jason or anyone else - Where are "use_cog_driver" and "load_cog_driver" defined. I can't find them in the simple libraries or in my copy of propeller.h or cog.h? But since the program compiled ok, they have to be somewhere
Thanks
Tom
C:\Program Files (x86)\SimpleIDE\propeller-gcc\propeller-elf\include\propeller.h
These are the defines for non-XMM compiles:
Thanks.
I had been looking in the propeller.h linked from the Learn pages.
Tom
I did not know what to do re the 32 bit doubles.
It now compiles OK! Life is Good! I can now use C and port over all my SPIN code using PASM.
The PASM code is just a chunk that I cut out for the purpose of getting something in PASM.
Jason, thanks again!
The C code really should have a structure(having 3 var fields) so that there are 3 values for the PASM to get the addresses for.
int data [] = {var_1, var_2, var_3};
&data is the parameter in the load _ cog statement, and the first element is pointed to by par.
I would use that method where the variables are related, such as list of pin numbers.
Tom
I haven't tried to make the code pretty, but it does work.
Tom