Trouble running a demo in P2 mode
Rayman
Posts: 14,665
Trying the demos out in P2 mode...
Got the "hello" demo running with just these steps:
add -mp2 to build
replace CNT with getcnt()
Change propeller-load argument to a P2 board (DE2-115) in Project Properties
(e.g.: -I C:/propgcc/propeller-load/ -b DE2-115 a.out -r -t -v)
But, running into trouble with the "calc" demo...
In "cmm" mode it compiles and runs but does some pretty bad math:
In "lmm" mode, it won't compile at all...
Here's what my command line looks like:
propeller-elf-gcc.exe -mp2 -m32bit-doubles -Dprintf=__simple_printf -Wall -o a.out -Os -mcmm -I . -fno-exceptions *.c -lm
Here's the kind of errors I'm getting:
Got the "hello" demo running with just these steps:
add -mp2 to build
replace CNT with getcnt()
Change propeller-load argument to a P2 board (DE2-115) in Project Properties
(e.g.: -I C:/propgcc/propeller-load/ -b DE2-115 a.out -r -t -v)
But, running into trouble with the "calc" demo...
In "cmm" mode it compiles and runs but does some pretty bad math:
Enter first number: 23 Enter second number: 23 16.000000 * 16.000000 = 256.000000
In "lmm" mode, it won't compile at all...
Here's what my command line looks like:
propeller-elf-gcc.exe -mp2 -m32bit-doubles -Dprintf=__simple_printf -Wall -o a.out -Os -mcmm -I . -fno-exceptions *.c -lm
Here's the kind of errors I'm getting:
1>Build: 1> c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/p2\libgcc.a(_loadfloat.o): In function `.FCfloatstart': 1> (.text+0x10): undefined reference to `__TMP1' 1> c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/p2\libgcc.a(_loadfloat.o): In function `.FCadd': 1> (.text+0x4c): undefined reference to `__TMP1' 1> c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/p2\libgcc.a(_loadfloat.o): In function `.FCadd':
Comments
Are you using the latest propgcc for p2 release? I'm not sure when that was made; if you are on the latest, then I guess it's time for us to send out another!
Eric
Just tried with the P2 version of calc.c and still get this error...
BTW: Calc used to be in 2 places demos\calc and demos\forumists\jazzed\calc
But now, demos\calc just has a makefile and no .c code...
The current set of demos need to be reviewed and ported where necessary to use a common Propeller API. Some of it may have already been done, but I'm sure there is more work to do.
I would like to see every Propeller demo work on every Propeller family chip. I'd like to help, but I'm buried in other issues.
We might consider a re-org of demos. I chose only a few for the SimpleIDE project.
PS. There was never any .c code in the top level demos/calc folder which was added by David. I only added the one under jazzed.
I guess I'm going to go through the demos as soon as I get something working for XMM on the P2. Our other P2 project participants seem to be unavailable.
Also, one should never include "propeller1.h" or "propeller2.h" directly. The correct one is included when you include "propeller.h" based on the preprocessor symbol __PROPELLER2__.
#ifdef __PROPELLER2__
#define CNT getcnt()
#define INA PINA
#define OUTA PINA
#endif
There's just no way all P2 demos could work on P1, but maybe you can make all P1 demos work on P2...
Won't compile with -mcmm...
These are the kind of warnings:
Thanks for doing this testing. I'll try these myself but I can't until later. I assume you're just using the makefiles in the demo directories?
LOL. Nice point. Do we have P2 specific demos yet?
I'm not sure using the defines mentioned would be correct in all cases. There must be at least one demo that does OUTA ^= (1 << pin). That case could be different in P1/P2 depending on the value actually present on the the pin for P2. P1 keeps a shadow copy of OUTA where P2 does not. We are almost forced to use a function-like API rather than using a register-like variable.
BTW: I get this error message if I try to use make:
The procedure entry point libintl_setlocale could not be located in the dynamic link library libintl-8.dll.
Thanks!
David
For me it looks like the Modulo operator (%) does not work correct in Prop2 mode.
Where can I find the LMM interpreter source code for Prop2? I searched a bit in the p2test branch but it's not obvious for me where it should be.
Thanks
Andy
propgcc/gcc/gcc/config/propeller/crt0_lmm2.s
As David mentioned, the LMM source is in gcc/gcc/config/propeller/. The main source is in crt0_lmm2.s, but the math routines are in kernel.ext (which is shared by CMM, XMM, and LMM). You've found a typo in the prop2 division routines: in __DIVSI_impl the lines: should read Thanks for catching this!
Eric
This typo explains why my decimal output code not works on Prop2.
I hope Ken has noticed that I've found a bug
Andy