Compile with PC version of GCC?
Rayman
Posts: 14,826
I think I remember being able to compile Catalina C code using a PC target compiler
(don't remember if it was gcc or Visual Studio...)
This seemed to be a nice way to test and debug code on the PC before trying on Propeller...
I think Ross did this by using a lot of ifdefs...
Does this type of thing work with PropGCC too?
Is there an easy way to compile the code in Visual Studio with PC target?
(don't remember if it was gcc or Visual Studio...)
This seemed to be a nice way to test and debug code on the PC before trying on Propeller...
I think Ross did this by using a lot of ifdefs...
Does this type of thing work with PropGCC too?
Is there an easy way to compile the code in Visual Studio with PC target?
Comments
#ifdef __PROPELLER__
// propeller specific code
#else
// other specific code
#endif
Only the compiler needs to change for use with tools.
There are several IDE alternatives that you might like. Geany is one which I've used - it is very nice, small, and is easy to configure.
From my brief investigations though, off-the-shelf Visual Studio doesn't seem to offer easy non-microsoft tool settings. There is a makefile build, but that probably uses nmake.
Isn't there an SDK for Visual Studio for customizing things? I've seen some recent migration of Atmel or Microchip (?) tools to Visual Studio.
http://forums.parallax.com/showthread.php?141940-Using-Visual-Studio-as-GCC-project-editor-%28-%29
I'm wondering if I can change the compiler and compile the exact same code so that it runs on a PC...
For standard C or C++, it seems like it could be made to work.
I think it's helpful for debugging...
You will have to use #ifdefs to support any propeller specific code on the PC -- obviously it's pretty hard to start a COG on the PC, and toggling LEDs is done in a very different way :-).
I think this is very useful for figuring things out. I'll be glad if it works a little Visual Studio... Maybe I could use Code::Blocks for this too...
MinGW is the windows GCC package. So that's easy enough.
Exactly the same code would be #ifdef'd as mentioned before.
Is there a way to specify another compiler in vanilla Visual Studio?
A batch file would work, but you need to use a %PREFIX% variable for the compiler and tools.
The MinGW equivalent of "propeller-elf-gcc" is just "gcc" ...
"avr-gcc", "avr32-gcc", "pic32-gcc" or "arm-gcc" could be used too ....
Ya, Code::Blocks is definitely much better suited to open source than Visual Studio.
MinGW is not installed with SimpleIDE.
I've definitely thought about adding support for it, but i have other things to do at the moment.
Atmel uses Visual Studio, Microchip uses NetBeans.
I'd gladly pay $200 for a Visual Studio Propeller plugin...
First, I had to disable use of precompiled headers in the project settings:
Second, I had to change unistd.h to Windows.h like this:
Then, had to change sleep to Sleep like this:
It then compiles and runs in a DOS window in full Debug mode with any breakpoints you want:
Since Visual Studio Express is a free download, this may offer people a way to test out and debug GCC code...
I see nothing wrong with using Visual Studio.