Compiling Branch issue_0066_bjones_pic24port

51 views
Skip to first unread message

Markus Gritsch

unread,
Feb 22, 2010, 3:35:21 PM2/22/10
to python-o...@googlegroups.com
Hi,

I would like to run MyMite on a dsPIC33 on this cheap open hardware
board: http://dangerousprototypes.com/2009/12/11/prototype-web-platform/

I checked out the issue_0066_bjones_pic24port branch, opened the
p14p.mcw in MPLAB, but several files seem to be missing in the project
tree:
* main_img.c
* main_nat.c
* pic24_times.c
* pic24_delay.h
* pic24_ports.h

When I try to build the project, I get the following error output:

----------------------------------------------------------------------
Debug build of project `C:\Dokumente und
Einstellungen\Markus\Desktop\pymite\src\platform\pic24\p14p.mcp'
started.
Language tool versions: pic30-as.exe v3.23, pic30-gcc.exe v3.23,
pic30-ld.exe v3.23, pic30-ar.exe v3.23
Preprocessor symbol `__DEBUG' is defined.
Mon Feb 22 21:33:34 2010
----------------------------------------------------------------------
Executing: make -C
/cygdrive/c/Users/bjones/Documents/svns/python-on-a-chip_pic24/src/platform/pic24
bytecode
Could not spawn language tool. Check command-line options. (2)
Make: The target "C:\Dokumente und
Einstellungen\Markus\Desktop\pymite\src\platform\pic24\main.o" is out
of date.
Executing: "C:\Programme\Microchip\MPLAB C30\bin\pic30-gcc.exe"
-mcpu=24HJ64GP502 -x c -c "main.c" -o"main.o" -I"." -I"..\..\vm"
-I"include" -D__DEBUG -Wall -D__DEBUG__ -DSIM -O1
Error: File "C:\Dokumente und
Einstellungen\Markus\Desktop\pymite\src\platform\pic24\main_img.c" not
found.
Error: File "C:\Dokumente und
Einstellungen\Markus\Desktop\pymite\src\platform\pic24\main_nat.c" not
found.
Make: The target "C:\Dokumente und
Einstellungen\Markus\Desktop\pymite\src\platform\pic24\plat.o" is out
of date.
Executing: "C:\Programme\Microchip\MPLAB C30\bin\pic30-gcc.exe"
-mcpu=24HJ64GP502 -x c -c "plat.c" -o"plat.o" -I"." -I"..\..\vm"
-I"include" -D__DEBUG -Wall -D__DEBUG__ -DSIM -O1
In file included from plat.c:26:
./include/pic24_all.h:60:28: error: pic24_unittest.h: No such file or directory
./include/pic24_all.h:62:25: error: pic24_delay.h: No such file or directory
./include/pic24_all.h:63:25: error: pic24_ports.h: No such file or directory
In file included from ./include/pic24_all.h:67,
from plat.c:26:
./include/pic24_serial.h:91:2: error: #error Invalid choice of DEFAULT_UART
In file included from ./include/pic24_all.h:68,
from plat.c:26:
./include/pic24_util.h:829:2: warning: #warning
***********************************************
./include/pic24_util.h:830:2: warning: #warning * SIMULATION MODE - DO
NOT RUN ON A REAL PIC! *
./include/pic24_util.h:831:2: warning: #warning
***********************************************
In file included from plat.c:26:
./include/pic24_all.h:71:25: error: pic24_timer.h: No such file or directory
./include/pic24_all.h:72:23: error: pic24_i2c.h: No such file or directory
./include/pic24_all.h:73:23: error: pic24_spi.h: No such file or directory
./include/pic24_all.h:74:23: error: pic24_adc.h: No such file or directory
./include/pic24_all.h:75:23: error: pic24_dma.h: No such file or directory
./include/pic24_all.h:76:24: error: pic24_ecan.h: No such file or directory
./include/pic24_all.h:77:25: error: pic24_flash.h: No such file or directory
./include/pic24_all.h:78:30: error: pic24_comparator.h: No such file
or directory
plat.c: In function 'configTimer2':
plat.c:46: error: 'T2_OFF' undeclared (first use in this function)
plat.c:46: error: (Each undeclared identifier is reported only once
plat.c:46: error: for each function it appears in.)
plat.c:46: error: 'T2_IDLE_CON' undeclared (first use in this function)
plat.c:47: error: 'T2_GATE_OFF' undeclared (first use in this function)
plat.c:48: error: 'T2_32BIT_MODE_OFF' undeclared (first use in this function)
plat.c:49: error: 'T2_SOURCE_INT' undeclared (first use in this function)
plat.c:49: error: 'T2_PS_1_1' undeclared (first use in this function)
plat.c:51: warning: implicit declaration of function 'msToU16Ticks'
plat.c:51: warning: implicit declaration of function 'getTimerPrescale'
plat.c: In function 'plat_getByte':
plat.c:123: warning: implicit declaration of function 'isCharReady1'
plat.c: In function 'plat_putByte':
plat.c:144: warning: implicit declaration of function 'outChar1'
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `C:\Dokumente und
Einstellungen\Markus\Desktop\pymite\src\platform\pic24\p14p.mcp'
failed.
Language tool versions: pic30-as.exe v3.23, pic30-gcc.exe v3.23,
pic30-ld.exe v3.23, pic30-ar.exe v3.23
Preprocessor symbol `__DEBUG' is defined.
Mon Feb 22 21:33:36 2010
----------------------------------------------------------------------
BUILD FAILED

Kind regards,
Markus

Bryan A. Jones

unread,
Feb 22, 2010, 5:32:25 PM2/22/10
to python-o...@googlegroups.com
Markus,

Thanks for taking a look! A couple of fixes:
- I checked in a number of missing files.
- You need to install the Cywin environment to generate the main_img.c and main_nat.c files from Python code. Then, put the path to its binaries (usually c:\cygwin\bin) in the Windows path, so that MPLAB can see it. Look at the README file in the pic24 directory for more info.

Hope that helps!

Bryan


--
You are subscribed to the "python-on-a-chip"  (or p14p for short) Google Group.
Site: http://groups.google.com/group/python-on-a-chip



--
Bryan A. Jones, Ph.D.
Assistant Professor
Department of Electrical and Computer Engineering
231 Simrall / PO Box 9571
Mississippi State University
Mississippi state, MS 39762
http://www.ece.msstate.edu/~bjones
bjones AT ece DOT msstate DOT edu
voice 662-325-3149
fax 662-325-9438

Our Master, Jesus Christ, is on his way. He'll show up right on
time, his arrival guaranteed by the Blessed and Undisputed Ruler,
High King, High God.
- 1 Tim. 6:14b-15 (The Message)

Markus Gritsch

unread,
Feb 23, 2010, 4:58:40 AM2/23/10
to python-o...@googlegroups.com
Thank you for the reply,

after svn updating I got the following error:

mgroovy:/cygdrive/c/Users/mgr/Desktop/PyMite/issue_0066/src/platform/pic24$
make
pic30-gcc.exe -mcpu=24HJ64GP502 -Wall -O1
-Wdeclaration-after-statement -I../../vm -D__PIC24HJ64GP502__
-Ic:/Users/mgr/Desktop/PyMite/issue_0066/src/platform/pic24
-Ic:/Users/mgr/Desktop/PyMite/issue_0066/src/platform/pic24/include
-c -o main.o main.c
pic30-gcc.exe -mcpu=24HJ64GP502 -Wall -O1
-Wdeclaration-after-statement -I../../vm -D__PIC24HJ64GP502__
-Ic:/Users/mgr/Desktop/PyMite/issue_0066/src/platform/pic24
-Ic:/Users/mgr/Desktop/PyMite/issue_0066/src/platform/pic24/include
-c -o plat.o plat.c
../../tools/pmImgCreator.py -c -u -o main_img.c --native-file=main_nat.c main.py
Traceback (most recent call last):
File "../../tools/pmImgCreator.py", line 934, in <module>
main()
File "../../tools/pmImgCreator.py", line 928, in main
pic.convert_files()
File "../../tools/pmImgCreator.py", line 317, in convert_files
co = compile(open(fn).read(), fn, 'exec')
File "main.py", line 22
def init():
^
SyntaxError: invalid syntax
make: *** [main_nat.c] Error 1


This was caused by inconsistent line-ending characters in main.py. I
manually converted them to be all LF and now it compiles. Some other
files I looked at (e.g. Makefile, README) also have inconsistent line
ending characters, so maybe this should be fixed for all files in the
tree.

I will report back when I receive my ordered Web Platform board if I
got it working on the silicon :)

One question: RAM usage of 7.7 kB is quite high. Not much left on a
device with 8 kB. What takes up all this space, and would it be
possible to make some of this date const so that it gets placed in the
auto_psv area?

A final remark: In the README file you mention "Bully Bootloader".
From the website it seems not being updated for quite some time. The
Web Platform uses "ds30 Loader" which is actively being developed:
http://mrmackey.no-ip.org/elektronik/ds30loader/

Kind regards,
Markus

Dean Hall

unread,
Feb 23, 2010, 9:13:43 AM2/23/10
to python-o...@googlegroups.com
Markus,

It's great to see someone trying the new PIC port. Thanks for helping
out and providing feedback.

Usually the biggest RAM consumer is the number of libraries and
functions that are included. Look through the standard libraries and
platform libraries and remove the ones from the build that you don't
need.

!!Dean

Bryan A. Jones

unread,
Feb 23, 2010, 3:29:19 PM2/23/10
to python-o...@googlegroups.com
Markus,

Thanks for taking a look and pointing out these problems! I've converted all line endings and committed.

Re: RAM usage, note that I allocate all of RAM for use with Python -- there's really 4130 bytes available of 7000 used for the Python heap. There's no easy way I'm aware of to make this data constant for storage in flash; Dean knows better than I.

On the bootloader, thanks for taking a look. I'm a co-author and update it regularly. However, I've obviously forgotten to update the web page cited with the latest features. I'll do that. One nice thing about this bootloader is the ability to use it both as a simple terminal program to communicate with the PIC and as a bootloader, rather than switching between two applications.

If you would, check out the latest build and let me know if it works (you should be able to run it on the MPLAB simulator). Thanks again for the feedback!

Bryan


Kind regards,
Markus

--
You are subscribed to the "python-on-a-chip"  (or p14p for short) Google Group.
Site: http://groups.google.com/group/python-on-a-chip



--
Bryan A. Jones, Ph.D.
Assistant Professor
Department of Electrical and Computer Engineering
231 Simrall / PO Box 9571
Mississippi State University
Mississippi state, MS 39762
http://www.ece.msstate.edu/~bjones
bjones AT ece DOT msstate DOT edu
voice 662-325-3149
fax 662-325-2298

Markus Gritsch

unread,
Feb 23, 2010, 3:50:25 PM2/23/10
to python-o...@googlegroups.com
On Tue, Feb 23, 2010 at 9:29 PM, Bryan A. Jones <bjo...@ece.msstate.edu> wrote:
> Markus,
>
> Thanks for taking a look and pointing out these problems! I've converted all
> line endings and committed.

Still inconsistent line endings:

mgroovy:/cygdrive/c/Users/mgr/Desktop/PyMite/issue_0066/src/platform/pic24$ make


../../tools/pmImgCreator.py -c -u -o main_img.c --native-file=main_nat.c main.py
Traceback (most recent call last):
File "../../tools/pmImgCreator.py", line 934, in <module>
main()
File "../../tools/pmImgCreator.py", line 928, in main
pic.convert_files()
File "../../tools/pmImgCreator.py", line 317, in convert_files
co = compile(open(fn).read(), fn, 'exec')

File "main.py", line 104

^
SyntaxError: invalid syntax
make: *** [main_nat.c] Error 1

> On the bootloader, thanks for taking a look. I'm a co-author and update it
> regularly. However, I've obviously forgotten to update the web page cited
> with the latest features. I'll do that. One nice thing about this bootloader
> is the ability to use it both as a simple terminal program to communicate
> with the PIC and as a bootloader, rather than switching between two
> applications.

I see. I agree that one rather uses the own software :) Just for
completeness: ds30 Loader also has an integrated terminal. Activating
'Advanced mode' in the 'View' menu displays some additional tabs, one
of them being the 'Terminal'.

Kind regards,
Markus

Bryan A. Jones

unread,
Feb 23, 2010, 3:54:24 PM2/23/10
to python-o...@googlegroups.com
Markus,

Oops -- fixed. Thanks for pointing out the ds30 Loader features; I'll have to take a look!

Bryan


Kind regards,
Markus

--
You are subscribed to the "python-on-a-chip"  (or p14p for short) Google Group.
Site: http://groups.google.com/group/python-on-a-chip

Markus Gritsch

unread,
Feb 23, 2010, 3:59:33 PM2/23/10
to python-o...@googlegroups.com
On Tue, Feb 23, 2010 at 9:29 PM, Bryan A. Jones <bjo...@ece.msstate.edu> wrote:
>
> If you would, check out the latest build and let me know if it works (you
> should be able to run it on the MPLAB simulator). Thanks again for the
> feedback!

Now it compiles out of the box :) The MPLAB simulator shows the
following output in the SIM Uart1 tab:


Reset cause: Power-on.
**** SIMULATION MODE: cannot read device and revision ID ****
Fast RC Osc

plat.c, built on Feb 23 2010 at 21:42:01
Python initialized.
Welcome to PIC24 Python! Free space: (4130, 7000)
Starting interactive mode.


Is it also possible to send characters to the simulated UART?

Kind regards,
Markus

Bryan A. Jones

unread,
Feb 23, 2010, 4:05:55 PM2/23/10
to python-o...@googlegroups.com
Markus,

I'm glad it's working for you! Yes, it is. From the MPLAB IDE, Under Help | Topics | Debuggers | MPLAB SIM, see the Getting Started with MPLAB SIM | Using a USART/UART for more info. IMHO, I think it's easier to either edit main.py then recompile to see results, or run it on a real PIC to test.

Bryan


Kind regards,
Markus

--
You are subscribed to the "python-on-a-chip"  (or p14p for short) Google Group.
Site: http://groups.google.com/group/python-on-a-chip

Ralph Green

unread,
Feb 23, 2010, 5:47:13 PM2/23/10
to python-o...@googlegroups.com
Howdy Markus,
That looks like a real nice platform for PyMite. I have been wanting
a Bus Pirate, anyway. I'll try to order one of these after the first of
the month and I'll join you on this port, if you don't mind.
Good day,
Ralph

Markus Gritsch

unread,
Feb 25, 2010, 8:51:26 AM2/25/10
to python-o...@googlegroups.com
On Tue, Feb 23, 2010 at 9:29 PM, Bryan A. Jones <bjo...@ece.msstate.edu> wrote:
>
> I've converted all line endings and committed.

main.py uses both, spaces and tabs for indentation, which should of
course be avoided. Your editor seems to use a tab as 4 spaces, which
gives bad indentation in my editor which assumes one tab being 8
spaces.

All tab indentation should be converted to 4 spaces.

Kind regards,
Markus

Bryan A. Jones

unread,
Feb 25, 2010, 11:15:52 AM2/25/10
to python-o...@googlegroups.com
Markus,

Thanks -- good point. Fixed now!

Bryan


Kind regards,
Markus

--
You are subscribed to the "python-on-a-chip"  (or p14p for short) Google Group.
Site: http://groups.google.com/group/python-on-a-chip

Markus Gritsch

unread,
Mar 12, 2010, 8:07:09 AM3/12/10
to python-o...@googlegroups.com
Bryan,

the source files in your branch contain mixed line ending characters.
The majority is using LF, but I assume the lines inserted with MPLAB
end in CR + LF. Maybe you can run a script before checking in, which
converts all line endings so LF. (We already resolved this issue for
main.py.)

Kind regards,
Markus

Bryan A. Jones

unread,
Mar 12, 2010, 9:52:33 AM3/12/10
to python-o...@googlegroups.com
Markus,

Good point -- I'll write the script and try to run it before each commit.


Kind regards,
Markus

--
You are subscribed to the "python-on-a-chip"  (or p14p for short) Google Group.
Site: http://groups.google.com/group/python-on-a-chip

Bryan A. Jones

unread,
Mar 23, 2010, 4:36:10 PM3/23/10
to python-o...@googlegroups.com
Markus,

I'm back and trying to catch up with e-mail. I've written a batch file to automate this, which is now checked in.

Bryan


Kind regards,
Markus

--
You are subscribed to the "python-on-a-chip"  (or p14p for short) Google Group.
Site: http://groups.google.com/group/python-on-a-chip

Markus Gritsch

unread,
Mar 23, 2010, 4:50:37 PM3/23/10
to python-o...@googlegroups.com
Fine. Nice to hear from you again.

Looking forward to any advice or insight concerning the Web Platform
UART communication issue.

Markus

Bryan A. Jones

unread,
Mar 24, 2010, 5:56:31 PM3/24/10
to python-o...@googlegroups.com
Markus,

I've reproduced it on my PIC here, so it shouldn't be hard for me to fix. I'll let you know when I've got it working!

Bryan

--
You are subscribed to the "python-on-a-chip"  (or p14p for short) Google Group.
Site: http://groups.google.com/group/python-on-a-chip

To unsubscribe from this group, send email to python-on-a-chip+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Reply all
Reply to author
Forward
0 new messages