Electronics > Microcontrollers

PIC ASM Help!

(1/1)

deephaven:
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.

tycz:
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.

Frangible:
What device are you building it for?

Frangible:
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

deephaven:
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.

Navigation

[0] Message Index

There was an error while thanking
Thanking...
Go to full version