Author Topic: PIC ASM Help!  (Read 4519 times)

0 Members and 1 Guest are viewing this topic.

Offline deephavenTopic starter

  • Frequent Contributor
  • **
  • Posts: 796
  • Country: gb
  • Civilization is just one big bootstrap
    • Deephaven Ltd
PIC ASM Help!
« on: September 10, 2011, 03:28:28 pm »
I'm trying to assemble a PIC asm file written by someone else. Trouble is, it is a few years old and so, no doubt, there have been a lot of changes in the Microchip assembler since then.

With the various org statements I am assuming it is written for absolute code generation as opposed to relocatable code. The errors I am getting are mainly like this:
Error[118]   E:\MPLAB_NEW\CC_DECODER\CC\CC.ASM 424 : Overwriting previous address contents (0020)

Now, I notice that the RAM locations are reserved using instructions like this:
count:      res   1         ; general purpose counter
with RAM origin previously set to 0020

What looks like happening is that the assember is interpreting this as reserving program space memory and thus I'm seeing this address duplication.

What is the easiest way of getting around this?

Code is attached.
 

Offline tycz

  • Regular Contributor
  • *
  • Posts: 104
Re: PIC ASM Help!
« Reply #1 on: September 11, 2011, 04:38:48 pm »
It's probably something to do with the 'res' directives, apparently they don't work like they used to... I always use the cblock/endc directives instead, I'm pretty sure that still works.

If you are not familiar with this code and just want to compile it, the quickest solution is to download an old version of MPLAB or just MPASM from the Microchip website and use that.
 

Offline Frangible

  • Regular Contributor
  • *
  • Posts: 109
  • Country: us
  • Contraptioneer
Re: PIC ASM Help!
« Reply #2 on: September 11, 2011, 08:34:20 pm »
What device are you building it for?
 

Offline Frangible

  • Regular Contributor
  • *
  • Posts: 109
  • Country: us
  • Contraptioneer
Re: PIC ASM Help!
« Reply #3 on: September 11, 2011, 09:12:34 pm »
Never mind - I read the code.

What's happening is that the assembler is reading the "org" statements (particularly the "org rambase" which is 20h) and is assigning that to flash space.  Since this is a Harvard architecture, program and data space are in separate memory maps (thus all the weird stuff you have to do to store constants in flash).

Unfortunately, the assembler is assigning program space for what should be in RAM.  So when the program (which is located at 04h, the interrupt vector) assembles to address 20h, you get this warning from then on - indicating two things are being assigned to the same address.

There's a way to organize data memory, but I can't remember it off hand.  Try the MPLAB docs for more info.

http://ww1.microchip.com/downloads/en/devicedoc/33014j.pdf

 

Offline deephavenTopic starter

  • Frequent Contributor
  • **
  • Posts: 796
  • Country: gb
  • Civilization is just one big bootstrap
    • Deephaven Ltd
Re: PIC ASM Help!
« Reply #4 on: September 13, 2011, 09:55:26 pm »
Thanks for the replies, guys. I solved it by using the suggestion of downloading an earlier version of MPLAB. It's nice of Microchip to keep previous versions of MPLAB available on their website.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf