Difference between revisions of "Python development"
m (→Source code) |
m |
||
Line 3: | Line 3: | ||
==Installation== | ==Installation== | ||
Python interpreter and libraries are not installed in the default rootfs. Currently it increases the rootfs size by 6 MBytes and so, without cleanup, '''it won't fit in the Armadeus standard Flash size (8 MBytes)'''.<br> | Python interpreter and libraries are not installed in the default rootfs. Currently it increases the rootfs size by 6 MBytes and so, without cleanup, '''it won't fit in the Armadeus standard Flash size (8 MBytes)'''.<br> | ||
− | So for the moment, you can only use it from a NFS or a MMC/SD rootfs. | + | So for the moment, you can only use it from a NFS or a MMC/SD rootfs.<br> |
+ | '''Python''' version installed by Buildroot is '''2.4'''.<br> | ||
If your are a Python expert you can still delete some files in $ROOTFS/usr/lib/python2.4/... and tell us what isn't mandatory and use a lot of space for nothing. | If your are a Python expert you can still delete some files in $ROOTFS/usr/lib/python2.4/... and tell us what isn't mandatory and use a lot of space for nothing. | ||
* Launch Buildroot's menuconfig: | * Launch Buildroot's menuconfig: | ||
− | armadeus $ make menuconfig | + | armadeus$ make menuconfig |
* In | * In | ||
[[Image:Menuconfig_package.png]] <br> choose <br> [[Image:Menuconfig_package_python.png]] <br> | [[Image:Menuconfig_package.png]] <br> choose <br> [[Image:Menuconfig_package_python.png]] <br> | ||
* then save your configuration and build your system: | * then save your configuration and build your system: | ||
− | $ make | + | armadeus$ make |
* copy generated rootfs to your NFS directory or on your MMC/SD. If you already have an existing rootfs then just make a: | * copy generated rootfs to your NFS directory or on your MMC/SD. If you already have an existing rootfs then just make a: | ||
− | armadeus $ cp -r buildroot/build_arm_nofpu/root/usr/ /local/export/ | + | armadeus$ cp -r buildroot/build_arm_nofpu/root/usr/ /local/export/ |
Here ''/local/export/'' is my NFS directory. | Here ''/local/export/'' is my NFS directory. | ||
Revision as of 10:59, 19 May 2007
On this page you will learn how to create your first Python script for your Armadeus board.
Installation
Python interpreter and libraries are not installed in the default rootfs. Currently it increases the rootfs size by 6 MBytes and so, without cleanup, it won't fit in the Armadeus standard Flash size (8 MBytes).
So for the moment, you can only use it from a NFS or a MMC/SD rootfs.
Python version installed by Buildroot is 2.4.
If your are a Python expert you can still delete some files in $ROOTFS/usr/lib/python2.4/... and tell us what isn't mandatory and use a lot of space for nothing.
- Launch Buildroot's menuconfig:
armadeus$ make menuconfig
- In
- then save your configuration and build your system:
armadeus$ make
- copy generated rootfs to your NFS directory or on your MMC/SD. If you already have an existing rootfs then just make a:
armadeus$ cp -r buildroot/build_arm_nofpu/root/usr/ /local/export/
Here /local/export/ is my NFS directory.
Source code
First take your favorite editor/IDE and create the following script:
import sys print "APF9328 says: Hello World ! ;-)" sys.exit(0)
Save it as hello.py
Compilation
Not needed. Transforming python script in executables hasn't been tested yet.
Running
- Copy your hello.py script on your NFS export directory or on your MMC/SD
- then on your APF console, launch it:
# python hello.py APF9328 says: Hello World ! ;-) #
Now it's up to you ! ;-) But keep in mind that Python is extremly powerfull and libraries rich, so if you don't pay attention to memory usage of your scripts, you can easily reach the APF9328 memory size limit: 16 MBytes.