Open main menu

Linux and Unix Users Group at Virginia Teck Wiki β

Changes

PIC

2,571 bytes added, 17:45, 18 February 2015
Merged in Uniluug content
'''PIC''' microcontrollers are a relatively popular line of [[w:Reduced_instruction_set_computing|RISC]] line microcontrollers from [[w:Microchip_Technology|MicrochipTechnology]]. Different toolchains are required to build code between the 8-bit, 16-bit, and 32-bit data size lines. They are used in [[gp:ECE 2504 Introduction to Computer Engineering|ECE 2504 Introduction to Computer Engineering]] and [[gp:ECE 4534 Embedded System Design|ECE 4534 Embedded System Design]]. ==Toolchains=====8-Bit===The [[freeware]] [http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en536656 MCC18 toolchain] from Microchip provides libraries and will compile and link for the 8-bit data word chips such as PIC18 devices. MCC18 can be run on Linux using wine. [http://sdcc.sourceforge.net/index.php sdcc] is a [[software libre]] toolchain that supports a [http://sdcc.sourceforge.net/doc/sdccman.html/node122.html number of PIC18 devices]. ===16-Bit===To build a nonfree toolchain for Linux, use the instructions at [http://www.electricrock.co.nz/blog/microchip-c30/]. To build a completely [[software libre]] toolchain for the PIC24 or dsPIC, follow the steps below.<pre>sudo apt-get install build-essential tofrodosmkdir ~/prj/pic30cd ~/prj/pic30wget http://ww1.microchip.com/downloads/en/DeviceDoc/mplabalc30v3_31.tar.gzwget http://ww1.microchip.com/downloads/en/DeviceDoc/mplabc30v3_31.tar.gzwget http://www.electricrock.co.nz/c30/pic30-binutils-v01.tar.bz2wget http://www.electricrock.co.nz/c30/pic30-gcc-v01.tar.bz2tar xf mplabalc30v3_31.tar.gztar xf mplabc30v3_31.tar.gzfind . -type f -exec fromdos {} \;# We don't need to "fix" the search path by adding -nonfree directoriestar xf pic30-binutils-v01.tar.bz2 --exclude=search-path-fix.difftar xf pic30-gcc-v01.tar.bz2 --exclude=search-path-fix.difffor p in pic30-binutils-v01/patches/*; do patch -p0 < $p; donefor p in pic30-gcc-v01/patches/*; do patch -p0 < $p; donecd acmeCFLAGS=-DMCHP_VERSION=v3.31-Debian ./configure --prefix="${HOME}/prj/pic30/build" --target=pic30-coffmakecd ..cd gcc-4.0.2/gcc-4.0.2CFLAGS=-DMCHP_VERSION=v3.31-Debian ./configure --prefix="${HOME}/prj/pic30/build" --target=pic30-coff --enable-languages=cmakecd ../..</pre> ===32-Bit===  ==Programmers==See the [[PICKit 2]] article for programming your hex file natively using <code>pk2cmd</code>. ==Integrated Development Environments==MPLAB is the freeware IDE written by Microchip. Only Windows versions of older versions were made available, although those could be run with wine and with a [[Windows virtual machine]]. The newer MPLAB X is cross-platform [[freeware]]. [http://piklab.sourceforge.net/ Piklab] is a [[software libre]] IDE for PIC microcontrollers.
==Compiling Code==
==External Links==
* [http://hackaday.com/2010/11/03/how-to-program-pics-using-linux/ How-to Program PICs using Linux - Hackaday] (see article and comments)
* [http://gun.io/open/43/libre-pic30-toolchain-bitbake-recipe Bounty on a libre pic30 toolchain BitBake recipe]
 
[[Category:Hardware hacking]]
[[Category:Classwork]]
Anonymous user