Electronics > Microcontrollers

Intel Hex format and PIC 12F675

(1/2) > >>

Hey everyone,

I couldn't find a free MPASM decompiler so I thought, why not make one ?
So I've just started yesterday. My ihex parser is done, it doesn't take everything into account, like the address of the first byte on a line or any other record type than 00, but it returns a pointer to an array filled with 'raw' data.

(Note : I probably should add the address of each byte, maybe I'll do it after I'm done with this post)

I'm using a program (written in MPASM) I recently made and I've just noticed something and I don't know why it's there.
Take a look at the 2nd line of the end of my hex file:

--- Quote ---:0A0140002F202F202F20850108003A
--- End quote ---

That line tells me that the value 0x3FB4 will be written at address 0x400E in the microcontroller.
But the program memory map of the 12F675 only goes to 0x1FFF.
Also, 0x3FB4 can be translated to:

--- Quote ---0011 1111 1011 0100 = 0x3FB4
From instruction set mid-range MCU:
0011 111x kkkk kkkk = ADDLW k
ADDLW    0xB4
--- End quote ---

Why would there be an ADDLW 0xB4 at address 0x400E ?
(Note : I never used ADDLW in my program)

The record type on that line is '00' so it's getting written in the data array as well.

Any thoughts on this ?


Could it be EEPROM?

I dunno about PICs but with AVRs you can set it to increment an EEPROM address every time you flash your device.
Does the value change at all?

I didn't do anything to write in the EEPROM and I think if there's something to flash to the EEPROM it will be written in another hex file (name.eep.hex or something like that).

I have cleaned and build the project again and the value doesn't change.


Just checked if this was the CONFIG bits address, but no, these are at 0x2007.

Maybe it's just packing it out with random data to get a specific length?

I should have searched before asking, sorry.
It seems to be the config bits (stupid me, how else could they be written ?).
This is what I found, but if someone can explain this to me, because I don't understand it.

--- Quote ---Data record
Example of a data record with configuration memory of a 14-bit part.:02400E00413F30

• Length of the record:
- Size of the configuration memory is one word = 14 bits = 2 bytes (aligned to whole bytes)

• Record address:
- Address of the configuration memory is 2007h which, addressed by bytes, is 400Eh

• Record type:
- Data record

• Record data:
- Configuration word is 3F41h

• Checksum:
= 02 + 40 + 0E + 00 + 41 + 3F = xxD0; neg D0 =
--- End quote ---

Nevermind, I found it. 0x2007 = (0x400E / 2).

I suppose this is the config address of all mid-range MCUs ?
How else can the decompiler tell if it's an MPASM instruction or CONFIG word, right ?


[0] Message Index

[#] Next page

There was an error while thanking
Go to full version