Author Topic: PIC: Debugging legacy ASM in MPLAB X 5.35  (Read 815 times)

0 Members and 1 Guest are viewing this topic.

Offline PinheadBETopic starter

  • Regular Contributor
  • *
  • Posts: 235
  • Country: be
  • Pinball Freak
PIC: Debugging legacy ASM in MPLAB X 5.35
« on: March 05, 2026, 12:23:01 pm »
Hi,

I wrote a program in JAL ( www.justanotherlanguage.org ) for a PIC16F1768.
It compiles without errors.
The JAL compiler produces (among other files) a .ASM file which is the legacy assembler equivalent to the JAL program

I now want to debug the ASM file with a simulator within MPLAB   
PIC16F1768 is not supported by MPLAB 8.92 (which I use usually), so, I have to use MPLAB X 5.35 (last version to support the legacy ASM syntax)

I create a new project, add the ASM file, build it for debugging without errors and want to debug it using the embedded simulator.

I can run the program, step by step if needed, but I cannot watch any variable (Example: Right-click on a variable, and Add to watch).    Besides, the Variables tab should display all variables immediately after loading the program, which is not the case here

What is weird is that in the Dashboard window, it appears that my compiled program has code, but 0 byte of data (see attached)

I also tried with MPLAB X 4.20, and the result is the same

Any idea ?
How do you do to debug (in a simulator) a legacy PIC .ASM file ?

Thanks

David
Please keep our planet clean
 

Offline MikeK

  • Super Contributor
  • ***
  • Posts: 1364
  • Country: us
Re: PIC: Debugging legacy ASM in MPLAB X 5.35
« Reply #1 on: March 05, 2026, 08:07:27 pm »
I hope you get an answer, David, but I think your best bet is to post on forum.microchip.com.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4660
  • Country: us
Re: PIC: Debugging legacy ASM in MPLAB X 5.35
« Reply #2 on: March 05, 2026, 11:52:36 pm »
Quote
I cannot watch any variable (Example: Right-click on a variable, and Add to watch).    Besides, the Variables tab should display all variables immediately after loading the program, which is not the case here

What is weird is that in the Dashboard window, it appears that my compiled program has code, but 0 byte of data (see attached)
Those are consistent, aren't they?  The debugger doesn't seem to think there is any data, therefore how could it watch any "variable"?   It would not surprise me if an "amateur" compiler did it's data allocation in a way that the debugger would not be aware of.  If you look at the assmebler output of gcc (for example), there is SO MUCH generated pseudo-op stuff aimed at supporting debugging, and it wouldn't surprise me if JAL is much less careful (and it also wouldn't surprise me if the old PIC assembler is not capable of producing such debugging info.)
(That said, I have no recent experience with JAL or the old PIC assembler, so this is just speculation...)
 

Offline MikeK

  • Super Contributor
  • ***
  • Posts: 1364
  • Country: us
Re: PIC: Debugging legacy ASM in MPLAB X 5.35
« Reply #3 on: March 06, 2026, 12:19:59 am »
Does the DEBUG bit in Configuration Word 2 need to be enabled for debugging to work?
 

Offline jnk0le

  • Regular Contributor
  • *
  • Posts: 228
  • Country: pl
Re: PIC: Debugging legacy ASM in MPLAB X 5.35
« Reply #4 on: March 06, 2026, 12:53:16 am »
"variables" view is for C variables. ASM doesn't produce debug metadata like compiled code.

In eclipse "variables" view is only for local variables, globals are done through "Expressions" view.
 

Offline PinheadBETopic starter

  • Regular Contributor
  • *
  • Posts: 235
  • Country: be
  • Pinball Freak
Re: PIC: Debugging legacy ASM in MPLAB X 5.35
« Reply #5 on: March 06, 2026, 11:34:03 am »
I hope you get an answer, David, but I think your best bet is to post on forum.microchip.com.

I'll do but I am stuck on the login page.   I'll have to try from another computer  ;)

Those are consistent, aren't they?  The debugger doesn't seem to think there is any data, therefore how could it watch any "variable"?   It would not surprise me if an "amateur" compiler did it's data allocation in a way that the debugger would not be aware of.  If you look at the assmebler output of gcc (for example), there is SO MUCH generated pseudo-op stuff aimed at supporting debugging, and it wouldn't surprise me if JAL is much less careful (and it also wouldn't surprise me if the old PIC assembler is not capable of producing such debugging info.)
(That said, I have no recent experience with JAL or the old PIC assembler, so this is just speculation...)


I've done it a ton of time, but always in MPLAB 8.92 and it always worked.   JAL is a very stable, simple and efficient language.   I do not call it "amateurish"

Does the DEBUG bit in Configuration Word 2 need to be enabled for debugging to work?

This is for hardware debugging, where you run it on the real hardware with the help of an ICD device (which I do not possess).   What I would like to do is a "software" debug, only on MPLAB SIM (included in the MPLAB IDE's)

"variables" view is for C variables. ASM doesn't produce debug metadata like compiled code.

In eclipse "variables" view is only for local variables, globals are done through "Expressions" view.

Not sure of what you mean, but again, in MPLAB 8.92, I've never been stuck.   Furthermore, I do not understand the role of Eclipse in this....  ???


To simplify my search: I'm looking for someone who has already imported a legacy ASM file into MPLAB X for debugging

Have a nice day
Please keep our planet clean
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->