Skip to content

rswarbrick/picasm

Repository files navigation

Thanks for trying out PICasm, a little development environment for
writing PIC assembler programs. This is the first release, so there
are probably bugs. Feel free to contact me if you find any.

Features:

* Syntax highlighting
* Indentation
* 'Electric' comment key
* Automatically look up information for a chip at Microchip's website.
* Assembler/Linker support for GNU gputils and Microchip's MPASM (via WINE)
* Programmer support for the pk2cmd program
* Delay loop calculation and code generation

I didn't implement a "Project" system like MPLAB and piklab have; if
you want that there are several project management systems for emacs
that you can add.

I plan to add simulation/debugging support via GPSIM at some point in
the future.

Installation
------------

I don't have much in the way of automated installation; here's a list
of things you'll want to do in no particular order:

* Drop all of the .el files somewhere emacs can find them. 

* Byte-compile all of the .el files if you want.

* Make sure you have either GNU gputils or MPLAB+WINE installed.
  GNU gputils is better supported, so use that if you have a choice.

* Add "(require 'picasm)" to your .emacs, and start Emacs. If you
  won't be writing PIC assembler all the time, another option is to
  use auto-loading. Try adding this to your .emacs instead:
    (autoload 'picasm-mode "picasm"
      "Mode for editing PIC assembly files." t)

* Visit the customization options: "M-x customize-group RET picasm"
  and "M-x customize-group RET picasm-external" to set paths and other
  options.

If you've done all of those things, you should be able to edit files
now. If you use the ".asm" extension for your PIC assembler files (and
only PIC; if you write assembler for other chips this will break
regular assembler-mode), you can change the auto-mode-alist entry for
.asm like this:

(add-to-list 'auto-mode-alist '("\\.asm$" . picasm-mode))

If the file you're editing contains a line like #include
<pSOMETHING.inc>, PICasm will assume that you're using a chip called
PICSOMETHING. Otherwise, it will ask you for the name of the chip
you're writing for when you open or create a file. Don't worry about
case. Once PICasm knows what chip you are using, M-x
picasm-describe-chip will be able to pull up information about it,
automatically downloaded (and cached) from Microchip's website.

If this doesn't work for some reason, the format of their website has
probably changed (unfortunately, the only way to get this information
is by screen scraping). If so, some of the code in picasm-db.el
probably needs to be changed.

Things to Try
-------------
Of course, the first order of business is indentation and syntax
highlighting. After that, here are a few neat things to try:

* "M-x picasm-describe-chip" will give you some interesting information about
  the PIC chip you have selected.
* "C-c C-c" will assemble and link your program using whatever toolchain
  you have selected (gpasm/gplink are the default).
* "C-c C-p" will upload your program (the ".hex" file you created when
  you compiled it) on to your chip. This assumes you have both a
  PicKit2-compatible programmer attached off of a USB port, and the
  Microchip "pk2cmd" command-line program installed. 
* Pressing ";" will insert a comment at the end of the current line
  and move point there.
* "M-x picasm-insert-delay" will ask you for a label, the number of seconds
  you wish to delay (use decimals for delays shorter than one second),
  and the speed of the clock you have selected in MHz (use decimals
  for sub-1MHz clocks), and insert code to delay that many seconds.

Links
-----
* This software can be downloaded at: 
  http://http://code.google.com/p/picasm/
* Links to pk2cmd (for Linux) and MPLAB (for Windows) can be found at: 
  http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en023805
* Your OS's package repository probably has WINE, needed to run MPASM, available
  as a package. If not, WINE can be downloaded at http://www.winehq.org.


I haven't written assembler for PIC18F-series chips yet, so you won't
find support for them here. Feel free to send me a patch implementing
this! 

Have fun. Report bugs. 

-Daniel Debertin
--
dan@mapcar.org
debertin@gmail.com

About

A PIC assembler mode for Emacs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published