PyMite Compilation errors

10 Jan 2010

Hi, I am trying to compile PyMite using the instructions in the cookbook (http://mbed.org/projects/cookbook/wiki/PyMite), but I am getting several errors in the compilation of core_cm3.h.  I have taken a screen shot:

http://redmine.ausparc.com/pymite-errors.png

I have been chatting with the developer of PyMite and he believes it is related to the fact that I have a newer mbed than it was developed on.  Normally I would go right into the pymite code to find the problem but it seems what ever is happening is causing the fault to appear in the mbed library's compilation.

I would appreciate any insight anyone might have on the issue.

 

Thanks,

10 Jan 2010 . Edited: 10 Jan 2010

I got the same symptom. It looks like header files clash between mbed and pymite.

I was able to fix the compilation by moving #include "mbed.h" line before #inlude "pm.h" line in plat.cpp and main_nat.c files.

However it did not make it run successfully. I'm getting error lights and ipm prints the same error code 0xEC for any command I try. I'm using LPC1768 and I don't have an LCD connected. Time to read PyMite docs. 0xEC code corresponds to PM_RET_EX_SYS, which is quite generic - it is thrown from 19 places in the imported code (22 places in pymite-08, 21 in code from SVN). Tough to narrow that down.

10 Jan 2010

Well, I'm in the same place now also, I am going to take this new information back to the python-on-a-chip Google group.

11 Jan 2010

Strange, in doing essentially the same thing described by Ilya I, I get a port that appears to work.  I'm using the current version from SVN (r404), no other changes, make zip, upload, move #include "mbed.h" up in both files, compile, download, load on mbed w/ LPC1768.

I'm running Mac OS X 10.6.2.

 

11 Jan 2010

James, when you say it "appears to work" can you describe?  ipm is working for you?  Also, would you please send the resulting binary to me.  I will put it in the PyMite cookbook as a prebuilt binary as a stopgap so people can get past this hurdle and start fiddling.

!!Dean

11 Jan 2010

Sorry, more details probably would have been helpful.  I am able to get ipm up and running.  I didn't try anything too extensive, but assigning and printing a few numbers (including floating point) and then I tried importing the mbed module and getting a few values from ADC.  I didn't get any errors.

I'll be curious to know whether my image is different, or if there's something behaving differently on the platforms others are using (either bundling the zip or using ipm).

PyMite mbed LPC1768

11 Jan 2010 . Edited: 11 Jan 2010

Well, I tried the binary you posted here and it seemed to work, but once I started using ipm.py I started getting errors, but one major difference is that I am NOT getting the scrolling lights of death on the mbed like I was before, i think this could be contributed to the fact that this was perhaps compiled for a slightly different version. I have a

mbed NXP LPC1768 board

Which I assumed was exactly like yours, but I am not sure.

Here is the output of my session:

 

C:\Users\william\Downloads\pymite-08\src\tools>python ipm.py -s COM5

PyMite is Copyright 2002 Dean Hall.  See LICENSE for details.

This software is licensed under the GNU GPL Version 2 with NO WARRANTY.

Type the Python code that you want to run on the target device.

If you see no prompt, type two consecutive returns to exit multiline mode.

Type Ctrl+C to interrupt and Ctrl+D to quit (or Ctrl+Z <enter> on Win32).

ipm> import mbed

Error:     0xE6

Release: 0x08

FileId:  0x00

LineNum: 0

Traceback (top first):

ipm>

ipm> import mbed

Connection read error, type Ctrl+Z to quit.

ipm> ^V

^Z

 

SyntaxError:invalid syntax (<ipm>, line 1)

ipm>

ipm> ^Z

11 Jan 2010

Ok, so I have made some progress, I checked out a fresh copy of PyMite r404 ON MY MAC and did make zip and imported the zip into the online compiler.  Then I moved the #include "mbed.h" above in both files and it compiled like normal.  I put this binary on my mbed and pymite IS working, sort of.  I can do many things like digitalIO, int/string/float manipulation, import mbed, etc...  But I have run into some things that cause errors and errors lights on the mbed.  For one thing the set_led function doesn't work. EDIT: I figured out you have to do mbed.set_led, which makes sense but the examples on the cook book are wrong/misleading.

 

So That means it is working!  Now, the question is why on a Mac and not windows...

11 Jan 2010

William, based on your line from above:

C:\Users\william\Downloads\pymite-08\src\tools>python ipm.py -s COM5

that looks like a standard windows terminal.  Is that correct?  If so, you might try using Cygwin.  The Cygwin install might need its own CPython and PySerial installs.

11 Jan 2010

It sounds like you have the same hardware as I have for an mbed.  I have not tried things on Windows before, but I could give it a shot in a VM.  I wonder if PySerial behaves somewhat differently on windows when used through Cygwin vs "native".  Perhaps it uses the POSIX interface in one case and the native windows APIs for the other and there's some difference in behavior between the two with the same Python code?

I wouldn't be entirely surprised given William's post over on the p14p group had more of a traceback listed previously. Perhaps timeouts or something else are behaving differently?  One thing that may also be interesting to check is resetting the mbed after bringing up the ipm (but before any commands are issued), and see if that makes a difference?

I'll experiment if I get some time to set things up in a Windows VM.

11 Jan 2010

I have tried this in cygwin and in the windows terminal using their respective python's and pyserials.... I have used pyserial on both windows and unix quite alot and I couldn't think of any reason that they would behave differently...  I will also continue to look into why this is happening, Thanks for all y'alls help.

11 Jan 2010

I tried grabbing the latest p14p SVN on a 32-bit WinXP VM, which has a Python 2.5.2 install w/ PySerial (no cygwin), using the same .bin as posted. This also seems to work for me (printing numbers, turning off/on the built-in leds).  PySerial (serial.VERSION) is 2.5-rc2.

Hmm..  perhaps it might be related to the version of Python, PySerial, or Windows?  Also is your Windows install 32 or 64-bit?

11 Jan 2010

It must, I am using python 2.6 on windows 7 and cywing's python 2.5.2 on windows 7 all 32bit.  And it doesn't work. But it works just fine from my laptop, I am beginning to agree that this must have something to do with the versions of python and pyserial on windows.

20 Jan 2010

Good news, bad news.  Bad news first: I was unable to recreate this issue with the '1768.  Good news: it works for me on a 32-bit WinXP system.  Details over on the p14p maillist.

!!Dean