Created Tue, 21 Jun 2011 13:44:12 +0000 by peddy
Tue, 21 Jun 2011 13:44:12 +0000
Hello,
Please forgive what are probably a bunch of simple questions, but I'm new to the whole Arduino world, and looking for some info to get started.
Is there an overview of how the build process works with the PIC32 C compiler? Specifically, when I write code, it ends up in a .pde file. When I click the "Verify/Compile" button, it's obviously compiling more than what's visible in the editor. Am I correct in assuming the extra code is in the following folder?
...\mpide-0022-chipkit-win-20110530\hardware\pic32\cores\pic32
Also, where does the output end up? I've read through some of the build process documentation for the general Arduino products, but it seems like things might be a bit different for the chipKIT boards?
Thirdly, I've read you can program the chipKIT boards using MPLAB with a PicKIT3. Will this also allow for debugging? Is there any way to debug code running on the chipKIT boards (e.g., breakpoints, stepping, etc).
I still have lots of other questions, but that should be enough to get me going for now.
Thanks for any help
Tue, 21 Jun 2011 14:21:56 +0000
peddy
You are asking very reasonable questions however, this stuff is specifically hidden to make the entire system easy for the beginner. You state your are a beginner so I would recommend ignoring these details to start with. HOWEVER, to answer your questions
The build process in MPIDE is the same as it is for the original Arduino system.
It compiles all of the files in the core/xxx folder, xxx is specified in boards.txt. Normally there is only one and for PIC32, its cores/pic32
it also will compile files from the 2 libraries folders. The 2 locations for libraries is the main one in pic32/libraries, this is where officially supported libraries go. There is a second optional libraries folder in your sketches folder. This is where you are supposed to put any libraries that you download from 3rd parties. The reason behind that is if you download a new version of MPIDE (or Arduino) you wont lose those 3rd party libraries as happened in earlier versions of Arduino.
It copies all files from your sketch folder, the library folders to a temp folder. You can follow this entire process by holding down the SHIFT key and clicking on COMPILE (the button on the far left). Similarly you can hold down the shift button when you click UPLOAD and you will see the entire UPLOAD process. ONE IMPORTANT NOTE... HITTING UPDATE ALSO COMPILES SO YOU DONT NEED TO DO BOTH.
The compile process uses gcc from a command line. What was done different in MPIDE is the code to drive the compiler was totally re-written and is driven by a file called platforms.txt which spells out the entire compile and link process. In Arduino this was hard coded and darn near impossible to change
Mark
Tue, 21 Jun 2011 15:15:54 +0000
Mark,
Thanks for the info. The tip about holding down the shift key during builds/uploads gives me a lot of what I was looking for.
I'm fairly experienced in PIC32 development, but not in the Arduino realm. I think the parts that are supposed to make it easier for beginners are actually making it confusing for me. Trying to figure out how the setup() and loop() functions fit into the underlying compile process is not intuitive to me yet.
So, as someone who has done a lot of PIC32 development in the past, what's the best way to approach this? Is using the MP IDE the way to go? Or can I get more features (debugging??) using MPLAB?
Tue, 21 Jun 2011 17:36:49 +0000
Thanks for the clues!
I've done a lot with the PICs and Hi-Tech C compilers for PIC16 and 18. I don't like stuff being hidden from me either! Where's my HEX file! ;>)
I'd like to edit code and run under the TextPad editor. (need a "loader" program to call.) I'd be VERY happy to run under MPLAB! This IDE doesn't appear to know about OLE! (can't switch back and forth to another editor and have the Arduino IDE know that the file has been changed!)
If you put your startup initialization (one time stuff) in setup(), and then just assume you've got a simple
do {...} while(1);
loop() function written in which to put your code, then it's not all that different. You can still properly prototype all your functions,
#include <Servo.h>
#include <MsTimer2.h>
#include "ASB13_I.h"
/* prototypes */
void setup(void);
void loop(void);
void SetJaws(int mode);
void JawStateMachine(void);
void TestRC_Servo(void);
void TestRC_Servo2(void);
void TestRC_ServoTracking(void);
Use your own .H files. This is ANSI C/C++ (or close), no matter what they call it.
The libraries aren't all functional for the UNO32 as yet, 'tho.
Alan KM6VV P.S. No, this code won't compile yet under UNO32...
P.P.S. Found my Hex file! in C:\Temp\build6658135427479867446.tmp ( also a .CCP and the object files needed to build my project (Arduino UNO build)
Tue, 21 Jun 2011 18:01:19 +0000
KM6VV (good to see a fellow ham here!),
As you mentioned, I have noticed that not all the libraries are available yet.
Maybe this is a topic for another thread, but I'm just trying to create an interrupt handler for an external interrupt. The attachInterrupt() function doesn't seem to do anything. My attempts at using attributes or pragmas to define the ISR haven't worked either, which led me to the question of how everything is compiled.
It seems like there should be a way to do this, but I'm not sure how.
Paul N7DSO
Tue, 21 Jun 2011 18:05:09 +0000
KM6VV (good to see a fellow ham here!),
I'm also here. :)
8-Dale N7PKT
Tue, 21 Jun 2011 18:09:20 +0000
N7PKT.. if your QRZ info is up to date, we're practically neighbors!
Tue, 21 Jun 2011 18:18:09 +0000
N7PKT.. if your QRZ info is up to date, we're practically neighbors!
Everything is current. :)
73 from 8-Dale N7PKT (going back into lurk mode)
Tue, 21 Jun 2011 18:19:39 +0000
Hi Paul!
Good to meet you! Dale I know.
See the example over on Servo Code!
[url]http://www.chipkit.org/forum/viewtopic.php?f=15&t=150&p=590#p590[/url]
I haven't had time to try out the servo code, I have an Arduino UNO running my 'bot code now. After the next "Table Top" Challenge (HBRobotics), I'll see if I can get my code running on the UNO32. No time now.
The answer will be when all the supplied LIBs support the UNO32, and a good sampling (MsTimer, etc) are ported as well. Had I known these weren't supported yet, I probably would have waited.
And I would like to see the dsPIC33FJ128xxx chip supported, so that I can use the built-in dual encoder support.
73's
Alan KM6VV
KM6VV (good to see a fellow ham here!), As you mentioned, I have noticed that not all the libraries are available yet. Maybe this is a topic for another thread, but I'm just trying to create an interrupt handler for an external interrupt. The attachInterrupt() function doesn't seem to do anything. My attempts at using attributes or pragmas to define the ISR haven't worked either, which led me to the question of how everything is compiled. It seems like there should be a way to do this, but I'm not sure how. Paul N7DSO
Tue, 21 Jun 2011 18:40:53 +0000
Good to meet both of you!
Alan,
Thanks for the pointer. I discovered what I was missing. I didn't have the 'extern "C" ' surrounding my ISR code. Once I added that, I no longer see the compiler errors I've been fighting with.
Thanks for the tip! 73s
Tue, 21 Jun 2011 21:56:34 +0000
(can't switch back and forth to another editor and have the Arduino IDE know that the file has been changed!)
Under preferences, there is a USE EXTERNAL EDITOR option, it works perfectly (I refuse to use the Arduino editor)
Tue, 21 Jun 2011 21:59:54 +0000
[quote][If you put your startup initialization (one time stuff) in setup(), and then just assume you've got a simple /quote]
Well for all of you real C programmers out there, "WHERE IS MAIN()"
There really is a main() in Arduino, again, its hidden. This has been there since day one of Arduino, its nothing new. The code is below, you can find this and all the rest of the magic in the core files "hardware/pic32/cores/pic32/"
#include "WProgram.h"
//************************************************************************
int main(void)
{
init();
setup();
while (1)
{
loop();
}
return 0;
}
Tue, 21 Jun 2011 22:01:38 +0000
TO the other Hams
I am KB2ICI, some of you may know me or have heard of me from MacAPRS and WinAPRS
Mark
Tue, 21 Jun 2011 22:04:07 +0000
Use your own .H files. This is ANSI C/C++ (or close), no matter what they call it.
It is C/C++, I have complained to Masimo about this mis-conception, its NOT wired language, its NOT processing language, its C/C++. It runs gcc. The process/wiring flavor to it is just in the libraries.
Mark
Wed, 22 Jun 2011 00:58:52 +0000
In arduino, the details are "hidden", but not in any way "secret" (and picKit Continues the tradition!)
http://arduino.cc/en/Hacking/BuildProcess Describes the normal Arduino build process, and would be a reasonable starting place for understanding the picKit built process (which is going to be very similar.)
Wed, 22 Jun 2011 01:01:45 +0000
[color=#FF0000]EXACTLY![/color]
That's been a sore point for me for a while... Basically taking credit for C. And generally "mangling" other stuff as well! It's a daughter board, or prototype board, or whatever, not a SHIELD! I could go on...
I tried the external edit again. OK, I get it, It grays out the edit window, and as long as one saves in the editor, when requested to compile (that's compile, not verify!) It reloads the file(s) and compiles. Great! Thanks!
Yeah, I remember APRS (DOS). I'm not that far from NPSG (Monterey).
Alan KM6VV
It is C/C++, I have complained to Masimo about this mis-conception, its NOT wired language, its NOT processing language, its C/C++. It runs gcc. The process/wiring flavor to it is just in the libraries. Mark
Wed, 22 Jun 2011 04:56:42 +0000
The process/wiring flavor to it is just in the libraries.
"Wiring" was just C too... Processing is just Java.
I have mixed feelings. On the one hand, I suspect that staying away from "techie language" with known connotations really does help attract a significant part of the target audience. On other other hand, that's really rather sad. (on the third hand, we brought it on ourselves. "You can install WINAVR, which is actually just a mashup of gcc, binutils, avrdude, and a bunch of general purpose unix utilities that help it all work together. You can work either from the Command line or a BASH shell. Isn't that great?! Unless you're on a Mac, in which case (as long as you already have the "Developer tools" installed), you should get AVRMacPack instead. That's because the Mac already has most of the unix tools. You'll have to work from a terminal window, of course. If you have linux, you can just tell the package manager (well, maybe the OTHER package manager" to install avr-gcc and it will automatically suck in the other gigabyte of stuff that you'll need. Except you'll still need AVRDude. Be sure to get the old version because the new versions don't work with the bootloader or hacky hardware." Right.)
Oh yeah, and they should have left all the other technical terms in the original Italian instead of trying to translate to English...
I don't recall ever hearing anyone in the arduino community try to "take credit for C." If you have the background, it only takes an instant to recognize what's going on...
Wed, 22 Jun 2011 05:20:41 +0000
OK, I didn't say that quite right. Not taking credit for C exactly, but calling C/C++ something else, and claiming that?
Seems like "they" should have said "based on processing, which is basically C/C++".
Alan KM6VV
Wed, 22 Jun 2011 07:12:07 +0000
Except that Processing is not C++ at all, it's JAVA. Arduino just borrows the IDE (which is written in JAVA.) Wiring is a set of libraries for C/C++.
So: Arduino is based on Wiring, which is a set of C/C++ libraries, and uses the Processing IDE which is simple enough for the average non-coder.
Wed, 22 Jun 2011 18:04:30 +0000
Got it. I think.
Alan KM6VV ... as long as it's C!
Wed, 22 Jun 2011 21:43:27 +0000
I dunno. I always thought that it was pretty interesting that the C++ subset used (encouraged) by Arduino/Wiring and the Java subset used by Processing looked very similar.