News:

Let's find out together what makes a PIC Tick!

Main Menu

How to deal with a simulation

Started by keytapper, Aug 15, 2022, 06:09 AM

Previous topic - Next topic

keytapper

Hi forum,
As we hijacked the positron studio thread, I felt sorry for that. I would get into the discussion with this post.
So first off, there might be a section for "useful tips".
Regarding my method is almost the way to see the underlying assembler after compiling a source, during a simulation. Mostly I don't need such a deep inspection, some time I like to intervene for a little risky optimization.
So for a simulation in VSM, the compilation will provide the debugging information which are described in a file named sourcename.cof. But if loading that on The VSM, then it's likely to see the basic source.
When I want to see the assembly like the one produced by the compiler I make 2 passes. First let the compiler finish its task then take the asm file into MPLAB and then compile that assembler. The resulting coff is exactly the same seen as inputted to the MPLAB (note not a MPLABX).
To make much more speady I made a batch file to run in a command line window.

@echo off
cd /d %~p1
"C:\Program Files (x86)\ProtonIDE\PDS\PrPlus.exe" %~n1.Bas -p%2 -z  >log.txt
type log.txt
IF %ERRORLEVEL% NEQ 0 goto restart
"C:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe" /q /p%2 %~n1.asm /l%~n1.lst /e%~n1.err
IF %ERRORLEVEL% NEQ 0 goto restart
"C:\Program Files (x86)\Microchip\MPASM Suite\mplink.exe" /p%2 %~n1.o /z MPLAB_BUILD=1 /o %~n1.cof /M %~n1.map /W /x
IF %ERRORLEVEL% EQU 0 goto :eof

:restart
echo error, please retry
How to use it?
makecoff.bat sourcename MCUcode
No need the .bas suffix for the sourcename
lengthy source may take a long while to load on the VSM.
Ignorance comes with a cost